-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Language-service-plugin can cause 'scriptInfo for file ... missing' assertion in tsserver #15344
Comments
@mjbvz some updates. The assertion failure is caused by a casing issue in the file paths. The file path is looked up with: The assertion failure does not occur when the program is run on Linux. The interesting question is how can running tslint in the tsserver have this side effect. |
@RyanCavanaugh Tslint is invoked from the extension as follows: let tslint = new linter(options, oldLS.getProgram()); It gets passed in the program with the intent to reuse Program inside tslint when validating rules. What happens is that running the As a consequence the ScriptInfo look up through the FileNameToScriptInfo map files since the key of the FileNameToScriptInfo is all lower case. The rule's implementation creates a new Program without passing in the Program it has received as an argument. When constructing the Program then it creates a fake Host. I can make the problem go away by patching getCanonicalFileName: function (f) { return f.toLowerCase(); } Questions:
The good news is that the |
The problem with the case sensitivity in the host implementation used by tslint has been addressed in palantir/tslint#2819. I'm closing this issue. |
// CC @mjbvz
The tslint-language-service plugin runs tslint as a language service extension. This works nicely for simple tslint rules, but for rules that require the typechecker the tsserver ends up hanging with a 'scriptInfo for file ... lib/lib.d.ts' is missing assertion.
This could be an issue in tslint (the rules that use the type checker work fine on the command line) or this can be an issue in the tsserver.
Here are the steps to reproduce (update: does not repro on Linux, repos on Windows):
set TSS_DEBUG=5859
set TSS_LOG=-level verbose -file c:\tmp\tsserver.log
hello.ts
, there is a tslint warning with a quick fix and all is good, you can make edits in the fileno-unused-variable
rule on line 6. Since tslint 5 this rule requires the TS type checker, see the breaking changes section in the tslint release notes.reload window
hello.ts
hello.ts
to trigger a syntax check ->the tsserver is now no longer responding to requests, e.g. no more hovers. You can also verify this by inspecting the trace inc:\tmp\tsserver.log
.Debugging
To debug the current server state you can attach the debugger from another VS Code version. In this setup I describe using the vscode stable version.
code
(the stable version) on an empty workspace.script info is missing
on adebugger
statement:The text was updated successfully, but these errors were encountered: