@@ -4,7 +4,7 @@ import * as path from 'path';
44import * as os from 'os' ;
55import * as fs from 'fs' ;
66import * as fse from 'fs-extra' ;
7- import { workspace , extensions , ExtensionContext , window , commands , ViewColumn , Uri , languages , IndentAction , InputBoxOptions , EventEmitter , OutputChannel , TextDocument , RelativePattern , ConfigurationTarget , WorkspaceConfiguration , env , UIKind , CodeActionContext , Diagnostic } from 'vscode' ;
7+ import { workspace , extensions , ExtensionContext , window , commands , ViewColumn , Uri , languages , IndentAction , InputBoxOptions , EventEmitter , OutputChannel , TextDocument , RelativePattern , ConfigurationTarget , WorkspaceConfiguration , env , UIKind , CodeActionContext , Diagnostic , CodeActionTriggerKind } from 'vscode' ;
88import { ExecuteCommandParams , ExecuteCommandRequest , LanguageClientOptions , RevealOutputChannelOn , ErrorHandler , Message , ErrorAction , CloseAction , DidChangeConfigurationNotification , CancellationToken , CodeActionRequest , CodeActionParams , Command } from 'vscode-languageclient' ;
99import { LanguageClient } from 'vscode-languageclient/node' ;
1010import { collectJavaExtensions , isContributedPartUpdated } from './plugin' ;
@@ -134,6 +134,12 @@ export class OutputInfoCollector implements OutputChannel {
134134 this . channel . appendLine ( value ) ;
135135 }
136136
137+ replace ( value : string ) : void {
138+ logger . info ( value ) ;
139+ this . clear ( ) ;
140+ this . channel . append ( value ) ;
141+ }
142+
137143 clear ( ) : void {
138144 this . channel . clear ( ) ;
139145 }
@@ -245,8 +251,8 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
245251 } ,
246252 middleware : {
247253 workspace : {
248- didChangeConfiguration : ( ) => {
249- standardClient . getClient ( ) . sendNotification ( DidChangeConfigurationNotification . type , {
254+ didChangeConfiguration : async ( ) => {
255+ await standardClient . getClient ( ) . sendNotification ( DidChangeConfigurationNotification . type , {
250256 settings : {
251257 java : getJavaConfig ( requirements . java_home ) ,
252258 }
@@ -256,7 +262,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
256262 // https://github.com/redhat-developer/vscode-java/issues/2130
257263 // include all diagnostics for the current line in the CodeActionContext params for the performance reason
258264 provideCodeActions : ( document , range , context , token , next ) => {
259- const client : any = standardClient . getClient ( ) ;
265+ const client : LanguageClient = standardClient . getClient ( ) ;
260266 const params : CodeActionParams = {
261267 textDocument : client . code2ProtocolConverter . asTextDocumentIdentifier ( document ) ,
262268 range : client . code2ProtocolConverter . asRange ( range ) ,
@@ -278,6 +284,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
278284 }
279285 const codeActionContext : CodeActionContext = {
280286 diagnostics : allDiagnostics ,
287+ triggerKind : CodeActionTriggerKind ?. Automatic ,
281288 only : context . only ,
282289 } ;
283290 params . context = client . code2ProtocolConverter . asCodeActionContext ( codeActionContext ) ;
@@ -298,7 +305,6 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
298305 }
299306 return result ;
300307 } , ( error ) => {
301- client . logFailedRequest ( CodeActionRequest . type , error ) ;
302308 return Promise . resolve ( [ ] ) ;
303309 } ) ;
304310 }
0 commit comments