notepad-plus-plus / notepad-plus-plus

Notepad++ official repository
https://notepad-plus-plus.org/
Other
22.58k stars 4.57k forks source link

[ENH] Brace Pair Colorization #13014

Open celestinoxp opened 1 year ago

celestinoxp commented 1 year ago

This is a suggested improvement to resolve confusion issues of opening and closing functions.

The original idea is from Microsoft for Visual Studio (https://devblogs.microsoft.com/cppblog/brace-pair-colorization-and-more-in-visual-studio/#brace-pair-colorization-for-c), however, as I use Notepad++ a lot (for programming PHP language), I thought it was an excellent idea if I could also use it.

Brace-Pair-Colorization-example Source: https://devblogs.microsoft.com/cppblog/brace-pair-colorization-and-more-in-visual-studio/

The idea is to color the functions or just the opening and closing "{" and "}" of the functions with different colors to be able to distinguish the functions when the code is too big and becomes confusing. I think the image illustrates the objective well.

I hope I can contribute with this idea in the right place and that you consider it a constructive idea.

Thanks

alankilborn commented 1 year ago

I understand the thought behind it, but your screenshot doesn't sell it in the best way possible. In the screenshot, the braces line up too nicely vertically for the colors to be of great assistance. :-)

If there's doubt about a matching brace, in N++ one can currently use the brace-matching function. by default on Ctrl+b.

This Community THREAD has information about a "bracket highlighter", which boxes in data within opposing pairs of braces/parentheses/brackets.

Not sure if this is of any use to anyone...just pointing it out.

rdipardo commented 1 year ago

This feature is known to be memory intensive: https://code.visualstudio.com/blogs/2021/09/29/bracket-pair-colorization#_the-performance-problem

It appears that VS Code ultimately overcame the issue, but I doubt their implementation is easily adaptable to N++. This is more the kind of thing that a plugin should provide, similar to Vim's Rainbow Parentheses plugin.