Skip to content

Commit 4f38362

Browse files
committed
highlight: make code more obvious
1 parent ee00744 commit 4f38362

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

typescript/src/documentHighlights.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ export default (proxy: ts.LanguageService, languageService: ts.LanguageService,
55
proxy.getDocumentHighlights = (fileName, position, filesToSearch) => {
66
const prior = languageService.getDocumentHighlights(fileName, position, filesToSearch)
77
if (!prior) return
8-
if (prior.length !== 1) return prior
8+
if (prior.length !== 1 || c('disableUselessHighlighting') === 'disable') return prior
99
const node = findChildContainingPosition(ts, languageService.getProgram()!.getSourceFile(fileName)!, position)
1010
if (!node) return prior
11-
if (
12-
c('disableUselessHighlighting') !== 'disable' &&
13-
ts.isStringLiteralLike(node) &&
14-
(c('disableUselessHighlighting') === 'inAllStrings' || ts.isJsxAttribute(node.parent))
15-
) {
11+
if (ts.isStringLiteralLike(node) && (c('disableUselessHighlighting') === 'inAllStrings' || ts.isJsxAttribute(node.parent))) {
1612
return
1713
}
1814
return prior

0 commit comments

Comments
 (0)