Skip to content

Commit 5a95e31

Browse files
committed
Fix #161. Use file decorators for comments.
1 parent e8310f3 commit 5a95e31

File tree

2 files changed

+10
-35
lines changed

2 files changed

+10
-35
lines changed

src/view/reviewManager.ts

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -602,27 +602,14 @@ export class ReviewManager implements vscode.DecorationProvider {
602602
_onDidChangeDecorations: vscode.EventEmitter<vscode.Uri | vscode.Uri[]> = new vscode.EventEmitter<vscode.Uri | vscode.Uri[]>();
603603
onDidChangeDecorations: vscode.Event<vscode.Uri | vscode.Uri[]> = this._onDidChangeDecorations.event;
604604
provideDecoration(uri: vscode.Uri, token: vscode.CancellationToken): vscode.ProviderResult<vscode.DecorationData> {
605-
if (uri.scheme === 'review') {
606-
let query = JSON.parse(uri.query);
607-
let matchingComments = this._comments.filter(comment => comment.path === query.path && comment.position !== null);
608-
if (matchingComments && matchingComments.length) {
609-
return {
610-
bubble: true,
611-
// abbreviation: '♪♪',
612-
title: '♪♪'
613-
};
614-
}
615-
} else if (uri.scheme === 'file') {
616-
// local file
617-
let fileName = uri.path;
618-
let matchingComments = this._comments.filter(comment => path.resolve(this._repository.path, comment.path) === fileName && comment.position !== null);
619-
if (matchingComments && matchingComments.length) {
620-
return {
621-
bubble: false,
622-
title: '♪♪',
623-
letter: '♪♪'
624-
};
625-
}
605+
let fileName = uri.path;
606+
let matchingComments = this._comments.filter(comment => path.resolve(this._repository.path, comment.path) === fileName && comment.position !== null);
607+
if (matchingComments && matchingComments.length) {
608+
return {
609+
bubble: false,
610+
title: '♪♪',
611+
letter: '♪♪'
612+
};
626613
}
627614

628615
return {};

src/view/treeNodes/fileChangeNode.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,7 @@ export class InMemFileChangeNode extends TreeNode implements vscode.TreeItem {
7373
super();
7474
this.contextValue = 'filechange';
7575
this.label = fileName;
76-
77-
if (this.comments && this.comments.length) {
78-
this.iconPath = Resource.icons.light.Comment;
79-
} else {
80-
this.iconPath = Resource.getFileStatusUri(this);
81-
}
82-
76+
this.iconPath = Resource.getFileStatusUri(this);
8377
this.resourceUri = toFileChangeNodeUri(this.filePath, comments.length > 0);
8478

8579
let opts: vscode.TextDocumentShowOptions = {
@@ -147,13 +141,7 @@ export class GitFileChangeNode extends TreeNode implements vscode.TreeItem {
147141
super();
148142
this.contextValue = 'filechange';
149143
this.label = fileName;
150-
151-
if (this.comments && this.comments.length) {
152-
this.iconPath = Resource.icons.light.Comment;
153-
} else {
154-
this.iconPath = Resource.getFileStatusUri(this);
155-
}
156-
144+
this.iconPath = Resource.getFileStatusUri(this);
157145
this.resourceUri = toFileChangeNodeUri(this.filePath, comments.length > 0);
158146

159147
let opts: vscode.TextDocumentShowOptions = {

0 commit comments

Comments
 (0)