mirror of
https://github.com/WhatsApp/erlang-language-platform.git
synced 2025-12-23 12:26:48 +00:00
Add support for elp.restartServer command (#90)
Summary: Adds the ability to restart the ELP server from the VS Code command palette. Closes #90. Reviewed By: alanz Differential Revision: D72441620 fbshipit-source-id: 7346149f6756520c0fa9cc4fccb0488009eccae7
This commit is contained in:
parent
fb987b48e3
commit
01f12130ad
3 changed files with 17 additions and 7 deletions
|
|
@ -10,6 +10,7 @@
|
|||
import * as vscode from 'vscode';
|
||||
import * as dapConfig from './dapConfig';
|
||||
import * as edbDebugger from './debugger';
|
||||
import { LanguageClient } from 'vscode-languageclient/node';
|
||||
|
||||
export type Runnable = {
|
||||
label: string;
|
||||
|
|
@ -30,8 +31,7 @@ export type CommonRunnableArgs = {
|
|||
workspaceRoot: string;
|
||||
};
|
||||
|
||||
export function registerCommands(context: vscode.ExtensionContext) {
|
||||
// elp.runSingle
|
||||
export function registerCommands(context: vscode.ExtensionContext, client: LanguageClient) {
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand(
|
||||
'elp.runSingle',
|
||||
|
|
@ -39,15 +39,18 @@ export function registerCommands(context: vscode.ExtensionContext) {
|
|||
await runSingle(runnable);
|
||||
},
|
||||
),
|
||||
);
|
||||
// elp.debugSingle
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand(
|
||||
'elp.debugSingle',
|
||||
async (runnable: Runnable) => {
|
||||
await debugSingle(runnable);
|
||||
},
|
||||
),
|
||||
vscode.commands.registerCommand(
|
||||
'elp.restartServer',
|
||||
async () => {
|
||||
await client.restart();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,6 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
}
|
||||
};
|
||||
|
||||
registerCommands(context);
|
||||
|
||||
// Create the language client and start the client.
|
||||
client = new LanguageClient(
|
||||
'elp',
|
||||
|
|
@ -76,6 +74,8 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
clientOptions
|
||||
);
|
||||
|
||||
registerCommands(context, client);
|
||||
|
||||
log.append('Activating debugger');
|
||||
// Activate the DAP Debugger
|
||||
activateDebugger(context);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,13 @@
|
|||
"path": "./third-party/grammar/Erlang.plist"
|
||||
}
|
||||
],
|
||||
"commands": [
|
||||
{
|
||||
"command": "elp.restartServer",
|
||||
"title": "Restart server",
|
||||
"category": "Erlang"
|
||||
}
|
||||
],
|
||||
"debuggers": [
|
||||
{
|
||||
"type": "erlang-edb",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue