How can I associate a codemodel item with its language?

David Nolden david.nolden.kdevelop at art-master.de
Mon Aug 31 21:44:20 UTC 2009


Am Montag 31 August 2009 22:54:50 schrieb Milian Wolff:
> And per-language grouping in the class browser is a WONTFIX then, correct?
> Since I don't see a way to implement it with the current architecture.
I wouldn't directly call it a WONTFIX, it is a feature that we need. The 
question is just how we implement it.

1.:
Filtering by filename is one way. It would work good in most cases, would not 
require any additional infrastructure, but might be a bit slow, and not 100% 
reliable unless we stop relying on KMimeType.

2.:
Another maybe better way would be adding own items into the code-model that 
would signalize the language. For example, adding "Language" to 
CodeModelData::Kind, and then putting such a language-item called "C++" into 
each C++ file, etc.

3.:
We could encode the language of each code-model item directly into 
CodeModelItem::Kind: There is actually still 16 bits left that can be used 
without increasing the size of the object. Some bits should be reserved, but 
we could use some to categorize the language of each declaration, for example 
just using the categories:
- Markup Language
- Build System Language
- Scripting Language
- Programming Language

Or similar. Then we could use those categories to categorize the language of 
each declaration, and do a precise filtering. I guess that would be the best 
option. What do you think?

Greetings, David





More information about the KDevelop-devel mailing list