Skip to content

"Project does not contain document" Error Causes Types to Stop Resolving in VS Code #38366

Closed
@JasonGore

Description

@JasonGore

TypeScript Version: 3.9.1-rc

Search Terms:
VS Code, Go to Definition, Go to Type Definition

Code

I'm not sure how to self-contain this, but within a given package I am:

  • Navigating to built-in class CustomDialog
  • Navigating to build-in interface CustomDialogProps (this navigation fails soon after TS Server restart)

Expected behavior:

Types defined within a given package are always navigable via VS Code.

Actual behavior:

I have an instance of navigating to type that works for a while after restarting TS server but then soon fails consistently. At some point navigation to a given type fails with the following error in the TS Server log. I am not sure why this error would occur given that the interface is defined and captured by the tsconfig.json and output into lib.

    Project 'G:/git/ooui-dd/packages/app-commanding-ui/tsconfig.json' does not contain document 'g:/git/ooui-dd/packages/app-commanding-ui/lib/UISurfaces/Dialog/Components/CustomDialog.d.ts'

    Error: Project 'G:/git/ooui-dd/packages/app-commanding-ui/tsconfig.json' does not contain document 'g:/git/ooui-dd/packages/app-commanding-ui/lib/UISurfaces/Dialog/Components/CustomDialog.d.ts'
        at Object.ThrowProjectDoesNotContainDocument (G:\git\ooui-dd\common\temp\node_modules\.pnpm\office.pkgs.visualstudio.com\typescript\3.9.1-rc\node_modules\typescript\lib\tsserver.js:141431:23)
        at ConfiguredProject.Project.getScriptInfoForNormalizedPath (G:\git\ooui-dd\common\temp\node_modules\.pnpm\office.pkgs.visualstudio.com\typescript\3.9.1-rc\node_modules\typescript\lib\tsserver.js:143467:42)
        at IOSession.Session.getApplicableRefactors (G:\git\ooui-dd\common\temp\node_modules\.pnpm\office.pkgs.visualstudio.com\typescript\3.9.1-rc\node_modules\typescript\lib\tsserver.js:149150:42)
        at Session.handlers.ts.createMapFromTemplate._a.<computed> (G:\git\ooui-dd\common\temp\node_modules\.pnpm\office.pkgs.visualstudio.com\typescript\3.9.1-rc\node_modules\typescript\lib\tsserver.js:147956:61)
        at G:\git\ooui-dd\common\temp\node_modules\.pnpm\office.pkgs.visualstudio.com\typescript\3.9.1-rc\node_modules\typescript\lib\tsserver.js:149451:88
        at IOSession.Session.executeWithRequestId (G:\git\ooui-dd\common\temp\node_modules\.pnpm\office.pkgs.visualstudio.com\typescript\3.9.1-rc\node_modules\typescript\lib\tsserver.js:149442:28)
        at IOSession.Session.executeCommand (G:\git\ooui-dd\common\temp\node_modules\.pnpm\office.pkgs.visualstudio.com\typescript\3.9.1-rc\node_modules\typescript\lib\tsserver.js:149451:33)
        at IOSession.Session.onMessage (G:\git\ooui-dd\common\temp\node_modules\.pnpm\office.pkgs.visualstudio.com\typescript\3.9.1-rc\node_modules\typescript\lib\tsserver.js:149475:35)
        at Interface.<anonymous> (G:\git\ooui-dd\common\temp\node_modules\.pnpm\office.pkgs.visualstudio.com\typescript\3.9.1-rc\node_modules\typescript\lib\tsserver.js:150791:27)
        at Interface.emit (events.js:203:13)
        at Interface._onLine (readline.js:316:10)
        at Interface._normalWrite (readline.js:461:12)
        at Socket.ondata (readline.js:172:10)
        at Socket.emit (events.js:203:13)
        at addChunk (_stream_readable.js:295:12)
        at readableAddChunk (_stream_readable.js:276:11)
        at Socket.Readable.push (_stream_readable.js:210:10)
        at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)

Playground Link:

I'm not sure how to replicate this kind of issue in Playground, but I do have a local repro that I can get to trigger consistently. I also have TS Server logs I can provide privately.

Related Issues:

I tried searching issues for "Go to definition" and didn't see anything applicable. @DanielRosenwasser if there are any further steps I can take to help, 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 outputFix 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