Lex/All,
I presume you mean VS code using differing colours for each nesting level
of braces. I also happen to use VS, but you can't expect that contributors to one project will be aware of the features of others apps, you need to describe the feature you want.
You are correct and thanks for the heads up.
Without seeing your code, can't tell, you point to the VScode plugin, but
not yours ;-)
That was because my code at the time was too embarrassing to release publicly 😅 I currently have my code hosted here: https://github.com/asifamin13/bracket-colors . Admittedly it's very minimal and currently bare on documentation and builds with a simple cmake setup. I plan to add the autotools build and docs later this week
Over the U.S. holiday break I decided to take a crack at writing the plugin. I used your idea of using timers to handle massive files, I think it performs pretty well. I didn't even have to use "a recursive descent parser to build an abstract syntax tree" like what VSCode does. The scintilla SCI_BRACEMATCH was enough and is also language agnostic. My plugin also handles coloring parentheses, braces, and angle brackets on dark and light backgrounds. I'd like to make the colors user configurable at some point
[image: image.png] [image: image.png]
A few questions
- I use 3 indicators to render colored text. From the scintilla documentation, there are only 43 indicators available to use. Currently I use INDICATOR_IME - 3 as my start index, the rationale being I don't know what INDICATOR_IME is used for and it doesn't seem to affect anything. Is there a better way to choose my start indicator? - The tricky part when writing this was determining when a bracket was inside a string, docstring, etc. The way I solved it was to check the style of the text and see if it matched up with known styles I got from trial and error: static const std::set<int> sIgnoreStyles { 1, 2, 3, 4, 6, 7, 9 } There must a better way to do this, does there exist a notion of "geany comment styles" I can leverage?
Thanks, Asif Amin
On Wed, Dec 14, 2022 at 3:29 PM Lex Trotman via Devel devel@lists.geany.org wrote:
On Thu, 15 Dec 2022 at 02:42, Asif Aaron Amin via Devel < devel@lists.geany.org> wrote:
All,
First I'd like to thank you for developing Geany as it has been my preferred IDE for 7 years due to how customizable and fast it is, especially over ssh/X forwarding. I also use VS Code in certain instances, and one of the features that I really wish was in Geany is the bracket pair colorization. Has anyone proposed this or is currently working on such functionality?
I presume you mean VS code using differing colours for each nesting level of braces. I also happen to use VS, but you can't expect that contributors to one project will be aware of the features of others apps, you need to describe the feature you want.
I decided to take a crack at implementing this into geany via a plugin based on this blog post: https://code.visualstudio.com/blogs/2021/09/29/bracket-pair-colorization
I got a simple a proof of concept working, basically using SCI_BRACEMATCH with indicators that colored braces with SCI_INDICSETSTYLE/INDIC_TEXTFORE/SCI_INDICSETFORE
[image: image.png]
Is this approach reasonable? I'm not sure how well this will scale on large documents or if using indicators for this purpose is valid
Without seeing your code, can't tell, you point to the VScode plugin, but not yours ;-)
Probably best if you just try it on big files ... using a slow computer, eg Raspberry PI. To reduce its impact only run it after a delay after change, and reset the delay if another change happens in the meantime. That way it runs when the user stops or slows typing.
Using a plugin seems a sensible idea, the alternative of having the Lexers do it means changing every lexer, but your plugin should be able to work for any language.
Cheers Lex
Thanks!
Devel mailing list -- devel@lists.geany.org To unsubscribe send an email to devel-leave@lists.geany.org
Devel mailing list -- devel@lists.geany.org To unsubscribe send an email to devel-leave@lists.geany.org