zufuliu / notepad4

Notepad4 (Notepad2⨯2, Notepad2++) is a light-weight Scintilla based text editor for Windows with syntax highlighting, code folding, auto-completion and API list for many programming languages and documents, bundled with file browser plugin matepath.
Other
2.56k stars 179 forks source link

[Feature Request] Add an option for auto completion for duplicated closing brackets #727

Open TetraTheta opened 10 months ago

TetraTheta commented 10 months ago

In VS Code, if you type [ and ], it will be []. But in Notepad2, it will be []] because of duplicated closing brackets.

In VS Code: VS Code

In Notepad2: Notepad2

I think when user types closing bracket, if next column character is exactly what the user typed, it should be 'ignored' and move on to next column, like VS Code. But if user explicitly moved to the location via Mouse Click or using Arrow Keys(, , , ), the character should be typed, so becoming something like []].
I misunderstood how VS Code handles closing brackets.

vsc

So, once the cursur has located after closing bracket, VS Code will disable 'smart closing bracket'-thing and just input ] as user typed.


But people might like current behavior which makes []], so I want an option for toggling the bahavior of handling closing brackets between old and new.

Sorry if this is already implemented. I couldn't find such configuration in Auto Completion setting.

zufuliu commented 10 months ago

How about turn off "Auto complete braces and quotes" for [ ]? Auto Completion Settings

TetraTheta commented 10 months ago

I think 'turning auto-complete off' is a different thing. That is a 'workaround' (and also what I configured for now).

VS Code does auto-complete ] when user inputs [, but it does not add additional ] when user inputs ] when cursor is in front of ], unless in some exceptions.

I will add few more example GIFs later for better understanding.

EDIT:
I added another example GIF at the first post. It turned out that I misunderstood how VS Code handles closing brackets depending on location of cursor.
I don't know how exactly VS Code handles closing brackets as code-wise, but for me, their approach is most 'pleasing' way of handling closing brackets.