@@ -54,6 +54,7 @@ import { RoslynLanguageServerEvents } from './languageServerEvents';
54
54
import { registerShowToastNotification } from './showToastNotification' ;
55
55
import { registerRazorCommands } from './razorCommands' ;
56
56
import { registerOnAutoInsert } from './onAutoInsert' ;
57
+ import { NamedPipeInformation } from './roslynProtocol' ;
57
58
58
59
let _channel : vscode . OutputChannel ;
59
60
let _traceChannel : vscode . OutputChannel ;
@@ -62,11 +63,6 @@ let _traceChannel: vscode.OutputChannel;
62
63
// Used to determine if we need to restart the server on extension changes.
63
64
let _wasActivatedWithCSharpDevkit : boolean | undefined ;
64
65
65
- interface TransmittedInformation {
66
- Key : string ;
67
- Value : string ;
68
- }
69
-
70
66
export class RoslynLanguageServer {
71
67
// These are notifications we will get from the LSP server and will forward to the Razor extension.
72
68
private static readonly provideRazorDynamicFileInfoMethodName : string = 'razor/provideDynamicFileInfo' ;
@@ -80,7 +76,7 @@ export class RoslynLanguageServer {
80
76
/**
81
77
* The regular expression used to find the named pipe key in the LSP server's stdout stream.
82
78
*/
83
- private static readonly namedPipeKeyRegex = / { " K e y " : " N a m e d P i p e I n f o r m a t i o n " , " V a l u e " : " [ ^ " ] + " } / ;
79
+ private static readonly namedPipeKeyRegex = / { " p i p e N a m e " : " [ ^ " ] + " } / ;
84
80
85
81
/**
86
82
* The timeout for stopping the language server (in ms).
@@ -560,15 +556,15 @@ export class RoslynLanguageServer {
560
556
561
557
// The server process will create the named pipe used for communcation. Wait for it to be created,
562
558
// and listen for the server to pass back the connection information via stdout.
563
- const namedPipeConnectionPromise = new Promise < TransmittedInformation > ( ( resolve ) => {
559
+ const namedPipeConnectionPromise = new Promise < NamedPipeInformation > ( ( resolve ) => {
564
560
childProcess . stdout . on ( 'data' , ( data : { toString : ( arg0 : any ) => any } ) => {
565
561
const result : string = isString ( data ) ? data : data . toString ( RoslynLanguageServer . encoding ) ;
566
562
_channel . append ( '[stdout] ' + result ) ;
567
563
568
564
// Use the regular expression to find all JSON lines
569
565
const jsonLines = result . match ( RoslynLanguageServer . namedPipeKeyRegex ) ;
570
566
if ( jsonLines ) {
571
- const transmittedPipeNameInfo : TransmittedInformation = JSON . parse ( jsonLines [ 0 ] ) ;
567
+ const transmittedPipeNameInfo : NamedPipeInformation = JSON . parse ( jsonLines [ 0 ] ) ;
572
568
_channel . appendLine ( 'received named pipe information from server' ) ;
573
569
resolve ( transmittedPipeNameInfo ) ;
574
570
}
@@ -581,7 +577,7 @@ export class RoslynLanguageServer {
581
577
582
578
const socketPromise = new Promise < net . Socket > ( ( resolve ) => {
583
579
_channel . appendLine ( 'attempting to connect client to server...' ) ;
584
- const socket = net . createConnection ( pipeConnectionInfo . Value , ( ) => {
580
+ const socket = net . createConnection ( pipeConnectionInfo . pipeName , ( ) => {
585
581
_channel . appendLine ( 'client has connected to server' ) ;
586
582
resolve ( socket ) ;
587
583
} ) ;
0 commit comments