File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 3939 "url" : " https://github.com/phan/phan/issues"
4040 },
4141 "activationEvents" : [
42+ " onCommand:phan.restartLanguageServer" ,
4243 " onLanguage:php" ,
4344 " workspaceContains:**/*.php"
4445 ],
6768 "vscode-languageclient" : " ^6.1.4"
6869 },
6970 "contributes" : {
71+ "commands" : [
72+ {
73+ "command" : " phan.restartLanguageServer" ,
74+ "title" : " Restart Phan Language Server" ,
75+ "category" : " Phan"
76+ }
77+ ],
7078 "configuration" : {
7179 "type" : " object" ,
7280 "title" : " PHP - Phan Analyzer" ,
Original file line number Diff line number Diff line change @@ -430,11 +430,17 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
430430 return new LanguageClient ( 'Phan Language Server' , serverOptions , clientOptions ) ;
431431 } ;
432432
433+ const languageClients = analyzedProjectDirectories . map ( createClient ) ;
434+
435+ function restartLanguageClients ( ) {
436+ return Promise . all ( languageClients . map ( ( c : LanguageClient ) => c . stop ( ) . then ( ( ) => c . start ( ) ) ) ) ;
437+ }
438+ context . subscriptions . push ( vscode . commands . registerCommand ( 'phan.restartLanguageServer' , restartLanguageClients ) ) ;
439+
433440 console . log ( 'starting PHP Phan language server' ) ;
434- // Create the language client and start the client.
435- for ( const dirToAnalyze of analyzedProjectDirectories ) {
441+ for ( const client of languageClients ) {
436442 // Push the disposable to the context's subscriptions so that the
437443 // client can be deactivated on extension deactivation
438- context . subscriptions . push ( createClient ( dirToAnalyze ) . start ( ) ) ;
444+ context . subscriptions . push ( client . start ( ) ) ;
439445 }
440446}
You can’t perform that action at this time.
0 commit comments