mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 04:09:28 +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 extractFunctionKind = vscode.CodeActionKind.RefactorExtract.append('function');
|
||||||
private static readonly extractConstantKind = vscode.CodeActionKind.RefactorExtract.append('constant');
|
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');
|
private static readonly moveKind = vscode.CodeActionKind.Refactor.append('move');
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -217,6 +218,8 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
|
|||||||
return TypeScriptRefactorProvider.extractConstantKind;
|
return TypeScriptRefactorProvider.extractConstantKind;
|
||||||
} else if (refactor.name.startsWith('Move')) {
|
} else if (refactor.name.startsWith('Move')) {
|
||||||
return TypeScriptRefactorProvider.moveKind;
|
return TypeScriptRefactorProvider.moveKind;
|
||||||
|
} else if (refactor.name.includes('Extract to type alias')) {
|
||||||
|
return TypeScriptRefactorProvider.extractTypeKind;
|
||||||
}
|
}
|
||||||
return vscode.CodeActionKind.Refactor;
|
return vscode.CodeActionKind.Refactor;
|
||||||
}
|
}
|
||||||
@@ -227,6 +230,9 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
|
|||||||
if (action.name.startsWith('constant_')) {
|
if (action.name.startsWith('constant_')) {
|
||||||
return action.name.endsWith('scope_0');
|
return action.name.endsWith('scope_0');
|
||||||
}
|
}
|
||||||
|
if (action.name.includes('Extract to type alias')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user