1
1
'use strict' ;
2
2
import * as os from 'os' ;
3
3
import * as path from 'path' ;
4
- import { ExtensionContext , OutputChannel , TextDocument , Uri , window , workspace , WorkspaceFolder } from 'vscode' ;
4
+ import {
5
+ commands ,
6
+ ExtensionContext ,
7
+ OutputChannel ,
8
+ TextDocument ,
9
+ Uri ,
10
+ window ,
11
+ workspace ,
12
+ WorkspaceFolder ,
13
+ } from 'vscode' ;
5
14
import {
6
15
ExecutableOptions ,
7
16
LanguageClient ,
@@ -10,8 +19,8 @@ import {
10
19
ServerOptions ,
11
20
TransportKind ,
12
21
} from 'vscode-languageclient' ;
22
+ import { CommandNames } from './commands/constants' ;
13
23
import { ImportIdentifier } from './commands/importIdentifier' ;
14
- import { RestartHie } from './commands/restartHie' ;
15
24
import { DocsBrowser } from './docsBrowser' ;
16
25
import { downloadServer } from './hlsBinaries' ;
17
26
import { executableExists } from './utils' ;
@@ -38,7 +47,14 @@ export async function activate(context: ExtensionContext) {
38
47
} ) ;
39
48
40
49
// Register editor commands for HIE, but only register the commands once at activation.
41
- context . subscriptions . push ( RestartHie . registerCommand ( clients ) ) ;
50
+ const restartCmd = commands . registerCommand ( CommandNames . RestartHieCommandName , async ( ) => {
51
+ for ( const langClient of clients . values ( ) ) {
52
+ await langClient . stop ( ) ;
53
+ langClient . start ( ) ;
54
+ }
55
+ } ) ;
56
+ context . subscriptions . push ( restartCmd ) ;
57
+
42
58
context . subscriptions . push ( ImportIdentifier . registerCommand ( ) ) ;
43
59
44
60
// Set up the documentation browser.
@@ -220,6 +236,8 @@ async function activateHieNoCheck(context: ExtensionContext, uri: Uri, folder?:
220
236
langClient . start ( ) ;
221
237
if ( folder ) {
222
238
clients . set ( folder . uri . toString ( ) , langClient ) ;
239
+ } else {
240
+ clients . set ( uri . toString ( ) , langClient ) ;
223
241
}
224
242
}
225
243
0 commit comments