-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy paththeia.ts
23 lines (19 loc) · 815 Bytes
/
theia.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import * as vscode from 'vscode';
const THEIA_CUSTOM_COMMAND = 'execution.messageCommand';
const getMessage = (actor: string = 'the extension') => `hello from ${actor}`;
export const activateTheia = async (appName: string) => {
if (vscode.env.appName === appName) {
// Implement Theia API
const api = await import('@extension/api');
api.host.getMessageHandler(() => getMessage());
api.host.onRequestMessage((actor: string) => {
const message = getMessage(actor);
api.host.showMessage(message);
});
// Execute Theia custom command
const commands = await vscode.commands.getCommands();
if (commands.indexOf(THEIA_CUSTOM_COMMAND) > -1) {
vscode.commands.executeCommand(THEIA_CUSTOM_COMMAND);
}
}
}