From 52e9441aea2519f0bfdd43eaafa45acdb53b20f5 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 15 Jan 2018 22:32:11 -0500 Subject: [PATCH] Moves config interfaces into single file --- src/annotations/annotationController.ts | 9 +- src/annotations/annotationProvider.ts | 2 +- src/annotations/annotations.ts | 2 +- src/annotations/blameAnnotationProvider.ts | 2 +- src/annotations/gutterBlameAnnotationProvider.ts | 3 +- src/annotations/heatmapBlameAnnotationProvider.ts | 2 +- src/annotations/hoverBlameAnnotationProvider.ts | 2 +- src/annotations/recentChangesAnnotationProvider.ts | 2 +- src/commands/openFileRevision.ts | 2 +- src/commands/openWorkingFile.ts | 2 +- src/commands/showFileBlame.ts | 3 +- src/commands/showLineBlame.ts | 3 +- src/commands/toggleFileBlame.ts | 3 +- src/commands/toggleFileHeatmap.ts | 2 +- src/commands/toggleFileRecentChanges.ts | 2 +- src/commands/toggleLineBlame.ts | 3 +- src/config.ts | 335 +++++++++++++++++++++ src/configuration.ts | 320 +------------------- src/currentLineController.ts | 8 +- src/extension.ts | 2 +- src/logger.ts | 8 +- src/views/gitExplorer.ts | 8 +- 22 files changed, 359 insertions(+), 366 deletions(-) create mode 100644 src/config.ts diff --git a/src/annotations/annotationController.ts b/src/annotations/annotationController.ts index 2f00b82..da5a51b 100644 --- a/src/annotations/annotationController.ts +++ b/src/annotations/annotationController.ts @@ -2,7 +2,7 @@ import { Functions, Iterables } from '../system'; import { ConfigurationChangeEvent, DecorationRangeBehavior, DecorationRenderOptions, Disposable, Event, EventEmitter, OverviewRulerLane, Progress, ProgressLocation, TextDocument, TextEditor, TextEditorDecorationType, TextEditorViewColumnChangeEvent, ThemeColor, window, workspace } from 'vscode'; import { AnnotationProviderBase, TextEditorCorrelationKey } from './annotationProvider'; -import { configuration, IConfig, LineHighlightLocations } from '../configuration'; +import { configuration, FileAnnotationType, IConfig, LineHighlightLocations } from '../configuration'; import { CommandContext, isTextEditor, setCommandContext } from '../constants'; import { Container } from '../container'; import { DocumentBlameStateChangeEvent, DocumentDirtyStateChangeEvent, GitDocumentState } from '../trackers/documentTracker'; @@ -14,13 +14,6 @@ import { Logger } from '../logger'; import { RecentChangesAnnotationProvider } from './recentChangesAnnotationProvider'; import * as path from 'path'; -export enum FileAnnotationType { - Gutter = 'gutter', - Heatmap = 'heatmap', - Hover = 'hover', - RecentChanges = 'recentChanges' -} - export enum AnnotationClearReason { User = 'User', BlameabilityChanged = 'BlameabilityChanged', diff --git a/src/annotations/annotationProvider.ts b/src/annotations/annotationProvider.ts index 089e1af..0d162f9 100644 --- a/src/annotations/annotationProvider.ts +++ b/src/annotations/annotationProvider.ts @@ -1,7 +1,7 @@ 'use strict'; import { Functions } from '../system'; import { DecorationOptions, Disposable, TextDocument, TextEditor, TextEditorDecorationType, TextEditorSelectionChangeEvent, Uri, window } from 'vscode'; -import { FileAnnotationType } from '../annotations/annotationController'; +import { FileAnnotationType } from '../configuration'; import { TextDocumentComparer } from '../comparers'; import { GitDocumentState, TrackedDocument } from '../trackers/documentTracker'; diff --git a/src/annotations/annotations.ts b/src/annotations/annotations.ts index a9e8c35..26dddcb 100644 --- a/src/annotations/annotations.ts +++ b/src/annotations/annotations.ts @@ -1,7 +1,7 @@ import { Dates, Objects, Strings } from '../system'; import { DecorationInstanceRenderOptions, DecorationOptions, MarkdownString, ThemableDecorationRenderOptions, ThemeColor, window } from 'vscode'; -import { FileAnnotationType } from './annotationController'; import { DiffWithCommand, OpenCommitInRemoteCommand, OpenFileRevisionCommand, ShowQuickCommitDetailsCommand, ShowQuickCommitFileDetailsCommand } from '../commands'; +import { FileAnnotationType } from './../configuration'; import { GlyphChars } from '../constants'; import { Container } from '../container'; import { CommitFormatter, GitCommit, GitDiffChunkLine, GitService, GitUri, ICommitFormatOptions } from '../gitService'; diff --git a/src/annotations/blameAnnotationProvider.ts b/src/annotations/blameAnnotationProvider.ts index 32d5c22..53fb45d 100644 --- a/src/annotations/blameAnnotationProvider.ts +++ b/src/annotations/blameAnnotationProvider.ts @@ -1,9 +1,9 @@ 'use strict'; import { Arrays, Iterables } from '../system'; import { CancellationToken, Disposable, Hover, HoverProvider, languages, Position, Range, TextDocument, TextEditor, TextEditorDecorationType } from 'vscode'; -import { FileAnnotationType } from './annotationController'; import { AnnotationProviderBase } from './annotationProvider'; import { Annotations } from './annotations'; +import { FileAnnotationType } from './../configuration'; import { RangeEndOfLineIndex } from '../constants'; import { Container } from '../container'; import { GitDocumentState, TrackedDocument } from '../trackers/documentTracker'; diff --git a/src/annotations/gutterBlameAnnotationProvider.ts b/src/annotations/gutterBlameAnnotationProvider.ts index 2e04a08..230cbe4 100644 --- a/src/annotations/gutterBlameAnnotationProvider.ts +++ b/src/annotations/gutterBlameAnnotationProvider.ts @@ -1,10 +1,9 @@ 'use strict'; import { Objects, Strings } from '../system'; import { DecorationOptions, DecorationRenderOptions, Range, TextEditorDecorationType, window } from 'vscode'; -import { FileAnnotationType } from './annotationController'; import { Annotations } from './annotations'; import { BlameAnnotationProviderBase } from './blameAnnotationProvider'; -import { GravatarDefaultStyle } from '../configuration'; +import { FileAnnotationType, GravatarDefaultStyle } from '../configuration'; import { GlyphChars } from '../constants'; import { Container } from '../container'; import { GitBlameCommit, ICommitFormatOptions } from '../gitService'; diff --git a/src/annotations/heatmapBlameAnnotationProvider.ts b/src/annotations/heatmapBlameAnnotationProvider.ts index 65189f2..5fecae8 100644 --- a/src/annotations/heatmapBlameAnnotationProvider.ts +++ b/src/annotations/heatmapBlameAnnotationProvider.ts @@ -1,8 +1,8 @@ 'use strict'; import { DecorationOptions, Range } from 'vscode'; -import { FileAnnotationType } from './annotationController'; import { Annotations } from './annotations'; import { BlameAnnotationProviderBase } from './blameAnnotationProvider'; +import { FileAnnotationType } from './../configuration'; import { GitBlameCommit } from '../gitService'; import { Logger } from '../logger'; diff --git a/src/annotations/hoverBlameAnnotationProvider.ts b/src/annotations/hoverBlameAnnotationProvider.ts index 5bc0052..2201a36 100644 --- a/src/annotations/hoverBlameAnnotationProvider.ts +++ b/src/annotations/hoverBlameAnnotationProvider.ts @@ -1,8 +1,8 @@ 'use strict'; import { DecorationOptions, Range } from 'vscode'; -import { FileAnnotationType } from './annotationController'; import { Annotations } from './annotations'; import { BlameAnnotationProviderBase } from './blameAnnotationProvider'; +import { FileAnnotationType } from './../configuration'; import { Container } from '../container'; import { GitBlameCommit } from '../gitService'; import { Logger } from '../logger'; diff --git a/src/annotations/recentChangesAnnotationProvider.ts b/src/annotations/recentChangesAnnotationProvider.ts index 47eb671..f296bbc 100644 --- a/src/annotations/recentChangesAnnotationProvider.ts +++ b/src/annotations/recentChangesAnnotationProvider.ts @@ -1,8 +1,8 @@ 'use strict'; import { DecorationOptions, MarkdownString, Position, Range, TextEditor, TextEditorDecorationType } from 'vscode'; -import { FileAnnotationType } from './annotationController'; import { AnnotationProviderBase } from './annotationProvider'; import { Annotations } from './annotations'; +import { FileAnnotationType } from './../configuration'; import { RangeEndOfLineIndex } from '../constants'; import { Container } from '../container'; import { GitDocumentState, TrackedDocument } from '../trackers/documentTracker'; diff --git a/src/commands/openFileRevision.ts b/src/commands/openFileRevision.ts index c9da35b..55eb0ff 100644 --- a/src/commands/openFileRevision.ts +++ b/src/commands/openFileRevision.ts @@ -1,8 +1,8 @@ 'use strict'; import { Iterables, Strings } from '../system'; import { CancellationTokenSource, Range, TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode'; -import { FileAnnotationType } from '../annotations/annotationController'; import { ActiveEditorCommand, Commands, getCommandUri, openEditor } from './common'; +import { FileAnnotationType } from '../configuration'; import { GlyphChars } from '../constants'; import { Container } from '../container'; import { GitUri } from '../gitService'; diff --git a/src/commands/openWorkingFile.ts b/src/commands/openWorkingFile.ts index 45d50f6..36ff4d8 100644 --- a/src/commands/openWorkingFile.ts +++ b/src/commands/openWorkingFile.ts @@ -1,7 +1,7 @@ 'use strict'; import { Range, TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode'; -import { FileAnnotationType } from '../annotations/annotationController'; import { ActiveEditorCommand, Commands, getCommandUri, openEditor } from './common'; +import { FileAnnotationType } from '../configuration'; import { Container } from '../container'; import { GitUri } from '../gitService'; import { Logger } from '../logger'; diff --git a/src/commands/showFileBlame.ts b/src/commands/showFileBlame.ts index 1427518..d94e942 100644 --- a/src/commands/showFileBlame.ts +++ b/src/commands/showFileBlame.ts @@ -1,8 +1,7 @@ 'use strict'; import { TextEditor, TextEditorEdit, Uri, window } from 'vscode'; -import { FileAnnotationType } from '../annotations/annotationController'; import { Commands, EditorCommand } from './common'; -import { configuration } from '../configuration'; +import { configuration, FileAnnotationType } from '../configuration'; import { Container } from '../container'; import { Logger } from '../logger'; diff --git a/src/commands/showLineBlame.ts b/src/commands/showLineBlame.ts index 0d8fdc6..c91ba7a 100644 --- a/src/commands/showLineBlame.ts +++ b/src/commands/showLineBlame.ts @@ -1,9 +1,8 @@ 'use strict'; import { TextEditor, TextEditorEdit, Uri, window } from 'vscode'; -import { LineAnnotationType } from '../currentLineController'; import { Commands, EditorCommand } from './common'; import { Container } from '../container'; -import { configuration } from '../configuration'; +import { configuration, LineAnnotationType } from '../configuration'; import { Logger } from '../logger'; export interface ShowLineBlameCommandArgs { diff --git a/src/commands/toggleFileBlame.ts b/src/commands/toggleFileBlame.ts index 8e56137..14d1769 100644 --- a/src/commands/toggleFileBlame.ts +++ b/src/commands/toggleFileBlame.ts @@ -1,9 +1,8 @@ 'use strict'; import { TextEditor, TextEditorEdit, Uri, window } from 'vscode'; -import { FileAnnotationType } from '../annotations/annotationController'; import { Commands, EditorCommand } from './common'; import { UriComparer } from '../comparers'; -import { configuration } from '../configuration'; +import { configuration, FileAnnotationType } from '../configuration'; import { Container } from '../container'; import { Logger } from '../logger'; diff --git a/src/commands/toggleFileHeatmap.ts b/src/commands/toggleFileHeatmap.ts index 286724d..ae301ac 100644 --- a/src/commands/toggleFileHeatmap.ts +++ b/src/commands/toggleFileHeatmap.ts @@ -1,8 +1,8 @@ 'use strict'; import { TextEditor, TextEditorEdit, Uri, window } from 'vscode'; -import { FileAnnotationType } from '../annotations/annotationController'; import { Commands, EditorCommand } from './common'; import { UriComparer } from '../comparers'; +import { FileAnnotationType } from '../configuration'; import { Container } from '../container'; import { Logger } from '../logger'; diff --git a/src/commands/toggleFileRecentChanges.ts b/src/commands/toggleFileRecentChanges.ts index b6abe6b..c7e5512 100644 --- a/src/commands/toggleFileRecentChanges.ts +++ b/src/commands/toggleFileRecentChanges.ts @@ -1,8 +1,8 @@ 'use strict'; import { TextEditor, TextEditorEdit, Uri, window } from 'vscode'; -import { FileAnnotationType } from '../annotations/annotationController'; import { Commands, EditorCommand } from './common'; import { UriComparer } from '../comparers'; +import { FileAnnotationType } from '../configuration'; import { Container } from '../container'; import { Logger } from '../logger'; diff --git a/src/commands/toggleLineBlame.ts b/src/commands/toggleLineBlame.ts index 86020f2..52e4f42 100644 --- a/src/commands/toggleLineBlame.ts +++ b/src/commands/toggleLineBlame.ts @@ -1,8 +1,7 @@ 'use strict'; import { TextEditor, TextEditorEdit, Uri, window } from 'vscode'; -import { LineAnnotationType } from '../currentLineController'; import { Commands, EditorCommand } from './common'; -import { configuration } from '../configuration'; +import { configuration, LineAnnotationType } from '../configuration'; import { Container } from '../container'; import { Logger } from '../logger'; diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..933207c --- /dev/null +++ b/src/config.ts @@ -0,0 +1,335 @@ +'use strict'; + +export enum CodeLensCommand { + DiffWithPrevious = 'gitlens.diffWithPrevious', + ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails', + ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails', + ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory', + ShowQuickFileHistory = 'gitlens.showQuickFileHistory', + ToggleFileBlame = 'gitlens.toggleFileBlame' +} + +export enum CodeLensLocations { + Document = 'document', + Containers = 'containers', + Blocks = 'blocks' +} + +export enum CustomRemoteType { + Bitbucket = 'Bitbucket', + BitbucketServer = 'BitbucketServer', + Custom = 'Custom', + GitHub = 'GitHub', + GitLab = 'GitLab' +} + +export enum DateStyle { + Absolute = 'absolute', + Relative = 'relative' +} + +export enum ExplorerFilesLayout { + Auto = 'auto', + List = 'list', + Tree = 'tree' +} + +export enum FileAnnotationType { + Gutter = 'gutter', + Heatmap = 'heatmap', + Hover = 'hover', + RecentChanges = 'recentChanges' +} + +export enum GitExplorerView { + Auto = 'auto', + History = 'history', + Repository = 'repository' +} + +export enum GravatarDefaultStyle { + Faces = 'wavatar', + Geometric = 'identicon', + Monster = 'monsterid', + MysteryMan = 'mm', + Retro = 'retro', + Robot = 'robohash' +} + +export enum KeyMap { + Standard = 'standard', + Chorded = 'chorded', + None = 'none' +} + +export enum LineAnnotationType { + Trailing = 'trailing', + Hover = 'hover' +} + +export enum LineHighlightLocations { + Gutter = 'gutter', + Line = 'line', + OverviewRuler = 'overviewRuler' +} + +export enum OutputLevel { + Silent = 'silent', + Errors = 'errors', + Verbose = 'verbose' +} + +export enum StatusBarCommand { + DiffWithPrevious = 'gitlens.diffWithPrevious', + DiffWithWorking = 'gitlens.diffWithWorking', + ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails', + ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails', + ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory', + ShowQuickFileHistory = 'gitlens.showQuickFileHistory', + ToggleCodeLens = 'gitlens.toggleCodeLens', + ToggleFileBlame = 'gitlens.toggleFileBlame' +} + +export interface IAdvancedConfig { + blame: { + delayAfterEdit: number; + sizeThresholdAfterEdit: number; + }; + caching: { + enabled: boolean; + }; + git: string; + maxListItems: number; + menus: { + explorerContext: { + fileDiff: boolean; + history: boolean; + remote: boolean; + }; + editorContext: { + blame: boolean; + copy: boolean; + details: boolean; + fileDiff: boolean; + history: boolean; + lineDiff: boolean; + remote: boolean; + }; + editorTitle: { + blame: boolean; + fileDiff: boolean; + history: boolean; + status: boolean; + }; + editorTitleContext: { + blame: boolean; + fileDiff: boolean; + history: boolean; + remote: boolean; + }; + }; + messages: { + suppressCommitHasNoPreviousCommitWarning: boolean, + suppressCommitNotFoundWarning: boolean, + suppressFileNotUnderSourceControlWarning: boolean, + suppressGitVersionWarning: boolean, + suppressLineUncommittedWarning: boolean, + suppressNoRepositoryWarning: boolean, + suppressResultsExplorerNotice: boolean, + suppressUpdateNotice: boolean, + suppressWelcomeNotice: boolean + }; + quickPick: { + closeOnFocusOut: boolean; + }; + repositorySearchDepth: number; + telemetry: { + enabled: boolean; + }; +} + +export interface ICodeLensConfig { + enabled: boolean; + recentChange: { + enabled: boolean; + command: CodeLensCommand; + }; + authors: { + enabled: boolean; + command: CodeLensCommand; + }; + locations: CodeLensLocations[]; + customLocationSymbols: string[]; + perLanguageLocations: ICodeLensLanguageLocation[]; + debug: boolean; +} + +export interface ICodeLensLanguageLocation { + language: string | undefined; + locations: CodeLensLocations[]; + customSymbols?: string[]; +} + +export interface IExplorerConfig { + files: { + layout: ExplorerFilesLayout; + compact: boolean; + threshold: number; + }; + commitFormat: string; + commitFileFormat: string; + // dateFormat: string | null; + gravatars: boolean; + showTrackingBranch: boolean; + stashFormat: string; + stashFileFormat: string; + statusFileFormat: string; +} + +export interface IGitExplorerConfig extends IExplorerConfig { + enabled: boolean; + autoRefresh: boolean; + includeWorkingTree: boolean; + showTrackingBranch: boolean; + view: GitExplorerView; +} + +export interface IResultsExplorerConfig extends IExplorerConfig { } + +export interface IRemotesConfig { + type: CustomRemoteType; + domain: string; + name?: string; + protocol?: string; + urls?: IRemotesUrlsConfig; +} + +export interface IRemotesUrlsConfig { + repository: string; + branches: string; + branch: string; + commit: string; + file: string; + fileInBranch: string; + fileInCommit: string; + fileLine: string; + fileRange: string; +} + +export interface IConfig { + annotations: { + file: { + gutter: { + format: string; + dateFormat: string | null; + compact: boolean; + gravatars: boolean; + heatmap: { + enabled: boolean; + location: 'left' | 'right'; + }; + hover: { + details: boolean; + changes: boolean; + wholeLine: boolean; + }; + separateLines: boolean; + }; + + hover: { + details: boolean; + changes: boolean; + heatmap: { + enabled: boolean; + }; + }; + + recentChanges: { + hover: { + details: boolean; + changes: boolean; + }; + }; + }; + + line: { + hover: { + details: boolean; + changes: boolean; + }; + + trailing: { + format: string; + dateFormat: string | null; + hover: { + details: boolean; + changes: boolean; + wholeLine: boolean; + }; + }; + }; + }; + + blame: { + ignoreWhitespace: boolean; + + file: { + annotationType: FileAnnotationType; + lineHighlight: { + enabled: boolean; + locations: LineHighlightLocations[]; + }; + }; + + line: { + enabled: boolean; + annotationType: LineAnnotationType; + }; + }; + + recentChanges: { + file: { + lineHighlight: { + locations: LineHighlightLocations[]; + }; + } + }; + + codeLens: ICodeLensConfig; + + defaultDateFormat: string | null; + defaultDateStyle: DateStyle; + defaultGravatarsStyle: GravatarDefaultStyle; + + gitExplorer: IGitExplorerConfig; + + keymap: KeyMap; + + remotes: IRemotesConfig[]; + + resultsExplorer: IResultsExplorerConfig; + + statusBar: { + enabled: boolean; + alignment: 'left' | 'right'; + command: StatusBarCommand; + format: string; + dateFormat: string | null; + }; + + strings: { + codeLens: { + unsavedChanges: { + recentChangeAndAuthors: string; + recentChangeOnly: string; + authorsOnly: string; + }; + }; + }; + + debug: boolean; + insiders: boolean; + outputLevel: OutputLevel; + + advanced: IAdvancedConfig; +} \ No newline at end of file diff --git a/src/configuration.ts b/src/configuration.ts index 0acd468..e678217 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -1,326 +1,14 @@ 'use strict'; +export * from './config'; +export { ExtensionKey }; + import { Functions } from './system'; import { ConfigurationChangeEvent, ConfigurationTarget, Event, EventEmitter, ExtensionContext, Uri, workspace } from 'vscode'; -import { FileAnnotationType } from './annotations/annotationController'; +import { IConfig, KeyMap } from './config'; import { CommandContext, ExtensionKey, setCommandContext } from './constants'; -import { LineAnnotationType } from './currentLineController'; -import { GitExplorerView } from './views/gitExplorer'; -import { OutputLevel } from './logger'; import { Container } from './container'; import { clearGravatarCache } from './gitService'; -export { ExtensionKey }; - -export enum CodeLensCommand { - DiffWithPrevious = 'gitlens.diffWithPrevious', - ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails', - ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails', - ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory', - ShowQuickFileHistory = 'gitlens.showQuickFileHistory', - ToggleFileBlame = 'gitlens.toggleFileBlame' -} - -export enum CodeLensLocations { - Document = 'document', - Containers = 'containers', - Blocks = 'blocks' -} - -export enum LineHighlightLocations { - Gutter = 'gutter', - Line = 'line', - OverviewRuler = 'overviewRuler' -} - -export enum CustomRemoteType { - Bitbucket = 'Bitbucket', - BitbucketServer = 'BitbucketServer', - Custom = 'Custom', - GitHub = 'GitHub', - GitLab = 'GitLab' -} - -export enum DateStyle { - Absolute = 'absolute', - Relative = 'relative' -} - -export enum ExplorerFilesLayout { - Auto = 'auto', - List = 'list', - Tree = 'tree' -} - -export enum GravatarDefaultStyle { - Faces = 'wavatar', - Geometric = 'identicon', - Monster = 'monsterid', - MysteryMan = 'mm', - Retro = 'retro', - Robot = 'robohash' -} - -export enum KeyMap { - Standard = 'standard', - Chorded = 'chorded', - None = 'none' -} - -export enum StatusBarCommand { - DiffWithPrevious = 'gitlens.diffWithPrevious', - DiffWithWorking = 'gitlens.diffWithWorking', - ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails', - ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails', - ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory', - ShowQuickFileHistory = 'gitlens.showQuickFileHistory', - ToggleCodeLens = 'gitlens.toggleCodeLens', - ToggleFileBlame = 'gitlens.toggleFileBlame' -} - -export interface IAdvancedConfig { - blame: { - delayAfterEdit: number; - sizeThresholdAfterEdit: number; - }; - caching: { - enabled: boolean; - }; - git: string; - maxListItems: number; - menus: { - explorerContext: { - fileDiff: boolean; - history: boolean; - remote: boolean; - }; - editorContext: { - blame: boolean; - copy: boolean; - details: boolean; - fileDiff: boolean; - history: boolean; - lineDiff: boolean; - remote: boolean; - }; - editorTitle: { - blame: boolean; - fileDiff: boolean; - history: boolean; - status: boolean; - }; - editorTitleContext: { - blame: boolean; - fileDiff: boolean; - history: boolean; - remote: boolean; - }; - }; - messages: { - suppressCommitHasNoPreviousCommitWarning: boolean, - suppressCommitNotFoundWarning: boolean, - suppressFileNotUnderSourceControlWarning: boolean, - suppressGitVersionWarning: boolean, - suppressLineUncommittedWarning: boolean, - suppressNoRepositoryWarning: boolean, - suppressResultsExplorerNotice: boolean, - suppressUpdateNotice: boolean, - suppressWelcomeNotice: boolean - }; - quickPick: { - closeOnFocusOut: boolean; - }; - repositorySearchDepth: number; - telemetry: { - enabled: boolean; - }; -} - -export interface ICodeLensConfig { - enabled: boolean; - recentChange: { - enabled: boolean; - command: CodeLensCommand; - }; - authors: { - enabled: boolean; - command: CodeLensCommand; - }; - locations: CodeLensLocations[]; - customLocationSymbols: string[]; - perLanguageLocations: ICodeLensLanguageLocation[]; - debug: boolean; -} - -export interface ICodeLensLanguageLocation { - language: string | undefined; - locations: CodeLensLocations[]; - customSymbols?: string[]; -} - -export interface IExplorerConfig { - files: { - layout: ExplorerFilesLayout; - compact: boolean; - threshold: number; - }; - commitFormat: string; - commitFileFormat: string; - // dateFormat: string | null; - gravatars: boolean; - showTrackingBranch: boolean; - stashFormat: string; - stashFileFormat: string; - statusFileFormat: string; -} - -export interface IGitExplorerConfig extends IExplorerConfig { - enabled: boolean; - autoRefresh: boolean; - includeWorkingTree: boolean; - showTrackingBranch: boolean; - view: GitExplorerView; -} - -export interface IResultsExplorerConfig extends IExplorerConfig { } - -export interface IRemotesConfig { - type: CustomRemoteType; - domain: string; - name?: string; - protocol?: string; - urls?: IRemotesUrlsConfig; -} - -export interface IRemotesUrlsConfig { - repository: string; - branches: string; - branch: string; - commit: string; - file: string; - fileInBranch: string; - fileInCommit: string; - fileLine: string; - fileRange: string; -} - -export interface IConfig { - annotations: { - file: { - gutter: { - format: string; - dateFormat: string | null; - compact: boolean; - gravatars: boolean; - heatmap: { - enabled: boolean; - location: 'left' | 'right'; - }; - hover: { - details: boolean; - changes: boolean; - wholeLine: boolean; - }; - separateLines: boolean; - }; - - hover: { - details: boolean; - changes: boolean; - heatmap: { - enabled: boolean; - }; - }; - - recentChanges: { - hover: { - details: boolean; - changes: boolean; - }; - }; - }; - - line: { - hover: { - details: boolean; - changes: boolean; - }; - - trailing: { - format: string; - dateFormat: string | null; - hover: { - details: boolean; - changes: boolean; - wholeLine: boolean; - }; - }; - }; - }; - - blame: { - ignoreWhitespace: boolean; - - file: { - annotationType: FileAnnotationType; - lineHighlight: { - enabled: boolean; - locations: LineHighlightLocations[]; - }; - }; - - line: { - enabled: boolean; - annotationType: LineAnnotationType; - }; - }; - - recentChanges: { - file: { - lineHighlight: { - locations: LineHighlightLocations[]; - }; - } - }; - - codeLens: ICodeLensConfig; - - defaultDateFormat: string | null; - defaultDateStyle: DateStyle; - defaultGravatarsStyle: GravatarDefaultStyle; - - gitExplorer: IGitExplorerConfig; - - keymap: KeyMap; - - remotes: IRemotesConfig[]; - - resultsExplorer: IResultsExplorerConfig; - - statusBar: { - enabled: boolean; - alignment: 'left' | 'right'; - command: StatusBarCommand; - format: string; - dateFormat: string | null; - }; - - strings: { - codeLens: { - unsavedChanges: { - recentChangeAndAuthors: string; - recentChangeOnly: string; - authorsOnly: string; - }; - }; - }; - - debug: boolean; - insiders: boolean; - outputLevel: OutputLevel; - - advanced: IAdvancedConfig; -} - const emptyConfig: any = new Proxy({} as IConfig, { get(target, propKey, receiver) { return emptyConfig; diff --git a/src/currentLineController.ts b/src/currentLineController.ts index a7caac5..02e1c82 100644 --- a/src/currentLineController.ts +++ b/src/currentLineController.ts @@ -1,10 +1,9 @@ 'use strict'; import { Functions, IDeferrable } from './system'; import { CancellationToken, ConfigurationChangeEvent, debug, DecorationRangeBehavior, DecorationRenderOptions, Disposable, Hover, HoverProvider, languages, Position, Range, StatusBarAlignment, StatusBarItem, TextDocument, TextEditor, TextEditorDecorationType, window } from 'vscode'; -import { FileAnnotationType } from './annotations/annotationController'; import { Annotations } from './annotations/annotations'; import { Commands } from './commands'; -import { configuration, IConfig, StatusBarCommand } from './configuration'; +import { configuration, FileAnnotationType, IConfig, LineAnnotationType, StatusBarCommand } from './configuration'; import { isTextEditor, RangeEndOfLineIndex } from './constants'; import { Container } from './container'; import { DocumentBlameStateChangeEvent, DocumentDirtyIdleTriggerEvent, DocumentDirtyStateChangeEvent, GitDocumentState, TrackedDocument } from './trackers/documentTracker'; @@ -19,11 +18,6 @@ const annotationDecoration: TextEditorDecorationType = window.createTextEditorDe rangeBehavior: DecorationRangeBehavior.ClosedClosed } as DecorationRenderOptions); -export enum LineAnnotationType { - Trailing = 'trailing', - Hover = 'hover' -} - class AnnotationState { constructor(private _enabled: boolean, private _annotationType: LineAnnotationType) { } diff --git a/src/extension.ts b/src/extension.ts index 5a20834..d86f4c8 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -4,12 +4,12 @@ import { ConfigurationTarget, ExtensionContext, extensions, languages, window, w import { configuration, Configuration, IConfig } from './configuration'; import { CommandContext, ExtensionKey, GlobalState, QualifiedExtensionId, setCommandContext } from './constants'; import { configureCommands } from './commands'; +import { Container } from './container'; import { GitContentProvider } from './gitContentProvider'; import { GitRevisionCodeLensProvider } from './gitRevisionCodeLensProvider'; import { GitService } from './gitService'; import { Logger } from './logger'; import { Messages, SuppressedMessages } from './messages'; -import { Container } from './container'; // import { Telemetry } from './telemetry'; // this method is called when your extension is activated diff --git a/src/logger.ts b/src/logger.ts index c340030..6571e1b 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -1,17 +1,11 @@ 'use strict'; import { ConfigurationChangeEvent, ExtensionContext, OutputChannel, window } from 'vscode'; -import { configuration } from './configuration'; +import { configuration, OutputLevel } from './configuration'; import { ExtensionOutputChannelName } from './constants'; // import { Telemetry } from './telemetry'; const ConsolePrefix = `[${ExtensionOutputChannelName}]`; -export enum OutputLevel { - Silent = 'silent', - Errors = 'errors', - Verbose = 'verbose' -} - export class Logger { static debug = false; diff --git a/src/views/gitExplorer.ts b/src/views/gitExplorer.ts index f5d60c1..1e4f6f2 100644 --- a/src/views/gitExplorer.ts +++ b/src/views/gitExplorer.ts @@ -2,7 +2,7 @@ import { Functions } from '../system'; import { commands, ConfigurationChangeEvent, ConfigurationTarget, Disposable, Event, EventEmitter, TextDocumentShowOptions, TextEditor, TreeDataProvider, TreeItem, Uri, window } from 'vscode'; import { UriComparer } from '../comparers'; -import { configuration, ExplorerFilesLayout, IGitExplorerConfig } from '../configuration'; +import { configuration, ExplorerFilesLayout, GitExplorerView, IGitExplorerConfig } from '../configuration'; import { CommandContext, GlyphChars, setCommandContext, WorkspaceState } from '../constants'; import { Container } from '../container'; import { RefreshNodeCommandArgs } from './explorerCommands'; @@ -12,12 +12,6 @@ import { Logger } from '../logger'; export * from './explorerNodes'; -export enum GitExplorerView { - Auto = 'auto', - History = 'history', - Repository = 'repository' -} - export interface OpenFileRevisionCommandArgs { uri?: Uri; showOptions?: TextDocumentShowOptions;