Skip to content

Commit cc91b5e

Browse files
committed
fix: inconsistent capitalization - ignore XML tags and anchors
1 parent 87f780c commit cc91b5e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/commands/inconsistent-capitalization.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,15 @@ export function registerListInconsistentCapitalizationCommand (context, outputCh
1818
return vscode.window.showErrorMessage('Unsupported Document Type.')
1919
}
2020

21-
const ignoreTextRgx = /<name>(?<term>.+)<\/name>/gi
22-
const results = findInconsistentCapitalization(activeDoc.getText().replaceAll(ignoreTextRgx, (_, p1) => `<name>${repeat('_', p1.length)}</name>`))
21+
const ignoreXmlTagsRgx = /<([ \t\S]+?)>/gi
22+
const ignoreNameTagTextRgx = /<name>(?<term>.+?)<\/name>/gi
23+
const ignoreAnchorPropTextRgx = /anchor="(?<term>.+?)"/gi
24+
const results = findInconsistentCapitalization(
25+
activeDoc.getText()
26+
.replaceAll(ignoreXmlTagsRgx, (_, p1) => `<${repeat('_', p1.length)}>`)
27+
.replaceAll(ignoreNameTagTextRgx, (_, p1) => `<name>${repeat('_', p1.length)}</name>`)
28+
.replaceAll(ignoreAnchorPropTextRgx, (_, p1) => `anchor="${repeat('_', p1.length)}"`)
29+
)
2330

2431
outputChannel.clear()
2532
outputChannel.appendLine(`List of inconsistent use of capitalization in ${activeDoc.fileName}:\n`)

0 commit comments

Comments
 (0)