try to create a simple language plugin

Fabian Schmitthenner fabian1024 at googlemail.com
Tue Feb 2 16:45:52 UTC 2010


Hi,

I tried to create a simple language plugin to test and try to learn how this 
works in KDevelop 4. What I did is roughly the following:

- extending my own class from ILanguageSupport and IPlugin, and making it 
accessible through KDevelop due to a .desktop-file.
- add a class which extends from ParseJob and which is constructed in the 
createParseJob-method.

So far, so good. After a bit of experimenting, the language is now loaded in 
KDevelop, when I load the first file with my extension. Then, a parse job is 
created and the run method is called. 
But when I open the same file a second time, or when I simply change the file by 
editing it, nothing happens (so neither a parse job is created nor the run 
method is called). 
Also, after having opened a file, which was alredy loaded in a previous 
instance of KDevelop, no parse job is created, and the file cannot be edited 
(it seems to be read-only). 
So, my question is, what do I do wrong? Do I have to say anything to the 
DuChain or an other instance, when I parse the file; and this parsing required 
for other things like code completion? I always thought, the DuCHain is "only" 
for serializing definitions and uses; so it wouldn't be a must-have ??

Second question: How can I enable code completion? I tried to extend a class 
from KTextEditor::CodeCompletionModel2, and construct an instance of 
KDevelop::CodeCompletion in the constructor of my language support, as I saw 
it in the Css-language-plugin. But the 
CodeCompletionModel2::completionInvoked-method is also never called.

Also, is there any good documentation about this stuff, because I didn't really 
find anything useful.

I hope you can help me.

Kind regards

Fabian




More information about the KDevelop-devel mailing list