try to create a simple language plugin
aleixpol at kde.org
Tue Feb 2 21:49:08 UTC 2010
On Tue, Feb 2, 2010 at 10:35 PM, Niko Sams <niko.sams at gmail.com> wrote:
> On Tue, Feb 2, 2010 at 17:45, Fabian Schmitthenner
> <fabian1024 at googlemail.com> wrote:
> > Hi,
> > I tried to create a simple language plugin to test and try to learn how
> > 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
> > KDevelop, when I load the first file with my extension. Then, a parse job
> > 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
> > method is called).
> Hmm... No idea what's wrong here.
> > 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
> > (it seems to be read-only).
> read only? that's really strange. kdevelop can't do that.
> Maybe the view you see here is a PartDocument instead of a TextDocument.
> > 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
> > for other things like code completion? I always thought, the DuCHain is
> > for serializing definitions and uses; so it wouldn't be a must-have ??
> Codecompletion is duchain independet. Basically it's KTextEditor only,
> just the way
> how the CodeCompletionModel is registered to kate is kdevelop specific.
> When parsing the file you most probably want a TopDuContext where you can
> problems (eg. parse errors) and an ParsingEnvironmentFile to track if
> the file was modified.
> The css (you looked at already) does have a very simple implementation
> of all this.
> > Second question: How can I enable code completion? I tried to extend a
> > from KTextEditor::CodeCompletionModel2, and construct an instance of
> > KDevelop::CodeCompletion in the constructor of my language support, as I
> > it in the Css-language-plugin. But the
> > CodeCompletionModel2::completionInvoked-method is also never called.
> hmm.. add some debug output in KDevelop::CodeCompletion, to check if the
> is registered to the view.
> > Also, is there any good documentation about this stuff, because I didn't
> > find anything useful.
> Unfortunately there is only a bit of api docs avaliable. But that's
> still better than nothing.
> KDevelop-devel mailing list
> KDevelop-devel at kdevelop.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the KDevelop-devel