Skip to content
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

Typescript 2.6 service (tsserver): cannot reload files without open projects #19336

Closed
anstarovoyt opened this issue Oct 19, 2017 · 5 comments
Closed
Assignees
Labels
API Relates to the public API for TypeScript Fixed A PR has been merged for this issue

Comments

@anstarovoyt
Copy link

anstarovoyt commented Oct 19, 2017

Starting from typescript 2.6 the tsserver caches ScriptInfo-s even if there is no open projects (or files under InferredProject) with the infos.
It is a problem for us because now we cannot properly handle changed files for compilation.
Our compilation implementation (if there is no open projects / files):

  1. Open project (or file if there is no configured projects for the file)
  2. Run compiling
  3. Close project (or file)

In previous versions the action (1) refreshed all files so all the files always were up-to-date.

After the changes in 2.6 the action (1) doesn't load actual contents for the files if the project was open before. Of course there are file watchers that will handle the content updates but they have a gap in couple seconds.

On the other side IDE has the necessary information but we cannot reload file content without open project (see src/server/session.ts:1346).

The best solution for us is to allow to run "reload" action without open project if the script info is loaded in the service.

@mhegazy mhegazy added this to the TypeScript 2.6.1 milestone Oct 20, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Oct 20, 2017

@sheetalkamat can you take a look.

@mhegazy mhegazy added the API Relates to the public API for TypeScript label Oct 20, 2017
@sheetalkamat
Copy link
Member

@anstarovoyt Before we propose and make change in the API, I would like to know the real issue here. We do watch all the files and depend on it to have correct state and set the correct text as watch callbacks are invoked so I am not sure what you mean by

Of course there are file watchers that will handle the content updates but they have a gap in couple seconds.
Is it the timing issue? Can this be not solved by delaying the compilation/project open?

Having said that we can easily make command reload to always reload contents from disk irrespective of project open (but only if script info is present in the cache). We also have few optimizations here that can be disabled for command reload but I would like to know the reasoning and understand the exact issue/need for this request so that we are handling it correctly and see if our file watching callbacks need some change as well.

@anstarovoyt
Copy link
Author

There are several cases:

  1. Our IDEs can keep non-opened, but changed files. If user explicitly call "compile" for the project we save the files and immediately send "compile" command to the service. I guess it cannot be fixed on the FW side.
  2. Some users use cascade tasks before run something (test for example):
    (1) process some files -> (2) compile project -> (3) do something else. In this case IDE usually knows which files were generated / changed on the step (1) before compiling

@sheetalkamat
Copy link
Member

sheetalkamat commented Oct 25, 2017

@anstarovoyt Is it possible for you to check if #19479 fulfills what you asked for?

@anstarovoyt
Copy link
Author

yes, definitely

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Relates to the public API for TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants