소스 검색

Closes #431 - adds tag annotations to tooltips

main
Eric Amodio 6 년 전
부모
커밋
bfbefd03ca
8개의 변경된 파일66개의 추가작업 그리고 13개의 파일을 삭제
  1. +1
    -0
      CHANGELOG.md
  2. +1
    -1
      src/git/git.ts
  3. +2
    -1
      src/git/models/tag.ts
  4. +14
    -1
      src/git/parsers/branchParser.ts
  5. +12
    -3
      src/git/parsers/diffParser.ts
  6. +15
    -5
      src/git/parsers/remoteParser.ts
  7. +20
    -2
      src/git/parsers/tagParser.ts
  8. +1
    -0
      src/views/tagNode.ts

+ 1
- 0
CHANGELOG.md 파일 보기

@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [Unreleased]
### Added
- Adds the ability to show the *GitLens*, *GitLens File History*, and *GitLens Results* explorers in an all-new *GitLens* view (in addition to the existing locations)
- Adds tag annotations to the tag tooltips in the *GitLens* explorer — closes [#431](https://github.com/eamodio/vscode-gitlens/issues/431)
- Adds `gitlens.hovers.avatars` setting to specify whether to show avatar images in hovers — closes [#432](https://github.com/eamodio/vscode-gitlens/issues/432) thanks to [PR #441](https://github.com/eamodio/vscode-gitlens/pull/441) by Segev Finer ([@segevfiner](https://github.com/segevfiner))
- Adds `gitlens.hovers.avatars` setting to the interactive settings editor to specify whether to show avatar images in hovers

+ 1
- 1
src/git/git.ts 파일 보기

@ -731,7 +731,7 @@ export class Git {
}
static tag(repoPath: string) {
const params = ['tag', '-l'];
const params = ['tag', '-l', '-n1'];
return gitCommand({ cwd: repoPath }, ...params);
}

+ 2
- 1
src/git/models/tag.ts 파일 보기

@ -3,7 +3,8 @@
export class GitTag {
constructor(
public readonly repoPath: string,
public readonly name: string
public readonly name: string,
public readonly annotation?: string
) {}
private _basename: string | undefined;

+ 14
- 1
src/git/parsers/branchParser.ts 파일 보기

@ -16,7 +16,20 @@ export class GitBranchParser {
if (match == null) break;
const [ahead, behind] = this.parseState(match[5]);
branches.push(new GitBranch(repoPath, match[2], match[1] === '*', match[3], match[4], ahead, behind));
branches.push(
new GitBranch(
repoPath,
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
(' ' + match[2]).substr(1),
match[1] === '*',
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
match[3] === undefined ? undefined : (' ' + match[3]).substr(1),
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
match[4] === undefined ? undefined : (' ' + match[4]).substr(1),
ahead,
behind
)
);
} while (match != null);
if (!branches.length) return undefined;

+ 12
- 3
src/git/parsers/diffParser.ts 파일 보기

@ -30,8 +30,7 @@ export class GitDiffParser {
match = unifiedDiffRegex.exec(`${data}\n@@`);
if (match == null) break;
// Stops excessive memory usage
// https://bugs.chromium.org/p/v8/issues/detail?id=2869
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
chunk = (' ' + match[5]).substr(1);
currentStart = parseInt(match[3], 10);
previousStart = parseInt(match[1], 10);
@ -148,7 +147,17 @@ export class GitDiffParser {
match = nameStatusDiffRegex.exec(data);
if (match == null) break;
statuses.push(GitStatusParser.parseStatusFile(repoPath, match[1], match[2], match[3]));
statuses.push(
GitStatusParser.parseStatusFile(
repoPath,
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
(' ' + match[1]).substr(1),
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
(' ' + match[2]).substr(1),
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
match[3] === undefined ? undefined : (' ' + match[3]).substr(1)
)
);
} while (match != null);
if (!statuses.length) return undefined;

+ 15
- 5
src/git/parsers/remoteParser.ts 파일 보기

@ -59,21 +59,31 @@ export class GitRemoteParser {
match = remoteRegex.exec(data);
if (match == null) break;
const url = match[2];
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
const url = (' ' + match[2]).substr(1);
const [scheme, domain, path] = this.parseGitUrl(url);
const uniqueness = `${domain}/${path}`;
let remote: GitRemote | undefined = groups[uniqueness];
if (remote === undefined) {
remote = new GitRemote(repoPath, match[1], scheme, domain, path, providerFactory(domain, path), [
{ url: url, type: match[3] as GitRemoteType }
]);
remote = new GitRemote(
repoPath,
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
(' ' + match[1]).substr(1),
scheme,
domain,
path,
providerFactory(domain, path),
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
[{ url: url, type: (' ' + match[3]).substr(1) as GitRemoteType }]
);
remotes.push(remote);
groups[uniqueness] = remote;
}
else {
remote.types.push({ url: url, type: match[3] as GitRemoteType });
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
remote.types.push({ url: url, type: (' ' + match[3]).substr(1) as GitRemoteType });
}
} while (match != null);

+ 20
- 2
src/git/parsers/tagParser.ts 파일 보기

@ -1,12 +1,30 @@
'use strict';
import { Arrays } from '../../system';
import { GitTag } from './../git';
const tagWithAnnotationRegex = /^(.+?)(?:$|(?:\s+)(.*)$)/gm;
export class GitTagParser {
static parse(data: string, repoPath: string): GitTag[] | undefined {
if (!data) return undefined;
const tags = Arrays.filterMap(data.split('\n'), t => (!!t ? new GitTag(repoPath, t) : undefined));
const tags: GitTag[] = [];
let match: RegExpExecArray | null = null;
do {
match = tagWithAnnotationRegex.exec(data);
if (match == null) break;
tags.push(
new GitTag(
repoPath,
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
(' ' + match[1]).substr(1),
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
match[2] === undefined ? undefined : (' ' + match[2]).substr(1)
)
);
} while (match != null);
if (!tags.length) return undefined;
return tags;

+ 1
- 0
src/views/tagNode.ts 파일 보기

@ -45,6 +45,7 @@ export class TagNode extends ExplorerRefNode {
async getTreeItem(): Promise<TreeItem> {
const item = new TreeItem(this.label, TreeItemCollapsibleState.Collapsed);
item.tooltip = `${this.tag.name}${this.tag.annotation === undefined ? '' : `\n${this.tag.annotation}`}`;
item.contextValue = ResourceType.Tag;
return item;
}

불러오는 중...
취소
저장