Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
"vscode-languageclient": "^6.1.4"
},
"contributes": {
"commands": [
{
"command": "phan.restartLanguageServer",
"title": "Restart Phan Language Server",
"category": "Phan"
}
],
"configuration": {
"type": "object",
"title": "PHP - Phan Analyzer",
Expand Down
12 changes: 9 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,17 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
return new LanguageClient('Phan Language Server', serverOptions, clientOptions);
};

const languageClients = analyzedProjectDirectories.map(createClient);

function restartLanguageClients() {
return Promise.all(languageClients.map((c: LanguageClient) => c.stop().then(() => c.start())));
}
context.subscriptions.push(vscode.commands.registerCommand('phan.restartLanguageServer', restartLanguageClients));

console.log('starting PHP Phan language server');
// Create the language client and start the client.
for (const dirToAnalyze of analyzedProjectDirectories) {
for (const client of languageClients) {
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
context.subscriptions.push(createClient(dirToAnalyze).start());
context.subscriptions.push(client.start());
}
}