-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathextension-node.ts
More file actions
44 lines (39 loc) · 2.13 KB
/
extension-node.ts
File metadata and controls
44 lines (39 loc) · 2.13 KB
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
42
43
44
/*---------------------------------------------------------------------------------------------
* Copyright (c) Rowe Wilson Frederisk Holme. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { getPageViewFactory, getPreviewFactory } from './export_command/wikimedia_function/view';
import { loginFactory, logoutFactory } from './export_command/wikimedia_function/bot';
import { closeEditorFactory, postPageFactory, pullPageFactory } from './export_command/wikimedia_function/page';
import { baseUriProcess } from './export_command/uri_function/uri';
import { addWebCiteFactory } from './export_command/cite_function/web';
import { WikitextCommandRegistrar } from './export_command/commandRegistrar';
import { client, restartLspFactory } from './export_command/vscode_function/wikiparser';
import './mwbot-patch';
export async function activate(context: vscode.ExtensionContext): Promise<void> {
console.log("Wikitext Extension is active.");
// extensionContext = context;
// URI
context.subscriptions.push(vscode.window.registerUriHandler({ handleUri: baseUriProcess }));
const commandRegistrar = new WikitextCommandRegistrar(context, false);
// Bot
commandRegistrar.register('login', loginFactory);
commandRegistrar.register('logout', logoutFactory);
// Core
commandRegistrar.register('readPage', pullPageFactory);
commandRegistrar.register('writePage', postPageFactory);
commandRegistrar.register('closeEditor', closeEditorFactory);
// View
commandRegistrar.register('getPreview', getPreviewFactory);
commandRegistrar.register('viewPage', getPageViewFactory);
// Cite
commandRegistrar.register('citeWeb', addWebCiteFactory);
// Lsp
commandRegistrar.register('restartLsp', restartLspFactory);
await vscode.commands.executeCommand('wikitext.restartLsp');
}
export async function deactivate(): Promise<void> {
await client?.stop();
console.log("Wikitext Extension is deactivate.");
}