Skip to content

Commit 2c14896

Browse files
committed
fix tag detection
1 parent 642f5e2 commit 2c14896

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/features/reactUnstableActions.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { makeOutlineChainFromPos } from '@zardoy/vscode-utils/build/outline'
44
export default () => {
55
vscode.languages.registerCodeActionsProvider(['javascriptreact', 'typescriptreact'], {
66
async provideCodeActions(document, range, context, token) {
7-
document.getWordRangeAtPosition(range.start, /<[A-Z][-\da-zA-Z]+/)
7+
const tagRange = document.getWordRangeAtPosition(range.start, /<[A-Z][-\da-zA-Z]+/)
8+
if (!tagRange) return
89
const diagnostic = context.diagnostics.find(d => d.message.startsWith('Cannot find name'))
910
if (!diagnostic) return
1011
const componentName = /'(.+?)'/.exec(diagnostic.message)?.[1]

0 commit comments

Comments
 (0)