Skip to content

TSServer: Project Info Should Not Throw an Exception On Files Without a Project #14007

Closed
@mjbvz

Description

@mjbvz

TypeScript Version: 2.1.6

Repo
Send projectInfo to the TSServer for a file that is not a javascript or typescript file that TypeScript knows about

Expected
Returns an empty response to indicate the file is not part of a project

Actual
TSServer throws an exception:

[Info  - 3:20:32 PM] Using tsserver from location: /Users/matb/projects/vscode/extensions/typescript/node_modules/typescript/lib/tsserver.js
[Trace - 3:20:32 PM] Sending request: projectInfo (0). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/test-site/x.html",
    "needFileNameList": false
}
[Trace - 3:20:32 PM] Response received: projectInfo (0). Request took 283 ms. Success: false . Message: Error processing request. No Project.
Error: No Project.
    at Object.ThrowNoProject (/Users/matb/projects/vscode/extensions/typescript/node_modules/typescript/lib/tsserver.js:67007:23)
    at IOSession.Session.getFileAndProjectWorker (/Users/matb/projects/vscode/extensions/typescript/node_modules/typescript/lib/tsserver.js:70846:42)
    at IOSession.Session.getProjectInfoWorker (/Users/matb/projects/vscode/extensions/typescript/node_modules/typescript/lib/tsserver.js:70654:36)
    at IOSession.Session.getProjectInfo (/Users/matb/projects/vscode/extensions/typescript/node_modules/typescript/lib/tsserver.js:70651:29)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Users/matb/projects/vscode/extensions/typescript/node_modules/typescript/lib/tsserver.js:70301:61)
    at IOSession.Session.executeCommand (/Users/matb/projects/vscode/extensions/typescript/node_modules/typescript/lib/tsserver.js:71348:28)
    at IOSession.Session.onMessage (/Users/matb/projects/vscode/extensions/typescript/node_modules/typescript/lib/tsserver.js:71368:35)
    at Interface.<anonymous> (/Users/matb/projects/vscode/extensions/typescript/node_modules/typescript/lib/tsserver.js:72520:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:188:7)
[Trace - 3:20:32 PM] Sending request: configure (1). Response expected: yes. Current queue length: 5
Arguments: {
    "hostInfo": "vscode"
}

Discovered while working on microsoft/vscode#20362 We've worked around this on the VSCode side

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issueVS Code TrackedThere is a VS Code equivalent to this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions