Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Developer: Add command to show the list of workspaceFolders (onivim#1320
)

* Add command for showing the list of workspaceFolders

* Tabs -> spaces
  • Loading branch information
bryphe committed Feb 11, 2020
1 parent 9ef211a commit c7aaf08
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
38 changes: 21 additions & 17 deletions development_extensions/oni-dev-extension/extension.js
Expand Up @@ -80,7 +80,7 @@ function activate(context) {
latestText = e.document.getText().split(os.EOL).join("|");
}

//vscode.window.showInformationMessage('Changed!');
//vscode.window.showInformationMessage('Changed!');
const document = e.document;
if (document && path.basename(document.uri.fsPath) == "test.oni-dev") {
collection.set(document.uri, [{
Expand All @@ -94,25 +94,29 @@ function activate(context) {
}
}));

// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
cleanup(vscode.commands.registerCommand('developer.oni.showNotification', () => {
// The code you place here will be executed every time your command is executed
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
cleanup(vscode.commands.registerCommand('developer.oni.showNotification', () => {
// The code you place here will be executed every time your command is executed

// Display a message box to the user
vscode.window.showInformationMessage('Hello from extension!');
}));
// Display a message box to the user
vscode.window.showInformationMessage('Hello from extension!');
}));

cleanup(vscode.commands.registerCommand('developer.oni.showWorkspaceRootPath', () => {
vscode.window.showInformationMessage("Workspace rootPath: " + vscode.workspace.rootPath);
}));

cleanup(vscode.commands.registerCommand('developer.oni.showWorkspaceRootPath', () => {
// Display a message box to the user
vscode.window.showInformationMessage("rootPath: " + vscode.workspace.rootPath);
}));
cleanup(vscode.commands.registerCommand('developer.oni.showWorkspaceFolders', () => {
vscode.window.showInformationMessage("Workspace folders: " +
JSON.stringify(vscode.workspace.workspaceFolders));
}));

// Helper command to show buffer text
// This helps us create a test case to validate buffer manipulations
cleanup(vscode.commands.registerCommand('developer.oni.getBufferText', () => {
vscode.window.showInformationMessage("fulltext:" + latestText);
cleanup(vscode.commands.registerCommand('developer.oni.getBufferText', () => {
vscode.window.showInformationMessage("fulltext:" + latestText);
}));

function createResourceUri(relativePath) {
Expand Down Expand Up @@ -158,6 +162,6 @@ function activate(context) {
function deactivate() {}

module.exports = {
activate,
deactivate
activate,
deactivate
}
6 changes: 5 additions & 1 deletion development_extensions/oni-dev-extension/package.json
Expand Up @@ -23,7 +23,11 @@
},
{
"command": "developer.oni.showWorkspaceRootPath",
"title": "Onivim - Developer: Show Root Path"
"title": "Onivim - Developer: Show Workspace Root Path"
},
{
"command": "developer.oni.showWorkspaceFolders",
"title": "Onivim - Developer: Show Workspace Folders"
}
],
"languages": [{
Expand Down

0 comments on commit c7aaf08

Please sign in to comment.