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

Typing repeated dots in js expands to first suggestion #130096

Closed
swantzter opened this issue Aug 4, 2021 · 13 comments
Closed

Typing repeated dots in js expands to first suggestion #130096

swantzter opened this issue Aug 4, 2021 · 13 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release insiders-released Patch has been released in VS Code Insiders javascript JavaScript support issues verified Verification succeeded

Comments

@swantzter
Copy link

swantzter commented Aug 4, 2021

Issue Type: Bug

For the past couple days when I type , for example ...rest the first suggested "property" get's automatically expanded when i enter the second and third dot, resulting in something like .name.name.rest meaning I have to do something like ...rest

VS Code version: Code - Insiders 1.59.0-insider (cead2f6, 2021-08-03T16:24:47.105Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2808)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.86GB (8.02GB free)
Process Argv --crash-reporter-id b535a63f-2266-449e-9950-8702a85093ac
Screen Reader no
VM 0%
Extensions (38)
Extension Author (truncated) Version
vscode-openapi 42C 4.5.2
vscode-apollo apo 1.19.4
github-markdown-preview bie 0.0.2
markdown-checkbox bie 0.1.3
markdown-emoji bie 0.1.0
markdown-preview-github-styles bie 0.2.0
markdown-yaml-preamble bie 0.0.4
vscode-test-explorer-status-bar con 1.2.0
vscode-github-actions csc 0.20.3
vscode-eslint dba 2.1.23
gitlens-insiders eam 2021.7.1905
vscode-test-explorer-diagnostics emi 0.1.1
php-intellisense fel 2.3.14
todo-tree Gru 0.0.213
vscode-mocha-test-adapter hbe 2.13.0
vscode-test-explorer hbe 2.20.4
code-coverage mar 1.3.3
dotenv mik 1.0.1
vscode-docker ms- 1.15.0
vscode-dotnet-runtime ms- 1.2.0
python ms- 2021.7.1060902895
vscode-pylance ms- 2021.7.7
jupyter ms- 2021.8.1081660962
remote-containers ms- 0.190.0
remote-ssh ms- 0.65.7
remote-ssh-edit ms- 0.65.7
remote-wsl ms- 0.58.2
test-adapter-converter ms- 0.1.2
debugger-for-chrome msj 4.12.12
vetur oct 0.34.1
material-icon-theme PKi 4.8.0
vscode-yaml red 0.22.0
partial-diff ryu 1.4.3
vscode-standard sta 1.5.1
code-spell-checker str 1.10.2
code-spell-checker-swedish str 0.1.8
vscode-nginx wil 0.7.2
material-theme zhu 3.11.2
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
python383:30185418
pythonvspyt602:30291494
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30291487
pythontb:30258533
vspre833:30321513
pythonptprofiler:30281269
vshan820:30294714
pythondataviewer:30285072
vscus158:30321503
pythonvsuse255:30319630
vscod805:30301674
pythonvspyt200:30323110
vscextlangct:30310089
vsccppwt:30312692
pythonvssor306:30340298
bridge0708:30335490

@IllusionMH
Copy link
Contributor

IllusionMH commented Aug 4, 2021

Controlled by editor.acceptSuggestionOnCommitCharacter and . is commit character for JS/TS, you can try to disable it in the meantime.

