@@ -4,7 +4,7 @@ import * as net from 'net';
44import * as path from 'path' ;
55import { CancellationToken , CodeActionKind , commands , ConfigurationTarget , DocumentSelector , EventEmitter , ExtensionContext , extensions , languages , Location , ProgressLocation , TextEditor , Uri , ViewColumn , window , workspace , WorkspaceConfiguration } from "vscode" ;
66import { ConfigurationParams , ConfigurationRequest , LanguageClientOptions , Location as LSLocation , MessageType , Position as LSPosition , TextDocumentPositionParams , WorkspaceEdit , StaticFeature , ClientCapabilities , FeatureState , TelemetryEventNotification } from "vscode-languageclient" ;
7- import { LanguageClient , ServerOptions , StreamInfo } from "vscode-languageclient/node" ;
7+ import { LanguageClient , StreamInfo } from "vscode-languageclient/node" ;
88import { apiManager } from "./apiManager" ;
99import * as buildPath from './buildpath' ;
1010import { javaRefactorKinds , RefactorDocumentProvider } from "./codeActionProvider" ;
@@ -42,7 +42,6 @@ import { listJdks, sortJdksBySource, sortJdksByVersion } from './jdkUtils';
4242import { ClientCodeActionProvider } from './clientCodeActionProvider' ;
4343import { BuildFileSelector } from './buildFilesSelector' ;
4444import { extendedOutlineQuickPick } from "./outline/extendedOutlineQuickPick" ;
45- import { startWithStdioFallback } from './standardLanguageClientStart' ;
4645
4746const extensionName = 'Language Support for Java' ;
4847const GRADLE_CHECKSUM = "gradle/checksum/prompt" ;
@@ -51,7 +50,6 @@ const USE_JAVA = "Use Java ";
5150const AS_GRADLE_JVM = " as Gradle JVM" ;
5251const UPGRADE_GRADLE = "Upgrade Gradle to " ;
5352const GRADLE_IMPORT_JVM = "java.import.gradle.java.home" ;
54- const PIPE_START_TIMEOUT_MS = 30000 ;
5553export const JAVA_SELECTOR : DocumentSelector = [
5654 { scheme : "file" , language : "java" , pattern : "**/*.java" } ,
5755 { scheme : "jdt" , language : "java" , pattern : "**/*.class" } ,
@@ -61,8 +59,6 @@ export const JAVA_SELECTOR: DocumentSelector = [
6159export class StandardLanguageClient {
6260
6361 private languageClient : LanguageClient ;
64- private serverOptions : ServerOptions ;
65- private clientOptions : LanguageClientOptions ;
6662 private status : ClientStatus = ClientStatus . uninitialized ;
6763
6864 public async initialize ( context : ExtensionContext , requirements : RequirementsData , clientOptions : LanguageClientOptions , workspacePath : string , jdtEventEmitter : EventEmitter < Uri > ) : Promise < void > {
@@ -89,7 +85,7 @@ export class StandardLanguageClient {
8985 }
9086 } ) ;
9187
92- let serverOptions : ServerOptions ;
88+ let serverOptions ;
9389 const port = process . env [ 'JDTLS_SERVER_PORT' ] ;
9490 if ( ! port ) {
9591 const lsPort = process . env [ 'JDTLS_CLIENT_PORT' ] ;
@@ -109,26 +105,19 @@ export class StandardLanguageClient {
109105 // used during development
110106 serverOptions = awaitServerConnection . bind ( null , port ) ;
111107 }
112- this . serverOptions = serverOptions ;
113- this . clientOptions = clientOptions ;
114108
115109 // Create the language client and start the client.
116- this . languageClient = this . createLanguageClient ( serverOptions , clientOptions ) ;
110+ this . languageClient = new TracingLanguageClient ( 'java' , extensionName , serverOptions , clientOptions , DEBUG ) ;
111+ this . languageClient . registerFeature ( new DisableWillRenameFeature ( ) ) ;
117112
118113 this . registerCommandsForStandardServer ( context , jdtEventEmitter ) ;
119- fileEventHandler . registerFileEventHandlers ( ( ) => this . languageClient , context ) ;
114+ fileEventHandler . registerFileEventHandlers ( this . languageClient , context ) ;
120115
121116 collectBuildFilePattern ( extensions . all ) ;
122117
123118 this . status = ClientStatus . initialized ;
124119 }
125120
126- private createLanguageClient ( serverOptions : ServerOptions , clientOptions : LanguageClientOptions ) : LanguageClient {
127- const languageClient = new TracingLanguageClient ( 'java' , extensionName , serverOptions , clientOptions , DEBUG ) ;
128- languageClient . registerFeature ( new DisableWillRenameFeature ( ) ) ;
129- return languageClient ;
130- }
131-
132121 public registerLanguageClientActions ( context : ExtensionContext , hasImported : boolean , jdtEventEmitter : EventEmitter < Uri > ) {
133122 activationProgressNotification . showProgress ( ) ;
134123 this . languageClient . onNotification ( StatusNotification . type , async ( report ) => {
@@ -788,16 +777,7 @@ export class StandardLanguageClient {
788777 public start ( ) : Promise < void > {
789778 if ( this . languageClient && this . status === ClientStatus . initialized ) {
790779 this . status = ClientStatus . starting ;
791- return startWithStdioFallback ( {
792- languageClient : this . languageClient ,
793- serverOptions : this . serverOptions ,
794- createLanguageClient : ( serverOptions ) => this . createLanguageClient ( serverOptions , this . clientOptions ) ,
795- pipeStartTimeout : PIPE_START_TIMEOUT_MS ,
796- onFallback : ( error ) => logger . warn ( `Falling back to 'stdio' (from 'pipe') because starting the pipe transport failed: ${ error } ` ) ,
797- } ) . then ( result => {
798- this . languageClient = result . client ;
799- this . serverOptions = result . serverOptions ;
800- } ) ;
780+ return this . languageClient . start ( ) ;
801781 }
802782 }
803783
0 commit comments