@@ -6,7 +6,7 @@ import * as fse from 'fs-extra';
66import  *  as  os  from  'os' ; 
77import  *  as  path  from  'path' ; 
88import  {  CodeActionContext ,  CodeActionTriggerKind ,  commands ,  ConfigurationTarget ,  Diagnostic ,  env ,  EventEmitter ,  ExtensionContext ,  extensions ,  IndentAction ,  InputBoxOptions ,  languages ,  RelativePattern ,  TextDocument ,  UIKind ,  Uri ,  ViewColumn ,  window ,  workspace ,  WorkspaceConfiguration  }  from  'vscode' ; 
9- import  {  CancellationToken ,  CodeActionParams ,  CodeActionRequest ,  Command ,  DidChangeConfigurationNotification ,  ExecuteCommandParams ,  ExecuteCommandRequest ,  LanguageClientOptions ,  RevealOutputChannelOn  }  from  'vscode-languageclient' ; 
9+ import  {  CancellationToken ,  CodeActionParams ,  CodeActionRequest ,  Command ,  DidChangeConfigurationNotification ,  ExecuteCommandParams ,  ExecuteCommandRequest ,  LanguageClientOptions ,  RevealOutputChannelOn ,   State  }  from  'vscode-languageclient' ; 
1010import  {  LanguageClient  }  from  'vscode-languageclient/node' ; 
1111import  {  apiManager  }  from  './apiManager' ; 
1212import  {  ClientErrorHandler  }  from  './clientErrorHandler' ; 
@@ -184,12 +184,12 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
184184					} , 
185185					// https://github.com/redhat-developer/vscode-java/issues/2130 
186186					// include all diagnostics for the current line in the CodeActionContext params for the performance reason 
187- 					provideCodeActions : ( document ,  range ,  context ,  token ,  next )  =>  { 
187+ 					provideCodeActions : async   ( document ,  range ,  context ,  token ,  next )  =>  { 
188188						const  client : LanguageClient  =  standardClient . getClient ( ) ; 
189189						const  params : CodeActionParams  =  { 
190190							textDocument : client . code2ProtocolConverter . asTextDocumentIdentifier ( document ) , 
191191							range : client . code2ProtocolConverter . asRange ( range ) , 
192- 							context : client . code2ProtocolConverter . asCodeActionContext ( context ) 
192+ 							context : await   client . code2ProtocolConverter . asCodeActionContext ( context ) 
193193						} ; 
194194						const  showAt   =  getJavaConfiguration ( ) . get < string > ( "quickfix.showAt" ) ; 
195195						if  ( showAt  ===  'line'  &&  range . start . line  ===  range . end . line  &&  range . start . character  ===  range . end . character )  { 
@@ -210,7 +210,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
210210									only : context . only , 
211211									triggerKind : context . triggerKind , 
212212								} ; 
213- 								params . context  =  client . code2ProtocolConverter . asCodeActionContext ( codeActionContext ) ; 
213+ 								params . context  =  await   client . code2ProtocolConverter . asCodeActionContext ( codeActionContext ) ; 
214214							} 
215215						} 
216216						return  client . sendRequest ( CodeActionRequest . type ,  params ,  token ) . then ( ( values )  =>  { 
@@ -248,13 +248,15 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
248248			// no need to pass `resolve` into any code past this point, 
249249			// since `resolve` is a no-op from now on 
250250
251+ 			const  serverOptions  =  prepareExecutable ( requirements ,  syntaxServerWorkspacePath ,  getJavaConfig ( requirements . java_home ) ,  context ,  true ) ; 
251252			if  ( requireSyntaxServer )  { 
252253				if  ( process . env [ 'SYNTAXLS_CLIENT_PORT' ] )  { 
253254					syntaxClient . initialize ( requirements ,  clientOptions ) ; 
254255				}  else  { 
255- 					syntaxClient . initialize ( requirements ,  clientOptions ,  prepareExecutable ( requirements ,   syntaxServerWorkspacePath ,   getJavaConfig ( requirements . java_home ) ,   context ,   true ) ) ; 
256+ 					syntaxClient . initialize ( requirements ,  clientOptions ,  serverOptions ) ; 
256257				} 
257- 				syntaxClient . start ( ) ; 
258+ 				await  syntaxClient . start ( ) ; 
259+ 				syntaxClient . registerSyntaxClientActions ( resolve ,  serverOptions ) ; 
258260				serverStatusBarProvider . showLightWeightStatus ( ) ; 
259261			} 
260262
@@ -429,7 +431,8 @@ async function startStandardServer(context: ExtensionContext, requirements: requ
429431		apiManager . fireDidServerModeChange ( ServerMode . hybrid ) ; 
430432	} 
431433	await  standardClient . initialize ( context ,  requirements ,  clientOptions ,  workspacePath ,  jdtEventEmitter ) ; 
432- 	standardClient . start ( ) ; 
434+ 	await  standardClient . start ( ) ; 
435+ 	standardClient . registerLanguageClientActions ( context ,  await  fse . pathExists ( path . join ( workspacePath ,  ".metadata" ,  ".plugins" ) ) ,  jdtEventEmitter ) ; 
433436	serverStatusBarProvider . showStandardStatus ( ) ; 
434437} 
435438
@@ -527,12 +530,10 @@ export async function getActiveLanguageClient(): Promise<LanguageClient | undefi
527530		languageClient  =  syntaxClient . getClient ( ) ; 
528531	} 
529532
530- 	if  ( ! languageClient )  { 
533+ 	if  ( ! languageClient   ||   languageClient . state   !==   State . Running )  { 
531534		return  undefined ; 
532535	} 
533536
534- 	await  languageClient . onReady ( ) ; 
535- 
536537	return  languageClient ; 
537538} 
538539
0 commit comments