From ee0c6335a42539dd598ff0e0b5a8081639e6b78e Mon Sep 17 00:00:00 2001 From: yblanken Date: Tue, 22 Oct 2024 11:17:23 +0200 Subject: [PATCH] [#32] Explicit completion request at any location is ignored --- src/index.ts | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/index.ts b/src/index.ts index aba3286..9ba61e7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -519,20 +519,13 @@ export function languageServerWithTransport(options: LanguageServerOptions) { let trigKind: CompletionTriggerKind = CompletionTriggerKind.Invoked; let trigChar: string | undefined; - if ( - !explicit && - plugin.client.capabilities?.completionProvider?.triggerCharacters?.includes( - line.text[pos - line.from - 1] - ) - ) { - trigKind = CompletionTriggerKind.TriggerCharacter; - trigChar = line.text[pos - line.from - 1]; - } - if ( - trigKind === CompletionTriggerKind.Invoked && - !context.matchBefore(/\w+$/) - ) { - return null; + if (!explicit) { + if (plugin.client.capabilities?.completionProvider?.triggerCharacters?.includes( + line.text[pos - line.from - 1]) + ) { + trigKind = CompletionTriggerKind.TriggerCharacter; + trigChar = line.text[pos - line.from - 1]; + } else if (!context.matchBefore(/\w+$/)) return null; } return await plugin.requestCompletion( context,