Skip to content

Commit 38bbf98

Browse files
committed
Add start and stop lsp server
1 parent 52c8d9e commit 38bbf98

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,16 @@
323323
"command": "haskell.commands.restartServer",
324324
"title": "Haskell: Restart Haskell LSP server",
325325
"description": "Restart the Haskell LSP server"
326+
},
327+
{
328+
"command": "haskell.commands.startServer",
329+
"title": "Haskell: Start Haskell LSP server",
330+
"description": "Start the Haskell LSP server"
331+
},
332+
{
333+
"command": "haskell.commands.stopServer",
334+
"title": "Haskell: Stop Haskell LSP server",
335+
"description": "Stop the Haskell LSP server"
326336
}
327337
]
328338
},

src/commands/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export namespace CommandNames {
22
export const ImportIdentifierCommandName = 'haskell.commands.importIdentifier';
33
export const RestartServerCommandName = 'haskell.commands.restartServer';
4+
export const StartServerCommandName = 'haskell.commands.startServer';
5+
export const StopServerCommandName = 'haskell.commands.stopServer';
46
}

src/extension.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,26 @@ export async function activate(context: ExtensionContext) {
6868

6969
context.subscriptions.push(restartCmd);
7070

71+
const stopCmd = commands.registerCommand(CommandNames.StopServerCommandName, async () => {
72+
for (const langClient of clients.values()) {
73+
langClient?.info('Stopping the client');
74+
await langClient?.stop();
75+
langClient?.info('Client stopped');
76+
}
77+
});
78+
79+
context.subscriptions.push(stopCmd);
80+
81+
const startCmd = commands.registerCommand(CommandNames.StartServerCommandName, async () => {
82+
for (const langClient of clients.values()) {
83+
langClient?.info('Starting the client');
84+
langClient?.start();
85+
langClient?.info('Client started');
86+
}
87+
});
88+
89+
context.subscriptions.push(startCmd);
90+
7191
context.subscriptions.push(ImportIdentifier.registerCommand());
7292

7393
// Set up the documentation browser.

0 commit comments

Comments
 (0)