As I use Geany for C work, one enhancement to the syntax highlighting would be to have C function names highlighted. This would be any symbol, other than a C language keyword such as do, if, else, while, etc. that often have an open parenthesis following them and are already highlighted.
For example, main() would have the word "main" highlighted but not the paratheses. Or, foo(bar(a, (b * x))) would have the words "foo" and "bar" highlighted, and the parentheses, operators, and arguments would be in the current colors.
Perhaps this is a limitation of the Scintilla editor?
This would really help when dealing with source that uses libraries such as Gtk+ with many long function names on line after line.
Thanks!
- Nate
On 11 January 2014 13:21, Nate Bargmann n0nb@n0nb.us wrote:
As I use Geany for C work, one enhancement to the syntax highlighting would be to have C function names highlighted. This would be any symbol, other than a C language keyword such as do, if, else, while, etc. that often have an open parenthesis following them and are already highlighted.
For example, main() would have the word "main" highlighted but not the paratheses. Or, foo(bar(a, (b * x))) would have the words "foo" and "bar" highlighted, and the parentheses, operators, and arguments would be in the current colors.
Perhaps this is a limitation of the Scintilla editor?
You are correct that the first step would be to make Scintilla's C lexer identify function calls as separate entities that can be highlighted. (and an option to turn this off as well)
Cheers Lex
This would really help when dealing with source that uses libraries such as Gtk+ with many long function names on line after line.
Thanks!
- Nate
--
"The optimist proclaims that we live in the best of all possible worlds. The pessimist fears this is true."
Ham radio, Linux, bikes, and more: http://www.n0nb.us _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 11/01/14 05:30, Lex Trotman wrote:
On 11 January 2014 13:21, Nate Bargmann n0nb@n0nb.us wrote:
As I use Geany for C work, one enhancement to the syntax highlighting would be to have C function names highlighted. This would be any symbol, other than a C language keyword such as do, if, else, while, etc. that often have an open parenthesis following them and are already highlighted.
For example, main() would have the word "main" highlighted but not the paratheses. Or, foo(bar(a, (b * x))) would have the words "foo" and "bar" highlighted, and the parentheses, operators, and arguments would be in the current colors.
Perhaps this is a limitation of the Scintilla editor?
You are correct that the first step would be to make Scintilla's C lexer identify function calls as separate entities that can be highlighted. (and an option to turn this off as well)
If I'm not totally wrong, you can already get quite close to that with the "identifier" style in Geany.
To change this, either set style "identifier" in .config/geany/filedefs/filetypes.c or more generally, set "identifier_1" in .config/geany/filedefs/filetypes.common.
For more details about these config files, check the manual.
However, a quick test shown that the style identifier (as provided by Scintilla) matches way more than function names only. It highlights also local variables in functions and many more symbols.
Regards, Enrico
[...]
However, a quick test shown that the style identifier (as provided by Scintilla) matches way more than function names only. It highlights also local variables in functions and many more symbols.
Yeah, thats the problem (my understanding of the OP was they only wanted function names highlighted, not variables).
Cheers Lex
Regards, Enrico
-- Get my GPG key from http://www.uvena.de/pub.asc
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
* On 2014 16 Jan 17:16 -0600, Lex Trotman wrote:
[...]
However, a quick test shown that the style identifier (as provided by Scintilla) matches way more than function names only. It highlights also local variables in functions and many more symbols.
Yeah, thats the problem (my understanding of the OP was they only wanted function names highlighted, not variables).
Indeed, only functions and macros called as functions. Naively, anything that follows the C rule for a function name, is preceeded by a word boundary, and succeeded by an opening parenthesis, '(', is what I would like to highlight. Years back I used FTE which did this which is where I became used to it but for various reasons I much prefer Geany.
- Nate
On 14-01-16 04:25 PM, Nate Bargmann wrote:
- On 2014 16 Jan 17:16 -0600, Lex Trotman wrote:
[...]
However, a quick test shown that the style identifier (as provided by Scintilla) matches way more than function names only. It highlights also local variables in functions and many more symbols.
Yeah, thats the problem (my understanding of the OP was they only wanted function names highlighted, not variables).
Indeed, only functions and macros called as functions. Naively, anything that follows the C rule for a function name, is preceeded by a word boundary, and succeeded by an opening parenthesis, '(', is what I would like to highlight. Years back I used FTE which did this which is where I became used to it but for various reasons I much prefer Geany.
One could hack something up in a plugin as a kind of workaround, but it would be sub-optimal. Maybe by handling Scintilla's sci-notify event to trigger off of modify and delete text notifications (ie. buffer changed), then do a pass over the buffer with GRegex, styling each match manually.
It would probably be quite slow if you opened massive source files but I did something similar before (for highlighting something else) and it wasn't noticeably slow on "normal" sized source code files IIRC.
Of course patching Scintilla's LexCPP.cxx to support styling function names would be much better. The Python lexer supports this for function definition names.
Cheers, Matthew Brush