-
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
isProgramUpToDate
reports false
because it expects HostCache
to include typescript/lib/*.d.ts
files
#36748
Labels
API
Relates to the public API for TypeScript
Bug
A bug in TypeScript
Fix Available
A PR has been opened for this issue
Milestone
Comments
sheetalkamat
added
Bug
A bug in TypeScript
API
Relates to the public API for TypeScript
labels
Feb 12, 2020
sheetalkamat
added a commit
that referenced
this issue
Feb 26, 2020
…ked correctly (#36808) * Fix tests when there are project references but has disableSourceOfProjectReferenceRedirect * Handle getScriptVersion correctly to ensure program structure is checked correctly Fixes #36748 * Harness's language service host doesnt have getProjectVersion. This means earlier we were creating fresh program everytime we did LS operation Now we reuse same program, so quick info depends on order of quickinfo demands * Because same program is used, it unvails a bug that if `export=` is evaluated before finding references, it cant find all definitions from the merge * Update src/server/project.ts Co-Authored-By: Nathan Shively-Sanders <[email protected]> * Make clearSourceMapperCache required Co-authored-by: Nathan Shively-Sanders <[email protected]>
This was referenced Mar 18, 2020
This was referenced Mar 25, 2020
This was referenced Apr 12, 2020
This was referenced Apr 13, 2020
This was referenced Apr 21, 2020
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
API
Relates to the public API for TypeScript
Bug
A bug in TypeScript
Fix Available
A PR has been opened for this issue
TypeScript Version: 3.8.0-dev.20200211
Search Terms:
isProgramUpToDate
getScriptFileNames
Code
Full reproduction:
https://github.com/TypeStrong/ts-node-repros/blob/tsIsProgramUpToDate/example.ts
Output:
https://github.com/TypeStrong/ts-node-repros/blob/tsIsProgramUpToDate/output.txt
Briefly, if I create a
languageService
and repeatedly ask it for theProgram
, it should return the same program instance each time, provided nothing has changed.Expected behavior:
Same
Program
instance is returned becauseisProgramUpToDate()
returnstrue
.Actual behavior:
New
Program
instance is returned each time becauseisProgramUpToDate()
always returnsfalse
.I believe this is the culprit:
https://github.com/microsoft/TypeScript/blob/master/src/compiler/program.ts#L586-L589
It asks
HostCache
for the version of allprogram.getSourceFiles()
.However, the
HostCache
only containshost.getScriptFileNames()
host.getScriptFileNames()
contains only root files, for example, the contents of asrc
directory.program.getSourceFiles()
contains things liketypescript/lib/lib.es5.d.ts
As far as I know,
host.getScriptFileNames()
must never includetypescript/lib/lib*.d.ts
Thus
isProgramUpToDate()
is doomed to fail every time, as far as I can tell.Related Issues:
#36010
The text was updated successfully, but these errors were encountered: