mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 12:15:34 -06:00
CR feedback
This commit is contained in:
parent
3e37b3158b
commit
ea9bf7313a
@ -360,7 +360,7 @@ namespace ts {
|
||||
let newFileNames = ts.map(parsedCommandLine.fileNames, compilerHost.getCanonicalFileName);
|
||||
let canonicalRootFileNames = ts.map(rootFileNames, compilerHost.getCanonicalFileName);
|
||||
|
||||
if (!arrayIsEqualTo(newFileNames, canonicalRootFileNames, /*comparer*/ undefined, /*sortBeforeComparison*/ true)) {
|
||||
if (!arrayIsEqualTo(newFileNames.sort(), canonicalRootFileNames.sort())) {
|
||||
setCachedProgram(undefined);
|
||||
startTimerForRecompilation();
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ namespace ts {
|
||||
return node.end - node.pos;
|
||||
}
|
||||
|
||||
export function arrayIsEqualTo<T>(arr1: T[], arr2: T[], comparer?: (a: T, b: T) => boolean, sortBeforeComparison = false): boolean {
|
||||
export function arrayIsEqualTo<T>(arr1: T[], arr2: T[], comparer?: (a: T, b: T) => boolean): boolean {
|
||||
if (!arr1 || !arr2) {
|
||||
return arr1 === arr2;
|
||||
}
|
||||
@ -91,11 +91,6 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sortBeforeComparison) {
|
||||
arr1.sort();
|
||||
arr2.sort();
|
||||
}
|
||||
|
||||
for (let i = 0; i < arr1.length; ++i) {
|
||||
let equals = comparer ? comparer(arr1[i], arr2[i]) : arr1[i] === arr2[i];
|
||||
if (!equals) {
|
||||
|
||||
@ -576,7 +576,7 @@ namespace ts.server {
|
||||
let newRootFiles = projectOptions.files.map((f => this.getCanonicalFileName(f)));
|
||||
let currentRootFiles = project.getRootFiles().map((f => this.getCanonicalFileName(f)));
|
||||
|
||||
if (!arrayIsEqualTo(currentRootFiles, newRootFiles, /*comparer*/ undefined, /*sortBeforeComparison*/ true)) {
|
||||
if (!arrayIsEqualTo(currentRootFiles.sort(), newRootFiles.sort())) {
|
||||
// For configured projects, the change is made outside the tsconfig file, and
|
||||
// it is not likely to affect the project for other files opened by the client. We can
|
||||
// just update the current project.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user