Source-formatter

David Nolden zwabel at googlemail.com
Mon Jan 11 00:01:07 UTC 2010


Am Montag 11 Januar 2010 00:40:02 schrieb Andreas Pakulat:
> On 10.01.10 23:07:30, David Nolden wrote:
> > Every language has a list of "supported mimetypes" in its configuration
> > file. Cannot we just access that information, without loading the
> > language supports?
> 
> IIRC thats not whats needed from the plugin. The problem is that the
> "language name" is only available once its loaded. The mimetype is
> indeed stored in the .desktop file and can be acessed that way.

Hmm if we can read X-KDevelop-SupportedMimeTypes, why cannot we read X-
KDevelop-Language in the same way? With those 2, we would have enough 
information to do the whole mapping.

> > > > It's even worse if you have multiple projects open in one session,
> > > > where each project may have _completely_ different formatting.
> > > >
> > > > I guess we should by default have per-session settings, and then
> > > > allow to selectively assign other styles to specific paths. Have you
> > > > thought about that already?
> > >
> > > I do understand the problem. The thing is that we already now have a
> > > dialog and a "dialog in a dialog". So we might need to completely
> > > redesign the configuration interface.
> > >
> > > > I guess the simplest way would be adding a "Path" dropdown under
> > > > "Mimetype aka. Language", where you have a little "+" and "-" button
> > > > to add new paths, and the default path would be "Global".
> > >
> > > Can you create a mockup, I'm not quite clear what you mean with
> > > dropdown or how you imagine this to look like.
> >
> > I've got enough of hacking for today, maybe tomorrow I will take a look
> > at it.
> 
> I'm mostly unclear about what kind of widgets you want to place where.
> So really a .ui file is enough I think.

Well looking at the current .ui file, I would redesign it a bit, to something 
like this:

--- Files ------------------------------------------------------
Project / Folder:      [ All            ]    [+] [-]
Language:              [ C++         ]
--- Formatting ---------------------------------------------
|  Formatter:  [ Astyle        ]  |
|  Style:                              |
..................
.................

At the right of "Project / Folder" there would be a dropdown list that by 
default contains "All", which means the following applies to all folders. If 
you push "+" at the right of it, you get a project-tree where you can either 
select a project or a subfolder of one, and then that folder will be added to 
the dropdown, eg. it would contain "kdevplatform/language". If you push "-", 
the folder is removed again from the dropdown.

Then you can select the language, which means that the formatting style will 
be applied to all files that are within the chosen project/folder that have 
the specified language.

Greetings, David




More information about the KDevelop-devel mailing list