Skip to content

Commit 966d411

Browse files
authored
(fix) dont show redundant onevent completions (#907)
Svelte wants events of the form "on:X", but the suggestions from the TS language service are of the form "onX". Moreover, they are doubled by the HTML attribute suggestions. Therefore filter them out.
1 parent 5d7bf1f commit 966d411

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,5 +476,11 @@ function isValidCompletion(
476476
if (!isCompletionInHTMLStartTag) {
477477
return () => true;
478478
}
479-
return (value) => !completionBlacklist.has(value.name);
479+
return (value) =>
480+
!completionBlacklist.has(value.name) &&
481+
// remove attribues starting with "on" because those are events.
482+
// Svelte wants events of the form "on:X", but the suggestions
483+
// are of the form "onX". Moreover, they are doubled by the HTML
484+
// attribute suggestions. Therefore filter them out.
485+
!value.name.startsWith('on');
480486
}

0 commit comments

Comments
 (0)