File tree Expand file tree Collapse file tree 4 files changed +47
-3
lines changed
Expand file tree Collapse file tree 4 files changed +47
-3
lines changed Original file line number Diff line number Diff line change 22 "name" : " simplicityhl" ,
33 "displayName" : " SimplicityHL Language Support" ,
44 "description" : " Syntax highlighting and autocompletion for SimplicityHL (Simfony) language" ,
5- "version" : " 0.2.0 " ,
5+ "version" : " 0.2.1 " ,
66 "publisher" : " Blockstream" ,
77 "repository" : {
88 "type" : " git" ,
6969 "description" : " Do not show missing LSP executable warning."
7070 }
7171 }
72- }
72+ },
73+ "commands" : [
74+ {
75+ "command" : " simplicityhl.restartServer" ,
76+ "title" : " Restart server" ,
77+ "category" : " SimplicityHL"
78+ }
79+ ]
7380 },
7481 "license" : " MIT" ,
7582 "scripts" : {
Original file line number Diff line number Diff line change @@ -59,4 +59,19 @@ export class LspClient {
5959 }
6060 return this . client . stop ( ) ;
6161 }
62+
63+ public async restart ( ) : Promise < void > {
64+ if ( ! this . client ) {
65+ window . showWarningMessage ( "LSP client not initialized. Cannot restart." ) ;
66+ return ;
67+ }
68+
69+ try {
70+ await this . client . stop ( ) ;
71+ await this . client . start ( ) ;
72+ window . showInformationMessage ( "SimplicityHL Language Server restarted successfully!" ) ;
73+ } catch ( e ) {
74+ window . showErrorMessage ( `Failed to restart LSP: ${ e } ` ) ;
75+ }
76+ }
6277}
Original file line number Diff line number Diff line change 1+ import { ExtensionContext , commands } from "vscode" ;
2+ import { LspClient } from "./client" ;
3+
4+ export function registerRestartCommand (
5+ context : ExtensionContext ,
6+ lspClient : LspClient
7+ ) {
8+ const command = commands . registerCommand (
9+ "simplicityhl.restartServer" ,
10+ async ( ) => {
11+ await lspClient . restart ( ) ;
12+ }
13+ ) ;
14+
15+ context . subscriptions . push ( command ) ;
16+ }
Original file line number Diff line number Diff line change 11import { LspClient } from "./client" ;
2+ import { registerRestartCommand } from "./commands"
3+ import { ExtensionContext } from "vscode"
4+
25let client : LspClient ;
3- export function activate ( ) {
6+
7+ export function activate ( context : ExtensionContext ) {
48 client = new LspClient ( ) ;
59 void client . start ( ) ;
10+
11+ registerRestartCommand ( context , client ) ;
612}
713export function deactivate ( ) : Thenable < void > | undefined {
814 if ( ! client ) {
You can’t perform that action at this time.
0 commit comments