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

Smart semicolon autocorrect? #703

Closed
fbricon opened this issue Nov 2, 2018 · 2 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#2710, #3159 or #3229
Closed

Smart semicolon autocorrect? #703

fbricon opened this issue Nov 2, 2018 · 2 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#2710, #3159 or #3229

Comments

@fbricon
Copy link
Collaborator

fbricon commented Nov 2, 2018

Intellij has this nice semicolon autocorrect, that when typed within parenthesis instead of end of the line, will automatically insert the semicolon at the end of the line.
smart-semicolon

The VS Code marketplace has at least one extension, which automatically moves the semicolon at the end, but I find it very buggy and causing more harm than it helps (stops inserting all semicolons!). Others require a keyboard shortcut to activate (meh).

I'm opening this issue for consideration

@fbricon
Copy link
Collaborator Author

fbricon commented Aug 11, 2020

Netbeans has this turned on by default too, although I haven't figured out if there's a preference to control it.
Eclipse supports this too, but needs to be enabled explicitly via:
Preferences -> Java -> Editor -> Typing -> Automatically insert at correct position -> [x] Semicolons.

@snjeza can you investigate what it'd take to make it happen in vscode too? Automatic insertion of textedits while typing will likely require custom calls to the LS.

@rgrunber
Copy link
Member

In case anyone is curious, the 2nd gif I mentioned in #3159 (comment) is actually https://bugs.eclipse.org/bugs/show_bug.cgi?id=506148 . Fun fact. It's the final bug that was needed (and still is) to be resolved in order to enable the feature by default in Eclipse.

Currently we work around that bug by not attempting to the smart insertion at all eclipse-jdtls/eclipse.jdt.ls@e49a751#diff-a317a5feec9771fbb07fe7c68f9cec2720c03d0977f47e1a9ce31cc82792c9cfR90-R95 .

However, if we have the MethodInvocation object, why can't we use that to get the statement in which it resides, and properly insert the semicolon ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment