File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-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,20 @@ 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+ async function restartLanguageClients ( ) : Promise < void > {
436+ for ( const client of languageClients ) {
437+ await client . stop ( ) ;
438+ context . subscriptions . push ( client . start ( ) ) ;
439+ }
440+ }
441+ context . subscriptions . push ( vscode . commands . registerCommand ( 'phan.restartLanguageServer' , restartLanguageClients ) ) ;
442+
433443 console . log ( 'starting PHP Phan language server' ) ;
434- // Create the language client and start the client.
435- for ( const dirToAnalyze of analyzedProjectDirectories ) {
444+ for ( const client of languageClients ) {
436445 // Push the disposable to the context's subscriptions so that the
437446 // client can be deactivated on extension deactivation
438- context . subscriptions . push ( createClient ( dirToAnalyze ) . start ( ) ) ;
447+ context . subscriptions . push ( client . start ( ) ) ;
439448 }
440449}
You can’t perform that action at this time.
0 commit comments