Просмотр исходного кода

Adds readonly to ctor props

main
Eric Amodio 7 лет назад
Родитель
Сommit
a785cfd22e
73 измененных файлов: 754 добавлений и 556 удалений
  1. +3
    -3
      src/annotations/annotationController.ts
  2. +2
    -2
      src/annotations/blameAnnotationProvider.ts
  3. +2
    -2
      src/annotations/recentChangesAnnotationProvider.ts
  4. +3
    -3
      src/codeLensController.ts
  5. +3
    -1
      src/commands/clearFileAnnotations.ts
  6. +3
    -1
      src/commands/closeUnchangedFiles.ts
  7. +3
    -1
      src/commands/copyMessageToClipboard.ts
  8. +3
    -1
      src/commands/copyShaToClipboard.ts
  9. +3
    -1
      src/commands/diffDirectory.ts
  10. +3
    -1
      src/commands/diffLineWithPrevious.ts
  11. +3
    -1
      src/commands/diffLineWithWorking.ts
  12. +3
    -1
      src/commands/diffWith.ts
  13. +3
    -1
      src/commands/diffWithBranch.ts
  14. +3
    -1
      src/commands/diffWithNext.ts
  15. +3
    -1
      src/commands/diffWithPrevious.ts
  16. +3
    -1
      src/commands/diffWithRevision.ts
  17. +3
    -1
      src/commands/diffWithWorking.ts
  18. +7
    -2
      src/commands/externalDiff.ts
  19. +3
    -1
      src/commands/openBranchInRemote.ts
  20. +3
    -1
      src/commands/openBranchesInRemote.ts
  21. +3
    -1
      src/commands/openChangedFiles.ts
  22. +3
    -1
      src/commands/openCommitInRemote.ts
  23. +3
    -1
      src/commands/openFileInRemote.ts
  24. +3
    -1
      src/commands/openFileRevision.ts
  25. +3
    -1
      src/commands/openRepoInRemote.ts
  26. +3
    -1
      src/commands/resetSuppressedWarnings.ts
  27. +3
    -1
      src/commands/showCommitSearch.ts
  28. +3
    -1
      src/commands/showFileBlame.ts
  29. +3
    -1
      src/commands/showLineBlame.ts
  30. +3
    -1
      src/commands/showQuickBranchHistory.ts
  31. +3
    -1
      src/commands/showQuickCommitDetails.ts
  32. +3
    -1
      src/commands/showQuickCommitFileDetails.ts
  33. +3
    -1
      src/commands/showQuickCurrentBranchHistory.ts
  34. +3
    -1
      src/commands/showQuickFileHistory.ts
  35. +3
    -1
      src/commands/showQuickRepoStatus.ts
  36. +3
    -1
      src/commands/showQuickStashList.ts
  37. +3
    -1
      src/commands/stashApply.ts
  38. +3
    -1
      src/commands/stashDelete.ts
  39. +3
    -1
      src/commands/stashSave.ts
  40. +3
    -1
      src/commands/toggleCodeLens.ts
  41. +3
    -1
      src/commands/toggleFileBlame.ts
  42. +3
    -1
      src/commands/toggleFileRecentChanges.ts
  43. +3
    -1
      src/commands/toggleLineBlame.ts
  44. +455
    -455
      src/currentLineController.ts
  45. +3
    -1
      src/git/gitContextTracker.ts
  46. +6
    -1
      src/git/models/branch.ts
  47. +5
    -1
      src/git/models/diff.ts
  48. +3
    -1
      src/git/models/repository.ts
  49. +9
    -1
      src/git/models/status.ts
  50. +6
    -1
      src/git/remotes/bitbucket-server.ts
  51. +6
    -1
      src/git/remotes/bitbucket.ts
  52. +5
    -1
      src/git/remotes/custom.ts
  53. +6
    -1
      src/git/remotes/github.ts
  54. +6
    -1
      src/git/remotes/gitlab.ts
  55. +5
    -1
      src/git/remotes/visualStudio.ts
  56. +14
    -11
      src/gitCodeLensProvider.ts
  57. +4
    -1
      src/gitContentProvider.ts
  58. +12
    -2
      src/gitRevisionCodeLensProvider.ts
  59. +6
    -2
      src/gitService.ts
  60. +3
    -1
      src/keyboard.ts
  61. +3
    -1
      src/quickPicks/branches.ts
  62. +13
    -3
      src/quickPicks/commitDetails.ts
  63. +8
    -2
      src/quickPicks/commitFileDetails.ts
  64. +9
    -2
      src/quickPicks/remotes.ts
  65. +8
    -2
      src/quickPicks/repoStatus.ts
  66. +16
    -4
      src/views/explorerNode.ts
  67. +1
    -1
      src/views/fileHistoryNode.ts
  68. +2
    -2
      src/views/folderNode.ts
  69. +4
    -1
      src/views/gitExplorer.ts
  70. +1
    -1
      src/views/historyNode.ts
  71. +1
    -1
      src/views/repositoryNode.ts
  72. +1
    -1
      src/views/statusFileCommitsNode.ts
  73. +2
    -2
      src/views/statusNode.ts

+ 3
- 3
src/annotations/annotationController.ts Просмотреть файл

@ -58,9 +58,9 @@ export class AnnotationController extends Disposable {
private _keyboardScope: KeyboardScope | undefined = undefined;
constructor(
private context: ExtensionContext,
private git: GitService,
private gitContextTracker: GitContextTracker
private readonly context: ExtensionContext,
private readonly git: GitService,
private readonly gitContextTracker: GitContextTracker
) {
super(() => this.dispose());

+ 2
- 2
src/annotations/blameAnnotationProvider.ts Просмотреть файл

@ -16,8 +16,8 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
editor: TextEditor,
decoration: TextEditorDecorationType | undefined,
highlightDecoration: TextEditorDecorationType | undefined,
protected git: GitService,
protected uri: GitUri
protected readonly git: GitService,
protected readonly uri: GitUri
) {
super(context, editor, decoration, highlightDecoration);

+ 2
- 2
src/annotations/recentChangesAnnotationProvider.ts Просмотреть файл

@ -13,8 +13,8 @@ export class RecentChangesAnnotationProvider extends AnnotationProviderBase {
editor: TextEditor,
decoration: TextEditorDecorationType | undefined,
highlightDecoration: TextEditorDecorationType | undefined,
private git: GitService,
private uri: GitUri
private readonly git: GitService,
private readonly uri: GitUri
) {
super(context, editor, decoration, highlightDecoration);
}

+ 3
- 3
src/codeLensController.ts Просмотреть файл

@ -15,9 +15,9 @@ export class CodeLensController extends Disposable {
private _disposable: Disposable | undefined;
constructor(
private context: ExtensionContext,
private git: GitService,
private gitContextTracker: GitContextTracker
private readonly context: ExtensionContext,
private readonly git: GitService,
private readonly gitContextTracker: GitContextTracker
) {
super(() => this.dispose());

+ 3
- 1
src/commands/clearFileAnnotations.ts Просмотреть файл

@ -6,7 +6,9 @@ import { Logger } from '../logger';
export class ClearFileAnnotationsCommand extends EditorCommand {
constructor(private annotationController: AnnotationController) {
constructor(
private readonly annotationController: AnnotationController
) {
super(Commands.ClearFileAnnotations);
}

+ 3
- 1
src/commands/closeUnchangedFiles.ts Просмотреть файл

@ -14,7 +14,9 @@ export interface CloseUnchangedFilesCommandArgs {
export class CloseUnchangedFilesCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.CloseUnchangedFiles);
}

+ 3
- 1
src/commands/copyMessageToClipboard.ts Просмотреть файл

@ -13,7 +13,9 @@ export interface CopyMessageToClipboardCommandArgs {
export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.CopyMessageToClipboard);
}

+ 3
- 1
src/commands/copyShaToClipboard.ts Просмотреть файл

@ -12,7 +12,9 @@ export interface CopyShaToClipboardCommandArgs {
export class CopyShaToClipboardCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.CopyShaToClipboard);
}

+ 3
- 1
src/commands/diffDirectory.ts Просмотреть файл

@ -16,7 +16,9 @@ export interface DiffDirectoryCommandCommandArgs {
export class DiffDirectoryCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super([Commands.DiffDirectory, Commands.ExternalDiffAll]);
}

+ 3
- 1
src/commands/diffLineWithPrevious.ts Просмотреть файл

@ -15,7 +15,9 @@ export interface DiffLineWithPreviousCommandArgs {
export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.DiffLineWithPrevious);
}

+ 3
- 1
src/commands/diffLineWithWorking.ts Просмотреть файл

@ -15,7 +15,9 @@ export interface DiffLineWithWorkingCommandArgs {
export class DiffLineWithWorkingCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.DiffLineWithWorking);
}

+ 3
- 1
src/commands/diffWith.ts Просмотреть файл

@ -79,7 +79,9 @@ export class DiffWithCommand extends ActiveEditorCommand {
return super.getMarkdownCommandArgsCore<DiffWithCommandArgs>(Commands.DiffWith, args);
}
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.DiffWith);
}

+ 3
- 1
src/commands/diffWithBranch.ts Просмотреть файл

@ -17,7 +17,9 @@ export interface DiffWithBranchCommandArgs {
export class DiffWithBranchCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.DiffWithBranch);
}

