8000 Debug failure in TSServer autocomplete · Issue #46024 · microsoft/TypeScript · GitHub
[go: up one dir, main page]

Skip to content
Debug failure in TSServer autocomplete #46024
@jackfranklin

Description

@jackfranklin

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).

  1. Pull down the latest devtools-frontend repo
  2. Load up ElementsBreadcrumbs_test.ts in the test/unittest folder (picking this file rather randomly - seems to happen in most files)
  3. Go to line 403, below it start typing leftB. See how the autocomplete suggests leftButton as you'd expect. Accept this suggestion.
  4. (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:

Screenshot 2021-09-23 at 16 49 57

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:

Screenshot 2021-09-23 at 16 53 50

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!

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputDomain: Auto-importFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0