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

Disabling automatic brace insertion #512

Closed
949f45ac opened this issue Feb 16, 2024 · 3 comments
Closed

Disabling automatic brace insertion #512

949f45ac opened this issue Feb 16, 2024 · 3 comments

Comments

@949f45ac
Copy link

Hey there, landed here from brotzeit/rustic#541

To recap, I am looking for a way to disable the emacs behavior where it inserts closing braces automatically in my Rust code, when I try to add braces to an existing piece of code somewhere.

The added braces (both normal and curly) are reliably in the wrong spot, and I cannot even outsmart the feature by inserting the non-matched closing brace first – it will still insist on adding another closing brace, reliably in a stupid spot.

I get generally unnerved when my editor inserts characters without me typing them. In this case the auto-edit’s quality is especially horrendous.

I am not sure rust-mode is to blame, I searched through the code briefly and did not find a lead. Please point me to the culprit. I have made sure that electric-pair-mode is not to blame, by explicitly toggling it off (it was already off).

@psibi
Copy link
Member

psibi commented Feb 17, 2024

I'm not able to reproduce the behavior, but I'm using the treesitter based mode implemented in this PR: #482

@psibi
Copy link
Member

psibi commented Feb 28, 2024

Please keep it this way, and never add any automatic characters to that mode.

Yeah, that's the plan. Maybe some helper functions to navigate, but I want to leave most of the things to tree sitter.

Don’t know if this is the intended experience, reading just through this repo’s README it didn’t seem like any special installation steps would be required.

I have heard from others that the installation experience is not that good yet. Feel free to send a documentation patch to update the README with instructions for your OS.

Thanks for the confirmation, I'm closing the issue since it's fixed.

@psibi psibi closed this as completed Feb 28, 2024
@vaab
Copy link

vaab commented Jul 25, 2024

Let me repost here also my answer for other people looking for pointers (as I did): you should try setting lsp-enable-on-type-formatting to nil. This is a rust-analyzer bug (cf: rust-lang/rust-analyzer#16084 for more info). The latter post is suggesting to run the function (lsp-toggle-on-type-formatting), which drives the former variable and do some upkeeping of hooks after toggling the variable's value. I had more success with nil in the variable at rustic setup time so I guess it would be the same for rust-mode.

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

3 participants