private void CreateCodeActionResolver(
            out CSharpCodeActionParams codeActionParams,
            out AddUsingsCSharpCodeActionResolver addUsingResolver,
            ClientNotifierServiceBase languageServer  = null,
            DocumentVersionCache documentVersionCache = null)
        {
            var documentPath = "c:/Test.razor";
            var documentUri  = new Uri(documentPath);
            var contents     = string.Empty;
            var codeDocument = CreateCodeDocument(contents, documentPath);

            codeActionParams = new CSharpCodeActionParams()
            {
                Data         = new JObject(),
                RazorFileUri = documentUri
            };

            languageServer ??= CreateLanguageServer();
            documentVersionCache ??= CreateDocumentVersionCache();

            addUsingResolver = new AddUsingsCSharpCodeActionResolver(
                new DefaultForegroundDispatcher(),
                CreateDocumentResolver(documentPath, codeDocument),
                languageServer,
                documentVersionCache);
        }
Example #2
0
        private void CreateCodeActionResolver(
            out CSharpCodeActionParams codeActionParams,
            out AddUsingsCSharpCodeActionResolver addUsingResolver)
        {
            var documentPath = "c:/Test.razor";
            var documentUri  = new Uri(documentPath);
            var contents     = string.Empty;
            var codeDocument = CreateCodeDocument(contents, documentPath);

            codeActionParams = new CSharpCodeActionParams()
            {
                Data         = new JObject(),
                RazorFileUri = documentUri
            };

            var languageServer       = CreateLanguageServer();
            var documentVersionCache = CreateDocumentVersionCache();

            addUsingResolver = new AddUsingsCSharpCodeActionResolver(
                Dispatcher,
                CreateDocumentResolver(documentPath, codeDocument),
                languageServer,
                documentVersionCache);
        }