mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Protect against a language service host mutating its underlying source for getScriptFileNames (#49813)
* Protect against a language service host mutating its underlying source for `getScriptFileNames` * Add comment
This commit is contained in:
parent
8687940398
commit
8002369871
@ -1283,7 +1283,10 @@ namespace ts {
|
||||
lastTypesRootVersion = typeRootsVersion;
|
||||
}
|
||||
|
||||
const rootFileNames = host.getScriptFileNames();
|
||||
// This array is retained by the program and will be used to determine if the program is up to date,
|
||||
// so we need to make a copy in case the host mutates the underlying array - otherwise it would look
|
||||
// like every program always has the host's current list of root files.
|
||||
const rootFileNames = host.getScriptFileNames().slice();
|
||||
|
||||
// Get a fresh cache of the host information
|
||||
const newSettings = host.getCompilationSettings() || getDefaultCompilerOptions();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user