Skip to content

Commit 19c0a03

Browse files
committed
fix: add kinds to refactorings
1 parent 2ef7de5 commit 19c0a03

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

typescript/src/codeActions/custom/changeStringReplaceToRegex.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const nodeToSpan = (node: ts.Node): ts.TextSpan => {
99
export default {
1010
id: 'changeStringReplaceToRegex',
1111
name: 'Change to Regex',
12+
kind: 'refactor.rewrite.stringToRegex',
1213
tryToApply(sourceFile, position, _range, node) {
1314
if (!node || !position) return
1415
// requires full explicit object selection (be aware of comma) to not be annoying with suggestion

typescript/src/codeActions/custom/objectSwapKeysAndValues.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const printNodeForObjectKey = (node: ts.Node) => {
2323
export default {
2424
id: 'objectSwapKeysAndValues',
2525
name: 'Swap Keys and Values in Object',
26+
kind: 'refactor.rewrite.object.swapKeysAndValues',
2627
tryToApply(sourceFile, _position, range, node) {
2728
if (!range || !node) return
2829
// requires full explicit object selection (be aware of comma) to not be annoying with suggestion

typescript/src/codeActions/getCodeActions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export type ApplyCodeAction = (
2222
export type CodeAction = {
2323
name: string
2424
id: string
25+
/** Base kind https://github.com/microsoft/vscode/blob/main/src/vscode-dts/vscode.d.ts#L2236 */
26+
kind: string
2527
tryToApply: ApplyCodeAction
2628
}
2729

@@ -72,8 +74,9 @@ export default (
7274
return {
7375
info:
7476
(appliableCodeActions.length && {
75-
actions: appliableCodeActions.map(({ id, name }) => ({
77+
actions: appliableCodeActions.map(({ id, name, kind }) => ({
7678
description: name,
79+
kind,
7780
name: id,
7881
})),
7982
// anyway not visible in ui

0 commit comments

Comments
 (0)