mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Add some comments
This commit is contained in:
parent
62b1b05a0d
commit
bbf38b9e72
4 changed files with 44 additions and 25 deletions
|
@ -1,8 +1,10 @@
|
|||
import * as vscode from 'vscode';
|
||||
import * as lc from 'vscode-languageclient';
|
||||
|
||||
import * as commands from './commands';
|
||||
import { TextDocumentContentProvider } from './commands/syntaxTree';
|
||||
import * as events from './events';
|
||||
import * as notifications from './notifications';
|
||||
import { Server } from './server';
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
|
@ -14,6 +16,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
disposeOnDeactivation(vscode.commands.registerCommand(name, f));
|
||||
}
|
||||
|
||||
// Commands are requests from vscode to the language server
|
||||
registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle);
|
||||
registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle);
|
||||
registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle);
|
||||
|
@ -22,19 +25,27 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
registerCommand('ra-lsp.run', commands.runnables.handle);
|
||||
registerCommand('ra-lsp.applySourceChange', commands.applySourceChange.handle);
|
||||
|
||||
// Notifications are events triggered by the language server
|
||||
const allNotifications: Iterable<[string, lc.GenericNotificationHandler]> = [
|
||||
['m/publishDecorations', notifications.publishDecorations.handle],
|
||||
];
|
||||
|
||||
// The events below are plain old javascript events, triggered and handled by vscode
|
||||
vscode.window.onDidChangeActiveTextEditor(events.changeActiveTextEditor.handle);
|
||||
|
||||
const textDocumentContentProvider = new TextDocumentContentProvider();
|
||||
disposeOnDeactivation(vscode.workspace.registerTextDocumentContentProvider(
|
||||
'ra-lsp',
|
||||
textDocumentContentProvider,
|
||||
));
|
||||
|
||||
Server.start();
|
||||
|
||||
vscode.workspace.onDidChangeTextDocument(
|
||||
events.changeTextDocument.createHandler(textDocumentContentProvider),
|
||||
null,
|
||||
context.subscriptions);
|
||||
vscode.window.onDidChangeActiveTextEditor(events.changeActiveTextEditor.handle);
|
||||
|
||||
// Start the language server, finally!
|
||||
Server.start(allNotifications);
|
||||
}
|
||||
|
||||
export function deactivate(): Thenable<void> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue