-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Auto-commit characters do not work consistently #208332
Comments
Please share a code example that demonstrates the issue |
Certainly, here is a way to reproduce two issues: @mjbvz Make a new file, set the language to "TypeScript", then paste the following snippet and follow the instructions: const foo = { boo: '' };
// 1. type "f" to see the suggestions pop up
// 2. type "." to autocomplete "foo"
// 3. press Enter or Tab (to commit "boo", since other characters we wish to type next (such as space or "=") don't work)
// 4. write " = " (now we are on the right-hand side of an expression)
// 5. now repeat, type "f" to see the suggestions pop up
// 6. type "." to see it FAIL to autocomplete "foo"
// foo.boo = f. PS: The same issue occurs using Javascript as the language. |
@RyanCavanaugh On the right hand side, |
AFAICT it's been this way forever. It's straightforward to change but I'd be quite concerned about messing with muscle memory. |
At least provide a setting for activating it? And how is the right-hand side ever a new identifier? |
I'm not trying to disagree with anything here, just stating facts. |
I'm also not trying to press any change here (apparently this behaviour has some point). |
@DanielRosenwasser reminded me why we do this If you're trying to write this code by typing the characters it contains: const addOne = x => x + 1; At this point when you write the space: const addOne = x|
// ^- space here we would end up completing it to const addOne = XMLDocument which is extremely annoying. |
Yeah, the space could be selectively disabled then maybe. Or (as in VS) the autocommit suggestion is not selected in the list in this case, but the mode can be switched using Alt+Space (or whatever it was there), since indeed both cases are possible and cannot be formally known beforehand. |
@RyanCavanaugh I think the proper fix is for TS to compute commit characters instead of having VS Code try to derive them: microsoft/TypeScript#27623 Closing in favor of that issue which also should align with lsp |
May I point out the other part of my request @mjbvz again:
Anything that can be done here? |
Type: Bug
In TypeScript, I can use the "." as an auto-commit character for committing the suggestion only in the left-hand-side expression. After an " = " in the right-hand-side they don't seem to work.
Also, these characters cannot be configured.
It is extremely annoying during development. I unlearnt my prior behaviour from other editors and am pressing Return or Tab all the time for autocompletion, but am annoyed having to do this explicitly.
It is surprising that a feature as very basic and essential as this does not get properly implemented in VSCode for such a long time. If Visual Studio is able to do it, VSCode should be.
Furthermore, committing a suggestion does not recognize what follows, always committing the whole word even if the rest of the word is already there, forcing everybody to delete the rest of the word. These basic convenience features are expected of a proper code editor. If it's too complicated to implement using a Regex-based system, I'm afraid you'll have to find a different way, having this not working properly cannot be excused, it's a must to have, or a reason to switch to a different editor.
VS Code version: Code 1.87.2 (863d258, 2024-03-08T15:20:17.278Z)
OS version: Windows_NT x64 10.0.22631
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Extensions (17)
A/B Experiments
The text was updated successfully, but these errors were encountered: