Skip to content

Intellisense fails for TS on "completionInfo" #55454

Open
@leite08

Description

@leite08

Type: Bug

Intellisense fails a few seconds after TS server runs. It seems related to the completionInfo request to TS server.

If we restart TS server and try get Intellisense suggestions right away, it works:

image

But after a few seconds (~5s), it stops working:

image

Steps to Reproduce:

  1. Clone https://github.com/metriport/metriport
  2. Checkout branch 944-tmp-no-fhir-converter
  3. Open packages/api/src/app.ts
  4. npm run install-deps && npm run build
  5. Somewhere below line 15, type ver and wait for Intellisense to kick-in
  6. If done right after TS server starts, it should work (shows suggestion with icon "box within brackets")
  7. If done ~5s after TS server starts, it should fail (shows suggestion with icon abc)

Looking at the TS server log, we get this:

Err 751   [18:43:42.056] Exception on executing command {
  "seq": 34,
  "type": "request",
  "command": "completionInfo",
  "arguments": {
    "file": "/Users/rafael/code/metriport/packages/api/src/app.ts",
    "line": 18,
    "offset": 2,
    "includeExternalModuleExports": true,
    "includeInsertTextCompletions": true,
    "triggerKind": 1
  }
}:

    Cannot read properties of undefined (reading 'lastIndexOf')

    TypeError: Cannot read properties of undefined (reading 'lastIndexOf')
        at Object.startsWith (/Users/rafael/code/metriport/node_modules/typescript/lib/tsserver.js:2290:20)
        at getNodeModuleRootSpecifier (/Users/rafael/code/metriport/node_modules/typescript/lib/tsserver.js:132350:20)
        ...

Full TS server log: tsserver.log

This fails on MacOS 13.4.1, but we couldn't reproduce it on Windows 10 (it works even after a few seconds of restarting the TS server).

Additional env info:

  • npm: 9.5.1
  • node: v18.14.2
  • VSCode: 1.81.0 (also tried on 1.79 and "Insiders")
  • TS version 4.9.5

VS Code version: Code 1.81.0 (Universal) (6445d93c81ebe42c4cbd7a60712e0b17d9463e97, 2023-08-02T12:40:02.782Z)
OS version: Darwin arm64 22.5.0
Modes:

System Info
Item Value
CPUs Apple M1 Max (10 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 24, 19, 15
Memory (System) 32.00GB (0.08GB free)
Process Argv --disable-extensions --crash-reporter-id c22e1216-d117-446f-9db4-d73fbdb3e601
Screen Reader no
VM 0%
Extensions disabled
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263cf:30792227
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
vscccc:30803845
282f8724:30602487
89544117:30613380
a9j8j154:30646983
showlangstatbar:30737416
vsctsb:30748421
a2ce3375:30757347
pythonfmttext:30731395
pythoncmvfstrcf:30756944
9b8hh234:30694863
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
gsofa:30804715
pythonnosmt12:30797651
pythonidxptcf:30805731
pythonnoceb:30805159
e537b577:30795824
dsvsc013:30795093
dsvsc014:30804076

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions