Пример #1
0
        public async Task CrefCompletionSpeculatesOutsideTrivia()
        {
            var text           = @"
/// <see cref=""$$
class C
{
}";
            var exportProvider = MinimalTestExportProvider.CreateExportProvider(TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithPart(typeof(PickySemanticFactsService)));

            using (var workspace = await TestWorkspaceFactory.CreateWorkspaceFromFilesAsync(LanguageNames.CSharp, new CSharpCompilationOptions(OutputKind.ConsoleApplication), new CSharpParseOptions(), new[] { text }, exportProvider))
            {
                // This test uses MEF to compose in an ISyntaxFactsService that
                // asserts it isn't asked to speculate on nodes inside documentation trivia.
                // This verifies that the provider is asking for a speculative SemanticModel
                // by walking to the node the documentation is attached to.

                var provider       = new CrefCompletionProvider();
                var hostDocument   = workspace.DocumentWithCursor;
                var document       = workspace.CurrentSolution.GetDocument(hostDocument.Id);
                var completionList = GetCompletionList(provider, document, hostDocument.CursorPosition.Value, CompletionTriggerInfo.CreateInvokeCompletionTriggerInfo());
            }
        }