mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Ensure getApplicableRefactors doesn't crash when given a position (#28361)
This commit is contained in:
3 files changed
+15
-8
No files matched your search
@@ -3433,7 +3433,17 @@ var x = 10;`
|
||||
command: protocol.CommandTypes.GetApplicableRefactors,
|
||||
arguments: { file: file2.path, startLine: 1, startOffset, endLine: 1, endOffset: startOffset + 1 }
|
||||
});
|
||||
});
|
||||
|
||||
describe("getApplicableRefactors", () => {
|
||||
it("works when taking position", () => {
|
||||
const aTs: File = { path: "/a.ts", content: "" };
|
||||
const session = createSession(createServerHost([aTs]));
|
||||
openFilesForSession([aTs], session);
|
||||
const response = executeSessionRequest<protocol.GetApplicableRefactorsRequest, protocol.GetApplicableRefactorsResponse>(
|
||||
session, protocol.CommandTypes.GetApplicableRefactors, { file: aTs.path, line: 1, offset: 1 });
|
||||
assert.deepEqual<ReadonlyArray<protocol.ApplicableRefactorInfo> | undefined>(response, []);
|
||||
});
|
||||
});
|
||||
|
||||
describe("includes deferred files in the project context", () => {
|
||||
|
||||
Reference in new issue
Block a user