mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-22 11:19:32 +00:00
Set extract kind for type alias refactoring
This lets you set up a single keybinding that applies to both extract constant and extract type
This commit is contained in:
@@ -116,6 +116,7 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
|
||||
|
||||
private static readonly extractFunctionKind = vscode.CodeActionKind.RefactorExtract.append('function');
|
||||
private static readonly extractConstantKind = vscode.CodeActionKind.RefactorExtract.append('constant');
|
||||
private static readonly extractTypeKind = vscode.CodeActionKind.RefactorExtract.append('type');
|
||||
private static readonly moveKind = vscode.CodeActionKind.Refactor.append('move');
|
||||
|
||||
constructor(
|
||||
@@ -217,6 +218,8 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
|
||||
return TypeScriptRefactorProvider.extractConstantKind;
|
||||
} else if (refactor.name.startsWith('Move')) {
|
||||
return TypeScriptRefactorProvider.moveKind;
|
||||
} else if (refactor.name.includes('Extract to type alias')) {
|
||||
return TypeScriptRefactorProvider.extractTypeKind;
|
||||
}
|
||||
return vscode.CodeActionKind.Refactor;
|
||||
}
|
||||
@@ -227,6 +230,9 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
|
||||
if (action.name.startsWith('constant_')) {
|
||||
return action.name.endsWith('scope_0');
|
||||
}
|
||||
if (action.name.includes('Extract to type alias')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user