-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Description
Bug Report
I've noticed that in the devtools-frontend codebase (https://chromium.googlesource.com/devtools/devtools-frontend), autocompletion suggestions work once and then do not work again when typing. I suspected at first it was a problem with my editor (Vim) but I've also been able to recreate the issue in VSCode, and have delved into the logs to find a "Debug Failure" error reported from TSServer.
🔎 Search Terms
autocomplete, no autocomplete entries
🕗 Version & Regression Information
I'm not exactly sure, but I suspect it started happening at some point in TS 4.4.X's lifespan. It's happening currently for me on TS 4.4.3.
This is also occurring on @next
, which at the time of writing is 4.5.0-dev.20210923.
- This is a crash
To reproduce
(Appreciate this is a lengthy repro but it's clearly something in our project causing the issue).
- Pull down the latest devtools-frontend repo
- Load up
ElementsBreadcrumbs_test.ts
in thetest/unittest
folder (picking this file rather randomly - seems to happen in most files) - Go to line 403, below it start typing
leftB
. See how the autocomplete suggestsleftButton
as you'd expect. Accept this suggestion. - (This is where I'm less confident), but keep trying below line 403 now to insert new lines and start typing
leftB
. At some point (not sure what the exact trigger is) you will see that the autocomplete falls back to just text matches because something has gone wrong in the server:
Looking at the logs from the server, I see:
"Request textDocument/completion failed with message: Error processing request. Debug Failure. Could not find symbol 'newDefaults' by key 'newDefaults' in module \"/usr/local/google/home/jacktfranklin/src/devtools-frontend/front_end/third_party/marked/package/src/defaults\"\nError: Debug Failure. Could not find symbol 'newDefaults' by key 'newDefaults' in module \"/usr/local/google/home/jacktfranklin/src/devtools-frontend/front_end/third_party/marked/package/src/defaults\"\n at rehydrateCachedInfo (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:124229:66)\n at Array.map (<anonymous>)\n at /usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:124177:33\n at Map.forEach (<anonymous>)\n at Object.forEach (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:124175:28)\n at /usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:127920:32\n at resolvingModuleSpecifiers (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:126505:26)\n at collectAutoImports (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:127919:17)\n at getGlobalCompletions (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:127831:17)\n at tryGetGlobalSymbols (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:127737:25)\n at getCompletionData (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:127508:22)\n at Object.getCompletionsAtPosition (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:126570:34)\n at Object.getCompletionsAtPosition (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:157807:35)\n at IOSession.Session.getCompletions (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:169269:64)\n at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:168116:61)\n at /usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:169918:88\n at IOSession.Session.executeWithRequestId (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:169909:28)\n at IOSession.Session.executeCommand (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:169918:33)\n at IOSession.Session.onMessage (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:169944:35)\n at Interface.<anonymous> (/usr/local/google/home/jacktfranklin/src/devtools-frontend/node_modules/typescript/lib/tsserver.js:172549:31)\n at Interface.emit (events.js:375:28)\n at Interface._onLine (readline.js:364:10)\n at Interface._normalWrite (readline.js:509:12)\n at Socket.ondata (readline.js:216:10)\n at Socket.emit (events.js:375:28)\n at addChunk (internal/streams/readable.js:290:12)\n at readableAddChunk (internal/streams/readable.js:265:9)\n at Socket.Readable.push (internal/streams/readable.js:204:10)\n at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)"
Clearly something in third_party/marked
is causing problems. Looking at third_party/marked/src/defaults.js
, we see:
I then decide that maybe the implicit any
is causing issues, so added the explicit any param:
/**
* @param newDefaults {any}
*/
function changeDefaults(newDefaults) {
module.exports.defaults = newDefaults;
}
But unfortunately it doesn't seem to fix the issue. I'm therefore assuming that something in the oddity of the module.exports.defaults = newDefaults
is throwing TSServer off, but that's as far as I can get.
If I can provide any more info or debugging, please let me know!