mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
fix54492: allow editor to check for original file extension for rename (#56680)
This commit is contained in:
@@ -193,4 +193,23 @@ describe("unittests:: tsserver:: rename", () => {
|
||||
});
|
||||
baselineTsserverLogs("rename", "with symlinks and case difference", session);
|
||||
});
|
||||
|
||||
it("rename TS file with js extension", () => {
|
||||
const aTs: File = { path: "/a.ts", content: "export const a = 1;" };
|
||||
const bTs: File = { path: "/b.ts", content: `import * as foo from './a.js';` };
|
||||
|
||||
const host = createServerHost([aTs, bTs]);
|
||||
const session = new TestSession(host);
|
||||
openFilesForSession([aTs, bTs], session);
|
||||
|
||||
session.executeCommandSeq<ts.server.protocol.ConfigureRequest>({
|
||||
command: ts.server.protocol.CommandTypes.Configure,
|
||||
arguments: { preferences: { allowRenameOfImportPath: true } },
|
||||
});
|
||||
session.executeCommandSeq<ts.server.protocol.RenameRequest>({
|
||||
command: ts.server.protocol.CommandTypes.Rename,
|
||||
arguments: protocolFileLocationFromSubstring(bTs, "a.js"),
|
||||
});
|
||||
baselineTsserverLogs("rename", "rename TS file with js extension", session);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user