Exemple #1
0
 /// <nodoc />
 internal CodeActionProvider(ProviderContext providerContext, IExecuteCommandProvider commandProvider)
     : base(providerContext)
 {
     foreach (var codeAction in s_codeActions)
     {
         commandProvider.AddCommand(codeAction.Command, codeAction.ExecuteCommand);
     }
 }
Exemple #2
0
 /// <nodoc />
 protected IdeProviderBase(ProviderContext providerContext)
 {
     ProviderContext = providerContext;
     JsonRpc         = providerContext.JsonRpc;
     PathTable       = providerContext.PathTable;
     m_incrementalWorkspaceProvider = providerContext.IncrementalWorkspaceProvider;
     m_incrementalWorkspaceProvider.WorkspaceRecomputed += OnWorkspaceRecomputed;
     ChangedTextDocumentItems = new TextDocumentItem[0];
 }
Exemple #3
0
        public LanguageServiceProviders(ProviderContext providerContext, FrontEndEngineAbstraction engineAbstraction, IProgressReporter progressReporter)
        {
            Contract.Requires(providerContext != null);
            Contract.Requires(engineAbstraction != null);

            m_autoCompleteProvider   = new AutoCompleteProvider(providerContext);
            m_gotoDefinitionProvider = new GotoDefinitionProvider(providerContext);
            m_findReferencesProvider = new FindReferencesProvider(providerContext, progressReporter);
            m_formattingProvider     = new FormattingProvider(providerContext, engineAbstraction);
            m_executeCommandProvider = new ExecuteCommandProvider(providerContext);
            m_codeActionProvider     = new CodeActionProvider(providerContext, m_executeCommandProvider);
            m_codeLensProvider       = new CodeLensProvider(providerContext);
            m_hoverProvider          = new HoverProvider(providerContext);
            m_diagnosticProvider     = new DiagnosticProvider(providerContext);
            m_signatureHelpProvider  = new SignatureHelpProvider(providerContext);
            m_symbolProvider         = new SymbolProvider(providerContext);
            m_renameProvider         = new RenameProvider(providerContext, m_findReferencesProvider);
        }
Exemple #4
0
        private static Result <dynamic, ResponseError> ExecuteCreateImportStatementCommand(
            ProviderContext providerContext,
            dynamic[] arguments)
        {
            string importString = arguments[0];
            string bannerString = arguments[1];

            try
            {
                Clipboard.CopyToClipboard(importString);
                Analysis.IgnoreResult(providerContext.ShowMessageAsync(MessageType.Info, bannerString), "Fire and forget");
            }
            catch (Win32Exception e)
            {
                Analysis.IgnoreResult(providerContext.ShowMessageAsync(MessageType.Error, $"Whoops, we couldn't copy import statement to the clipboard. Error: '{e.Message}'"), "Fire and forget");
            }

            return(Result.Success);
        }
Exemple #5
0
 /// <nodoc/>
 public GotoDefinitionProvider(ProviderContext providerContext)
     : base(providerContext)
 {
 }
Exemple #6
0
 /// <nodoc/>
 public SymbolProvider(ProviderContext providerContext)
     : base(providerContext)
 {
 }
Exemple #7
0
        private static void DoReportDiagnostics(Workspace workspace, TextDocumentItem document, PathTable pathTable, ProviderContext providerContext)
        {
            // We report diagnostics for the document
            var documentUri = document.Uri;

            var semanticModel = workspace.GetSemanticModel();

            Contract.Assert(semanticModel != null, "We should always get a semantic model since we don't cancel on first failure");

            // These are all the syntactic diagnostics that come from the workspace, across all files
            var allDiagnostics = workspace.GetAllParsingAndBindingErrors();

            // If the file is part of the workspace, we add the type checking errors for that file only
            var path = documentUri.ToAbsolutePath(pathTable);

            if (workspace.TryGetSourceFile(path, out var spec))
            {
                allDiagnostics = allDiagnostics.Union(semanticModel.GetTypeCheckingDiagnosticsForFile(spec));
            }

            var publishDiagnostics = FilterDiagnosticsForSpec(documentUri, allDiagnostics, pathTable);

            // Need to report even if publishedDiagnostics is empty to clear the diagnostics list in IDE.
            Analysis.IgnoreResult(providerContext.PublishDiagnosticsAsync(publishDiagnostics), "Fire and forget");
        }
Exemple #8
0
 /// <nodoc/>
 public DiagnosticProvider(ProviderContext providerContext)
     : base(providerContext)
 {
 }
Exemple #9
0
 /// <nodoc/>
 internal CodeLensProvider(ProviderContext providerContext)
     : base(providerContext)
 {
 }
Exemple #10
0
 /// <nodoc />
 public RenameProvider(ProviderContext providerContext, FindReferencesProvider findReferencesProvider)
     : base(providerContext)
 {
     m_findReferencesProvider = findReferencesProvider;
 }
 /// <nodoc />
 public FormattingProvider(ProviderContext providerContext, FrontEndEngineAbstraction engineAbstraction)
     : base(providerContext)
 {
     m_engineAbstraction = engineAbstraction;
 }
 /// <nodoc />
 public SignatureHelpProvider(ProviderContext providerContext)
     : base(providerContext)
 {
 }
 /// <nodoc/>
 internal ExecuteCommandProvider(ProviderContext providerContext)
     : base(providerContext)
 {
 }
Exemple #14
0
 /// <nodoc/>
 public HoverProvider(ProviderContext providerContext)
     : base(providerContext)
 {
 }