Skip to content

Commit fc01a78

Browse files
committed
completed source control view file open
1 parent d34b58e commit fc01a78

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
**v0.4.0**
2+
=============================================
3+
4+
## What's New
5+
- Files/Folders can be clicked open from source control view
6+
17
**v0.3.1**
28
=============================================
39

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "svn-scm",
33
"displayName": "svn-scm",
44
"description": "",
5-
"version": "0.3.1",
5+
"version": "0.4.0",
66
"publisher": "johnstoncode",
77
"engines": {
88
"vscode": "^1.16.0"

src/extension.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {vscode, commands} = require('vscode');
1+
const vscode = require('vscode');
22
const path = require('path');
33
const Svn = require('./svn');
44
const svnSCM = require('./svnSCM');
@@ -42,6 +42,11 @@ const updateChangesResourceGroup = (data) => {
4242
iconPath: vscode.Uri.file(path.join(iconsRootPath, `${item['wc-status'].$.item}.svg`)),
4343
tooltip: item['wc-status'].$.item,
4444
},
45+
command: {
46+
command: 'svn.fileOpen',
47+
title: 'Open',
48+
arguments: [createResourceUri(item.$.path)]
49+
}
4550
});
4651
}
4752
});
@@ -61,16 +66,21 @@ const updateNotTrackedResourceGroup = (data) => {
6166
iconPath: vscode.Uri.file(path.join(iconsRootPath, `unversioned.svg`)),
6267
tooltip: item['wc-status'].$.item,
6368
},
69+
command: {
70+
command: 'svn.fileOpen',
71+
title: 'Open',
72+
arguments: [createResourceUri(item.$.path)]
73+
}
6474
});
6575
}
6676
});
6777

6878
return matches;
6979
}
7080

71-
const registerFileOpenCommand = (resourceUri) => {
72-
commands.registerCommand('svn.fileOpen', () => {
73-
commands.executeCommand('vscode.open', resourceUri);
81+
const registerFileOpenCommand = () => {
82+
vscode.commands.registerCommand('svn.fileOpen', (resourceUri) => {
83+
vscode.commands.executeCommand('vscode.open', resourceUri);
7484
});
7585
}
7686

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

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

95+
registerFileOpenCommand();
96+
8597
const sourceControl = new svnSCM();
8698
const contentProvider = new svnContentProvider();
8799
const svn = new Svn();

src/svnContentProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ svnContentProvider.prototype.provideTextDocumentContent = function(uri) {
1919
resolve(result);
2020
})
2121
.catch((err) => {
22-
reject(error);
22+
reject(err);
2323
});
2424
});
2525
}

0 commit comments

Comments
 (0)