Browse Source

Changes to const enums for better tree shaking

main
Eric Amodio 3 years ago
parent
commit
fc99c2754c
16 changed files with 47 additions and 47 deletions
  1. +1
    -1
      src/annotations/annotationProvider.ts
  2. +1
    -1
      src/annotations/fileAnnotationController.ts
  3. +2
    -2
      src/commands/common.ts
  4. +21
    -21
      src/config.ts
  5. +9
    -9
      src/constants.ts
  6. +1
    -1
      src/git/git.ts
  7. +1
    -1
      src/git/gitProvider.ts
  8. +1
    -1
      src/git/models/branch.ts
  9. +1
    -1
      src/git/models/commit.ts
  10. +3
    -3
      src/git/models/file.ts
  11. +1
    -1
      src/git/models/pullRequest.ts
  12. +1
    -1
      src/git/models/remote.ts
  13. +1
    -1
      src/git/remotes/provider.ts
  14. +1
    -1
      src/messages.ts
  15. +1
    -1
      src/quickpicks/referencePicker.ts
  16. +1
    -1
      src/views/nodes/viewNode.ts

+ 1
- 1
src/annotations/annotationProvider.ts View File

@ -15,7 +15,7 @@ import { ContextKeys, setContext } from '../constants';
import { Logger } from '../logger';
import { GitDocumentState, TrackedDocument } from '../trackers/gitDocumentTracker';
export enum AnnotationStatus {
export const enum AnnotationStatus {
Computing = 'computing',
Computed = 'computed',
}

+ 1
- 1
src/annotations/fileAnnotationController.ts View File

@ -45,7 +45,7 @@ import { GutterBlameAnnotationProvider } from './gutterBlameAnnotationProvider';
import { ChangesAnnotationContext, GutterChangesAnnotationProvider } from './gutterChangesAnnotationProvider';
import { GutterHeatmapBlameAnnotationProvider } from './gutterHeatmapBlameAnnotationProvider';
export enum AnnotationClearReason {
export const enum AnnotationClearReason {
User = 'User',
BlameabilityChanged = 'BlameabilityChanged',
ColumnChanged = 'ColumnChanged',

+ 2
- 2
src/commands/common.ts View File

@ -25,7 +25,7 @@ import { Logger } from '../logger';
import { CommandQuickPickItem, RepositoryPicker } from '../quickpicks';
import { ViewNode, ViewRefNode } from '../views/nodes';
export enum Commands {
export const enum Commands {
ActionPrefix = 'gitlens.action.',
AddAuthors = 'gitlens.addAuthors',
BrowseRepoAtRevision = 'gitlens.browseRepoAtRevision',
@ -732,7 +732,7 @@ export async function openEditor(
}
}
export enum OpenWorkspaceLocation {
export const enum OpenWorkspaceLocation {
CurrentWindow = 'currentWindow',
NewWindow = 'newWindow',
AddToWorkspace = 'addToWorkspace',

+ 21
- 21
src/config.ts View File

@ -1,6 +1,6 @@
'use strict';
export enum TraceLevel {
export const enum TraceLevel {
Silent = 'silent',
Errors = 'errors',
Verbose = 'verbose',
@ -152,7 +152,7 @@ export interface Config {
advanced: AdvancedConfig;
}
export enum AnnotationsToggleMode {
export const enum AnnotationsToggleMode {
File = 'file',
Window = 'window',
}
@ -165,25 +165,25 @@ export interface AutolinkReference {
ignoreCase?: boolean;
}
export enum BlameHighlightLocations {
export const enum BlameHighlightLocations {
Gutter = 'gutter',
Line = 'line',
Overview = 'overview',
}
export enum BranchSorting {
export const enum BranchSorting {
DateDesc = 'date:desc',
DateAsc = 'date:asc',
NameAsc = 'name:asc',
NameDesc = 'name:desc',
}
export enum ChangesLocations {
export const enum ChangesLocations {
Gutter = 'gutter',
Overview = 'overview',
}
export enum CodeLensCommand {
export const enum CodeLensCommand {
CopyRemoteCommitUrl = 'gitlens.copyRemoteCommitUrl',
CopyRemoteFileUrl = 'gitlens.copyRemoteFileUrl',
DiffWithPrevious = 'gitlens.diffWithPrevious',
@ -201,13 +201,13 @@ export enum CodeLensCommand {
ToggleFileHeatmap = 'gitlens.toggleFileHeatmap',
}
export enum CodeLensScopes {
export const enum CodeLensScopes {
Document = 'document',
Containers = 'containers',
Blocks = 'blocks',
}
export enum ContributorSorting {
export const enum ContributorSorting {
CountDesc = 'count:desc',
CountAsc = 'count:asc',
DateDesc = 'date:desc',
@ -216,7 +216,7 @@ export enum ContributorSorting {
NameDesc = 'name:desc',
}
export enum CustomRemoteType {
export const enum CustomRemoteType {
AzureDevOps = 'AzureDevOps',
Bitbucket = 'Bitbucket',
BitbucketServer = 'BitbucketServer',
@ -227,28 +227,28 @@ export enum CustomRemoteType {
GitLab = 'GitLab',
}
export enum DateSource {
export const enum DateSource {
Authored = 'authored',
Committed = 'committed',
}
export enum DateStyle {
export const enum DateStyle {
Absolute = 'absolute',
Relative = 'relative',
}
export enum FileAnnotationType {
export const enum FileAnnotationType {
Blame = 'blame',
Changes = 'changes',
Heatmap = 'heatmap',
}
export enum GitCommandSorting {
export const enum GitCommandSorting {
Name = 'name',
Usage = 'usage',
}
export enum GravatarDefaultStyle {
export const enum GravatarDefaultStyle {
Faces = 'wavatar',
Geometric = 'identicon',
Monster = 'monsterid',
@ -257,18 +257,18 @@ export enum GravatarDefaultStyle {
Robot = 'robohash',
}
export enum HeatmapLocations {
export const enum HeatmapLocations {
Gutter = 'gutter',
Overview = 'overview',
}
export enum KeyMap {
export const enum KeyMap {
Alternate = 'alternate',
Chorded = 'chorded',
None = 'none',
}
export enum StatusBarCommand {
export const enum StatusBarCommand {
CopyRemoteCommitUrl = 'gitlens.copyRemoteCommitUrl',
CopyRemoteFileUrl = 'gitlens.copyRemoteFileUrl',
DiffWithPrevious = 'gitlens.diffWithPrevious',
@ -288,25 +288,25 @@ export enum StatusBarCommand {
ToggleFileHeatmap = 'gitlens.toggleFileHeatmap',
}
export enum TagSorting {
export const enum TagSorting {
DateDesc = 'date:desc',
DateAsc = 'date:asc',
NameAsc = 'name:asc',
NameDesc = 'name:desc',
}
export enum ViewBranchesLayout {
export const enum ViewBranchesLayout {
List = 'list',
Tree = 'tree',
}
export enum ViewFilesLayout {
export const enum ViewFilesLayout {
Auto = 'auto',
List = 'list',
Tree = 'tree',
}
export enum ViewShowBranchComparison {
export const enum ViewShowBranchComparison {
Branch = 'branch',
Working = 'working',
}

+ 9
- 9
src/constants.ts View File

@ -5,7 +5,7 @@ import { SearchPattern } from './git/git';
export const quickPickTitleMaxChars = 80;
export enum BuiltInCommands {
export const enum BuiltInCommands {
CloseActiveEditor = 'workbench.action.closeActiveEditor',
CloseAllEditors = 'workbench.action.closeAllEditors',
CursorMove = 'cursorMove',
@ -27,7 +27,7 @@ export enum BuiltInCommands {
ShowReferences = 'editor.action.showReferences',
}
export enum BuiltInGitCommands {
export const enum BuiltInGitCommands {
Publish = 'git.publish',
Pull = 'git.pull',
PullRebase = 'git.pullRebase',
@ -36,13 +36,13 @@ export enum BuiltInGitCommands {
UndoCommit = 'git.undoCommit',
}
export enum BuiltInGitConfiguration {
export const enum BuiltInGitConfiguration {
AutoRepositoryDetection = 'git.autoRepositoryDetection',
FetchOnPull = 'git.fetchOnPull',
UseForcePushWithLease = 'git.useForcePushWithLease',
}
export enum ContextKeys {
export const enum ContextKeys {
ActionPrefix = 'gitlens:action:',
ActiveFileStatus = 'gitlens:activeFileStatus',
AnnotationStatus = 'gitlens:annotationStatus',
@ -71,7 +71,7 @@ export function setContext(key: ContextKeys | string, value: any) {
return commands.executeCommand(BuiltInCommands.SetContext, key, value);
}
export enum Colors {
export const enum Colors {
GutterBackgroundColor = 'gitlens.gutterBackgroundColor',
GutterForegroundColor = 'gitlens.gutterForegroundColor',
GutterUncommittedForegroundColor = 'gitlens.gutterUncommittedForegroundColor',
@ -87,7 +87,7 @@ export enum Colors {
UnpulledChangesIconColor = 'gitlens.unpulledChangesIconColor',
}
export enum DocumentSchemes {
export const enum DocumentSchemes {
DebugConsole = 'debug',
File = 'file',
Git = 'git',
@ -172,14 +172,14 @@ export const enum GlyphChars {
ZeroWidthSpace = '\u200b',
}
export enum SyncedState {
export const enum SyncedState {
Version = 'gitlens:synced:version',
WelcomeViewVisible = 'gitlens:views:welcome:visible',
Deprecated_DisallowConnectionPrefix = 'gitlens:disallow:connection:',
}
export enum GlobalState {
export const enum GlobalState {
Avatars = 'gitlens:avatars',
PendingWelcomeOnFocus = 'gitlens:pendingWelcomeOnFocus',
PendingWhatsNewOnFocus = 'gitlens:pendingWhatsNewOnFocus',
@ -254,7 +254,7 @@ export interface Usage {
[id: string]: number;
}
export enum WorkspaceState {
export const enum WorkspaceState {
AssumeRepositoriesOnStartup = 'gitlens:assumeRepositoriesOnStartup',
BranchComparisons = 'gitlens:branch:comparisons',

+ 1
- 1
src/git/git.ts View File

@ -56,7 +56,7 @@ const GitWarnings = {
notAGitCommand: /'.+' is not a git command/i,
};
export enum GitErrorHandling {
export const enum GitErrorHandling {
Ignore = 'ignore',
Throw = 'throw',
}

+ 1
- 1
src/git/gitProvider.ts View File

@ -35,7 +35,7 @@ import { GitUri } from './gitUri';
import { RemoteProviders } from './remotes/factory';
import { SearchPattern } from './search';
export enum GitProviderId {
export const enum GitProviderId {
Git = 'git',
GitHub = 'github',
}

+ 1
- 1
src/git/models/branch.ts View File

@ -25,7 +25,7 @@ export interface GitTrackingState {
behind: number;
}
export enum GitBranchStatus {
export const enum GitBranchStatus {
Ahead = 'ahead',
Behind = 'behind',
Diverged = 'diverged',

+ 1
- 1
src/git/models/commit.ts View File

@ -21,7 +21,7 @@ export interface GitCommitLine {
code?: string;
}
export enum GitCommitType {
export const enum GitCommitType {
Blame = 'blame',
Log = 'log',
LogFile = 'logFile',

+ 3
- 3
src/git/models/file.ts View File

@ -6,7 +6,7 @@ import { GitLogCommit } from './logCommit';
export declare type GitFileStatus = GitFileConflictStatus | GitFileIndexStatus | GitFileWorkingTreeStatus;
export enum GitFileConflictStatus {
export const enum GitFileConflictStatus {
AddedByBoth = 'AA',
AddedByUs = 'AU',
AddedByThem = 'UA',
@ -16,7 +16,7 @@ export enum GitFileConflictStatus {
ModifiedByBoth = 'UU',
}
export enum GitFileIndexStatus {
export const enum GitFileIndexStatus {
Added = 'A',
Deleted = 'D',
Modified = 'M',
@ -24,7 +24,7 @@ export enum GitFileIndexStatus {
Copied = 'C',
}
export enum GitFileWorkingTreeStatus {
export const enum GitFileWorkingTreeStatus {
Added = 'A',
Deleted = 'D',
Modified = 'M',

+ 1
- 1
src/git/models/pullRequest.ts View File

@ -13,7 +13,7 @@ export const PullRequestDateFormatting = {
},
};
export enum PullRequestState {
export const enum PullRequestState {
Open = 'Open',
Closed = 'Closed',
Merged = 'Merged',

+ 1
- 1
src/git/models/remote.ts View File

@ -3,7 +3,7 @@ import { WorkspaceState } from '../../constants';
import { Container } from '../../container';
import { RemoteProvider, RichRemoteProvider } from '../remotes/factory';
export enum GitRemoteType {
export const enum GitRemoteType {
Fetch = 'fetch',
Push = 'push',
}

+ 1
- 1
src/git/remotes/provider.ts View File

@ -26,7 +26,7 @@ import {
Repository,
} from '../models/models';
export enum RemoteResourceType {
export const enum RemoteResourceType {
Branch = 'branch',
Branches = 'branches',
Commit = 'commit',

+ 1
- 1
src/messages.ts View File

@ -4,7 +4,7 @@ import { configuration } from './configuration';
import { GitCommit } from './git/git';
import { Logger } from './logger';
export enum SuppressedMessages {
export const enum SuppressedMessages {
CommitHasNoPreviousCommitWarning = 'suppressCommitHasNoPreviousCommitWarning',
CommitNotFoundWarning = 'suppressCommitNotFoundWarning',
CreatePullRequestPrompt = 'suppressCreatePullRequestPrompt',

+ 1
- 1
src/quickpicks/referencePicker.ts View File

@ -10,7 +10,7 @@ import { BranchQuickPickItem, getQuickPickIgnoreFocusOut, RefQuickPickItem, TagQ
export type ReferencesQuickPickItem = BranchQuickPickItem | TagQuickPickItem | RefQuickPickItem;
export enum ReferencesQuickPickIncludes {
export const enum ReferencesQuickPickIncludes {
Branches = 1,
Tags = 2,
WorkingTree = 4,

+ 1
- 1
src/views/nodes/viewNode.ts View File

@ -25,7 +25,7 @@ import { Logger } from '../../logger';
import { debug, Functions, gate, log, logName, Strings } from '../../system';
import { TreeViewNodeCollapsibleStateChangeEvent, View } from '../viewBase';
export enum ContextValues {
export const enum ContextValues {
ActiveFileHistory = 'gitlens:history:active:file',
ActiveLineHistory = 'gitlens:history:active:line',
Branch = 'gitlens:branch',

Loading…
Cancel
Save