aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/extension.ts
diff options
context:
space:
mode:
authorAdolfo OchagavĂ­a <[email protected]>2018-10-08 19:55:22 +0100
committerAdolfo OchagavĂ­a <[email protected]>2018-10-08 19:55:22 +0100
commitbbf38b9e722e8d6455828ff22242c92219da346d (patch)
tree1b47f5e93e45a22cc20abd1c965dc496ef20bda9 /editors/code/src/extension.ts
parent62b1b05a0d9dd021f98352b6229e48e0d8b94f78 (diff)
Add some comments
Diffstat (limited to 'editors/code/src/extension.ts')
-rw-r--r--editors/code/src/extension.ts17
1 files changed, 14 insertions, 3 deletions
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index f1bc0b457..44e74f4cc 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -1,8 +1,10 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2import * as lc from 'vscode-languageclient';
2 3
3import * as commands from './commands'; 4import * as commands from './commands';
4import { TextDocumentContentProvider } from './commands/syntaxTree'; 5import { TextDocumentContentProvider } from './commands/syntaxTree';
5import * as events from './events'; 6import * as events from './events';
7import * as notifications from './notifications';
6import { Server } from './server'; 8import { Server } from './server';
7 9
8export function activate(context: vscode.ExtensionContext) { 10export function activate(context: vscode.ExtensionContext) {
@@ -14,6 +16,7 @@ export function activate(context: vscode.ExtensionContext) {
14 disposeOnDeactivation(vscode.commands.registerCommand(name, f)); 16 disposeOnDeactivation(vscode.commands.registerCommand(name, f));
15 } 17 }
16 18
19 // Commands are requests from vscode to the language server
17 registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle); 20 registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle);
18 registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle); 21 registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle);
19 registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle); 22 registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle);
@@ -22,19 +25,27 @@ export function activate(context: vscode.ExtensionContext) {
22 registerCommand('ra-lsp.run', commands.runnables.handle); 25 registerCommand('ra-lsp.run', commands.runnables.handle);
23 registerCommand('ra-lsp.applySourceChange', commands.applySourceChange.handle); 26 registerCommand('ra-lsp.applySourceChange', commands.applySourceChange.handle);
24 27
28 // Notifications are events triggered by the language server
29 const allNotifications: Iterable<[string, lc.GenericNotificationHandler]> = [
30 ['m/publishDecorations', notifications.publishDecorations.handle],
31 ];
32
33 // The events below are plain old javascript events, triggered and handled by vscode
34 vscode.window.onDidChangeActiveTextEditor(events.changeActiveTextEditor.handle);
35
25 const textDocumentContentProvider = new TextDocumentContentProvider(); 36 const textDocumentContentProvider = new TextDocumentContentProvider();
26 disposeOnDeactivation(vscode.workspace.registerTextDocumentContentProvider( 37 disposeOnDeactivation(vscode.workspace.registerTextDocumentContentProvider(
27 'ra-lsp', 38 'ra-lsp',
28 textDocumentContentProvider, 39 textDocumentContentProvider,
29 )); 40 ));
30 41
31 Server.start();
32
33 vscode.workspace.onDidChangeTextDocument( 42 vscode.workspace.onDidChangeTextDocument(
34 events.changeTextDocument.createHandler(textDocumentContentProvider), 43 events.changeTextDocument.createHandler(textDocumentContentProvider),
35 null, 44 null,
36 context.subscriptions); 45 context.subscriptions);
37 vscode.window.onDidChangeActiveTextEditor(events.changeActiveTextEditor.handle); 46
47 // Start the language server, finally!
48 Server.start(allNotifications);
38} 49}
39 50
40export function deactivate(): Thenable<void> { 51export function deactivate(): Thenable<void> {