[Github-comments] [geany/geany] Different or disabled syntax highlighting for block segments effectively turned off by preprocessing directives (#1047)

Colomban Wendling notifications at xxxxx
Mon May 30 10:16:38 UTC 2016


As @codebrainz pointed out, Scintilla uses preprocessor directives to decide whether a code block is enabled or not.  This is easy for `#if 0`s, but a lot trickier for less obvious directives, like `#if ONE`, where Scintilla has to know the value of `ONE` to decide -- and it assumes any unknown evaluate to false, so would disable the `#if ONE` case.

To get better results, yes, CTags could be used.  Scintilla's C lexer has a set of keywords used for predefined preprocessor definitions (set n°4, "Preprocessor definitions"), that can be filled with `definition[=value]` entries.  A plugin could update those keywords from the tagmanager's workspace tags to help Scintilla make the right choice.

An alternative could be proposing an alternative, dumber, preprocessor parser for the Scintilla lexer, that would only look out for literal values for disabling parts, with `#if 0` or `#if 1`.  That would have to be submitted to Scintilla.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1047#issuecomment-222461094
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20160530/d994e514/attachment.html>


More information about the Github-comments mailing list