Skip to content

handle logic to auto close and delete brackets #501

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

lunargon
Copy link

Handle Auto Close Parentheses, Braces, Brackets

To solved #488
I add logic to handle:

  • Auto close: If you type '(' or '[' or '{' with have auto close that and cursor will go between these.
  • Auto delete:
    For example: You have (|) ( this is parentheses with cursor between, if you delete - type BACK both open and close will be delele)

@lunargon
Copy link
Author

@microsoft-github-policy-service agree

@Consolatis
Copy link

Could this feature be made optional?

For me this is one of the most annoying features in other editors, frequently causing me to write things like [2]] or if (some_thing) { do_something(); } )}). And with the auto-delete it makes it even harder to prevent because when I then delete the closing bracket it also deletes the opening one. Another example is retro-actively adding a () around an existing condition.

Some more general remarks:

  • It leaks syntax of the language written into the editor itself.
  • There are cases were you just want a single opening bracket, for example in multi line comments or strings.

@lunargon
Copy link
Author

@Consolatis You can try my ver first. Because delete only auto delete if between that is empty.
For example:

  • [|] -> if your cursor is between and you type BACK button -> will auto delete both open and close
  • [some thing]| -> if your cursor is right close and you type BACK button -> you just delete close one.

My auto just delete with not thing between open and close. Can you check that first. If still annoy for you I will add some change to make that to optional or remove that feature.

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

Successfully merging this pull request may close these issues.

2 participants