This repository has been archived by the owner on Mar 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathextension.js
68 lines (54 loc) · 2.75 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
60
61
62
63
64
65
66
67
68
const vscode = require('vscode');
const {newNote, newNoteInWorkspace} = require('./src/newNote');
const listNotes = require('./src/listNotes');
const listTags = require('./src/listTags')
const setupNotes = require('./src/setupNotes');
const VSNotesTreeView = require('./src/treeView');
const commitPush = require('./src/commitPush');
const pull = require('./src/pull');
const search = require('./src/search');
const utils = require('./src/utils');
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
function activate(context) {
const tv = new VSNotesTreeView()
vscode.window.registerTreeDataProvider('vsnotes', tv);
// Refresh View
vscode.commands.registerCommand('vsnotes.refreshVSNotesView', () => tv.refresh());
// Create a new note
let newNoteDisposable = vscode.commands.registerCommand('vsnotes.newNote', newNote);
context.subscriptions.push(newNoteDisposable);
// Create a new note in a current workspace
let newNoteInWorkspaceDisposable = vscode.commands.registerCommand('vsnotes.newNoteInWorkspace', newNoteInWorkspace);
context.subscriptions.push(newNoteInWorkspaceDisposable);
// Open a note
let listNotesDisposable = vscode.commands.registerCommand('vsnotes.listNotes', listNotes);
context.subscriptions.push(listNotesDisposable);
// List tags
let listTagsDisposable = vscode.commands.registerCommand('vsnotes.listTags', listTags);
context.subscriptions.push(listTagsDisposable);
// Run setup
let setupDisposable = vscode.commands.registerCommand('vsnotes.setupNotes', setupNotes);
context.subscriptions.push(setupDisposable);
// Commit and Push
let commitPushDisposable = vscode.commands.registerCommand('vsnotes.commitPush', commitPush);
context.subscriptions.push(commitPushDisposable);
let pullDisposable = vscode.commands.registerCommand('vsnotes.pull', pull);
context.subscriptions.push(pullDisposable);
// Search
let searchDisposable = vscode.commands.registerCommand('vsnotes.search', search, {context: context});
context.subscriptions.push(searchDisposable);
// Open note folder in new workspace
let openNoteFolderDisposable = vscode.commands.registerCommand('vsnotes.openNoteFolder', () => {
const noteFolder = vscode.workspace.getConfiguration('vsnotes').get('defaultNotePath');
const folderPath = utils.resolveHome(noteFolder);
const uri = vscode.Uri.file(folderPath)
return vscode.commands.executeCommand('vscode.openFolder', uri, true);
})
context.subscriptions.push(openNoteFolderDisposable);
}
exports.activate = activate;
// this method is called when your extension is deactivated
function deactivate() {
}
exports.deactivate = deactivate;