Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TetraTheta opened this issue Oct 21, 2023 · 2 comments

Comments

@TetraTheta
Copy link

TetraTheta commented Oct 21, 2023

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

  • First line: Blank
  • Second line: I entered [here are some words] normally.
  • Third line: I moved cursor back with Arrow Key, entered additional characters, and go back in front of ] and typed ].
  • Fourth line: I explicitly moved cursor back and in front of ] with Mouse, and typed ].
  • Fifth line: I moved cursor after ] with Arrow Key and go back in front of ] and typed ].
  • Sixth line: I moved cursor after ] with Mouse and go back in front of ] and typed ].

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
Copy link
Owner

zufuliu commented Oct 22, 2023

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

@TetraTheta
Copy link
Author

TetraTheta commented Oct 22, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants