-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Automatically add semicolon #3830
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
Comments
You may have wanted to type |
I don't get it about
|
You may have wanted to end up with |
@bjorn3 if |
I think it is more annoying if something gets added when you didn't want it, than having to add it manually when you want. Maybe make adding the semicolon an off by default thing? |
Yeah, I also with that rust-analyzer handled semicolons in more cases. I am afraid though that just "type something" would be a too impercise heuristic here. Like, if the user types I definitely will be fine with merging this as off-by-default though, for the sake of experimentation. IntelliJ has complete statement feature for similar cases, but I personally have never figured out how to use it effectively. |
looks like it will affect performance :( |
One specific thing we can try is extending this: to add a semicolon after
Be warned though, that I have a vague recollection that I've actually tried doing that, (or something similar) and was unable to add new characters immediately after the cursor, due to how vscode works. |
I checked how it can be done, and found:
|
Automatic semicolon insertion is never a good idea. It may not totally apply but we know automatic semicolon insertion was one of Eich's regret about the language. https://brendaneich.com/2012/04/the-infernal-semicolon/ You may argue this is nothing to do with Rust, this is just a tool but few years later there will be more and more people asking or depending of this feature. Things will get more complicated. |
The feature described here has nothing to do with JavaScript style ASI. |
I was trying to bring your attention to a well known example of adding unnecessary complexiy early in the project to solve a very trivial problem, based on the earlier comments. Never mind. |
anything new here? |
Rust need semicolon, seems that cannot changed: rust-lang/rfcs#2583 |
Maybe an option to insert missing semis on save? |
any info? |
Right now formatting is handled via rustfmt and we are quite a bit a way from having our own formatter so this isn't really something we can tackle right now |
Can we add a semicolon at the end if something is added in not to the end of function?
for example
The text was updated successfully, but these errors were encountered: