internal VisualStudioInProcLanguageServer( AbstractRequestDispatcherFactory requestDispatcherFactory, JsonRpc jsonRpc, ICapabilitiesProvider capabilitiesProvider, LspWorkspaceRegistrationService workspaceRegistrationService, IGlobalOptionService globalOptions, IAsynchronousOperationListenerProvider listenerProvider, ILspLogger logger, IDiagnosticService?diagnosticService, ImmutableArray <string> supportedLanguages, string?clientName, string userVisibleServerName, string telemetryServerTypeName) : base(requestDispatcherFactory, jsonRpc, capabilitiesProvider, workspaceRegistrationService, lspMiscellaneousFilesWorkspace: null, globalOptions, listenerProvider, logger, supportedLanguages, clientName, userVisibleServerName, telemetryServerTypeName) { _supportedLanguages = supportedLanguages; _diagnosticService = diagnosticService; // Dedupe on DocumentId. If we hear about the same document multiple times, we only need to process that id once. _diagnosticsWorkQueue = new AsyncBatchingWorkQueue <DocumentId>( TimeSpan.FromMilliseconds(250), (ids, ct) => ProcessDiagnosticUpdatedBatchAsync(_diagnosticService, ids, ct), EqualityComparer <DocumentId> .Default, Listener, Queue.CancellationToken); if (_diagnosticService != null) { _diagnosticService.DiagnosticsUpdated += DiagnosticService_DiagnosticsUpdated; } }
public static async Task <InProcLanguageServer> CreateAsync( AbstractInProcLanguageClient languageClient, Stream inputStream, Stream outputStream, RequestDispatcher requestDispatcher, Workspace workspace, IDiagnosticService?diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, VSShell.IAsyncServiceProvider?asyncServiceProvider, string?clientName, CancellationToken cancellationToken) { var jsonMessageFormatter = new JsonMessageFormatter(); VSExtensionUtilities.AddVSExtensionConverters(jsonMessageFormatter.JsonSerializer); var jsonRpc = new JsonRpc(new HeaderDelimitedMessageHandler(outputStream, inputStream, jsonMessageFormatter)); var serverTypeName = languageClient.GetType().Name; var logger = await CreateLoggerAsync(asyncServiceProvider, serverTypeName, clientName, jsonRpc, cancellationToken).ConfigureAwait(false); return(new InProcLanguageServer( languageClient, requestDispatcher, workspace, diagnosticService, listenerProvider, lspWorkspaceRegistrationService, serverTypeName, clientName, jsonRpc, logger)); }
public AbstractInProcLanguageClient( AbstractRequestHandlerProvider requestHandlerProvider, VisualStudioWorkspace workspace, IDiagnosticService?diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, string?diagnosticsClientName) { _requestHandlerProvider = requestHandlerProvider; Workspace = workspace; _diagnosticService = diagnosticService; _listenerProvider = listenerProvider; _lspWorkspaceRegistrationService = lspWorkspaceRegistrationService; _diagnosticsClientName = diagnosticsClientName; }
public InProcLanguageServer( AbstractInProcLanguageClient languageClient, Stream inputStream, Stream outputStream, AbstractRequestHandlerProvider requestHandlerProvider, Workspace workspace, IDiagnosticService?diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspSolutionProvider solutionProvider, string?clientName) { _languageClient = languageClient; _requestHandlerProvider = requestHandlerProvider; _workspace = workspace; var jsonMessageFormatter = new JsonMessageFormatter(); jsonMessageFormatter.JsonSerializer.Converters.Add(new VSExtensionConverter <TextDocumentIdentifier, VSTextDocumentIdentifier>()); jsonMessageFormatter.JsonSerializer.Converters.Add(new VSExtensionConverter <ClientCapabilities, VSClientCapabilities>()); _jsonRpc = new JsonRpc(new HeaderDelimitedMessageHandler(outputStream, inputStream, jsonMessageFormatter)); _jsonRpc.AddLocalRpcTarget(this); _jsonRpc.StartListening(); _diagnosticService = diagnosticService; _listener = listenerProvider.GetListener(FeatureAttribute.LanguageServer); _clientName = clientName; _queue = new RequestExecutionQueue(solutionProvider); _queue.RequestServerShutdown += RequestExecutionQueue_Errored; // Dedupe on DocumentId. If we hear about the same document multiple times, we only need to process that id once. _diagnosticsWorkQueue = new AsyncBatchingWorkQueue <DocumentId>( TimeSpan.FromMilliseconds(250), ProcessDiagnosticUpdatedBatchAsync, EqualityComparer <DocumentId> .Default, _listener, _queue.CancellationToken); if (_diagnosticService != null) { _diagnosticService.DiagnosticsUpdated += DiagnosticService_DiagnosticsUpdated; } }
public AbstractInProcLanguageClient( AbstractRequestDispatcherFactory requestDispatcherFactory, VisualStudioWorkspace workspace, IDiagnosticService?diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, VSShell.IAsyncServiceProvider asyncServiceProvider, IThreadingContext threadingContext, string?diagnosticsClientName) { _requestDispatcherFactory = requestDispatcherFactory; Workspace = workspace; _diagnosticService = diagnosticService; _listenerProvider = listenerProvider; _lspWorkspaceRegistrationService = lspWorkspaceRegistrationService; _diagnosticsClientName = diagnosticsClientName; _asyncServiceProvider = asyncServiceProvider; _threadingContext = threadingContext; }
public AbstractInProcLanguageClient( AbstractRequestDispatcherFactory requestDispatcherFactory, IGlobalOptionService globalOptions, IDiagnosticService?diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, LspWorkspaceRegistrationService lspWorkspaceRegistrationService, ILspLoggerFactory lspLoggerFactory, IThreadingContext threadingContext, string?diagnosticsClientName) { _requestDispatcherFactory = requestDispatcherFactory; GlobalOptions = globalOptions; _diagnosticService = diagnosticService; _listenerProvider = listenerProvider; _lspWorkspaceRegistrationService = lspWorkspaceRegistrationService; _diagnosticsClientName = diagnosticsClientName; _lspLoggerFactory = lspLoggerFactory; _threadingContext = threadingContext; }
private InProcLanguageServer( AbstractInProcLanguageClient languageClient, RequestDispatcher requestDispatcher, Workspace workspace, IDiagnosticService?diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, string serverTypeName, string?clientName, JsonRpc jsonRpc, LogHubLspLogger?logger) { _languageClient = languageClient; _requestDispatcher = requestDispatcher; _workspace = workspace; _logger = logger; _jsonRpc = jsonRpc; _jsonRpc.AddLocalRpcTarget(this); _jsonRpc.StartListening(); _diagnosticService = diagnosticService; _listener = listenerProvider.GetListener(FeatureAttribute.LanguageServer); _clientName = clientName; _queue = new RequestExecutionQueue(logger ?? NoOpLspLogger.Instance, lspWorkspaceRegistrationService, languageClient.Name, serverTypeName); _queue.RequestServerShutdown += RequestExecutionQueue_Errored; // Dedupe on DocumentId. If we hear about the same document multiple times, we only need to process that id once. _diagnosticsWorkQueue = new AsyncBatchingWorkQueue <DocumentId>( TimeSpan.FromMilliseconds(250), ProcessDiagnosticUpdatedBatchAsync, EqualityComparer <DocumentId> .Default, _listener, _queue.CancellationToken); if (_diagnosticService != null) { _diagnosticService.DiagnosticsUpdated += DiagnosticService_DiagnosticsUpdated; } }