+ 3
- 1
src/commands/diffWithNext.ts Просмотреть файл

@ -17,7 +17,9 @@ export interface DiffWithNextCommandArgs {
export class DiffWithNextCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.DiffWithNext);
}

+ 3
- 1
src/commands/diffWithPrevious.ts Просмотреть файл

@ -18,7 +18,9 @@ export interface DiffWithPreviousCommandArgs {
export class DiffWithPreviousCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.DiffWithPrevious);
}

+ 3
- 1
src/commands/diffWithRevision.ts Просмотреть файл

@ -16,7 +16,9 @@ export interface DiffWithRevisionCommandArgs {
export class DiffWithRevisionCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.DiffWithRevision);
}

+ 3
- 1
src/commands/diffWithWorking.ts Просмотреть файл

@ -15,7 +15,9 @@ export interface DiffWithWorkingCommandArgs {
export class DiffWithWorkingCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.DiffWithWorking);
}

+ 7
- 2
src/commands/externalDiff.ts Просмотреть файл

@ -41,7 +41,10 @@ interface Resource extends SourceControlResourceState {
class ExternalDiffFile {
constructor(public uri: Uri, public staged: boolean) { }
constructor(
public readonly uri: Uri,
public readonly staged: boolean
) { }
}
export interface ExternalDiffCommandArgs {
@ -50,7 +53,9 @@ export interface ExternalDiffCommandArgs {
export class ExternalDiffCommand extends Command {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.ExternalDiff);
}

+ 3
- 1
src/commands/openBranchInRemote.ts Просмотреть файл

@ -14,7 +14,9 @@ export interface OpenBranchInRemoteCommandArgs {
export class OpenBranchInRemoteCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.OpenBranchInRemote);
}

+ 3
- 1
src/commands/openBranchesInRemote.ts Просмотреть файл

@ -11,7 +11,9 @@ export interface OpenBranchesInRemoteCommandArgs {
export class OpenBranchesInRemoteCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.OpenBranchesInRemote);
}

+ 3
- 1
src/commands/openChangedFiles.ts Просмотреть файл

@ -11,7 +11,9 @@ export interface OpenChangedFilesCommandArgs {
export class OpenChangedFilesCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.OpenChangedFiles);
}

+ 3
- 1
src/commands/openCommitInRemote.ts Просмотреть файл

@ -21,7 +21,9 @@ export class OpenCommitInRemoteCommand extends ActiveEditorCommand {
return super.getMarkdownCommandArgsCore<OpenCommitInRemoteCommandArgs>(Commands.OpenCommitInRemote, args);
}
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.OpenCommitInRemote);
}

+ 3
- 1
src/commands/openFileInRemote.ts Просмотреть файл

@ -12,7 +12,9 @@ export interface OpenFileInRemoteCommandArgs {
export class OpenFileInRemoteCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.OpenFileInRemote);
}

+ 3
- 1
src/commands/openFileRevision.ts Просмотреть файл

@ -33,7 +33,9 @@ export class OpenFileRevisionCommand extends ActiveEditorCommand {
return super.getMarkdownCommandArgsCore<OpenFileRevisionCommandArgs>(Commands.OpenFileRevision, args);
}
constructor(private annotationController: AnnotationController) {
constructor(
private readonly annotationController: AnnotationController
) {
super(Commands.OpenFileRevision);
}

+ 3
- 1
src/commands/openRepoInRemote.ts Просмотреть файл

@ -11,7 +11,9 @@ export interface OpenRepoInRemoteCommandArgs {
export class OpenRepoInRemoteCommand extends ActiveEditorCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.OpenRepoInRemote);
}

+ 3
- 1
src/commands/resetSuppressedWarnings.ts Просмотреть файл

@ -6,7 +6,9 @@ import { SuppressedKeys } from '../messages';
export class ResetSuppressedWarningsCommand extends Command {
constructor(private context: ExtensionContext) {
constructor(
private readonly context: ExtensionContext
) {
super(Commands.ResetSuppressedWarnings);
}

+ 3
- 1
src/commands/showCommitSearch.ts Просмотреть файл

@ -27,7 +27,9 @@ export interface ShowCommitSearchCommandArgs {
export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.ShowCommitSearch);
}

+ 3
- 1
src/commands/showFileBlame.ts Просмотреть файл

@ -12,7 +12,9 @@ export interface ShowFileBlameCommandArgs {
export class ShowFileBlameCommand extends EditorCommand {
constructor(private annotationController: AnnotationController) {
constructor(
private readonly annotationController: AnnotationController
) {
super(Commands.ShowFileBlame);
}

+ 3
- 1
src/commands/showLineBlame.ts Просмотреть файл

@ -11,7 +11,9 @@ export interface ShowLineBlameCommandArgs {
export class ShowLineBlameCommand extends EditorCommand {
constructor(private currentLineController: CurrentLineController) {
constructor(
private readonly currentLineController: CurrentLineController
) {
super(Commands.ShowLineBlame);
}

+ 3
- 1
src/commands/showQuickBranchHistory.ts Просмотреть файл

@ -20,7 +20,9 @@ export interface ShowQuickBranchHistoryCommandArgs {
export class ShowQuickBranchHistoryCommand extends ActiveEditorCachedCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.ShowQuickBranchHistory);
}

+ 3
- 1
src/commands/showQuickCommitDetails.ts Просмотреть файл

@ -29,7 +29,9 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
return super.getMarkdownCommandArgsCore<ShowQuickCommitDetailsCommandArgs>(Commands.ShowQuickCommitDetails, args);
}
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.ShowQuickCommitDetails);
}

+ 3
- 1
src/commands/showQuickCommitFileDetails.ts Просмотреть файл

@ -29,7 +29,9 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCachedCommand
return super.getMarkdownCommandArgsCore<ShowQuickCommitFileDetailsCommandArgs>(Commands.ShowQuickCommitFileDetails, args);
}
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.ShowQuickCommitFileDetails);
}

+ 3
- 1
src/commands/showQuickCurrentBranchHistory.ts Просмотреть файл

@ -13,7 +13,9 @@ export interface ShowQuickCurrentBranchHistoryCommandArgs {
export class ShowQuickCurrentBranchHistoryCommand extends ActiveEditorCachedCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.ShowQuickCurrentBranchHistory);
}

+ 3
- 1
src/commands/showQuickFileHistory.ts Просмотреть файл

@ -21,7 +21,9 @@ export interface ShowQuickFileHistoryCommandArgs {
export class ShowQuickFileHistoryCommand extends ActiveEditorCachedCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.ShowQuickFileHistory);
}

+ 3
- 1
src/commands/showQuickRepoStatus.ts Просмотреть файл

@ -12,7 +12,9 @@ export interface ShowQuickRepoStatusCommandArgs {
export class ShowQuickRepoStatusCommand extends ActiveEditorCachedCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.ShowQuickRepoStatus);
}

+ 3
- 1
src/commands/showQuickStashList.ts Просмотреть файл

@ -15,7 +15,9 @@ export interface ShowQuickStashListCommandArgs {
export class ShowQuickStashListCommand extends ActiveEditorCachedCommand {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.ShowQuickStashList);
}

+ 3
- 1
src/commands/stashApply.ts Просмотреть файл

@ -17,7 +17,9 @@ export interface StashApplyCommandArgs {
export class StashApplyCommand extends Command {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.StashApply);
}

+ 3
- 1
src/commands/stashDelete.ts Просмотреть файл

@ -15,7 +15,9 @@ export interface StashDeleteCommandArgs {
export class StashDeleteCommand extends Command {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.StashDelete);
}

+ 3
- 1
src/commands/stashSave.ts Просмотреть файл

