Skip to content

Conversation

@jb-alvarado
Copy link

@jb-alvarado jb-alvarado commented Nov 4, 2025

I know this was changed in 25c732e eight months ago, but I really think that was a mistake. We always use curly braces in formatted strings, so they should auto-close. Same would happen in JS/TS.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 4, 2025
@ChayimFriedman2
Copy link
Contributor

I disagree. Not all strings are format strings. If we can find a way to limit this to format strings, that'll be acceptable.

@jb-alvarado
Copy link
Author

Not all strings are format strings.

Sorry, yes you are right. But how many times your add a open braces in a string, that should not be closed compared to braces in formatted strings?

For me it is also confusion when in other languages like JS/TS the braces are closing, but not in rust.

A good compromise would also to respect the Editor setting: "editor.autoClosingBrackets": "always", but I'm not exactly sure how to implement this.

@ShoyuVanilla
Copy link
Member

The commit you've mentioned is from #19514 and its main purpose is to fix vs-code's weird syntax highlighting for strings containing non-matching braces. I think auto closing this for completion is a matter of preference, while fixing the weird highlighting is a noncontroversial thing to have.

@ShoyuVanilla
Copy link
Member

A good compromise would also to respect the Editor setting: "editor.autoClosingBrackets": "always", but I'm not exactly sure how to implement this.

It does not work well with this language-configuration.json. microsoft/vscode#38352 is not exactly the case but as we can see from that issue, vs-code doesn't offer much customizability upon those features.

@jb-alvarado
Copy link
Author

jb-alvarado commented Nov 4, 2025

fix vs-code's weird syntax highlighting for strings containing non-matching braces

Ah, that is interesting, this is not happen in JS/TS.

It does not work well with this language-configuration.json

Thank you for the explanation!

Then I close this PR.

@jb-alvarado jb-alvarado closed this Nov 4, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 4, 2025
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.

4 participants