Skip to content

Commit 518d736

Browse files
committed
added gutter decorations
1 parent 806ba2e commit 518d736

File tree

5 files changed

+61
-5
lines changed

5 files changed

+61
-5
lines changed

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
**v0.2.0**
2+
=============================================
3+
4+
## What's New
5+
- Added quick diff editor gutter decorations.
6+
7+
**v0.1.3**
8+
=============================================
9+
10+
## Changes
11+
- Removed boilerplate code
12+
13+
**v0.1.2**
14+
=============================================
15+
16+
## Bug Fixes
17+
- Updated incorrect information in pagage.json
18+
19+
**v0.1.1**
20+
=============================================
21+
22+
## Bug Fixes
23+
- Incorrect groups in source control view.
24+
25+
**v0.1.0**
26+
=============================================
27+
28+
## What's New
29+
- Added Soruce control view

extension.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var vscode = require('vscode');
22
const SvnSpawn = require('svn-spawn');
33
const path = require('path');
44
const svnSCM = require('./src/svnSCM.js');
5+
const svnContentProvider = require('./src/svnContentProvider');
56

67
const createStatusBar = () => {
78
const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
@@ -83,6 +84,7 @@ function activate(context) {
8384
const watcher = vscode.workspace.createFileSystemWatcher(`${rootPath}/**/*`);
8485

8586
const sourceControl = svnSCM.init();
87+
svnContentProvider.init();
8688

8789
const modified = sourceControl.createResourceGroup('modified', 'Modified');
8890
const removed = sourceControl.createResourceGroup('removed', 'Removed');

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.1.3",
5+
"version": "0.2.0",
66
"publisher": "johnstoncode",
77
"engines": {
88
"vscode": "^1.16.0"

src/svnContentProvider.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
11
var vscode = require('vscode');
2+
var svnSpawn = require('svn-spawn');
3+
var path = require('path');
24

35
module.exports = {
46
init: function() {
57
vscode.workspace.registerTextDocumentContentProvider('svn', this);
68
},
79

810
provideTextDocumentContent: function(uri) {
9-
11+
const relativePath = path.relative(vscode.workspace.rootPath, uri.fsPath).replace(/\\/g, '/');
12+
13+
var client = this.createClient();
14+
15+
return new Promise((resolve, reject) => {
16+
client.cmd(['ls', relativePath], function(err, data) {
17+
if (err) {
18+
resolve('');
19+
reject(err);
20+
}
21+
});
22+
23+
client.cmd(['cat', '-r', 'HEAD', relativePath], function(err, data) {
24+
resolve(data);
25+
reject(err);
26+
});
27+
});
28+
},
29+
30+
createClient: () => {
31+
return new svnSpawn({
32+
cwd: vscode.workspace.rootPath,
33+
noAuthCache: true,
34+
});
1035
}
1136
};

src/svnSCM.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
var vscode = require('vscode');
1+
var {Uri, scm} = require('vscode');
22

33
module.exports = {
44
sourceControl: null,
55

66
init: function() {
7-
this.sourceControl = vscode.scm.createSourceControl('svn', 'svn');
7+
this.sourceControl = scm.createSourceControl('svn', 'svn');
88
this.sourceControl.quickDiffProvider = this;
99

1010
return this.sourceControl;
@@ -15,6 +15,6 @@ module.exports = {
1515
return;
1616
}
1717

18-
return vscode.Uri.with({ scheme: 'svn', query: uri.path, path: uri.path});
18+
return new Uri().with({ scheme: 'svn', query: uri.path, path: uri.path});
1919
}
2020
};

0 commit comments

Comments
 (0)