Skip to content

Commit 1360a98

Browse files
committed
Update LKG
1 parent 29446c7 commit 1360a98

10 files changed

+2862
-1760
lines changed

lib/protocol.d.ts

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ declare namespace ts.server.protocol {
4848
GetCodeFixes = "getCodeFixes",
4949
GetSupportedCodeFixes = "getSupportedCodeFixes",
5050
GetApplicableRefactors = "getApplicableRefactors",
51-
GetRefactorCodeActions = "getRefactorCodeActions",
52-
GetRefactorCodeActionsFull = "getRefactorCodeActions-full",
51+
GetEditsForRefactor = "getEditsForRefactor",
5352
}
5453
/**
5554
* A TypeScript Server message
@@ -291,32 +290,84 @@ declare namespace ts.server.protocol {
291290
offset: number;
292291
}
293292
type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs;
293+
/**
294+
* Request refactorings at a given position or selection area.
295+
*/
294296
interface GetApplicableRefactorsRequest extends Request {
295297
command: CommandTypes.GetApplicableRefactors;
296298
arguments: GetApplicableRefactorsRequestArgs;
297299
}
298300
type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs;
299-
interface ApplicableRefactorInfo {
300-
name: string;
301-
description: string;
302-
}
301+
/**
302+
* Response is a list of available refactorings.
303+
* Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring
304+
*/
303305
interface GetApplicableRefactorsResponse extends Response {
304306
body?: ApplicableRefactorInfo[];
305307
}
306-
interface GetRefactorCodeActionsRequest extends Request {
307-
command: CommandTypes.GetRefactorCodeActions;
308-
arguments: GetRefactorCodeActionsRequestArgs;
308+
/**
309+
* A set of one or more available refactoring actions, grouped under a parent refactoring.
310+
*/
311+
interface ApplicableRefactorInfo {
312+
/**
313+
* The programmatic name of the refactoring
314+
*/
315+
name: string;
316+
/**
317+
* A description of this refactoring category to show to the user.
318+
* If the refactoring gets inlined (see below), this text will not be visible.
319+
*/
320+
description: string;
321+
/**
322+
* Inlineable refactorings can have their actions hoisted out to the top level
323+
* of a context menu. Non-inlineanable refactorings should always be shown inside
324+
* their parent grouping.
325+
*
326+
* If not specified, this value is assumed to be 'true'
327+
*/
328+
inlineable?: boolean;
329+
actions: RefactorActionInfo[];
309330
}
310-
type GetRefactorCodeActionsRequestArgs = FileLocationOrRangeRequestArgs & {
311-
refactorName: string;
331+
/**
332+
* Represents a single refactoring action - for example, the "Extract Method..." refactor might
333+
* offer several actions, each corresponding to a surround class or closure to extract into.
334+
*/
335+
type RefactorActionInfo = {
336+
/**
337+
* The programmatic name of the refactoring action
338+
*/
339+
name: string;
340+
/**
341+
* A description of this refactoring action to show to the user.
342+
* If the parent refactoring is inlined away, this will be the only text shown,
343+
* so this description should make sense by itself if the parent is inlineable=true
344+
*/
345+
description: string;
312346
};
313-
type RefactorCodeActions = {
314-
actions: protocol.CodeAction[];
315-
renameLocation?: number;
347+
interface GetEditsForRefactorRequest extends Request {
348+
command: CommandTypes.GetEditsForRefactor;
349+
arguments: GetEditsForRefactorRequestArgs;
350+
}
351+
/**
352+
* Request the edits that a particular refactoring action produces.
353+
* Callers must specify the name of the refactor and the name of the action.
354+
*/
355+
type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & {
356+
refactor: string;
357+
action: string;
316358
};
317-
interface GetRefactorCodeActionsResponse extends Response {
318-
body: RefactorCodeActions;
359+
interface GetEditsForRefactorResponse extends Response {
360+
body?: RefactorEditInfo;
319361
}
362+
type RefactorEditInfo = {
363+
edits: FileCodeEdits[];
364+
/**
365+
* An optional location where the editor should start a rename operation once
366+
* the refactoring edits have been applied
367+
*/
368+
renameLocation?: Location;
369+
renameFilename?: string;
370+
};
320371
/**
321372
* Request for the available codefixes at a specific position.
322373
*/

0 commit comments

Comments
 (0)