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/BUG] Closing Symbol Override #121

Closed
NullPlane opened this issue Feb 2, 2024 · 4 comments
Closed

[FEATURE/BUG] Closing Symbol Override #121

NullPlane opened this issue Feb 2, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request ready for release

Comments

@NullPlane
Copy link

NullPlane commented Feb 2, 2024

I do not know if it is supposed to work or not yet implemented, but
when activating automated bracket-/tag-closing and then manually
closing a bracket/tag there'll be one closing bracket surplus.

Would be nice if it got replaced. But then only the automatically
generated bracket and correct layer, so you can close other brackets
inside first before replacing the correct layer (often saw LaTeX-editors
not layering, so I know to appreciate it if it was a feature too...).

@SpartanJ SpartanJ self-assigned this Feb 3, 2024
@SpartanJ SpartanJ added the enhancement New feature or request label Feb 3, 2024
@SpartanJ
Copy link
Owner

SpartanJ commented Feb 3, 2024

The problem with trying to do things in a "smarter" way is that the editor has to guess what was the user intention in the first place, the situation you describe could be exactly what the user intended. I don't know if there's a way to create a set of rules that it's better for all cases. That's why currently the editor will simply do what it's suppose to do, just auto-insert.

Maybe I can add an optional rule that defines that: never double insert same open or close tag when there's one at cursor position. So it should cover two cases:
instead of
( -> (()
would do
( -> ()

and instead of:

() -> ())
would simply ignore the last insert:
() -> ()

And also should allow to insert the character if tries one more time.
But I don't know, I'm not convinced. I never use auto-insert because I always ends up double inserting things. Maybe you can come up with a set of rules that are good enough for most scenarios, it must be generic and not know anything about the abstract syntax tree.

@ghost
Copy link

ghost commented Mar 5, 2024

The rule of thumb is the brackets must be balanced. It's just that. Very simple.

@SpartanJ
Copy link
Owner

SpartanJ commented Mar 5, 2024

We can do that 👍

SpartanJ added a commit to SpartanJ/eepp that referenced this issue Mar 9, 2024
Implemented Closing Symbol Override (SpartanJ/ecode#121), improved the auto-close bracket to be balanced.
@SpartanJ
Copy link
Owner

SpartanJ commented Mar 9, 2024

OK, I added proper closing symbol override and balanced auto-close. I think it feels nice, I'll try to use it and see how it feels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready for release
Projects
None yet
Development

No branches or pull requests

2 participants