Skip to content

Commit 1d3845b

Browse files
committed
Closes #66 - Removes peek explorers
Converts type/const into string enums Refactors command initialization
1 parent 5e62d5e commit 1d3845b

39 files changed

+387
-796
lines changed

README.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,6 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
255255

256256
- Adds a `Show Last Opened Quick Pick` command (`gitlens.showLastQuickPick`) with a shortcut of `alt+-` to quickly get back to where you were when the last GitLens quick pick menu closed
257257

258-
- Adds a `Open File History Explorer` command (`gitlens.showFileHistory`) to show a **file history explorer** (peek style) to visualize the history of a file
259-
- Likely to be deprecated in a future release, add your voice to [#66](https://github.com/eamodio/vscode-gitlens/issues/66) if you feel it should not be removed
260-
261-
- Adds a `Open Blame History Explorer` command (`gitlens.showBlameHistory`) to show a **blame history explorer** (peek style) to visualize the blame history of a file or code block
262-
- Likely to be deprecated in a future release, add your voice to [#66](https://github.com/eamodio/vscode-gitlens/issues/66) if you feel it should not be removed
263-
264258
### And More
265259

266260
- Adds a `Copy Commit ID to Clipboard` command (`gitlens.copyShaToClipboard`) to copy the commit id (sha) of the active line to the clipboard or from the most recent commit to the current branch, if there is no active editor
@@ -343,9 +337,9 @@ GitLens is highly customizable and provides many configuration settings to allow
343337
|-----|------------
344338
|`gitlens.codeLens.enabled`|Specifies whether or not to provide any Git code lens, by default<br />Use the `gitlens.toggleCodeLens` command to toggle the Git code lens on and off for the current session
345339
|`gitlens.codeLens.recentChange.enabled`|Specifies whether or not to show a `recent change` code lens showing the author and date of the most recent commit for the file or code block
346-
|`gitlens.codeLens.recentChange.command`|Specifies the command to be executed when the `recent change` code lens is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.showBlameHistory` - opens the blame history explorer<br />`gitlens.showFileHistory` - opens the file history explorer<br />`gitlens.diffWithPrevious` - compares the current committed file with the previous commit<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
340+
|`gitlens.codeLens.recentChange.command`|Specifies the command to be executed when the `recent change` code lens is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current committed file with the previous commit<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
347341
|`gitlens.codeLens.authors.enabled`|Specifies whether or not to show an `authors` code lens showing number of authors of the file or code block and the most prominent author (if there is more than one)
348-
|`gitlens.codeLens.authors.command`|Specifies the command to be executed when the `authors` code lens is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.showBlameHistory` - opens the blame history explorer<br />`gitlens.showFileHistory` - opens the file history explorer<br />`gitlens.diffWithPrevious` - compares the current committed file with the previous commit<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
342+
|`gitlens.codeLens.authors.command`|Specifies the command to be executed when the `authors` code lens is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current committed file with the previous commit<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
349343
|`gitlens.codeLens.locations`|Specifies where Git code lens will be shown in the document<br />`document` - adds code lens at the top of the document<br />`containers` - adds code lens at the start of container-like symbols (modules, classes, interfaces, etc)<br />`blocks` - adds code lens at the start of block-like symbols (functions, methods, properties, etc) lines<br />`custom` - adds code lens at the start of symbols contained in `gitlens.codeLens.locationCustomSymbols`
350344
|`gitlens.codeLens.customLocationSymbols`|Specifies the set of document symbols where Git code lens will be shown in the document
351345
|`gitlens.codeLens.perLanguageLocations`|Specifies where Git code lens will be shown in the document for the specified languages
@@ -379,7 +373,7 @@ GitLens is highly customizable and provides many configuration settings to allow
379373
|-----|------------
380374
|`gitlens.statusBar.enabled`|Specifies whether or not to provide blame information on the status bar
381375
|`gitlens.statusBar.alignment`|Specifies the blame alignment in the status bar<br />`left` - align to the left, `right` - align to the right
382-
|`gitlens.statusBar.command`|Specifies the command to be executed when the blame status bar item is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.showBlameHistory` - opens the blame history explorer<br />`gitlens.showFileHistory` - opens the file history explorer<br />`gitlens.diffWithPrevious` - compares the current line commit with the previous<br />`gitlens.diffWithWorking` - compares the current line commit with the working tree<br />`gitlens.toggleCodeLens` - toggles Git code lens<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
376+
|`gitlens.statusBar.command`|Specifies the command to be executed when the blame status bar item is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current line commit with the previous<br />`gitlens.diffWithWorking` - compares the current line commit with the working tree<br />`gitlens.toggleCodeLens` - toggles Git code lens<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
383377
|`gitlens.statusBar.format`|Specifies the format of the blame information on the status bar<br />Available tokens<br />`${id}` - commit id<br />`${author}` - commit author<br />`${message}` - commit message<br />`${ago}` - relative commit date (e.g. 1 day ago)<br />`${date}` - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br />See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting
384378
|`gitlens.statusBar.dateFormat`|Specifies the date format of absolute dates shown in the blame information on the status bar<br />See https://momentjs.com/docs/#/displaying/format/ for valid formats
385379

package.json

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,13 @@
255255
"default": "gitlens.showQuickCommitFileDetails",
256256
"enum": [
257257
"gitlens.toggleFileBlame",
258-
"gitlens.showBlameHistory",
259-
"gitlens.showFileHistory",
260258
"gitlens.diffWithPrevious",
261259
"gitlens.showQuickCommitDetails",
262260
"gitlens.showQuickCommitFileDetails",
263261
"gitlens.showQuickFileHistory",
264262
"gitlens.showQuickRepoHistory"
265263
],
266-
"description": "Specifies the command to be executed when the `recent change` code lens is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.showBlameHistory` - opens the blame history explorer\n `gitlens.showFileHistory` - opens the file history explorer\n `gitlens.diffWithPrevious` - compares the current committed file with the previous commit\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
264+
"description": "Specifies the command to be executed when the `recent change` code lens is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.diffWithPrevious` - compares the current committed file with the previous commit\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
267265
},
268266
"gitlens.codeLens.authors.enabled": {
269267
"type": "boolean",
@@ -275,15 +273,13 @@
275273
"default": "gitlens.toggleFileBlame",
276274
"enum": [
277275
"gitlens.toggleFileBlame",
278-
"gitlens.showBlameHistory",
279-
"gitlens.showFileHistory",
280276
"gitlens.diffWithPrevious",
281277
"gitlens.showQuickCommitDetails",
282278
"gitlens.showQuickCommitFileDetails",
283279
"gitlens.showQuickFileHistory",
284280
"gitlens.showQuickRepoHistory"
285281
],
286-
"description": "Specifies the command to be executed when the `authors` code lens is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.showBlameHistory` - opens the blame history explorer\n `gitlens.showFileHistory` - opens the file history explorer\n `gitlens.diffWithPrevious` - compares the current committed file with the previous commit\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
282+
"description": "Specifies the command to be executed when the `authors` code lens is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.diffWithPrevious` - compares the current committed file with the previous commit\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
287283
},
288284
"gitlens.codeLens.locations": {
289285
"type": "array",
@@ -589,8 +585,6 @@
589585
"default": "gitlens.showQuickCommitDetails",
590586
"enum": [
591587
"gitlens.toggleFileBlame",
592-
"gitlens.showBlameHistory",
593-
"gitlens.showFileHistory",
594588
"gitlens.diffWithPrevious",
595589
"gitlens.diffWithWorking",
596590
"gitlens.toggleCodeLens",
@@ -599,7 +593,7 @@
599593
"gitlens.showQuickFileHistory",
600594
"gitlens.showQuickRepoHistory"
601595
],
602-
"description": "Specifies the command to be executed when the blame status bar item is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.showBlameHistory` - opens the blame history explorer\n `gitlens.showFileHistory` - opens the file history explorer\n `gitlens.diffWithPrevious` - compares the current line commit with the previous\n `gitlens.diffWithWorking` - compares the current line commit with the working tree\n `gitlens.toggleCodeLens` - toggles Git code lens\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
596+
"description": "Specifies the command to be executed when the blame status bar item is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.diffWithPrevious` - compares the current line commit with the previous\n `gitlens.diffWithWorking` - compares the current line commit with the working tree\n `gitlens.toggleCodeLens` - toggles Git code lens\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
603597
},
604598
"gitlens.statusBar.format": {
605599
"type": "string",
@@ -1003,11 +997,6 @@
1003997
"title": "Toggle Git Code Lens",
1004998
"category": "GitLens"
1005999
},
1006-
{
1007-
"command": "gitlens.showBlameHistory",
1008-
"title": "Open Blame History Explorer",
1009-
"category": "GitLens"
1010-
},
10111000
{
10121001
"command": "gitlens.showCommitSearch",
10131002
"title": "Search Commits",
@@ -1017,11 +1006,6 @@
10171006
"light": "images/light/icon-search.svg"
10181007
}
10191008
},
1020-
{
1021-
"command": "gitlens.showFileHistory",
1022-
"title": "Open File History Explorer",
1023-
"category": "GitLens"
1024-
},
10251009
{
10261010
"command": "gitlens.showLastQuickPick",
10271011
"title": "Show Last Opened Quick Pick",
@@ -1284,14 +1268,6 @@
12841268
"command": "gitlens.toggleCodeLens",
12851269
"when": "gitlens:isTracked && gitlens:canToggleCodeLens"
12861270
},
1287-
{
1288-
"command": "gitlens.showBlameHistory",
1289-
"when": "gitlens:isBlameable"
1290-
},
1291-
{
1292-
"command": "gitlens.showFileHistory",
1293-
"when": "gitlens:isTracked"
1294-
},
12951271
{
12961272
"command": "gitlens.showLastQuickPick",
12971273
"when": "gitlens:enabled"

src/annotations/annotationController.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ import { RecentChangesAnnotationProvider } from './recentChangesAnnotationProvid
1414
import { WhitespaceController } from './whitespaceController';
1515
import * as path from 'path';
1616

17-
export type FileAnnotationType = 'gutter' | 'hover' | 'recentChanges';
18-
export const FileAnnotationType = {
19-
Gutter: 'gutter' as FileAnnotationType,
20-
Hover: 'hover' as FileAnnotationType,
21-
RecentChanges: 'recentChanges' as FileAnnotationType
22-
};
17+
export enum FileAnnotationType {
18+
Gutter = 'gutter',
19+
Hover = 'hover',
20+
RecentChanges = 'recentChanges'
21+
}
2322

2423
export const Decorations = {
2524
blameAnnotation: window.createTextEditorDecorationType({

src/annotations/annotations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class Annotations {
121121
}
122122

123123
static async changesHover(commit: GitCommit, line: number, uri: GitUri, git: GitService): Promise<DecorationOptions> {
124-
const chunkLine = await git.getDiffForLine(uri, line + uri.offset, commit.isUncommitted ? undefined : commit.previousSha);
124+
const chunkLine = await git.getDiffForLine(uri, line, commit.isUncommitted ? undefined : commit.previousSha);
125125
const message = this.getHoverDiffMessage(commit, chunkLine);
126126

127127
return {

src/annotations/blameAnnotationProvider.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,13 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
3030
if (!blame || !blame.lines.length) return;
3131
}
3232

33-
const offset = this.uri.offset;
34-
3533
let sha: string | undefined = undefined;
3634
if (typeof shaOrLine === 'string') {
3735
sha = shaOrLine;
3836
}
3937
else if (typeof shaOrLine === 'number') {
40-
const line = shaOrLine - offset;
41-
if (line >= 0) {
42-
const commitLine = blame.lines[line];
38+
if (shaOrLine >= 0) {
39+
const commitLine = blame.lines[shaOrLine];
4340
sha = commitLine && commitLine.sha;
4441
}
4542
}
@@ -54,7 +51,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
5451

5552
const highlightDecorationRanges = blame.lines
5653
.filter(l => l.sha === sha)
57-
.map(l => this.editor.document.validateRange(new Range(l.line + offset, 0, l.line + offset, 1000000)));
54+
.map(l => this.editor.document.validateRange(new Range(l.line, 0, l.line, 1000000)));
5855

5956
this.editor.setDecorations(this.highlightDecoration, highlightDecorationRanges);
6057
}
@@ -101,7 +98,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
10198
const blame = await this.getBlame(true);
10299
if (blame === undefined) return undefined;
103100

104-
const line = blame.lines[position.line - this.uri.offset];
101+
const line = blame.lines[position.line];
105102

106103
const commit = blame.commits.get(line.sha);
107104
if (commit === undefined) return undefined;

src/annotations/gutterBlameAnnotationProvider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
3333
};
3434

3535
const now = Date.now();
36-
const offset = this.uri.offset;
3736
const renderOptions = Annotations.gutterRenderOptions(this._config.theme, cfg.heatmap, options);
3837
const separateLines = this._config.theme.annotations.file.gutter.separateLines;
3938

@@ -46,7 +45,7 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
4645
let previousSha: string | undefined;
4746

4847
for (const l of blame.lines) {
49-
const line = l.line + offset;
48+
const line = l.line;
5049

5150
if (previousSha === l.sha) {
5251
// Use a shallow copy of the previous decoration options

src/annotations/hoverBlameAnnotationProvider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export class HoverBlameAnnotationProvider extends BlameAnnotationProviderBase {
2020
const start = process.hrtime();
2121

2222
const now = Date.now();
23-
const offset = this.uri.offset;
2423
const renderOptions = Annotations.hoverRenderOptions(this._config.theme, cfg.heatmap);
2524

2625
const decorations: DecorationOptions[] = [];
@@ -30,7 +29,7 @@ export class HoverBlameAnnotationProvider extends BlameAnnotationProviderBase {
3029
let hover: DecorationOptions | undefined;
3130

3231
for (const l of blame.lines) {
33-
const line = l.line + offset;
32+
const line = l.line;
3433

3534
hover = decorationsMap[l.sha];
3635

0 commit comments

Comments
 (0)