@@ -14,7 +14,6 @@ import { UriConverter } from './uriConverter';
14
14
import {
15
15
DidChangeTextDocumentNotification ,
16
16
DidCloseTextDocumentNotification ,
17
- LanguageClient ,
18
17
LanguageClientOptions ,
19
18
ServerOptions ,
20
19
DidCloseTextDocumentParams ,
@@ -56,6 +55,7 @@ import TelemetryReporter from '@vscode/extension-telemetry';
56
55
import CSharpIntelliCodeExports from '../CSharpIntelliCodeExports' ;
57
56
import { csharpDevkitExtensionId , getCSharpDevKit } from '../utils/getCSharpDevKit' ;
58
57
import { randomUUID } from 'crypto' ;
58
+ import { RoslynLanguageClientInstance } from './roslynLanguageClient' ;
59
59
60
60
let _languageServer : RoslynLanguageServer ;
61
61
let _channel : vscode . OutputChannel ;
@@ -89,7 +89,7 @@ export class RoslynLanguageServer {
89
89
* The timeout for stopping the language server (in ms).
90
90
*/
91
91
private static _stopTimeout : number = 10000 ;
92
- private _languageClient : LanguageClient | undefined ;
92
+ private _languageClient : RoslynLanguageClientInstance | undefined ;
93
93
94
94
/**
95
95
* Flag indicating if C# Devkit was installed the last time we activated.
@@ -192,7 +192,7 @@ export class RoslynLanguageServer {
192
192
} ;
193
193
194
194
// Create the language client and start the client.
195
- let client = new LanguageClient (
195
+ let client = new RoslynLanguageClientInstance (
196
196
'microsoft-codeanalysis-languageserver' ,
197
197
'Microsoft.CodeAnalysis.LanguageServer' ,
198
198
serverOptions ,
@@ -460,7 +460,7 @@ export class RoslynLanguageServer {
460
460
return childProcess ;
461
461
}
462
462
463
- private registerRazor ( client : LanguageClient ) {
463
+ private registerRazor ( client : RoslynLanguageClientInstance ) {
464
464
// When the Roslyn language server sends a request for Razor dynamic file info, we forward that request along to Razor via
465
465
// a command.
466
466
client . onRequest (
@@ -472,40 +472,40 @@ export class RoslynLanguageServer {
472
472
473
473
// Razor will call into us (via command) for generated file didChange/didClose notifications. We'll then forward these
474
474
// notifications along to Roslyn. didOpen notifications are handled separately via the vscode.openTextDocument method.
475
- vscode . commands . registerCommand ( RoslynLanguageServer . roslynDidChangeCommand , ( notification : DidChangeTextDocumentParams ) => {
475
+ client . addDisposable ( vscode . commands . registerCommand ( RoslynLanguageServer . roslynDidChangeCommand , ( notification : DidChangeTextDocumentParams ) => {
476
476
client . sendNotification ( DidChangeTextDocumentNotification . method , notification ) ;
477
- } ) ;
478
- vscode . commands . registerCommand ( RoslynLanguageServer . roslynDidCloseCommand , ( notification : DidCloseTextDocumentParams ) => {
477
+ } ) ) ;
478
+ client . addDisposable ( vscode . commands . registerCommand ( RoslynLanguageServer . roslynDidCloseCommand , ( notification : DidCloseTextDocumentParams ) => {
479
479
client . sendNotification ( DidCloseTextDocumentNotification . method , notification ) ;
480
- } ) ;
481
- vscode . commands . registerCommand ( RoslynLanguageServer . roslynPullDiagnosticCommand , async ( request : DocumentDiagnosticParams ) => {
480
+ } ) ) ;
481
+ client . addDisposable ( vscode . commands . registerCommand ( RoslynLanguageServer . roslynPullDiagnosticCommand , async ( request : DocumentDiagnosticParams ) => {
482
482
let diagnosticRequestType = new RequestType < DocumentDiagnosticParams , DocumentDiagnosticReport , any > ( DocumentDiagnosticRequest . method ) ;
483
483
return await this . sendRequest ( diagnosticRequestType , request , CancellationToken . None ) ;
484
- } ) ;
484
+ } ) ) ;
485
485
486
486
// The VS Code API for code actions (and the vscode.CodeAction type) doesn't support everything that LSP supports,
487
487
// namely the data property, which Razor needs to identify which code actions are on their allow list, so we need
488
488
// to expose a command for them to directly invoke our code actions LSP endpoints, rather than use built-in commands.
489
- vscode . commands . registerCommand ( RoslynLanguageServer . provideCodeActionsCommand , async ( request : CodeActionParams ) => {
489
+ client . addDisposable ( vscode . commands . registerCommand ( RoslynLanguageServer . provideCodeActionsCommand , async ( request : CodeActionParams ) => {
490
490
return await this . sendRequest ( CodeActionRequest . type , request , CancellationToken . None ) ;
491
- } ) ;
492
- vscode . commands . registerCommand ( RoslynLanguageServer . resolveCodeActionCommand , async ( request : CodeAction ) => {
491
+ } ) ) ;
492
+ client . addDisposable ( vscode . commands . registerCommand ( RoslynLanguageServer . resolveCodeActionCommand , async ( request : CodeAction ) => {
493
493
return await this . sendRequest ( CodeActionResolveRequest . type , request , CancellationToken . None ) ;
494
- } ) ;
494
+ } ) ) ;
495
495
496
- vscode . commands . registerCommand ( RoslynLanguageServer . provideCompletionsCommand , async ( request : CompletionParams ) => {
496
+ client . addDisposable ( vscode . commands . registerCommand ( RoslynLanguageServer . provideCompletionsCommand , async ( request : CompletionParams ) => {
497
497
return await this . sendRequest ( CompletionRequest . type , request , CancellationToken . None ) ;
498
- } ) ;
499
- vscode . commands . registerCommand ( RoslynLanguageServer . resolveCompletionsCommand , async ( request : CompletionItem ) => {
498
+ } ) ) ;
499
+ client . addDisposable ( vscode . commands . registerCommand ( RoslynLanguageServer . resolveCompletionsCommand , async ( request : CompletionItem ) => {
500
500
return await this . sendRequest ( CompletionResolveRequest . type , request , CancellationToken . None ) ;
501
- } ) ;
501
+ } ) ) ;
502
502
503
503
// Roslyn is responsible for producing a json file containing information for Razor, that comes from the compilation for
504
504
// a project. We want to defer this work until necessary, so this command is called by the Razor document manager to tell
505
505
// us when they need us to initialize the Razor things.
506
- vscode . commands . registerCommand ( RoslynLanguageServer . razorInitializeCommand , ( ) => {
506
+ client . addDisposable ( vscode . commands . registerCommand ( RoslynLanguageServer . razorInitializeCommand , ( ) => {
507
507
client . sendNotification ( "razor/initialize" , { } ) ;
508
- } ) ;
508
+ } ) ) ;
509
509
}
510
510
511
511
private getServerFileName ( ) {
0 commit comments