diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 31b637ce..feb27e6d 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -863,6 +863,15 @@ func (l *LanguageServer) handleTextDocumentCompletion( return nil, fmt.Errorf("failed to unmarshal params: %w", err) } + // when config ignores a file, then we return an empty completion list + // as a no-op. + if l.ignoreURI(params.TextDocument.URI) { + return types.CompletionList{ + IsIncomplete: false, + Items: []types.CompletionItem{}, + }, nil + } + // items is allocated here so that the return value is always a non-nil CompletionList items, err := l.completionsManager.Run(params, &providers.Options{ ClientIdentifier: l.clientIdentifier,