Skip to content

Commit

Permalink
Merge pull request gitkraken#89 from afrisalyp/issue-61
Browse files Browse the repository at this point in the history
Issue 61: Show line comment from common windows.

Blue bookmark icons appear on common editor windows, but "Show comment for this line" button menu doesn't
  • Loading branch information
billsedison committed Dec 11, 2018
2 parents 2b3bc50 + 0bdd25e commit ba6715b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -2327,7 +2327,7 @@
},
{
"command": "gitlens.showCommentCommitLine",
"when": "isInDiffEditor && gitlens:activeFileStatus =~ /tracked/"
"when": "gitlens:activeFileStatus =~ /tracked/"
},
{
"command": "gitlens.diffFileNext",
Expand Down Expand Up @@ -2843,7 +2843,7 @@
},
{
"command": "gitlens.showCommentCommitLine",
"when": "isInDiffEditor && gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare",
"group": "navigation@97"
},
{
Expand Down
12 changes: 10 additions & 2 deletions src/gitCommentService.ts
Expand Up @@ -179,9 +179,17 @@ export class GitCommentService implements Disposable {
}

async showLineComment() {
if (!AddLineCommentCommand.currentFileCommit || !window.activeTextEditor) return undefined;
if (!window.activeTextEditor) return undefined;
let repoPath: string | undefined;
if (!AddLineCommentCommand.currentFileCommit) {
repoPath = await Container.git.getActiveRepoPath(window.activeTextEditor);
}
else {
repoPath = AddLineCommentCommand.currentFileCommit.repoPath;
}
if (!repoPath) return undefined;
const gitUri = await GitUri.fromUri(window.activeTextEditor.document.uri);
const filename: string = path.relative(AddLineCommentCommand.currentFileCommit.repoPath, gitUri.fsPath);
const filename: string = path.relative(repoPath, gitUri.fsPath);

AddLineCommentCommand.currentFileName = filename;

Expand Down

0 comments on commit ba6715b

Please sign in to comment.