godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Implement multicolor highlight of brackets (Bracket Pair Colorizer) #4728

Open me2beats opened 2 years ago

me2beats commented 2 years ago

Describe the project you are working on

Games

Describe the problem or limitation you are having in your project

When I write code with brackets like something(some(a, b, Vector2(2,0,0))) it can be hard to see matched brackets. Sometimes I even had errors in the running game, because I wrote code in wrong place.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Implementing multi-color highlight of matching brackets would solve the problem

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Like this syntax_dark_plus

If this enhancement will not be used often, can it be worked around with a few lines of script?

It can't, Editor related

Is there a reason why this should be core and not an add-on in the asset library?

To make it as a plugin, I can't see some API methods for that. AFAIK TextEdit doesn't allow to do this

SilencedPerson commented 2 years ago

Gonna be honest, this is just way too colorful. Could you procure mockup of how it would look with GDScript?

Calinou commented 2 years ago

I like the feature on paper, but if it is to be enabled by default, it should use more subtle colors than what the Bracket Pair Colorizer VS Code extension defaults to.

just-like-that commented 2 years ago

I recommend to use one base color with gradient or a zebra look (high contrast between two alternating colors).

me2beats commented 2 years ago

In the image I posted above 3 colors are used cyclically: yellow-pink-blue Looks like 3 colors are enough.

The colors could be set in Editor Settings

filipworksdev commented 2 years ago

I think these should also be implemented to nested dictionaries on curly brackets as well which can also get quite confusing.

me2beats commented 2 years ago

maybe even for square brackets

arr [arr2[arr3[something]]]

I try to avoid such deep nested arrays tho But sometimes you can do it