@ -15,7 +15,9 @@ export interface StashSaveCommandArgs {
export class StashSaveCommand extends Command {
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(Commands.StashSave);
}

+ 3
- 1
src/commands/toggleCodeLens.ts Просмотреть файл

@ -5,7 +5,9 @@ import { Commands, EditorCommand } from './common';
export class ToggleCodeLensCommand extends EditorCommand {
constructor(private codeLensController: CodeLensController) {
constructor(
private readonly codeLensController: CodeLensController
) {
super(Commands.ToggleCodeLens);
}

+ 3
- 1
src/commands/toggleFileBlame.ts Просмотреть файл

@ -13,7 +13,9 @@ export interface ToggleFileBlameCommandArgs {
export class ToggleFileBlameCommand extends EditorCommand {
constructor(private annotationController: AnnotationController) {
constructor(
private readonly annotationController: AnnotationController
) {
super(Commands.ToggleFileBlame);
}

+ 3
- 1
src/commands/toggleFileRecentChanges.ts Просмотреть файл

@ -7,7 +7,9 @@ import { Logger } from '../logger';
export class ToggleFileRecentChangesCommand extends EditorCommand {
constructor(private annotationController: AnnotationController) {
constructor(
private readonly annotationController: AnnotationController
) {
super(Commands.ToggleFileRecentChanges);
}

+ 3
- 1
src/commands/toggleLineBlame.ts Просмотреть файл

@ -11,7 +11,9 @@ export interface ToggleLineBlameCommandArgs {
export class ToggleLineBlameCommand extends EditorCommand {
constructor(private currentLineController: CurrentLineController) {
constructor(
private readonly currentLineController: CurrentLineController
) {
super(Commands.ToggleLineBlame);
}

+ 455
- 455
src/currentLineController.ts Просмотреть файл

@ -1,456 +1,456 @@
'use strict';
import { Functions, Objects } from './system';
import { CancellationToken, debug, DecorationRangeBehavior, DecorationRenderOptions, Disposable, ExtensionContext, Hover, HoverProvider, languages, Position, Range, StatusBarAlignment, StatusBarItem, TextDocument, TextEditor, TextEditorDecorationType, TextEditorSelectionChangeEvent, window, workspace } from 'vscode';
import { AnnotationController, FileAnnotationType } from './annotations/annotationController';
import { Annotations, endOfLineIndex } from './annotations/annotations';
import { Commands } from './commands';
import { TextEditorComparer } from './comparers';
import { IConfig, StatusBarCommand } from './configuration';
import { DocumentSchemes, ExtensionKey, isTextEditor } from './constants';
import { BlameabilityChangeEvent, CommitFormatter, GitCommit, GitCommitLine, GitContextTracker, GitLogCommit, GitService, GitUri, ICommitFormatOptions } from './gitService';
// import { Logger } from './logger';
const annotationDecoration: TextEditorDecorationType = window.createTextEditorDecorationType({
after: {
margin: '0 0 0 3em',
textDecoration: 'none'
},
rangeBehavior: DecorationRangeBehavior.ClosedClosed
} as DecorationRenderOptions);
export enum LineAnnotationType {
Trailing = 'trailing',
Hover = 'hover'
}
export class CurrentLineController extends Disposable {
private _blameable: boolean;
private _blameLineAnnotationState: { enabled: boolean, annotationType: LineAnnotationType, reason: 'user' | 'debugging' } | undefined = undefined;
private _config: IConfig;
private _currentLine: { line: number, commit?: GitCommit, logCommit?: GitLogCommit } = { line: -1 };
private _debugSessionEndDisposable: Disposable | undefined;
private _disposable: Disposable;
private _editor: TextEditor | undefined;
private _hoverProviderDisposable: Disposable | undefined;
private _isAnnotating: boolean = false;
private _statusBarItem: StatusBarItem | undefined;
private _trackCurrentLineDisposable: Disposable | undefined;
private _updateBlameDebounced: (line: number, editor: TextEditor) => Promise<void>;
private _uri: GitUri;
constructor(
context: ExtensionContext,
private git: GitService,
private gitContextTracker: GitContextTracker,
private annotationController: AnnotationController
) {
super(() => this.dispose());
this._updateBlameDebounced = Functions.debounce(this.updateBlame, 250);
this.onConfigurationChanged();
this._disposable = Disposable.from(
workspace.onDidChangeConfiguration(this.onConfigurationChanged, this),
annotationController.onDidToggleAnnotations(this.onFileAnnotationsToggled, this),
debug.onDidStartDebugSession(this.onDebugSessionStarted, this)
);
}
dispose() {
this.clearAnnotations(this._editor, true);
this.unregisterHoverProviders();
this._trackCurrentLineDisposable && this._trackCurrentLineDisposable.dispose();
this._statusBarItem && this._statusBarItem.dispose();
this._debugSessionEndDisposable && this._debugSessionEndDisposable.dispose();
this._disposable && this._disposable.dispose();
}
private onConfigurationChanged() {
const cfg = workspace.getConfiguration().get<IConfig>(ExtensionKey)!;
let changed = false;
let clear = false;
if (!Objects.areEquivalent(cfg.blame.line, this._config && this._config.blame.line)) {
changed = true;
this._blameLineAnnotationState = undefined;
clear = (this._config !== undefined);
}
if (!Objects.areEquivalent(cfg.annotations.line.trailing, this._config && this._config.annotations.line.trailing) ||
!Objects.areEquivalent(cfg.annotations.line.hover, this._config && this._config.annotations.line.hover) ||
!Objects.areEquivalent(cfg.theme.annotations.line.trailing, this._config && this._config.theme.annotations.line.trailing)) {
changed = true;
clear = (this._config !== undefined);
}
if (!Objects.areEquivalent(cfg.statusBar, this._config && this._config.statusBar)) {
changed = true;
if (cfg.statusBar.enabled) {
const alignment = cfg.statusBar.alignment !== 'left' ? StatusBarAlignment.Right : StatusBarAlignment.Left;
if (this._statusBarItem !== undefined && this._statusBarItem.alignment !== alignment) {
this._statusBarItem.dispose();
this._statusBarItem = undefined;
}
this._statusBarItem = this._statusBarItem || window.createStatusBarItem(alignment, alignment === StatusBarAlignment.Right ? 1000 : 0);
this._statusBarItem.command = cfg.statusBar.command;
}
else if (!cfg.statusBar.enabled && this._statusBarItem) {
this._statusBarItem.dispose();
this._statusBarItem = undefined;
}
}
this._config = cfg;
if (!changed) return;
if (clear) {
this.clearAnnotations(this._editor);
}
const trackCurrentLine = cfg.statusBar.enabled || cfg.blame.line.enabled || (this._blameLineAnnotationState !== undefined && this._blameLineAnnotationState.enabled);
if (trackCurrentLine && !this._trackCurrentLineDisposable) {
this._trackCurrentLineDisposable = Disposable.from(
window.onDidChangeActiveTextEditor(Functions.debounce(this.onActiveTextEditorChanged, 50), this),
window.onDidChangeTextEditorSelection(this.onTextEditorSelectionChanged, this),
this.gitContextTracker.onDidChangeBlameability(this.onBlameabilityChanged, this)
);
}
else if (!trackCurrentLine && this._trackCurrentLineDisposable) {
this._trackCurrentLineDisposable.dispose();
this._trackCurrentLineDisposable = undefined;
}
this.refresh(window.activeTextEditor);
}
private onActiveTextEditorChanged(editor: TextEditor | undefined) {
if (this._editor === editor) return;
if (editor !== undefined && !isTextEditor(editor)) return;
// Logger.log('CurrentLineController.onActiveTextEditorChanged', editor && editor.document.uri.fsPath);
this.refresh(editor);
}
private onBlameabilityChanged(e: BlameabilityChangeEvent) {
if (!this._blameable && !e.blameable) return;
this._blameable = e.blameable;
if (!e.blameable || this._editor === undefined) {
this.clear(e.editor);
return;
}
// Make sure this is for the editor we are tracking
if (!TextEditorComparer.equals(this._editor, e.editor)) return;
this._updateBlameDebounced(this._editor.selection.active.line, this._editor);
}
private onDebugSessionStarted() {
const state = this.getLineAnnotationState();
if (!state.enabled) return;
this._debugSessionEndDisposable = debug.onDidTerminateDebugSession(this.onDebugSessionEnded, this);
this.toggleAnnotations(window.activeTextEditor, state.annotationType, 'debugging');
}
private onDebugSessionEnded() {
this._debugSessionEndDisposable && this._debugSessionEndDisposable.dispose();
this._debugSessionEndDisposable = undefined;
if (this._blameLineAnnotationState === undefined || this._blameLineAnnotationState.enabled || this._blameLineAnnotationState.reason !== 'debugging') return;
this.toggleAnnotations(window.activeTextEditor, this._blameLineAnnotationState.annotationType);
}
private onFileAnnotationsToggled() {
this.refresh(window.activeTextEditor);
}
private async onTextEditorSelectionChanged(e: TextEditorSelectionChangeEvent): Promise<void> {
// Make sure this is for the editor we are tracking
if (!this._blameable || !TextEditorComparer.equals(this._editor, e.textEditor)) return;
const line = e.selections[0].active.line;
if (line === this._currentLine.line) return;
this._currentLine.line = line;
this._currentLine.commit = undefined;
this._currentLine.logCommit = undefined;
if (this._uri === undefined && e.textEditor !== undefined) {
this._uri = await GitUri.fromUri(e.textEditor.document.uri, this.git);
}
this.clearAnnotations(e.textEditor);
this._updateBlameDebounced(line, e.textEditor);
}
private getLineAnnotationState() {
return this._blameLineAnnotationState !== undefined ? this._blameLineAnnotationState : this._config.blame.line;
}
private isEditorBlameable(editor: TextEditor | undefined): boolean {
if (editor === undefined || editor.document === undefined) return false;
if (!this.git.isTrackable(editor.document.uri)) return false;
if (editor.document.isUntitled && editor.document.uri.scheme === DocumentSchemes.File) return false;
return this.git.isEditorBlameable(editor);
}
private async updateBlame(line: number, editor: TextEditor) {
this._currentLine.line = line;
this._currentLine.commit = undefined;
this._currentLine.logCommit = undefined;
let commit: GitCommit | undefined = undefined;
let commitLine: GitCommitLine | undefined = undefined;
// Since blame information isn't valid when there are unsaved changes -- don't show any status
if (this._blameable && line >= 0) {
const blameLine = await this.git.getBlameForLine(this._uri, line);
commitLine = blameLine === undefined ? undefined : blameLine.line;
commit = blameLine === undefined ? undefined : blameLine.commit;
}
this._currentLine.commit = commit;
if (commit !== undefined && commitLine !== undefined) {
this.show(commit, commitLine, editor, line);
}
else {
this.clear(editor);
}
}
async clear(editor: TextEditor | undefined) {
this.unregisterHoverProviders();
this.clearAnnotations(editor, true);
this._statusBarItem && this._statusBarItem.hide();
}
private async clearAnnotations(editor: TextEditor | undefined, force: boolean = false) {
if (editor === undefined || (!this._isAnnotating && !force)) return;
editor.setDecorations(annotationDecoration, []);
this._isAnnotating = false;
if (!force) return;
// I have no idea why the decorators sometimes don't get removed, but if they don't try again with a tiny delay
await Functions.wait(1);
editor.setDecorations(annotationDecoration, []);
}
async refresh(editor?: TextEditor) {
this._currentLine.line = -1;
this.clearAnnotations(this._editor);
if (editor === undefined || !this.isEditorBlameable(editor)) {
this.clear(editor);
this._editor = undefined;
return;
}
this._blameable = editor !== undefined && editor.document !== undefined && !editor.document.isDirty;
this._editor = editor;
this._uri = await GitUri.fromUri(editor.document.uri, this.git);
const maxLines = this._config.advanced.caching.maxLines;
// If caching is on and the file is small enough -- kick off a blame for the whole file
if (this._config.advanced.caching.enabled && (maxLines <= 0 || editor.document.lineCount <= maxLines)) {
this.git.getBlameForFile(this._uri);
}
const state = this.getLineAnnotationState();
if (state.enabled && this._blameable) {
const cfg = this._config.annotations.line;
this.registerHoverProviders(state.annotationType === LineAnnotationType.Trailing ? cfg.trailing.hover : cfg.hover);
}
else {
this.unregisterHoverProviders();
}
this._updateBlameDebounced(editor.selection.active.line, editor);
}
async show(commit: GitCommit, blameLine: GitCommitLine, editor: TextEditor, line: number) {
// I have no idea why I need this protection -- but it happens
if (editor.document === undefined) return;
this.updateStatusBar(commit);
this.updateTrailingAnnotation(commit, blameLine, editor, line);
}
async showAnnotations(editor: TextEditor | undefined, type: LineAnnotationType, reason: 'user' | 'debugging' = 'user') {
if (editor === undefined) return;
const state = this.getLineAnnotationState();
if (!state.enabled || state.annotationType !== type) {
this._blameLineAnnotationState = { enabled: true, annotationType: type, reason: reason };
await this.clearAnnotations(editor);
await this.updateBlame(editor.selection.active.line, editor);
}
}
async toggleAnnotations(editor: TextEditor | undefined, type: LineAnnotationType, reason: 'user' | 'debugging' = 'user') {
if (editor === undefined) return;
const state = this.getLineAnnotationState();
this._blameLineAnnotationState = { enabled: !state.enabled, annotationType: type, reason: reason };
await this.clearAnnotations(editor);
await this.updateBlame(editor.selection.active.line, editor);
}
private updateStatusBar(commit: GitCommit) {
const cfg = this._config.statusBar;
if (!cfg.enabled || this._statusBarItem === undefined) return;
this._statusBarItem.text = `$(git-commit) ${CommitFormatter.fromTemplate(cfg.format, commit, {
truncateMessageAtNewLine: true,
dateFormat: cfg.dateFormat === null ? this._config.defaultDateFormat : cfg.dateFormat
} as ICommitFormatOptions)}`;
switch (cfg.command) {
case StatusBarCommand.ToggleFileBlame:
this._statusBarItem.tooltip = 'Toggle Blame Annotations';
break;
case StatusBarCommand.DiffWithPrevious:
this._statusBarItem.command = Commands.DiffLineWithPrevious;
this._statusBarItem.tooltip = 'Compare Line Revision with Previous';
break;
case StatusBarCommand.DiffWithWorking:
this._statusBarItem.command = Commands.DiffLineWithWorking;
this._statusBarItem.tooltip = 'Compare Line Revision with Working';
break;
case StatusBarCommand.ToggleCodeLens:
this._statusBarItem.tooltip = 'Toggle Git CodeLens';
break;
case StatusBarCommand.ShowQuickCommitDetails:
this._statusBarItem.tooltip = 'Show Commit Details';
break;
case StatusBarCommand.ShowQuickCommitFileDetails:
this._statusBarItem.tooltip = 'Show Line Commit Details';
break;
case StatusBarCommand.ShowQuickFileHistory:
this._statusBarItem.tooltip = 'Show File History';
break;
case StatusBarCommand.ShowQuickCurrentBranchHistory:
this._statusBarItem.tooltip = 'Show Branch History';
break;
}
this._statusBarItem.show();
}
private async updateTrailingAnnotation(commit: GitCommit, blameLine: GitCommitLine, editor: TextEditor, line?: number) {
const state = this.getLineAnnotationState();
if (!state.enabled || state.annotationType !== LineAnnotationType.Trailing) return;
line = line === undefined ? blameLine.line : line;
const cfg = this._config.annotations.line.trailing;
const decoration = Annotations.trailing(commit, cfg.format, cfg.dateFormat === null ? this._config.defaultDateFormat : cfg.dateFormat, this._config.theme);
decoration.range = editor.document.validateRange(new Range(line, endOfLineIndex, line, endOfLineIndex));
editor.setDecorations(annotationDecoration, [decoration]);
this._isAnnotating = true;
}
registerHoverProviders(providers: { details: boolean, changes: boolean }) {
this.unregisterHoverProviders();
if (this._editor === undefined) return;
if (!providers.details && !providers.changes) return;
const subscriptions: Disposable[] = [];
if (providers.changes) {
subscriptions.push(languages.registerHoverProvider({ pattern: this._editor.document.uri.fsPath }, { provideHover: this.provideChangesHover.bind(this) } as HoverProvider));
}
if (providers.details) {
subscriptions.push(languages.registerHoverProvider({ pattern: this._editor.document.uri.fsPath }, { provideHover: this.provideDetailsHover.bind(this) } as HoverProvider));
}
this._hoverProviderDisposable = Disposable.from(...subscriptions);
}
unregisterHoverProviders() {
if (this._hoverProviderDisposable !== undefined) {
this._hoverProviderDisposable.dispose();
this._hoverProviderDisposable = undefined;
}
}
async provideDetailsHover(document: TextDocument, position: Position, token: CancellationToken): Promise<Hover | undefined> {
if (this._editor === undefined || this._editor.document !== document) return undefined;
if (this._currentLine.line !== position.line) return undefined;
const commit = this._currentLine.commit;
if (commit === undefined) return undefined;
const fileAnnotations = this.annotationController.getAnnotationType(this._editor);
// Avoid double annotations if we are showing the whole-file hover blame annotations
if ((fileAnnotations === FileAnnotationType.Gutter && this._config.annotations.file.gutter.hover.details) ||
(fileAnnotations === FileAnnotationType.Hover && this._config.annotations.file.hover.details)) {
return undefined;
}
const state = this.getLineAnnotationState();
const wholeLine = state.annotationType === LineAnnotationType.Hover || (state.annotationType === LineAnnotationType.Trailing && this._config.annotations.line.trailing.hover.wholeLine) ||
fileAnnotations === FileAnnotationType.Hover || (fileAnnotations === FileAnnotationType.Gutter && this._config.annotations.file.gutter.hover.wholeLine);
const range = document.validateRange(new Range(position.line, wholeLine ? 0 : endOfLineIndex, position.line, endOfLineIndex));
if (!wholeLine && range.start.character !== position.character) return undefined;
// Get the full commit message -- since blame only returns the summary
let logCommit = this._currentLine.logCommit;
if (logCommit === undefined && !commit.isUncommitted) {
logCommit = await this.git.getLogCommit(commit.repoPath, commit.uri.fsPath, commit.sha);
if (logCommit !== undefined) {
// Preserve the previous commit from the blame commit
logCommit.previousFileName = commit.previousFileName;
logCommit.previousSha = commit.previousSha;
this._currentLine.logCommit = logCommit;
}
}
const message = Annotations.getHoverMessage(logCommit || commit, this._config.defaultDateFormat, this.git.hasRemotes(commit.repoPath), this._config.blame.file.annotationType);
return new Hover(message, range);
}
async provideChangesHover(document: TextDocument, position: Position, token: CancellationToken): Promise<Hover | undefined> {
if (this._editor === undefined || this._editor.document !== document) return undefined;
if (this._currentLine.line !== position.line) return undefined;
const commit = this._currentLine.commit;
if (commit === undefined) return undefined;
const fileAnnotations = this.annotationController.getAnnotationType(this._editor);
// Avoid double annotations if we are showing the whole-file hover blame annotations
if ((fileAnnotations === FileAnnotationType.Gutter && this._config.annotations.file.gutter.hover.changes) ||
(fileAnnotations === FileAnnotationType.Hover && this._config.annotations.file.hover.changes)) {
return undefined;
}
const state = this.getLineAnnotationState();
const wholeLine = state.annotationType === LineAnnotationType.Hover || (state.annotationType === LineAnnotationType.Trailing && this._config.annotations.line.trailing.hover.wholeLine) ||
fileAnnotations === FileAnnotationType.Hover || (fileAnnotations === FileAnnotationType.Gutter && this._config.annotations.file.gutter.hover.wholeLine);
const range = document.validateRange(new Range(position.line, wholeLine ? 0 : endOfLineIndex, position.line, endOfLineIndex));
if (!wholeLine && range.start.character !== position.character) return undefined;
const hover = await Annotations.changesHover(commit, position.line, this._uri, this.git);
return new Hover(hover.hoverMessage!, range);
}
'use strict';
import { Functions, Objects } from './system';
import { CancellationToken, debug, DecorationRangeBehavior, DecorationRenderOptions, Disposable, ExtensionContext, Hover, HoverProvider, languages, Position, Range, StatusBarAlignment, StatusBarItem, TextDocument, TextEditor, TextEditorDecorationType, TextEditorSelectionChangeEvent, window, workspace } from 'vscode';
import { AnnotationController, FileAnnotationType } from './annotations/annotationController';
import { Annotations, endOfLineIndex } from './annotations/annotations';
import { Commands } from './commands';
import { TextEditorComparer } from './comparers';
import { IConfig, StatusBarCommand } from './configuration';
import { DocumentSchemes, ExtensionKey, isTextEditor } from './constants';
import { BlameabilityChangeEvent, CommitFormatter, GitCommit, GitCommitLine, GitContextTracker, GitLogCommit, GitService, GitUri, ICommitFormatOptions } from './gitService';
// import { Logger } from './logger';
const annotationDecoration: TextEditorDecorationType = window.createTextEditorDecorationType({
after: {
margin: '0 0 0 3em',
textDecoration: 'none'
},
rangeBehavior: DecorationRangeBehavior.ClosedClosed
} as DecorationRenderOptions);
export enum LineAnnotationType {
Trailing = 'trailing',
Hover = 'hover'
}
export class CurrentLineController extends Disposable {
private _blameable: boolean;
private _blameLineAnnotationState: { enabled: boolean, annotationType: LineAnnotationType, reason: 'user' | 'debugging' } | undefined = undefined;
private _config: IConfig;
private _currentLine: { line: number, commit?: GitCommit, logCommit?: GitLogCommit } = { line: -1 };
private _debugSessionEndDisposable: Disposable | undefined;
private _disposable: Disposable;
private _editor: TextEditor | undefined;
private _hoverProviderDisposable: Disposable | undefined;
private _isAnnotating: boolean = false;
private _statusBarItem: StatusBarItem | undefined;
private _trackCurrentLineDisposable: Disposable | undefined;
private _updateBlameDebounced: (line: number, editor: TextEditor) => Promise<void>;
private _uri: GitUri;
constructor(
context: ExtensionContext,
private readonly git: GitService,
private readonly gitContextTracker: GitContextTracker,
private readonly annotationController: AnnotationController
) {
super(() => this.dispose());
this._updateBlameDebounced = Functions.debounce(this.updateBlame, 250);
this.onConfigurationChanged();
this._disposable = Disposable.from(
workspace.onDidChangeConfiguration(this.onConfigurationChanged, this),
annotationController.onDidToggleAnnotations(this.onFileAnnotationsToggled, this),
debug.onDidStartDebugSession(this.onDebugSessionStarted, this)
);
}
dispose() {
this.clearAnnotations(this._editor, true);
this.unregisterHoverProviders();
this._trackCurrentLineDisposable && this._trackCurrentLineDisposable.dispose();
this._statusBarItem && this._statusBarItem.dispose();
this._debugSessionEndDisposable && this._debugSessionEndDisposable.dispose();
this._disposable && this._disposable.dispose();
}
private onConfigurationChanged() {
const cfg = workspace.getConfiguration().get<IConfig>(ExtensionKey)!;
let changed = false;
let clear = false;
if (!Objects.areEquivalent(cfg.blame.line, this._config && this._config.blame.line)) {
changed = true;
this._blameLineAnnotationState = undefined;
clear = (this._config !== undefined);
}
if (!Objects.areEquivalent(cfg.annotations.line.trailing, this._config && this._config.annotations.line.trailing) ||
!Objects.areEquivalent(cfg.annotations.line.hover, this._config && this._config.annotations.line.hover) ||
!Objects.areEquivalent(cfg.theme.annotations.line.trailing, this._config && this._config.theme.annotations.line.trailing)) {
changed = true;
clear = (this._config !== undefined);
}
if (!Objects.areEquivalent(cfg.statusBar, this._config && this._config.statusBar)) {
changed = true;
if (cfg.statusBar.enabled) {
const alignment = cfg.statusBar.alignment !== 'left' ? StatusBarAlignment.Right : StatusBarAlignment.Left;
if (this._statusBarItem !== undefined && this._statusBarItem.alignment !== alignment) {
this._statusBarItem.dispose();
this._statusBarItem = undefined;
}
this._statusBarItem = this._statusBarItem || window.createStatusBarItem(alignment, alignment === StatusBarAlignment.Right ? 1000 : 0);
this._statusBarItem.command = cfg.statusBar.command;
}
else if (!cfg.statusBar.enabled && this._statusBarItem) {
this._statusBarItem.dispose();
this._statusBarItem = undefined;
}
}
this._config = cfg;
if (!changed) return;
if (clear) {
this.clearAnnotations(this._editor);
}
const trackCurrentLine = cfg.statusBar.enabled || cfg.blame.line.enabled || (this._blameLineAnnotationState !== undefined && this._blameLineAnnotationState.enabled);
if (trackCurrentLine && !this._trackCurrentLineDisposable) {
this._trackCurrentLineDisposable = Disposable.from(
window.onDidChangeActiveTextEditor(Functions.debounce(this.onActiveTextEditorChanged, 50), this),
window.onDidChangeTextEditorSelection(this.onTextEditorSelectionChanged, this),
this.gitContextTracker.onDidChangeBlameability(this.onBlameabilityChanged, this)
);
}
else if (!trackCurrentLine && this._trackCurrentLineDisposable) {
this._trackCurrentLineDisposable.dispose();
this._trackCurrentLineDisposable = undefined;
}
this.refresh(window.activeTextEditor);
}
private onActiveTextEditorChanged(editor: TextEditor | undefined) {
if (this._editor === editor) return;
if (editor !== undefined && !isTextEditor(editor)) return;
// Logger.log('CurrentLineController.onActiveTextEditorChanged', editor && editor.document.uri.fsPath);
this.refresh(editor);
}
private onBlameabilityChanged(e: BlameabilityChangeEvent) {
if (!this._blameable && !e.blameable) return;
this._blameable = e.blameable;
if (!e.blameable || this._editor === undefined) {
this.clear(e.editor);
return;
}
// Make sure this is for the editor we are tracking
if (!TextEditorComparer.equals(this._editor, e.editor)) return;
this._updateBlameDebounced(this._editor.selection.active.line, this._editor);
}
private onDebugSessionStarted() {
const state = this.getLineAnnotationState();
if (!state.enabled) return;
this._debugSessionEndDisposable = debug.onDidTerminateDebugSession(this.onDebugSessionEnded, this);
this.toggleAnnotations(window.activeTextEditor, state.annotationType, 'debugging');
}
private onDebugSessionEnded() {
this._debugSessionEndDisposable && this._debugSessionEndDisposable.dispose();
this._debugSessionEndDisposable = undefined;
if (this._blameLineAnnotationState === undefined || this._blameLineAnnotationState.enabled || this._blameLineAnnotationState.reason !== 'debugging') return;
this.toggleAnnotations(window.activeTextEditor, this._blameLineAnnotationState.annotationType);
}
private onFileAnnotationsToggled() {
this.refresh(window.activeTextEditor);
}
private async onTextEditorSelectionChanged(e: TextEditorSelectionChangeEvent): Promise<void> {
// Make sure this is for the editor we are tracking
if (!this._blameable || !TextEditorComparer.equals(this._editor, e.textEditor)) return;
const line = e.selections[0].active.line;
if (line === this._currentLine.line) return;
this._currentLine.line = line;
this._currentLine.commit = undefined;
this._currentLine.logCommit = undefined;
if (this._uri === undefined && e.textEditor !== undefined) {
this._uri = await GitUri.fromUri(e.textEditor.document.uri, this.git);
}
this.clearAnnotations(e.textEditor);
this._updateBlameDebounced(line, e.textEditor);
}
private getLineAnnotationState() {
return this._blameLineAnnotationState !== undefined ? this._blameLineAnnotationState : this._config.blame.line;
}
private isEditorBlameable(editor: TextEditor | undefined): boolean {
if (editor === undefined || editor.document === undefined) return false;
if (!this.git.isTrackable(editor.document.uri)) return false;
if (editor.document.isUntitled && editor.document.uri.scheme === DocumentSchemes.File) return false;
return this.git.isEditorBlameable(editor);
}
private async updateBlame(line: number, editor: TextEditor) {
this._currentLine.line = line;
this._currentLine.commit = undefined;
this._currentLine.logCommit = undefined;
let commit: GitCommit | undefined = undefined;
let commitLine: GitCommitLine | undefined = undefined;
// Since blame information isn't valid when there are unsaved changes -- don't show any status
if (this._blameable && line >= 0) {
const blameLine = await this.git.getBlameForLine(this._uri, line);
commitLine = blameLine === undefined ? undefined : blameLine.line;
commit = blameLine === undefined ? undefined : blameLine.commit;
}
this._currentLine.commit = commit;
if (commit !== undefined && commitLine !== undefined) {
this.show(commit, commitLine, editor, line);
}
else {
this.clear(editor);
}
}
async clear(editor: TextEditor | undefined) {
this.unregisterHoverProviders();
this.clearAnnotations(editor, true);
this._statusBarItem && this._statusBarItem.hide();
}
private async clearAnnotations(editor: TextEditor | undefined, force: boolean = false) {
if (editor === undefined || (!this._isAnnotating && !force)) return;
editor.setDecorations(annotationDecoration, []);
this._isAnnotating = false;
if (!force) return;
// I have no idea why the decorators sometimes don't get removed, but if they don't try again with a tiny delay
await Functions.wait(1);
editor.setDecorations(annotationDecoration, []);
}
async refresh(editor?: TextEditor) {
this._currentLine.line = -1;
this.clearAnnotations(this._editor);
if (editor === undefined || !this.isEditorBlameable(editor)) {
this.clear(editor);
this._editor = undefined;
return;
}
this._blameable = editor !== undefined && editor.document !== undefined && !editor.document.isDirty;
this._editor = editor;
this._uri = await GitUri.fromUri(editor.document.uri, this.git);
const maxLines = this._config.advanced.caching.maxLines;
// If caching is on and the file is small enough -- kick off a blame for the whole file
if (this._config.advanced.caching.enabled && (maxLines <= 0 || editor.document.lineCount <= maxLines)) {
this.git.getBlameForFile(this._uri);
}
const state = this.getLineAnnotationState();
if (state.enabled && this._blameable) {
const cfg = this._config.annotations.line;
this.registerHoverProviders(state.annotationType === LineAnnotationType.Trailing ? cfg.trailing.hover : cfg.hover);
}
else {
this.unregisterHoverProviders();
}
this._updateBlameDebounced(editor.selection.active.line, editor);
}
async show(commit: GitCommit, blameLine: GitCommitLine, editor: TextEditor, line: number) {
// I have no idea why I need this protection -- but it happens
if (editor.document === undefined) return;
this.updateStatusBar(commit);
this.updateTrailingAnnotation(commit, blameLine, editor, line);
}
async showAnnotations(editor: TextEditor | undefined, type: LineAnnotationType, reason: 'user' | 'debugging' = 'user') {
if (editor === undefined) return;
const state = this.getLineAnnotationState();
if (!state.enabled || state.annotationType !== type) {
this._blameLineAnnotationState = { enabled: true, annotationType: type, reason: reason };
await this.clearAnnotations(editor);
await this.updateBlame(editor.selection.active.line, editor);
}
}
async toggleAnnotations(editor: TextEditor | undefined, type: LineAnnotationType, reason: 'user' | 'debugging' = 'user') {
if (editor === undefined) return;
const state = this.getLineAnnotationState();
this._blameLineAnnotationState = { enabled: !state.enabled, annotationType: type, reason: reason };
await this.clearAnnotations(editor);
await this.updateBlame(editor.selection.active.line, editor);
}
private updateStatusBar(commit: GitCommit) {
const cfg = this._config.statusBar;
if (!cfg.enabled || this._statusBarItem === undefined) return;
this._statusBarItem.text = `$(git-commit) ${CommitFormatter.fromTemplate(cfg.format, commit, {
truncateMessageAtNewLine: true,
dateFormat: cfg.dateFormat === null ? this._config.defaultDateFormat : cfg.dateFormat
} as ICommitFormatOptions)}`;
switch (cfg.command) {
case StatusBarCommand.ToggleFileBlame:
this._statusBarItem.tooltip = 'Toggle Blame Annotations';
break;
case StatusBarCommand.DiffWithPrevious:
this._statusBarItem.command = Commands.DiffLineWithPrevious;
this._statusBarItem.tooltip = 'Compare Line Revision with Previous';
break;
case StatusBarCommand.DiffWithWorking:
this._statusBarItem.command = Commands.DiffLineWithWorking;
this._statusBarItem.tooltip = 'Compare Line Revision with Working';
break;
case StatusBarCommand.ToggleCodeLens:
this._statusBarItem.tooltip = 'Toggle Git CodeLens';
break;
case StatusBarCommand.ShowQuickCommitDetails:
this._statusBarItem.tooltip = 'Show Commit Details';
break;
case StatusBarCommand.ShowQuickCommitFileDetails:
this._statusBarItem.tooltip = 'Show Line Commit Details';
break;
case StatusBarCommand.ShowQuickFileHistory:
this._statusBarItem.tooltip = 'Show File History';
break;
case StatusBarCommand.ShowQuickCurrentBranchHistory:
this._statusBarItem.tooltip = 'Show Branch History';
break;
}
this._statusBarItem.show();
}
private async updateTrailingAnnotation(commit: GitCommit, blameLine: GitCommitLine, editor: TextEditor, line?: number) {
const state = this.getLineAnnotationState();
if (!state.enabled || state.annotationType !== LineAnnotationType.Trailing) return;
line = line === undefined ? blameLine.line : line;
const cfg = this._config.annotations.line.trailing;
const decoration = Annotations.trailing(commit, cfg.format, cfg.dateFormat === null ? this._config.defaultDateFormat : cfg.dateFormat, this._config.theme);
decoration.range = editor.document.validateRange(new Range(line, endOfLineIndex, line, endOfLineIndex));
editor.setDecorations(annotationDecoration, [decoration]);
this._isAnnotating = true;
}
registerHoverProviders(providers: { details: boolean, changes: boolean }) {
this.unregisterHoverProviders();
if (this._editor === undefined) return;
if (!providers.details && !providers.changes) return;
const subscriptions: Disposable[] = [];
if (providers.changes) {
subscriptions.push(languages.registerHoverProvider({ pattern: this._editor.document.uri.fsPath }, { provideHover: this.provideChangesHover.bind(this) } as HoverProvider));
}
if (providers.details) {
subscriptions.push(languages.registerHoverProvider({ pattern: this._editor.document.uri.fsPath }, { provideHover: this.provideDetailsHover.bind(this) } as HoverProvider));
}
this._hoverProviderDisposable = Disposable.from(...subscriptions);
}
unregisterHoverProviders() {
if (this._hoverProviderDisposable !== undefined) {
this._hoverProviderDisposable.dispose();
this._hoverProviderDisposable = undefined;
}
}
async provideDetailsHover(document: TextDocument, position: Position, token: CancellationToken): Promise<Hover | undefined> {
if (this._editor === undefined || this._editor.document !== document) return undefined;
if (this._currentLine.line !== position.line) return undefined;
const commit = this._currentLine.commit;
if (commit === undefined) return undefined;
const fileAnnotations = this.annotationController.getAnnotationType(this._editor);
// Avoid double annotations if we are showing the whole-file hover blame annotations
if ((fileAnnotations === FileAnnotationType.Gutter && this._config.annotations.file.gutter.hover.details) ||
(fileAnnotations === FileAnnotationType.Hover && this._config.annotations.file.hover.details)) {
return undefined;
}
const state = this.getLineAnnotationState();
const wholeLine = state.annotationType === LineAnnotationType.Hover || (state.annotationType === LineAnnotationType.Trailing && this._config.annotations.line.trailing.hover.wholeLine) ||
fileAnnotations === FileAnnotationType.Hover || (fileAnnotations === FileAnnotationType.Gutter && this._config.annotations.file.gutter.hover.wholeLine);
const range = document.validateRange(new Range(position.line, wholeLine ? 0 : endOfLineIndex, position.line, endOfLineIndex));
if (!wholeLine && range.start.character !== position.character) return undefined;
// Get the full commit message -- since blame only returns the summary
let logCommit = this._currentLine.logCommit;
if (logCommit === undefined && !commit.isUncommitted) {
logCommit = await this.git.getLogCommit(commit.repoPath, commit.uri.fsPath, commit.sha);
if (logCommit !== undefined) {
// Preserve the previous commit from the blame commit
logCommit.previousFileName = commit.previousFileName;
logCommit.previousSha = commit.previousSha;
this._currentLine.logCommit = logCommit;
}
}
const message = Annotations.getHoverMessage(logCommit || commit, this._config.defaultDateFormat, this.git.hasRemotes(commit.repoPath), this._config.blame.file.annotationType);
return new Hover(message, range);
}
async provideChangesHover(document: TextDocument, position: Position, token: CancellationToken): Promise<Hover | undefined> {
if (this._editor === undefined || this._editor.document !== document) return undefined;
if (this._currentLine.line !== position.line) return undefined;
const commit = this._currentLine.commit;
if (commit === undefined) return undefined;
const fileAnnotations = this.annotationController.getAnnotationType(this._editor);
// Avoid double annotations if we are showing the whole-file hover blame annotations
if ((fileAnnotations === FileAnnotationType.Gutter && this._config.annotations.file.gutter.hover.changes) ||
(fileAnnotations === FileAnnotationType.Hover && this._config.annotations.file.hover.changes)) {
return undefined;
}
const state = this.getLineAnnotationState();
const wholeLine = state.annotationType === LineAnnotationType.Hover || (state.annotationType === LineAnnotationType.Trailing && this._config.annotations.line.trailing.hover.wholeLine) ||
fileAnnotations === FileAnnotationType.Hover || (fileAnnotations === FileAnnotationType.Gutter && this._config.annotations.file.gutter.hover.wholeLine);
const range = document.validateRange(new Range(position.line, wholeLine ? 0 : endOfLineIndex, position.line, endOfLineIndex));
if (!wholeLine && range.start.character !== position.character) return undefined;
const hover = await Annotations.changesHover(commit, position.line, this._uri, this.git);
return new Hover(hover.hoverMessage!, range);
}
}

+ 3
- 1
src/git/gitContextTracker.ts Просмотреть файл

@ -44,7 +44,9 @@ export class GitContextTracker extends Disposable {
private _disposable: Disposable | undefined;
private _gitEnabled: boolean;
constructor(private git: GitService) {
constructor(
private readonly git: GitService
) {
super(() => this.dispose());
this.onConfigurationChanged();

+ 6
- 1
src/git/models/branch.ts Просмотреть файл

@ -7,7 +7,12 @@ export class GitBranch {
remote: boolean;
tracking?: string;
constructor(public readonly repoPath: string, branch: string, current: boolean = false, tracking?: string) {
constructor(
public readonly repoPath: string,
branch: string,
current: boolean = false,
tracking?: string
) {
if (branch.startsWith('remotes/')) {
branch = branch.substring(8);
this.remote = true;

+ 5
- 1
src/git/models/diff.ts Просмотреть файл

@ -15,7 +15,11 @@ export class GitDiffChunk {
private _chunk: string | undefined;
private _lines: GitDiffChunkLine[] | undefined;
constructor(chunk: string, public currentPosition: { start: number, end: number }, public previousPosition: { start: number, end: number }) {
constructor(
chunk: string,
public currentPosition: { start: number, end: number },
public previousPosition: { start: number, end: number }
) {
this._chunk = chunk;
}

+ 3
- 1
src/git/models/repository.ts Просмотреть файл

@ -12,7 +12,9 @@ export class RepositoryChangeEvent {
readonly changes: RepositoryChange[] = [];
constructor(public repository?: Repository) { }
constructor(
public repository?: Repository
) { }
changed(change: RepositoryChange, solely: boolean = false) {
if (solely) return this.changes.length === 1 && this.changes[0] === change;

+ 9
- 1
src/git/models/status.ts Просмотреть файл

@ -38,7 +38,15 @@ export class GitStatusFile implements IGitStatusFile {
originalFileName?: string;
constructor(public repoPath: string, public status: GitStatusFileStatus, public workTreeStatus: GitStatusFileStatus, public indexStatus: GitStatusFileStatus, public fileName: string, public staged: boolean, originalFileName?: string) {
constructor(
public repoPath: string,
public status: GitStatusFileStatus,
public workTreeStatus: GitStatusFileStatus,
public indexStatus: GitStatusFileStatus,
public fileName: string,
public staged: boolean,
originalFileName?: string
) {
this.originalFileName = originalFileName;
}

+ 6
- 1
src/git/remotes/bitbucket-server.ts Просмотреть файл

@ -4,7 +4,12 @@ import { RemoteProvider } from './provider';
export class BitbucketServerService extends RemoteProvider {
constructor(domain: string, path: string, name?: string, custom: boolean = false) {
constructor(
domain: string,
path: string,
name?: string,
custom: boolean = false
) {
super(domain, path, name, custom);
}

+ 6
- 1
src/git/remotes/bitbucket.ts Просмотреть файл

@ -4,7 +4,12 @@ import { RemoteProvider } from './provider';
export class BitbucketService extends RemoteProvider {
constructor(domain: string, path: string, name?: string, custom: boolean = false) {
constructor(
domain: string,
path: string,
name?: string,
custom: boolean = false
) {
super(domain, path, name, custom);
}

+ 5
- 1
src/git/remotes/custom.ts Просмотреть файл

@ -6,7 +6,11 @@ import { RemoteProvider } from './provider';
export class CustomService extends RemoteProvider {
constructor(domain: string, path: string, private readonly config: IRemotesConfig) {
constructor(
domain: string,
path: string,
private readonly config: IRemotesConfig
) {
super(domain, path, config.name, true);
}

+ 6
- 1
src/git/remotes/github.ts Просмотреть файл

@ -4,7 +4,12 @@ import { RemoteProvider } from './provider';
export class GitHubService extends RemoteProvider {
constructor(domain: string, path: string, name?: string, custom: boolean = false) {
constructor(
domain: string,
path: string,
name?: string,
custom: boolean = false
) {
super(domain, path, name, custom);
}

+ 6
- 1
src/git/remotes/gitlab.ts Просмотреть файл

@ -4,7 +4,12 @@ import { RemoteProvider } from './provider';
export class GitLabService extends RemoteProvider {
constructor(domain: string, path: string, name?: string, custom: boolean = false) {
constructor(
domain: string,
path: string,
name?: string,
custom: boolean = false
) {
super(domain, path, name, custom);
}

+ 5
- 1
src/git/remotes/visualStudio.ts Просмотреть файл

@ -4,7 +4,11 @@ import { RemoteProvider } from './provider';
export class VisualStudioService extends RemoteProvider {
constructor(domain: string, path: string, name?: string) {
constructor(
domain: string,
path: string,
name?: string
) {
super(domain, path, name);
}

+ 14
- 11
src/gitCodeLensProvider.ts Просмотреть файл

@ -10,11 +10,11 @@ import { Logger } from './logger';
export class GitRecentChangeCodeLens extends CodeLens {
constructor(
public symbolKind: SymbolKind,
public uri: GitUri | undefined,
private blame: (() => GitBlameLines | undefined) | undefined,
public blameRange: Range,
public isFullRange: boolean,
public readonly symbolKind: SymbolKind,
public readonly uri: GitUri | undefined,
private readonly blame: (() => GitBlameLines | undefined) | undefined,
public readonly blameRange: Range,
public readonly isFullRange: boolean,
range: Range,
public dirty: boolean
) {
@ -29,11 +29,11 @@ export class GitRecentChangeCodeLens extends CodeLens {
export class GitAuthorsCodeLens extends CodeLens {
constructor(
public symbolKind: SymbolKind,
public uri: GitUri | undefined,
private blame: () => GitBlameLines | undefined,
public blameRange: Range,
public isFullRange: boolean,
public readonly symbolKind: SymbolKind,
public readonly uri: GitUri | undefined,
private readonly blame: () => GitBlameLines | undefined,
public readonly blameRange: Range,
public readonly isFullRange: boolean,
range: Range
) {
super(range);
@ -55,7 +55,10 @@ export class GitCodeLensProvider implements CodeLensProvider {
private _config: IConfig;
constructor(context: ExtensionContext, private git: GitService) {
constructor(
context: ExtensionContext,
private readonly git: GitService
) {
this._config = workspace.getConfiguration().get<IConfig>(ExtensionKey)!;
}

+ 4
- 1
src/gitContentProvider.ts Просмотреть файл

@ -9,7 +9,10 @@ export class GitContentProvider implements TextDocumentContentProvider {
static scheme = DocumentSchemes.GitLensGit;
constructor(context: ExtensionContext, private git: GitService) { }
constructor(
context: ExtensionContext,
private readonly git: GitService
) { }
async provideTextDocumentContent(uri: Uri, token: CancellationToken): Promise<string | undefined> {
const data = GitService.fromGitContentUri(uri);

+ 12
- 2
src/gitRevisionCodeLensProvider.ts Просмотреть файл

@ -7,14 +7,24 @@ import { GitCommit, GitService, GitUri } from './gitService';
export class GitDiffWithWorkingCodeLens extends CodeLens {
constructor(git: GitService, public fileName: string, public commit: GitCommit, range: Range) {
constructor(
git: GitService,
public fileName: string,
public commit: GitCommit,
range: Range
) {
super(range);
}
}
export class GitDiffWithPreviousCodeLens extends CodeLens {
constructor(git: GitService, public fileName: string, public commit: GitCommit, range: Range) {
constructor(
git: GitService,
public fileName: string,
public commit: GitCommit,
range: Range
) {
super(range);
}
}

+ 6
- 2
src/gitService.ts Просмотреть файл

@ -20,14 +20,18 @@ export * from './git/gitContextTracker';
class UriCacheEntry {
constructor(public readonly uri: GitUri) { }
constructor(
public readonly uri: GitUri
) { }
}
class GitCacheEntry {
private cache: Map<string, CachedBlame | CachedDiff | CachedLog> = new Map();
constructor(public readonly key: string) { }
constructor(
public readonly key: string
) { }
get hasErrors(): boolean {
return Iterables.every(this.cache.values(), entry => entry.errorMessage !== undefined);

+ 3
- 1
src/keyboard.ts Просмотреть файл

@ -29,7 +29,9 @@ let _instance: Keyboard;
export class KeyboardScope extends Disposable {
constructor(private mapping: KeyMapping) {
constructor(
private readonly mapping: KeyMapping
) {
super(() => this.dispose());
for (const key in mapping) {

+ 3
- 1
src/quickPicks/branches.ts Просмотреть файл

@ -10,7 +10,9 @@ export class BranchQuickPickItem implements QuickPickItem {
description: string;
detail: string;
constructor(public branch: GitBranch) {
constructor(
public readonly branch: GitBranch
) {
this.label = `${branch.current ? `$(check)${GlyphChars.Space}` : GlyphChars.Space.repeat(4)} ${branch.name}`;
this.description = branch.remote ? `${GlyphChars.Space.repeat(2)} remote branch` : '';
}

+ 13
- 3
src/quickPicks/commitDetails.ts Просмотреть файл

@ -18,7 +18,10 @@ export class CommitWithFileStatusQuickPickItem extends OpenFileCommandQuickPickI
shortSha: string;
status: GitStatusFileStatus;
constructor(commit: GitCommit, status: IGitStatusFile) {
constructor(
commit: GitCommit,
status: IGitStatusFile
) {
const octicon = getGitStatusOcticon(status.status);
const description = GitStatusFile.getFormattedDirectory(status, true);
@ -65,7 +68,11 @@ export class CommitWithFileStatusQuickPickItem extends OpenFileCommandQuickPickI
export class OpenCommitFilesCommandQuickPickItem extends OpenFilesCommandQuickPickItem {
constructor(commit: GitLogCommit, versioned: boolean = false, item?: QuickPickItem) {
constructor(
commit: GitLogCommit,
versioned: boolean = false,
item?: QuickPickItem
) {
const repoPath = commit.repoPath;
const uris = commit.fileStatuses
.filter(s => s.status !== 'D')
@ -81,7 +88,10 @@ export class OpenCommitFilesCommandQuickPickItem extends OpenFilesCommandQuickPi
export class OpenCommitFileRevisionsCommandQuickPickItem extends OpenFilesCommandQuickPickItem {
constructor(commit: GitLogCommit, item?: QuickPickItem) {
constructor(
commit: GitLogCommit,
item?: QuickPickItem
) {
const uris = commit.fileStatuses
.filter(s => s.status !== 'D')
.map(s => GitService.toGitContentUri(commit.sha, s.fileName, commit.repoPath, s.originalFileName));

+ 8
- 2
src/quickPicks/commitFileDetails.ts Просмотреть файл

@ -11,7 +11,10 @@ import * as path from 'path';
export class OpenCommitFileCommandQuickPickItem extends OpenFileCommandQuickPickItem {
constructor(commit: GitLogCommit, item?: QuickPickItem) {
constructor(
commit: GitLogCommit,
item?: QuickPickItem
) {
const uri = Uri.file(path.resolve(commit.repoPath, commit.fileName));
super(uri, item || {
label: `$(file-symlink-file) Open File`,
@ -22,7 +25,10 @@ export class OpenCommitFileCommandQuickPickItem extends OpenFileCommandQuickPick
export class OpenCommitFileRevisionCommandQuickPickItem extends OpenFileCommandQuickPickItem {
constructor(commit: GitLogCommit, item?: QuickPickItem) {
constructor(
commit: GitLogCommit,
item?: QuickPickItem
) {
let description: string;
let uri: Uri;
if (commit.status === 'D') {

+ 9
- 2
src/quickPicks/remotes.ts Просмотреть файл

@ -12,7 +12,10 @@ export class OpenRemoteCommandQuickPickItem extends CommandQuickPickItem {
private remote: GitRemote;
private resource: RemoteResource;
constructor(remote: GitRemote, resource: RemoteResource) {
constructor(
remote: GitRemote,
resource: RemoteResource
) {
super({
label: `$(link-external) Open ${getNameFromRemoteResource(resource)} in ${remote.provider!.name}`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(repo) ${remote.provider!.path}`
@ -29,7 +32,11 @@ export class OpenRemoteCommandQuickPickItem extends CommandQuickPickItem {
export class OpenRemotesCommandQuickPickItem extends CommandQuickPickItem {
constructor(remotes: GitRemote[], resource: RemoteResource, goBackCommand?: CommandQuickPickItem) {
constructor(
remotes: GitRemote[],
resource: RemoteResource,
goBackCommand?: CommandQuickPickItem
) {
const name = getNameFromRemoteResource(resource);
let description = '';

+ 8
- 2
src/quickPicks/repoStatus.ts Просмотреть файл

@ -10,7 +10,10 @@ import * as path from 'path';
export class OpenStatusFileCommandQuickPickItem extends OpenFileCommandQuickPickItem {
constructor(status: GitStatusFile, item?: QuickPickItem) {
constructor(
status: GitStatusFile,
item?: QuickPickItem
) {
const octicon = status.getOcticon();
const description = status.getFormattedDirectory(true);
@ -34,7 +37,10 @@ export class OpenStatusFileCommandQuickPickItem extends OpenFileCommandQuickPick
export class OpenStatusFilesCommandQuickPickItem extends CommandQuickPickItem {
constructor(statuses: GitStatusFile[], item?: QuickPickItem) {
constructor(
statuses: GitStatusFile[],
item?: QuickPickItem
) {
const uris = statuses.map(f => f.Uri);
super(item || {

+ 16
- 4
src/views/explorerNode.ts Просмотреть файл

@ -34,7 +34,9 @@ export abstract class ExplorerNode extends Disposable {
protected children: ExplorerNode[] | undefined;
protected disposable: Disposable | undefined;
constructor(public readonly uri: GitUri) {
constructor(
public readonly uri: GitUri
) {
super(() => this.dispose());
}
@ -66,7 +68,9 @@ export class MessageNode extends ExplorerNode {
readonly resourceType: ResourceType = 'gitlens:message';
constructor(private message: string) {
constructor(
private readonly message: string
) {
super(new GitUri());
}
@ -86,7 +90,11 @@ export class PagerNode extends ExplorerNode {
readonly resourceType: ResourceType = 'gitlens:pager';
args: RefreshNodeCommandArgs = {};
constructor(private message: string, private node: ExplorerNode, protected readonly context: ExtensionContext) {
constructor(
private readonly message: string,
private readonly node: ExplorerNode,
protected readonly context: ExtensionContext
) {
super(new GitUri());
}
@ -118,7 +126,11 @@ export class ShowAllNode extends PagerNode {
args: RefreshNodeCommandArgs = { maxCount: 0 };
constructor(message: string, node: ExplorerNode, context: ExtensionContext) {
constructor(
message: string,
node: ExplorerNode,
context: ExtensionContext
) {
super(`${message} ${GlyphChars.Space}${GlyphChars.Dash}${GlyphChars.Space} this may take a while`, node, context);
}
}

+ 1
- 1
src/views/fileHistoryNode.ts Просмотреть файл

@ -13,7 +13,7 @@ export class FileHistoryNode extends ExplorerNode {
constructor(
uri: GitUri,
private repo: Repository,
private readonly repo: Repository,
private readonly explorer: GitExplorer
) {
super(uri);

+ 2
- 2
src/views/folderNode.ts Просмотреть файл

@ -20,8 +20,8 @@ export class FolderNode extends ExplorerNode {
constructor(
public readonly repoPath: string,
public folderName: string,
public relativePath: string | undefined,
public readonly folderName: string,
public readonly relativePath: string | undefined,
public readonly root: Arrays.IHierarchicalItem<IFileExplorerNode>,
private readonly config: IGitExplorerConfig
) {

+ 4
- 1
src/views/gitExplorer.ts Просмотреть файл

@ -52,7 +52,10 @@ export class GitExplorer implements TreeDataProvider {
return this._onDidChangeTreeData.event;
}
constructor(public readonly context: ExtensionContext, public readonly git: GitService) {
constructor(
public readonly context: ExtensionContext,
public readonly git: GitService
) {
commands.registerCommand('gitlens.gitExplorer.setAutoRefreshToOn', () => this.setAutoRefresh(this.git.config.gitExplorer.autoRefresh, true), this);
commands.registerCommand('gitlens.gitExplorer.setAutoRefreshToOff', () => this.setAutoRefresh(this.git.config.gitExplorer.autoRefresh, false), this);
commands.registerCommand('gitlens.gitExplorer.setFilesLayoutToAuto', () => this.setFilesLayout(GitExplorerFilesLayout.Auto), this);

+ 1
- 1
src/views/historyNode.ts Просмотреть файл

@ -11,7 +11,7 @@ export class HistoryNode extends ExplorerNode {
constructor(
uri: GitUri,
private repo: Repository,
private readonly repo: Repository,
private readonly explorer: GitExplorer
) {
super(uri);

+ 1
- 1
src/views/repositoryNode.ts Просмотреть файл

@ -17,7 +17,7 @@ export class RepositoryNode extends ExplorerNode {
constructor(
uri: GitUri,
private repo: Repository,
private readonly repo: Repository,
private readonly explorer: GitExplorer
) {
super(uri);

+ 1
- 1
src/views/statusFileCommitsNode.ts Просмотреть файл

@ -13,7 +13,7 @@ export class StatusFileCommitsNode extends ExplorerNode {
constructor(
public readonly repoPath: string,
public readonly status: IGitStatusFile,
public commits: GitLogCommit[],
public readonly commits: GitLogCommit[],
protected readonly context: ExtensionContext,
protected readonly git: GitService,
public readonly branch?: GitBranch

+ 2
- 2
src/views/statusNode.ts Просмотреть файл

@ -12,8 +12,8 @@ export class StatusNode extends ExplorerNode {
constructor(
uri: GitUri,
private repo: Repository,
private parent: ExplorerNode,
private readonly repo: Repository,
private readonly parent: ExplorerNode,
private readonly explorer: GitExplorer
) {
super(uri);

Загрузка…
Отмена
Сохранить