On 8/7/2011 7:13 PM, ext Konstantin Tokarev wrote:
> Hi Qt Creator developers,
>
> I'm implementing custom Completer for Lua files, and I'd like to implement
> isInComment method. I'm using Generic Highlighter for syntax highlighting,
> and Highlighter definitely "knows" what places of code are comments and
> what are not.
>
> How can I get this information from Generic Highlighter?
>

Hi,

the generic highlighter itself doesn't know when it's inside a comment. 
What it knows is that at any point in time there's a context with a set 
of rules it needs to match. Based on this it will apply some format. 
Then, whether this text format corresponds to a comment or not is a 
different story.

In addition, the way the generic highlighter stores its state is 
different from the other highlighters we have because it's totally 
dynamic and depend on each highlight definition. So it has an indefinite 
number of states.

One option that comes to mind would be to hook somehow in the 
Highlighter::applyFormat method in order to identify a comment (the Kate 
dsComment format which is mapped to our Highlighter::Comment format) and 
then create some state association.

Cheers

-- 
Leandro T. C. Melo
Software Engineer
Nokia, Qt Development Frameworks

Nokia gate5 GmbH
Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443B
Umsatzsteueridentifikationsnummer: DE 812 845 193
Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori

_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-creator

Reply via email to