Skip to content

Commit

Permalink
completed source control view file open
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnstonCode committed Oct 11, 2017
1 parent d34b58e commit fc01a78
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
**v0.4.0**
=============================================

## What's New
- Files/Folders can be clicked open from source control view

**v0.3.1**
=============================================

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "svn-scm",
"displayName": "svn-scm",
"description": "",
"version": "0.3.1",
"version": "0.4.0",
"publisher": "johnstoncode",
"engines": {
"vscode": "^1.16.0"
Expand Down
20 changes: 16 additions & 4 deletions src/extension.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {vscode, commands} = require('vscode');
const vscode = require('vscode');
const path = require('path');
const Svn = require('./svn');
const svnSCM = require('./svnSCM');
Expand Down Expand Up @@ -42,6 +42,11 @@ const updateChangesResourceGroup = (data) => {
iconPath: vscode.Uri.file(path.join(iconsRootPath, `${item['wc-status'].$.item}.svg`)),
tooltip: item['wc-status'].$.item,
},
command: {
command: 'svn.fileOpen',
title: 'Open',
arguments: [createResourceUri(item.$.path)]
}
});
}
});
Expand All @@ -61,16 +66,21 @@ const updateNotTrackedResourceGroup = (data) => {
iconPath: vscode.Uri.file(path.join(iconsRootPath, `unversioned.svg`)),
tooltip: item['wc-status'].$.item,
},
command: {
command: 'svn.fileOpen',
title: 'Open',
arguments: [createResourceUri(item.$.path)]
}
});
}
});

return matches;
}

const registerFileOpenCommand = (resourceUri) => {
commands.registerCommand('svn.fileOpen', () => {
commands.executeCommand('vscode.open', resourceUri);
const registerFileOpenCommand = () => {
vscode.commands.registerCommand('svn.fileOpen', (resourceUri) => {
vscode.commands.executeCommand('vscode.open', resourceUri);
});
}

Expand All @@ -82,6 +92,8 @@ function activate(context) {

const watcher = vscode.workspace.createFileSystemWatcher(`${rootPath}/**/*`);

registerFileOpenCommand();

const sourceControl = new svnSCM();
const contentProvider = new svnContentProvider();
const svn = new Svn();
Expand Down
2 changes: 1 addition & 1 deletion src/svnContentProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ svnContentProvider.prototype.provideTextDocumentContent = function(uri) {
resolve(result);
})
.catch((err) => {
reject(error);
reject(err);
});
});
}
Expand Down

0 comments on commit fc01a78

Please sign in to comment.