diff --git a/typescript/src/specialCommands/handle.ts b/typescript/src/specialCommands/handle.ts index ac35702..1e10a75 100644 --- a/typescript/src/specialCommands/handle.ts +++ b/typescript/src/specialCommands/handle.ts @@ -132,6 +132,9 @@ export default ( let targetNode: undefined | ts.Node | [number, number] if (ts.isIdentifier(node) && node.parent) { node = node.parent + if (ts.isJsxExpression(node)) node = node.parent + if (ts.isJsxAttributeLike(node)) node = node.parent + if (ts.isJsxAttributes(node)) node = node.parent if (ts.isPropertyAssignment(node)) { targetNode = node.initializer } else if ('body' in node) { @@ -140,6 +143,10 @@ export default ( const pos = node.end targetNode = [pos, pos] } + if (ts.isJsxClosingElement(node) || ts.isJsxClosingFragment(node)) { + const { pos } = node + targetNode = [pos, pos] + } } if (!targetNode) {