From 23e6625b6684619e89b54a027e6ff14cdea13884 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 22 Mar 2021 14:35:08 -0700 Subject: [PATCH] Retain old behavior in compile on save by disabling use of file version as signature in when state is not reused --- src/server/project.ts | 2 +- .../unittests/tsserver/compileOnSave.ts | 4 - .../tsserver/projectReferenceCompileOnSave.ts | 854 +----------------- 3 files changed, 15 insertions(+), 845 deletions(-) diff --git a/src/server/project.ts b/src/server/project.ts index 9220d134fa234..208fe18d70954 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -640,7 +640,7 @@ namespace ts.server { return []; } updateProjectIfDirty(this); - this.builderState = BuilderState.create(this.program!, this.projectService.toCanonicalFileName, this.builderState); + this.builderState = BuilderState.create(this.program!, this.projectService.toCanonicalFileName, this.builderState, /*disableUseFileVersionAsSignature*/ true); return mapDefined( BuilderState.getFilesAffectedBy( this.builderState, diff --git a/src/testRunner/unittests/tsserver/compileOnSave.ts b/src/testRunner/unittests/tsserver/compileOnSave.ts index 2d9736dcf2a80..ec30aef0087fa 100644 --- a/src/testRunner/unittests/tsserver/compileOnSave.ts +++ b/src/testRunner/unittests/tsserver/compileOnSave.ts @@ -951,14 +951,10 @@ function bar() { } // Change file1 get affected file list - verifyLocalEdit(file1, "hello", "world", /*returnsAllFilesAsAffected*/ !declaration); // Signatures are not initialized before this request - verifyLocalEdit(file1, "world", "hello"); verifyLocalEdit(file1, "hello", "world"); // Change file2 get affected file list = will return only file2 if --declaration otherwise all files verifyLocalEdit(file2, "world", "hello", /*returnsAllFilesAsAffected*/ !declaration); - verifyLocalEdit(file2, "hello", "world"); - verifyLocalEdit(file2, "world", "hello"); function verifyFileSave(file: File) { const response = session.executeCommandSeq({ diff --git a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts index d2bd281dac281..653043cce9fe5 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts @@ -188,16 +188,6 @@ ${appendDts}` const session = createSession(host); openFilesForSession([usageTs], session); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}${localChange}`); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}`); session.executeCommandSeq({ command: protocol.CommandTypes.CompileOnSaveAffectedFileList, arguments: { file: dependencyTs.path } @@ -241,16 +231,6 @@ ${appendDts}` const session = createSession(host); openFilesForSession([usageTs], session); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}${localChange}`); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}`); session.executeCommandSeq({ command: protocol.CommandTypes.CompileOnSaveAffectedFileList, arguments: { file: dependencyTs.path } @@ -310,34 +290,6 @@ ${appendDts}` insertString: localChange } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -392,34 +344,6 @@ ${appendDts}` insertString: localChange } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -458,16 +382,6 @@ ${appendDts}` const session = createSession(host); openFilesForSession([usageTs], session); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}${change}`); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}`); session.executeCommandSeq({ command: protocol.CommandTypes.CompileOnSaveAffectedFileList, arguments: { file: dependencyTs.path } @@ -511,16 +425,6 @@ ${appendDts}` const session = createSession(host); openFilesForSession([usageTs], session); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}${change}`); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}`); session.executeCommandSeq({ command: protocol.CommandTypes.CompileOnSaveAffectedFileList, arguments: { file: dependencyTs.path } @@ -580,34 +484,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -662,34 +538,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -793,16 +641,6 @@ ${appendDts}` const session = createSession(host); openFilesForSession([usageTs], session); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}${localChange}`); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}`); session.executeCommandSeq({ command: protocol.CommandTypes.CompileOnSaveAffectedFileList, arguments: { file: dependencyTs.path } @@ -841,16 +679,6 @@ ${appendDts}` const session = createSession(host); openFilesForSession([usageTs], session); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}${localChange}`); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}`); session.executeCommandSeq({ command: protocol.CommandTypes.CompileOnSaveAffectedFileList, arguments: { file: dependencyTs.path } @@ -905,34 +733,6 @@ ${appendDts}` insertString: localChange } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -982,34 +782,6 @@ ${appendDts}` insertString: localChange } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -1091,16 +863,6 @@ ${appendDts}` const session = createSession(host); openFilesForSession([usageTs], session); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}${change}`); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - host.writeFile(dependencyTs.path, `${dependencyTs.content}`); session.executeCommandSeq({ command: protocol.CommandTypes.CompileOnSaveAffectedFileList, arguments: { file: dependencyTs.path } @@ -1155,38 +917,10 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); - host.writtenFiles.clear(); - - // Verify CompileOnSaveAffectedFileList - const actualAffectedFiles = session.executeCommandSeq({ + host.writtenFiles.clear(); + + // Verify CompileOnSaveAffectedFileList + const actualAffectedFiles = session.executeCommandSeq({ command: protocol.CommandTypes.CompileOnSaveAffectedFileList, arguments: { file: dependencyTs.path } }).response as protocol.CompileOnSaveAffectedFileListSingleProject[]; @@ -1232,34 +966,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -1386,34 +1092,6 @@ ${appendDts}` insertString: localChange } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -1468,34 +1146,6 @@ ${appendDts}` insertString: localChange } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -1550,34 +1200,6 @@ ${appendDts}` insertString: localChange } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -1632,34 +1254,6 @@ ${appendDts}` insertString: localChange } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -1714,34 +1308,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -1796,34 +1362,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -1878,34 +1416,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -1960,34 +1470,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -2076,34 +1558,6 @@ ${appendDts}` insertString: localChange } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -2129,48 +1583,20 @@ ${appendDts}` arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } }).response as EmitOutput; assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); - }); - it("with local change to usage, with specifying project file", () => { - const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( - createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) - ); - const session = createSession(host); - openFilesForSession([usageTs, dependencyTs], session); - - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - const toLocation = protocolToLocation(usageTs.content); - const location = toLocation(usageTs.content.length); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); + }); + it("with local change to usage, with specifying project file", () => { + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( + createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) + ); + const session = createSession(host); + openFilesForSession([usageTs, dependencyTs], session); + session.executeCommandSeq({ command: protocol.CommandTypes.CompileOnSaveAffectedFileList, arguments: { file: dependencyTs.path } }); + const toLocation = protocolToLocation(usageTs.content); + const location = toLocation(usageTs.content.length); session.executeCommandSeq({ command: protocol.CommandTypes.Change, arguments: { @@ -2230,34 +1656,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -2307,34 +1705,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -2460,34 +1830,6 @@ ${appendDts}` insertString: localChange } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -2543,34 +1885,6 @@ ${appendDts}` insertString: localChange } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -2625,34 +1939,6 @@ ${appendDts}` insertString: localChange } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + localChange.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: localChange - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -2790,34 +2076,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -2873,34 +2131,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: dependencyTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -2955,34 +2185,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList @@ -3038,34 +2240,6 @@ ${appendDts}` insertString: change } }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset + change.length, - insertString: "" - } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } - }); - session.executeCommandSeq({ - command: protocol.CommandTypes.Change, - arguments: { - file: usageTs.path, - ...location, - endLine: location.line, - endOffset: location.offset, - insertString: change - } - }); host.writtenFiles.clear(); // Verify CompileOnSaveAffectedFileList