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: insert closing delimiter #601

Open
kengruven opened this issue Apr 6, 2024 · 1 comment
Open

Feature request: insert closing delimiter #601

kengruven opened this issue Apr 6, 2024 · 1 comment

Comments

@kengruven
Copy link

Hello! I'm a longtime on-again/off-again js2-mode user. Recently, I've been writing a lot of programs in Racket, and racket-mode has a very nifty feature that I've come to enjoy: when you type either ) or ], it will figure out the correct closing delimiter from context (whether ) or ] or } or maybe even others) and insert that, so when I'm are at the end of a line or function I can just hit ] several times until everything is closed.

JS has at least the variety of delimiters as Racket, and so I think a similar feature would be tremendously useful here, too. I've only ever been a user of js2-mode, not a developer, so I have no idea how difficult this would be to implement. Anyway, thanks!

@dgutov
Copy link
Collaborator

dgutov commented Apr 7, 2024

Hi!

I think this might work better as a feature for electric-pair-mode: this mode already watches that any opening paren (or brace, or bracket) that you type is accompanied by its closing counterpart, and it could use similar knowledge (about which characters are paired) to decide whether to replace one closing parentheses type with another, to keep things paired correctly. As an optional feature, of course.

To file a feature request for it, just use M-x report-emacs-bug.

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

No branches or pull requests

2 participants