Skip to content

allow tsserver to be restarted via its public API #13059

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

Closed
zpdDG4gta8XKpMCd opened this issue Dec 20, 2016 · 13 comments
Closed

allow tsserver to be restarted via its public API #13059

zpdDG4gta8XKpMCd opened this issue Dec 20, 2016 · 13 comments
Assignees
Labels
Bug A bug in TypeScript Needs More Info The issue still hasn't been fully clarified

Comments

@zpdDG4gta8XKpMCd
Copy link

zpdDG4gta8XKpMCd commented Dec 20, 2016

every time i open a JS file in my TS project in VSCode, i stop getting any help from tsserver, no autocomplete/hints/anything

i have to close VSCode and start it over, it would be nice to tell tsserver to restart itself instead

@aluanhaddad
Copy link
Contributor

I actually have set this up because the problem is so rampant

  {
    "key": "ctrl+shift+l",
    "command": "workbench.action.reloadWindow"
  }

@mhegazy
Copy link
Contributor

mhegazy commented Dec 20, 2016

This sounds like a bug. we would appreciate it if you can share some repro steps/project samples to help us diagnose the issue.

@mhegazy mhegazy added Bug A bug in TypeScript Needs More Info The issue still hasn't been fully clarified labels Dec 20, 2016
@mhegazy mhegazy added this to the TypeScript 2.2 milestone Dec 20, 2016
@vladima
Copy link
Contributor

vladima commented Dec 20, 2016

@Aleksey-Bykov can you please enable tracing for tsserver in VSCode via "typescript.tsserver.trace": "verbose" and send us the content of TypeScript output window after opening .js file and requesting i.e. quick info?

@zpdDG4gta8XKpMCd
Copy link
Author

zpdDG4gta8XKpMCd commented Dec 20, 2016

[Trace - 2:20:18 PM] Sending request: quickinfo (7). Response expected: yes. Current queue length: 0
Arguments: {}
[Trace - 2:20:18 PM] Response received: quickinfo (7). Request took 1 ms. Success: false . Message: No content available.
[Trace - 2:20:24 PM] Sending request: open (8). Response expected: no. Current queue length: 0
Arguments: {}
[Trace - 2:20:24 PM] Sending request: geterr (9). Response expected: no. Current queue length: 0
Arguments: {}
[Trace - 2:20:30 PM] Sending request: quickinfo (10). Response expected: yes. Current queue length: 0
Arguments: {}
[Trace - 2:20:31 PM] TypeScript Service: tried to cancel request with sequence number 10. But request got already delivered.
[Trace - 2:20:42 PM] TypeScript Service: canceled request with sequence number 11
[Trace - 2:21:20 PM] TypeScript Service: canceled request with sequence number 18
[Trace - 2:21:27 PM] TypeScript Service: canceled request with sequence number 16
[Trace - 2:21:27 PM] TypeScript Service: canceled request with sequence number 17

@mhegazy
Copy link
Contributor

mhegazy commented Dec 21, 2016

looks like the same symptoms of #10735. do you see this with all projects, or just one?

@mhegazy
Copy link
Contributor

mhegazy commented Feb 13, 2017

@Aleksey-Bykov is this still a problem?

@zpdDG4gta8XKpMCd
Copy link
Author

zpdDG4gta8XKpMCd commented Feb 14, 2017 via email

@mhegazy mhegazy assigned mhegazy and unassigned vladima Mar 24, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Mar 24, 2017

Can you share a repro project?

@mhegazy mhegazy modified the milestone: TypeScript 2.3 Mar 24, 2017
@zpdDG4gta8XKpMCd
Copy link
Author

no, it's not mine, and the client is very serious about not showing it to anyone

@mhegazy
Copy link
Contributor

mhegazy commented Mar 30, 2017

Do you see this on other projects? Anything special stands out to you about this project? Do you see any exceptions in the log?

@zpdDG4gta8XKpMCd
Copy link
Author

to clear it up, i see this problem when i open a javascript emitted by the typescript compiler

i cannot see it in my own personal project that uses javascript along side with typescript, but i see in at the work project, i think i might know the reason, there are a bunch of heavy javascript libraries like knockout, jquery, jqx, etc in a close vicinity of the typescript generated javascript files, i think what happens is that when i open a generated javascript file these libs get loaded via dependencies and it's just too much for the language service to handle

while coding typescript there is no such problem because instead of the implementation we work with definitions which are several times shorter

although it's the speculation i don't have a better explanation, so i blame heavy javascript libs

@zpdDG4gta8XKpMCd
Copy link
Author

just checked my theory, i think i found it

i have test.js

var hey = 'hey';

alert(hey);

when i put it to my src folder (where i keep all *.ts files) it works!

    - src
       - test.js // <-- typescript service works
       - ...*.ts

image

when i put it outside of src at the same level where the heavy js libs sit, it hangs:

    - test.js // <-- typescript service doesn't work (hangs)
    - libs
       - ...*.js
    - src
       - ...*.ts    

image

@mhegazy
Copy link
Contributor

mhegazy commented Aug 31, 2017

VS Code's Restart TS server command should address the request in the OP.

from the screen shots above, we are just loading too many files, we have added some checks for detecting too many files cases and handling them gracefully. but enumerating directories and parsing JS files still take resources. our recommendation is to add excludes to tsconfig.

@mhegazy mhegazy closed this as completed Aug 31, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

4 participants