[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: Re: Plugin development related questions
From: "Paul A. Giannaros" <paul () giannaros ! org>
Date: 2008-09-07 17:46:41
Message-ID: 3cce4fc80809071046y8511f20ke32c7d2ff2894df0 () mail ! gmail ! com
[Download RAW message or body]
On Sun, Sep 7, 2008 at 4:20 PM, Milian Wolff <mail@milianw.de> wrote:
> Hello!
>
> To learn C++ and Qt some more, I want to write a plugin for Kate which does
> validates PHP files using the `php -l` linter. I'm a bit lost though and am
> not sure whether my ideas are even feasible:
Sure they are, adding this kind of thing is exactly what Kate plugins are
about.
> 1. How would I access the highlighter from a plugin? I thought it would be
> great to have the "bad lines" marked inside the code, i.e. assigning them
> the "Normal Text Style -> Error". But I cannot find any examples or
> documentation on how do that. Any hints?
I'm not sure, but I don't think it's the highlighter that you want to access.
The MarkInterface provided by KTextEditor::Document is probably what
you're after -- it lets you mark lines as you wish (e.g as errors or as
bookmarks or whatever).
> 2. I imagine more sophisticated PHP IDEs include their own PHP parsers (see
> also 4.) to generate on-the-fly error reporting which is out of my reach.
> For the time being it would be enough to call this linter either via
> menu/shortcut or (optionally) each time the document is saved. So far I did
> not find a proper signal for that purpose, does one exist? Nearest I got was
> KTextEditor::Document::modeChanged or ::modifiedChanged. Do I have to work
> with one of those? I.e. on Plugin-Setup get current mode, then take a "was
> modified" -> "now not modified" change as "document was saved" status? Other
> ideas?
How about Document::documentSavedOrUploaded?
> I'm not sure how fast the actual linting process is, but maybe later on I
> can get it somewhat optimized so that I could trigger it after a "text
> change". How often is the textChanged signal triggered? For every char that
> I type? Or is there a "buffer" which makes it trigger after I typed in some
> chars and stopped typing? If that is the case I could use that maybe...
I believe it's for every character typed (i.e like Qt's QTextEdit)
> 3. Since I want to manipulate the highlighting of the current file when
> errors occur I depend on Kate, i.e. I cannot do a generic KTextEditor
> plugin/extension as far as I see. But as far as I understand it, that limits
> the plugin to Kate only. Is there a way to make this plugin "generic" enough
> so that it can be used in other Editors which use the Kate KPart?
>
> 4. Does anybody know an alternative to the above mentioned `php -l` via
> system call? Maybe there exists a C++ generic linter I did not know / find
> so far which could be used? It's a pity I cannot find in-depth documentation
> on how the validation is done in e.g. Eclipse PDT or similar.
Can't help you with these two.
Regards,
PAG
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic