mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Mark extract constant as a preferred refactoring
https://github.com/Microsoft/TypeScript/issues/29587
This commit is contained in:
@@ -188,6 +188,7 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
|
||||
command: ApplyRefactoringCommand.ID,
|
||||
arguments: [document, file, info.name, action.name, rangeOrSelection],
|
||||
};
|
||||
codeAction.isPreferred = TypeScriptRefactorProvider.isPreferred(action);
|
||||
return codeAction;
|
||||
}
|
||||
|
||||
@@ -209,6 +210,15 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
|
||||
}
|
||||
return vscode.CodeActionKind.Refactor;
|
||||
}
|
||||
|
||||
private static isPreferred(
|
||||
action: Proto.RefactorActionInfo
|
||||
): boolean {
|
||||
if (action.name.startsWith('constant_')) {
|
||||
return action.name.endsWith('scope_0');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function register(
|
||||
|
||||
Reference in New Issue
Block a user