And also it works OKish¹ for "rest"-places const [a, ...rest] = [] (triggers only after third .), however unexpectedly triggers in "spread"-places const a = [...arr] (triggers after first ., and I think it's only text suggestions)

@swantzter is it reproducible for you when you add "editor.suggest.showWords": false to settings (without disabling editor.acceptSuggestionOnCommitCharacter)?


¹ - inconsistent (e.g. no trigger for functions parameters) and questionable benefit for rest places inside of const/let/var you need to declare new local name.

@swantzter
Copy link
Author

swantzter commented Aug 4, 2021

@IllusionMH "editor.suggest.showWords": false does make it go away.

The specific place I had this happen the most was in an "object rest" in an arrow function for an array method callback, for example arr.map(({ privateParam, ...rest }) => rest) but I did notice it in some spread instances too like you mentioned

I also found that if the load on my computer is high I can avoid it by typing faster than the suggestions can load (which seems expected)

@hexpunk
Copy link

hexpunk commented Aug 11, 2021

I think this was introduced with commit 76885d7 but I'm not 💯 about that.

@IllusionMH
Copy link
Contributor

IllusionMH commented Aug 12, 2021

@jayandcatchfire looks like you are correct.

In JS/TS files suggestions are triggered when user types first . in {} and word based suggestions were always there (at least present in 1.43), they just had not commit characters and were not suggested when user typed second and third dots.
And after ... TS provided adequate suggestions that were acceptable with commit characters.

1.60-insiders has .,; as commit characters on word based suggestions
image

while 1.58 does not
image

@mjbvz mjbvz added bug Issue identified by VS Code Team member as probable bug javascript JavaScript support issues labels Aug 12, 2021
@mjbvz mjbvz closed this as completed in 5fe071c Aug 12, 2021
@mjbvz mjbvz modified the milestones: August 2021, July 2021 Recovery Aug 12, 2021
mjbvz added a commit to mjbvz/vscode that referenced this issue Aug 12, 2021
@alexr00 alexr00 added the candidate Issue identified as probable candidate for fixing in the next release label Aug 13, 2021
@rzhao271 rzhao271 added verified Verification succeeded and removed verified Verification succeeded labels Aug 16, 2021
@rebornix rebornix added verified Verification succeeded verification-steps-needed Steps to verify are needed for verification and removed verified Verification succeeded labels Aug 16, 2021
@rebornix
Copy link
Member

@mjbvz may I ask what's the scenario that I should check, I tried

var a = {
    b: 1,
    c: 2
}

...

Every dot on the last line will trigger the auto complete.

@mjbvz
Copy link
Contributor

mjbvz commented Aug 17, 2021

@rebornix Try typing inside an object or array literal. microsoft/TypeScript#45436 has a simple code example, for example:

const abc = {};

({ }); // type inside here
([  ]); // or here

The first three dots should not accept abc. The fourth should accept it

@IllusionMH
Copy link
Contributor

@rebornix I think it's valid place to trigger and accept suggestions. There are no ASI and it's valid to use property access right after object literal
image

@rzhao271 rzhao271 added verified Verification succeeded and removed verification-steps-needed Steps to verify are needed for verification labels Aug 17, 2021
@albannurkollari
Copy link

albannurkollari commented Aug 19, 2021

I'm still having this issue of spread operator not respected rather abrupted by VSCode's auto-select of first suggestion on each dot type.

Version: 1.59.0 (system setup)
Commit: 379476f0e13988d90fab105c5c19e7abc8b1dea8
Date: 2021-08-04T23:13:12.822Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Windows_NT x64 10.0.19043

Edit: It appears the commit fixing this issue has been merged on 13th August, which is 9 days after the latest 1.59 release.
So this is probably going to be shipped in 1.60 I assume? What is the approximate rolling date? I know I can opt in for the nightly build but Id rather not.

@mjbvz can you shed some information about my question above? Thnx.

@IllusionMH
Copy link
Contributor

1.60 will be released in early September.

In your case you are more interested in July 2021 Recovery release that is tracked in #130212

@albannurkollari
Copy link

albannurkollari commented Aug 19, 2021

1.60 will be released in early September.

In your case you are more interested in July 2021 Recovery release that is tracked in #130212

No indication of any release date for that milestone or am I missing something?
Would really appreciate to have this bugfix asap released, really dont wanna opt-in to nightly build.

@IllusionMH
Copy link
Contributor

No date there.

As mentioned in #130096 (comment) in the meantime you can:

  1. disable word suggestions that are shown and accepted with "editor.suggest.showWords": false
  2. prevent . from accepting any suggestions with "editor.acceptSuggestionOnCommitCharacter": false

@AngryGroceries
Copy link

IDK if this type of suggestion is allowed but I just put this in the vscode snippets:
"tripleDotOperator": {
"scope": "javascript,typescript",
"prefix": "3dot",
"body": ["..."]
"description": "workaround for annoying '...' glitch which populates to .adress.address"

@IllusionMH
Copy link
Contributor

It's unnecessary as 1.59.1 already released and contains fix

@github-actions github-actions bot locked and limited conversation to collaborators Sep 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release insiders-released Patch has been released in VS Code Insiders javascript JavaScript support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

10 participants