-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.js
59 lines (49 loc) · 1.67 KB
/
extension.js
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const vscode = require('vscode');
/**
* @param {vscode.ExtensionContext} context
*/
function activate(context) {
let disposable = vscode.commands.registerCommand('vel-extension.helloWorld', function () {
let treeDataProvider = new InputFilesTreeDataProvider();
let treeView = vscode.window.createTreeView('inputFilesView', { treeDataProvider: treeDataProvider });
context.subscriptions.push(disposable, treeView);
});
class InputFilesTreeDataProvider {
getTreeItem(element) {
return {
label: element.label,
collapsibleState: element.collapsibleState,
command: element.command
};
}
getChildren(element) {
if (!element) {
// Return the root level items
return [
{ label: 'input1.txt', collapsibleState: vscode.TreeItemCollapsibleState.None, command: { command: 'extension.openInputFile', title: 'Open File', arguments: ['input1.txt'] } },
{ label: 'input2.txt', collapsibleState: vscode.TreeItemCollapsibleState.None, command: { command: 'extension.openInputFile', title: 'Open File', arguments: ['input2.txt'] } }
];
}
return [];
}
}
} // End of activate function
function openInputFile(filePath) {
vscode.workspace.openTextDocument(filePath).then(doc => {
vscode.window.showTextDocument(doc, { preview: false });
});
}
let panel = vscode.window.createWebviewPanel(
'webviewPanel',
'Webview Panel',
vscode.ViewColumn.One,
{}
);
// Set the HTML content of the webview panel
panel.webview.html = '<html><body> <h1>Hello Worlddddddd!</h1> </body></html>';
// This method is called when your extension is deactivated
function deactivate() {}
module.exports = {
activate,
deactivate
}