-
Notifications
You must be signed in to change notification settings - Fork 2
/
extension.ts
41 lines (34 loc) · 1.14 KB
/
extension.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import * as vscode from 'vscode';
import * as commands from './commands';
import { COMMANDS } from './constants';
import ExtensionManager from './manager';
import * as services from './services';
import * as utils from './utils';
let manager: ExtensionManager;
// Extension is activated.
export function activate(context: vscode.ExtensionContext) {
// Creates an extension manager instance.
manager = new ExtensionManager(context);
// Initializes and starts the language client/server.
manager.start();
// Registers commands for the extension.
manager
// Restarts the language server.
.registerCommand(COMMANDS.restart, commands.restartServer)
// Stops the language server.
.registerCommand(COMMANDS.stop, commands.stopServer)
// Creates a new project.
.registerCommand(COMMANDS.createProject, commands.createProject);
// Initialize project (if necessary).
if (utils.isUninitializedProject()) {
manager.onStart(services.initializeProject);
}
}
// Extension is deactivated.
export function deactivate() {
if (!manager) {
return undefined;
}
// Stops the language client/server.
return manager.stop();
}