From 3661c57a90f2ba80833865a6600ce0c8a7f50c1d Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Tue, 23 Mar 2021 10:00:39 +0100 Subject: [PATCH] (fix) dont show redundant onevent completions 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. --- .../src/plugins/typescript/features/CompletionProvider.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/language-server/src/plugins/typescript/features/CompletionProvider.ts b/packages/language-server/src/plugins/typescript/features/CompletionProvider.ts index 998d3b2fd..1620a4a24 100644 --- a/packages/language-server/src/plugins/typescript/features/CompletionProvider.ts +++ b/packages/language-server/src/plugins/typescript/features/CompletionProvider.ts @@ -476,5 +476,11 @@ function isValidCompletion( if (!isCompletionInHTMLStartTag) { return () => true; } - return (value) => !completionBlacklist.has(value.name); + return (value) => + !completionBlacklist.has(value.name) && + // remove attribues starting with "on" because those are events. + // Svelte wants events of the form "on:X", but the suggestions + // are of the form "onX". Moreover, they are doubled by the HTML + // attribute suggestions. Therefore filter them out. + !value.name.startsWith('on'); }