提交 e007371e 编写于 作者: D David Barbet

Set both completion options to ensure neither can cause unimported types to be included.

上级 8ff5d6d2
......@@ -40,8 +40,11 @@ internal class CompletionHandler : IRequestHandler<LSP.CompletionParams, object>
// https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1076759
// 2. We need to figure out how to provide the text edits along with the completion item or provide them in the resolve request.
// https://devdiv.visualstudio.com/DevDiv/_workitems/edit/985860/
// 3. LSP client should support completion filters / expanders
var documentOptions = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false);
var completionOptions = documentOptions.WithChangedOption(CompletionServiceOptions.IsExpandedCompletion, false);
var completionOptions = documentOptions
.WithChangedOption(CompletionOptions.ShowItemsFromUnimportedNamespaces, false)
.WithChangedOption(CompletionServiceOptions.IsExpandedCompletion, false);
var completionService = document.Project.LanguageServices.GetService<CompletionService>();
var list = await completionService.GetCompletionsAsync(document, position, options: completionOptions, cancellationToken: cancellationToken).ConfigureAwait(false);
......
......@@ -47,7 +47,9 @@ void M()
var (solution, locations) = CreateTestSolution(markup);
// Make sure the unimported types option is on by default.
solution = solution.WithOptions(solution.Options.WithChangedOption(CompletionServiceOptions.IsExpandedCompletion, true));
solution = solution.WithOptions(solution.Options
.WithChangedOption(CompletionOptions.ShowItemsFromUnimportedNamespaces, LanguageNames.CSharp, true)
.WithChangedOption(CompletionServiceOptions.IsExpandedCompletion, true));
var expected = CreateCompletionItem("A", LSP.CompletionItemKind.Class, new string[] { "Class", "Internal" }, CreateCompletionParams(locations["caret"].Single()));
var clientCapabilities = new LSP.VSClientCapabilities { SupportsVisualStudioExtensions = true };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册