Typescript: Intellisense stops working when TS Server is higher version

Created on 28 Nov 2019  ·  9Comments  ·  Source: microsoft/TypeScript

Issue Type: Bug

Intellisense stops working when using a higher version of TS than 3.6.3 (version shipped with vscode). Restarting the TS server restores functionality for one request.

I've spent most of this afternoon exploring this, and I'll be happy to provide more info if needed.

Demonstration

First is behavior with 3.7.2 (workspace), then 3.6.3 (default), then 3.8.0 (nightly). Only the middle one works as expected.

Demonstration

To reproduce:

Clone and npm install this repo.

Disable all extensions and ensure language services is using the workspace version of TS (3.7.2), not the default version (3.6.3).

Actual behavior:

Open src/example.ts. Open Intellisense menu for problem items. The first time, the menu will offer auto-import suggestions. Subsequent Intellisense menus will say "No suggestions".

Expected behavior:

Intellisense should offer auto-import suggestions on all menus, when appropriate. See the included gif for details.

VS Code version: Code 1.40.2 (f359dd69833dd8800b54d458f6d37ab7c78df520, 2019-11-25T14:54:40.719Z)
OS version: Linux x64 5.0.0-20-generic


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i3-6100U CPU @ 2.30GHz (4 x 2300)|
|GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: unavailable_off
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled|
|Load (avg)|3, 3, 2|
|Memory (System)|15.55GB (1.17GB free)|
|Process Argv|/home/jack/Documents/Rollup/rollup-plugin-chrome-extension -n --no-sandbox|
|Screen Reader|no|
|VM|0%|

Extensions (48)

Extension|Author (truncated)|Version
---|---|---
yaml2json|ahe|0.0.3
Handlebars|and|0.4.1
vscode-node-readme|ben|3.0.2
github-markdown-preview|bie|0.0.2
markdown-checkbox|bie|0.1.3
markdown-emoji|bie|0.0.9
markdown-preview-github-styles|bie|0.1.6
vscode-toggle-quotes|Bri|0.3.2
turbo-console-log|Cha|1.3.1
npm-intellisense|chr|1.3.0
regex|chr|0.2.0
vscode-eslint|dba|1.9.1
githistory|don|0.4.6
vscode-babel-coloring|dza|0.0.4
vscode-great-icons|emm|2.1.47
prettier-vscode|esb|3.11.0
vscode-open-multiple-files|fab|1.3.0
vscode-jest-runner|fir|0.4.2
vscode-pull-request-github|Git|0.13.0
todo-tree|Gru|0.0.162
turbo-js|hef|1.0.1
npm-dependency-links|her|1.0.1
vscode-simple-icons|Lau|1.11.10
vscode-language-babel|mgm|0.0.25
gitignore|mic|1.0.1
HTMLHint|mka|0.6.0
github-issues-prs|ms-|0.9.2
vscode-typescript-next|ms-|3.8.20191126
color-highlight|nau|2.3.0
material-icon-theme|PKi|3.9.2
polacode|pnp|0.3.4
vscode-yaml|red|0.6.1
postcss|ric|2.0.0
vscode-sort-json|ric|1.18.0
LiveServer|rit|5.6.1
sass-indented|rob|1.5.1
rust|rus|0.7.0
stylelint|shi|0.51.0
vscode-fileutils|sle|3.0.0
comment-divider|sta|0.2.1
vscode-readme-pattern|tho|1.2.0
sort-lines|Tyr|1.9.0
vscode-sort-package-json|uni|1.2.0
vscode-icons|vsc|9.6.0
change-case|wma|1.0.0
markdown-all-in-one|yzh|2.5.1
sort-js-object-keys|zen|1.0.6
vscode-open-in-github|ziy|1.3.6

(1 theme extensions excluded)


Bug

All 9 comments

@andrewbranch can confirm but this seems like expected behavior due to #32517

npm install --save-dev @types/node restores the quick fixes for me

Thanks for looking into this! Installed @types/node, but no joy. 😢

Current behavior with TS 3.7.2 (with @types/node)

Notice that the first attempt works, but none after. The problem includes local modules and all installed packages, like rollup in this example.

intellisense-bug-TS-3 7 2

Expected behavior with TS 3.6.3

All auto-imports work with TS 3.6.3.

intellisense-bug-TS-3 6 3

btw, I've updated the suggested changes to the example repo.

Definitely not expected behavior, but it does sound like #32517 could be the culprit.

Ooh, I was having trouble reproducing this, but I think I figured it out. @jacksteamdev are you pressing Ctrl+Space rather than Ctrl+.?

Found the issue. The code is not guarded against export default undefined, which firebase used to do for some weird reason 😄 https://github.com/firebase/firebase-js-sdk/pull/2379

@andrewbranch I was using Ctrl+Space. Funny, but I'd never heard of Ctrl+.! It's so much better!

You just blew my mind

After npm rm firebase, everything works as expected with 3.7.2. Brilliant.

Ctrl+Space requests _completions_ (same thing as what happens during regular typing); Ctrl+. requests code fixes (same thing as clicking the light bulb icon whenever it appears). Auto imports can happen via either.

Just to be clear, this is still a TypeScript bug that will be fixed for 3.8, but upgrading or removing firebase can be a workaround if you have the option. Thanks for the detailed issue report with repro steps; I would have never been able to figure this out otherwise!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jbondc picture jbondc  ·  3Comments

wmaurer picture wmaurer  ·  3Comments

fwanicka picture fwanicka  ·  3Comments

bgrieder picture bgrieder  ·  3Comments

dlaberge picture dlaberge  ·  3Comments