Skip to content

Commit 52bf7d8

Browse files
authored
fix: don't highlight component as a parameter in the template (#2732)
1 parent 74b6caf commit 52bf7d8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/language-server/src/plugins/typescript/features/SemanticTokensProvider.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { LSAndTSDocResolver } from '../LSAndTSDocResolver';
1212
import { convertToTextSpan } from '../utils';
1313
import { isInGeneratedCode } from './utils';
1414
import { internalHelpers } from 'svelte2tsx';
15+
import { TokenType } from '../../../lib/semanticToken/semanticTokenLegend';
1516

1617
const CONTENT_LENGTH_LIMIT = 50000;
1718

@@ -133,10 +134,11 @@ export class SemanticTokensProviderImpl implements SemanticTokensProvider {
133134

134135
// Ensure components in the template get no semantic highlighting
135136
if (
136-
(classificationType === 0 ||
137-
classificationType === 5 ||
138-
classificationType === 7 ||
139-
classificationType === 10) &&
137+
(classificationType === TokenType.class ||
138+
classificationType === TokenType.type ||
139+
classificationType === TokenType.parameter ||
140+
classificationType === TokenType.variable ||
141+
classificationType === TokenType.function) &&
140142
snapshot.svelteNodeAt(startOffset)?.type === 'InlineComponent' &&
141143
(document.getText().charCodeAt(startOffset - 1) === /* < */ 60 ||
142144
document.getText().charCodeAt(startOffset - 1) === /* / */ 47)

0 commit comments

Comments
 (0)