Browse Source

Moves storage & context into system

Moves storage types into constants
main
Eric Amodio 1 year ago
parent
commit
ad36305765
47 changed files with 365 additions and 358 deletions
  1. +1
    -1
      src/annotations/annotationProvider.ts
  2. +1
    -1
      src/annotations/fileAnnotationController.ts
  3. +1
    -1
      src/api/actionRunners.ts
  4. +2
    -2
      src/avatars.ts
  5. +1
    -1
      src/codelens/codeLensController.ts
  6. +1
    -1
      src/commands/generateCommitMessage.ts
  7. +1
    -1
      src/commands/git/search.ts
  8. +1
    -1
      src/commands/git/stash.ts
  9. +2
    -2
      src/commands/gitCommands.utils.ts
  10. +182
    -0
      src/constants.ts
  11. +1
    -1
      src/container.ts
  12. +3
    -3
      src/extension.ts
  13. +1
    -1
      src/git/gitProviderService.ts
  14. +1
    -1
      src/plus/github/githubGitProvider.ts
  15. +1
    -1
      src/plus/subscription/subscriptionService.ts
  16. +1
    -1
      src/plus/subscription/utils.ts
  17. +1
    -1
      src/plus/webviews/focus/focusWebview.ts
  18. +2
    -2
      src/plus/webviews/graph/graphWebview.ts
  19. +1
    -1
      src/plus/webviews/graph/statusbar.ts
  20. +0
    -282
      src/storage.ts
  21. +2
    -2
      src/system/context.ts
  22. +2
    -6
      src/system/decorators/resolver.ts
  23. +1
    -1
      src/system/keyboard.ts
  24. +111
    -0
      src/system/storage.ts
  25. +1
    -1
      src/telemetry/usageTracker.ts
  26. +1
    -1
      src/trackers/documentTracker.ts
  27. +1
    -1
      src/trackers/trackedDocument.ts
  28. +1
    -1
      src/uris/deepLinks/deepLinkService.ts
  29. +1
    -1
      src/views/commitsView.ts
  30. +1
    -1
      src/views/fileHistoryView.ts
  31. +1
    -1
      src/views/lineHistoryView.ts
  32. +2
    -2
      src/views/nodes/branchNode.ts
  33. +2
    -2
      src/views/nodes/commitNode.ts
  34. +1
    -1
      src/views/nodes/compareBranchNode.ts
  35. +1
    -1
      src/views/nodes/comparePickerNode.ts
  36. +1
    -1
      src/views/nodes/compareResultsNode.ts
  37. +1
    -1
      src/views/nodes/fileHistoryTrackerNode.ts
  38. +1
    -1
      src/views/nodes/lineHistoryTrackerNode.ts
  39. +1
    -1
      src/views/nodes/worktreeNode.ts
  40. +1
    -1
      src/views/repositoriesView.ts
  41. +2
    -2
      src/views/searchAndCompareView.ts
  42. +1
    -1
      src/views/viewCommands.ts
  43. +1
    -1
      src/vsls/vsls.ts
  44. +1
    -1
      src/webviews/commitDetails/commitDetailsWebview.ts
  45. +2
    -2
      src/webviews/home/homeWebview.ts
  46. +1
    -1
      src/webviews/webviewController.ts

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

@ -9,7 +9,7 @@ import type {
} from 'vscode';
import { Disposable, window } from 'vscode';
import type { FileAnnotationType } from '../config';
import { setContext } from '../context';
import { setContext } from '../system/context';
import { Logger } from '../system/logger';
import type { GitDocumentState, TrackedDocument } from '../trackers/gitDocumentTracker';

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

@ -23,8 +23,8 @@ import {
import { AnnotationsToggleMode, BlameHighlightLocations, ChangesLocations, FileAnnotationType } from '../config';
import type { Colors, CoreColors } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { configuration } from '../system/configuration';
import { setContext } from '../system/context';
import { once } from '../system/event';
import { debounce } from '../system/function';
import { find } from '../system/iterable';

+ 1
- 1
src/api/actionRunners.ts View File

@ -3,9 +3,9 @@ import { Disposable, EventEmitter, window } from 'vscode';
import type { Config } from '../config';
import { Commands } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { registerCommand } from '../system/command';
import { configuration } from '../system/configuration';
import { setContext } from '../system/context';
import { sortCompare } from '../system/string';
import { getQuickPickIgnoreFocusOut } from '../system/utils';
import type { Action, ActionContext, ActionRunner } from './gitlens';

+ 2
- 2
src/avatars.ts View File

@ -1,11 +1,11 @@
import { EventEmitter, Uri } from 'vscode';
import { md5 } from '@env/crypto';
import { GravatarDefaultStyle } from './config';
import type { StoredAvatar } from './constants';
import { Container } from './container';
import { getContext } from './context';
import { getGitHubNoReplyAddressParts } from './git/remotes/github';
import type { StoredAvatar } from './storage';
import { configuration } from './system/configuration';
import { getContext } from './system/context';
import { debounce } from './system/function';
import { filterMap } from './system/iterable';
import { base64, equalsIgnoreCase } from './system/string';

+ 1
- 1
src/codelens/codeLensController.ts View File

@ -1,8 +1,8 @@
import type { ConfigurationChangeEvent } from 'vscode';
import { Disposable, languages } from 'vscode';
import type { Container } from '../container';
import { setContext } from '../context';
import { configuration } from '../system/configuration';
import { setContext } from '../system/context';
import { once } from '../system/event';
import { Logger } from '../system/logger';
import type {

+ 1
- 1
src/commands/generateCommitMessage.ts View File

@ -7,10 +7,10 @@ import { GitUri } from '../git/gitUri';
import { uncommittedStaged } from '../git/models/constants';
import { showGenericErrorMessage } from '../messages';
import { getBestRepositoryOrShowPicker } from '../quickpicks/repositoryPicker';
import type { Storage } from '../storage';
import { command, executeCoreCommand } from '../system/command';
import { configuration } from '../system/configuration';
import { Logger } from '../system/logger';
import type { Storage } from '../system/storage';
import { supportedInVSCodeVersion } from '../system/utils';
import { ActiveEditorCommand, Command, getCommandUri } from './base';

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

@ -1,6 +1,5 @@
import { GlyphChars } from '../../constants';
import type { Container } from '../../container';
import { getContext } from '../../context';
import { showDetailsView } from '../../git/actions/commit';
import type { GitCommit } from '../../git/models/commit';
import type { GitLog } from '../../git/models/log';
@ -10,6 +9,7 @@ import { getSearchQueryComparisonKey, parseSearchQuery, searchOperators } from '
import type { QuickPickItemOfT } from '../../quickpicks/items/common';
import { ActionQuickPickItem } from '../../quickpicks/items/common';
import { configuration } from '../../system/configuration';
import { getContext } from '../../system/context';
import { pluralize } from '../../system/string';
import { SearchResultsNode } from '../../views/nodes/searchResultsNode';
import type { ViewsWithRepositoryFolders } from '../../views/viewBase';

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

@ -2,7 +2,6 @@ import type { QuickPickItem, Uri } from 'vscode';
import { QuickInputButtons, window } from 'vscode';
import { GlyphChars } from '../../constants';
import type { Container } from '../../container';
import { getContext } from '../../context';
import { reveal, showDetailsView } from '../../git/actions/stash';
import { StashApplyError, StashApplyErrorReason, StashPushError, StashPushErrorReason } from '../../git/errors';
import type { GitStashCommit } from '../../git/models/commit';
@ -13,6 +12,7 @@ import { showGenericErrorMessage } from '../../messages';
import type { QuickPickItemOfT } from '../../quickpicks/items/common';
import type { FlagsQuickPickItem } from '../../quickpicks/items/flags';
import { createFlagsQuickPickItem } from '../../quickpicks/items/flags';
import { getContext } from '../../system/context';
import { formatPath } from '../../system/formatPath';
import { Logger } from '../../system/logger';
import { pad } from '../../system/string';

+ 2
- 2
src/commands/gitCommands.utils.ts View File

@ -1,8 +1,8 @@
import { GitCommandSorting } from '../config';
import type { RecentUsage } from '../constants';
import type { Container } from '../container';
import { getContext } from '../context';
import type { RecentUsage } from '../storage';
import { configuration } from '../system/configuration';
import { getContext } from '../system/context';
import { BranchGitCommand } from './git/branch';
import { CherryPickGitCommand } from './git/cherry-pick';
import { CoAuthorsGitCommand } from './git/coauthors';

+ 182
- 0
src/constants.ts View File

@ -1,3 +1,11 @@
import type { ViewShowBranchComparison } from './config';
import type { Environment } from './container';
import type { StoredSearchQuery } from './git/search';
import type { Subscription } from './subscription';
import type { TrackedUsage, TrackedUsageKeys } from './telemetry/usageTracker';
import type { CommitDetailsDismissed } from './webviews/commitDetails/protocol';
import type { CompletedActions } from './webviews/home/protocol';
export const extensionPrefix = 'gitlens';
export const quickPickTitleMaxChars = 80;
@ -488,3 +496,177 @@ export type TelemetryEvents =
| 'subscription'
| 'subscription/changed'
| 'usage/track';
export type SecretKeys =
| `gitlens.integration.auth:${string}`
| 'gitlens.openai.key'
| `gitlens.plus.auth:${Environment}`;
export const enum SyncedStorageKeys {
Version = 'gitlens:synced:version',
PreReleaseVersion = 'gitlens:synced:preVersion',
HomeViewWelcomeVisible = 'gitlens:views:welcome:visible',
}
export type DeprecatedGlobalStorage = {
/** @deprecated */
[key in `disallow:connection:${string}`]: any;
};
export type GlobalStorage = {
avatars: [string, StoredAvatar][];
repoVisibility: [string, StoredRepoVisibilityInfo][];
'confirm:sendToOpenAI': boolean;
'deepLinks:pending': StoredDeepLinkContext;
'home:actions:completed': CompletedActions[];
'home:steps:completed': string[];
'home:sections:dismissed': string[];
'home:status:pinned': boolean;
'home:banners:dismissed': string[];
pendingWelcomeOnFocus: boolean;
pendingWhatsNewOnFocus: boolean;
'plus:migratedAuthentication': boolean;
'plus:discountNotificationShown': boolean;
'plus:renewalDiscountNotificationShown': boolean;
// Don't change this key name ('premium`) as its the stored subscription
'premium:subscription': Stored<Subscription>;
'synced:version': string;
// Keep the pre-release version separate from the released version
'synced:preVersion': string;
usages: Record<TrackedUsageKeys, TrackedUsage>;
version: string;
// Keep the pre-release version separate from the released version
preVersion: string;
'views:layout': StoredViewsLayout;
'views:welcome:visible': boolean;
'views:commitDetails:dismissed': CommitDetailsDismissed[];
} & { [key in `provider:authentication:skip:${string}`]: boolean };
export type DeprecatedWorkspaceStorage = {
/** @deprecated use `graph:filtersByRepo.excludeRefs` */
'graph:hiddenRefs': Record<string, StoredGraphExcludedRef>;
/** @deprecated use `views:searchAndCompare:pinned` */
'pinned:comparisons': Record<string, DeprecatedPinnedComparison>;
};
export type WorkspaceStorage = {
assumeRepositoriesOnStartup?: boolean;
'branch:comparisons': StoredBranchComparisons;
'confirm:sendToOpenAI': boolean;
'gitComandPalette:usage': RecentUsage;
gitPath: string;
'graph:banners:dismissed': Record<string, boolean>;
'graph:columns': Record<string, StoredGraphColumn>;
'graph:filtersByRepo': Record<string, StoredGraphFilters>;
'remote:default': string;
'starred:branches': StoredStarred;
'starred:repositories': StoredStarred;
'views:repositories:autoRefresh': boolean;
'views:searchAndCompare:keepResults': boolean;
'views:searchAndCompare:pinned': StoredPinnedItems;
'views:commitDetails:autolinksExpanded': boolean;
} & { [key in `connected:${string}`]: boolean };
export type StoredViewsLayout = 'gitlens' | 'scm';
export interface Stored<T, SchemaVersion extends number = 1> {
v: SchemaVersion;
data: T;
}
export interface StoredAvatar {
uri: string;
timestamp: number;
}
export type StoredRepositoryVisibility = 'private' | 'public' | 'local';
export interface StoredRepoVisibilityInfo {
visibility: StoredRepositoryVisibility;
timestamp: number;
remotesHash?: string;
}
export interface StoredBranchComparison {
ref: string;
notation: '..' | '...' | undefined;
type: Exclude<ViewShowBranchComparison, false> | undefined;
}
export interface StoredBranchComparisons {
[id: string]: string | StoredBranchComparison;
}
export interface StoredDeepLinkContext {
url?: string | undefined;
repoPath?: string | undefined;
}
export interface StoredGraphColumn {
isHidden?: boolean;
mode?: string;
width?: number;
}
export interface StoredGraphFilters {
includeOnlyRefs?: Record<string, StoredGraphIncludeOnlyRef>;
excludeRefs?: Record<string, StoredGraphExcludedRef>;
excludeTypes?: Record<string, boolean>;
}
export type StoredGraphRefType = 'head' | 'remote' | 'tag';
export interface StoredGraphExcludedRef {
id: string;
type: StoredGraphRefType;
name: string;
owner?: string;
}
export interface StoredGraphIncludeOnlyRef {
id: string;
type: StoredGraphRefType;
name: string;
owner?: string;
}
export interface StoredNamedRef {
label?: string;
ref: string;
}
export interface StoredPinnedComparison {
type: 'comparison';
timestamp: number;
path: string;
ref1: StoredNamedRef;
ref2: StoredNamedRef;
notation?: '..' | '...';
}
export interface StoredPinnedSearch {
type: 'search';
timestamp: number;
path: string;
labels: {
label: string;
queryLabel:
| string
| {
label: string;
resultsType?: { singular: string; plural: string };
};
};
search: StoredSearchQuery;
}
export type StoredPinnedItem = StoredPinnedComparison | StoredPinnedSearch;
export type StoredPinnedItems = Record<string, StoredPinnedItem>;
export type StoredStarred = Record<string, boolean>;
export type RecentUsage = Record<string, number>;
interface DeprecatedPinnedComparison {
path: string;
ref1: StoredNamedRef;
ref2: StoredNamedRef;
notation?: '..' | '...';
}

+ 1
- 1
src/container.ts View File

@ -31,13 +31,13 @@ import {
import { GraphStatusBarController } from './plus/webviews/graph/statusbar';
import { registerTimelineWebviewPanel, registerTimelineWebviewView } from './plus/webviews/timeline/registration';
import { StatusBarController } from './statusbar/statusBarController';
import type { Storage } from './storage';
import { executeCommand } from './system/command';
import { configuration } from './system/configuration';
import { log } from './system/decorators/log';
import { memoize } from './system/decorators/memoize';
import { Keyboard } from './system/keyboard';
import { Logger } from './system/logger';
import type { Storage } from './system/storage';
import { TelemetryService } from './telemetry/telemetry';
import { UsageTracker } from './telemetry/usageTracker';
import { GitTerminalLinkProvider } from './terminal/linkProvider';

+ 3
- 3
src/extension.ts View File

@ -6,9 +6,8 @@ import { Api } from './api/api';
import type { CreatePullRequestActionContext, GitLensApi, OpenPullRequestActionContext } from './api/gitlens';
import type { CreatePullRequestOnRemoteCommandArgs, OpenPullRequestOnRemoteCommandArgs } from './commands';
import { fromOutputLevel, OutputLevel } from './config';
import { Commands } from './constants';
import { Commands, SyncedStorageKeys } from './constants';
import { Container } from './container';
import { setContext } from './context';
import { isGitUri } from './git/gitUri';
import { getBranchNameWithoutRemote, isBranch } from './git/models/branch';
import { isCommit } from './git/models/commit';
@ -16,15 +15,16 @@ import { isRepository } from './git/models/repository';
import { isTag } from './git/models/tag';
import { showDebugLoggingWarningMessage, showPreReleaseExpiredErrorMessage, showWhatsNewMessage } from './messages';
import { registerPartnerActionRunners } from './partners';
import { Storage, SyncedStorageKeys } from './storage';
import { executeCommand, executeCoreCommand, registerCommands } from './system/command';
import { configuration, Configuration } from './system/configuration';
import { setContext } from './system/context';
import { setDefaultDateLocales } from './system/date';
import { once } from './system/event';
import { Logger } from './system/logger';
import { LogLevel } from './system/logger.constants';
import { flatten } from './system/object';
import { Stopwatch } from './system/stopwatch';
import { Storage } from './system/storage';
import { compare, fromString, satisfies } from './system/version';
import { isViewNode } from './views/nodes/viewNode';

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

@ -14,7 +14,6 @@ import { resetAvatarCache } from '../avatars';
import type { CoreGitConfiguration } from '../constants';
import { GlyphChars, Schemes } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { AccessDeniedError, ProviderNotFoundError } from '../errors';
import type { FeatureAccess, Features, PlusFeatures, RepoFeatureAccess } from '../features';
import type { SubscriptionChangeEvent } from '../plus/subscription/subscriptionService';
@ -25,6 +24,7 @@ import { isSubscriptionPaidPlan, SubscriptionPlanId } from '../subscription';
import { groupByFilterMap, groupByMap, joinUnique } from '../system/array';
import { registerCommand } from '../system/command';
import { configuration } from '../system/configuration';
import { setContext } from '../system/context';
import { gate } from '../system/decorators/gate';
import { debug, log } from '../system/decorators/log';
import type { Deferrable } from '../system/function';

+ 1
- 1
src/plus/github/githubGitProvider.ts View File

@ -13,7 +13,6 @@ import { authentication, EventEmitter, FileType, Uri, window, workspace } from '
import { encodeUtf8Hex } from '@env/hex';
import { CharCode, Schemes } from '../../constants';
import type { Container } from '../../container';
import { setContext } from '../../context';
import { emojify } from '../../emojis';
import {
AuthenticationError,
@ -77,6 +76,7 @@ import { getRemoteProviderMatcher, loadRemoteProviders } from '../../git/remotes
import type { GitSearch, GitSearchResultData, GitSearchResults, SearchQuery } from '../../git/search';
import { getSearchQueryComparisonKey, parseSearchQuery } from '../../git/search';
import { configuration } from '../../system/configuration';
import { setContext } from '../../system/context';
import { gate } from '../../system/decorators/gate';
import { debug, log } from '../../system/decorators/log';
import { filterMap, first, last, some } from '../../system/iterable';

+ 1
- 1
src/plus/subscription/subscriptionService.ts View File

@ -25,7 +25,6 @@ import { getPlatform } from '@env/platform';
import type { CoreColors } from '../../constants';
import { Commands } from '../../constants';
import type { Container } from '../../container';
import { setContext } from '../../context';
import { AccountValidationError } from '../../errors';
import type { RepositoriesChangeEvent } from '../../git/gitProviderService';
import { showMessage } from '../../messages';
@ -45,6 +44,7 @@ import {
} from '../../subscription';
import { executeCommand, registerCommand } from '../../system/command';
import { configuration } from '../../system/configuration';
import { setContext } from '../../system/context';
import { createFromDateDelta } from '../../system/date';
import { gate } from '../../system/decorators/gate';
import { debug, log } from '../../system/decorators/log';

+ 1
- 1
src/plus/subscription/utils.ts View File

@ -1,7 +1,7 @@
import type { MessageItem } from 'vscode';
import { window } from 'vscode';
import { getContext } from '../../context';
import { configuration } from '../../system/configuration';
import { getContext } from '../../system/context';
export function arePlusFeaturesEnabled(): boolean {
return getContext('gitlens:plus:enabled', configuration.get('plusFeatures.enabled', undefined, true));

+ 1
- 1
src/plus/webviews/focus/focusWebview.ts View File

@ -2,7 +2,6 @@ import { Disposable, Uri, window } from 'vscode';
import type { GHPRPullRequest } from '../../../commands';
import { Commands } from '../../../constants';
import type { Container } from '../../../container';
import { setContext } from '../../../context';
import { PlusFeatures } from '../../../features';
import { add as addRemote } from '../../../git/actions/remote';
import * as RepoActions from '../../../git/actions/repository';
@ -26,6 +25,7 @@ import type { RichRemoteProvider } from '../../../git/remotes/richRemoteProvider
import type { Subscription } from '../../../subscription';
import { SubscriptionState } from '../../../subscription';
import { executeCommand, registerCommand } from '../../../system/command';
import { setContext } from '../../../system/context';
import type { IpcMessage } from '../../../webviews/protocol';
import { onIpc } from '../../../webviews/protocol';
import type { WebviewController, WebviewProvider } from '../../../webviews/webviewController';

+ 2
- 2
src/plus/webviews/graph/graphWebview.ts View File

@ -12,9 +12,9 @@ import type {
} from '../../../commands';
import { parseCommandContext } from '../../../commands/base';
import type { Config } from '../../../config';
import type { StoredGraphFilters, StoredGraphIncludeOnlyRef, StoredGraphRefType } from '../../../constants';
import { Commands, GlyphChars } from '../../../constants';
import type { Container } from '../../../container';
import { getContext, onDidChangeContext } from '../../../context';
import type { CommitSelectedEvent } from '../../../eventBus';
import { PlusFeatures } from '../../../features';
import * as BranchActions from '../../../git/actions/branch';
@ -57,7 +57,6 @@ import {
import type { GitSearch } from '../../../git/search';
import { getSearchQueryComparisonKey } from '../../../git/search';
import { showRepositoryPicker } from '../../../quickpicks/repositoryPicker';
import type { StoredGraphFilters, StoredGraphIncludeOnlyRef, StoredGraphRefType } from '../../../storage';
import {
executeActionCommand,
executeCommand,
@ -66,6 +65,7 @@ import {
registerCommand,
} from '../../../system/command';
import { configuration } from '../../../system/configuration';
import { getContext, onDidChangeContext } from '../../../system/context';
import { gate } from '../../../system/decorators/gate';
import { debug } from '../../../system/decorators/log';
import type { Deferrable } from '../../../system/function';

+ 1
- 1
src/plus/webviews/graph/statusbar.ts View File

@ -2,8 +2,8 @@ import type { ConfigurationChangeEvent, StatusBarItem } from 'vscode';
import { Disposable, MarkdownString, StatusBarAlignment, window } from 'vscode';
import { Commands } from '../../../constants';
import type { Container } from '../../../container';
import { getContext, onDidChangeContext } from '../../../context';
import { configuration } from '../../../system/configuration';
import { getContext, onDidChangeContext } from '../../../system/context';
import { once } from '../../../system/function';
import type { SubscriptionChangeEvent } from '../../subscription/subscriptionService';
import { arePlusFeaturesEnabled } from '../../subscription/utils';

+ 0
- 282
src/storage.ts View File

@ -1,282 +0,0 @@
import type { Disposable, Event, ExtensionContext, SecretStorageChangeEvent } from 'vscode';
import { EventEmitter } from 'vscode';
import type { ViewShowBranchComparison } from './config';
import { extensionPrefix } from './constants';
import type { Environment } from './container';
import type { StoredSearchQuery } from './git/search';
import type { Subscription } from './subscription';
import { debug } from './system/decorators/log';
import type { TrackedUsage, TrackedUsageKeys } from './telemetry/usageTracker';
import type { CommitDetailsDismissed } from './webviews/commitDetails/protocol';
import type { CompletedActions } from './webviews/home/protocol';
export type StorageChangeEvent =
| {
/**
* The key of the stored value that has changed.
*/
readonly key: keyof (GlobalStorage & DeprecatedGlobalStorage);
readonly workspace: false;
}
| {
/**
* The key of the stored value that has changed.
*/
readonly key: keyof (WorkspaceStorage & DeprecatedWorkspaceStorage);
readonly workspace: true;
};
export class Storage implements Disposable {
private _onDidChange = new EventEmitter<StorageChangeEvent>();
get onDidChange(): Event<StorageChangeEvent> {
return this._onDidChange.event;
}
private _onDidChangeSecrets = new EventEmitter<SecretStorageChangeEvent>();
get onDidChangeSecrets(): Event<SecretStorageChangeEvent> {
return this._onDidChangeSecrets.event;
}
private readonly _disposable: Disposable;
constructor(private readonly context: ExtensionContext) {
this._disposable = this.context.secrets.onDidChange(e => this._onDidChangeSecrets.fire(e));
}
dispose(): void {
this._disposable.dispose();
}
get<T extends keyof GlobalStorage>(key: T): GlobalStorage[T] | undefined;
/** @deprecated */
get<T extends keyof DeprecatedGlobalStorage>(key: T): DeprecatedGlobalStorage[T] | undefined;
get<T extends keyof GlobalStorage>(key: T, defaultValue: GlobalStorage[T]): GlobalStorage[T];
@debug({ logThreshold: 50 })
get(key: keyof (GlobalStorage & DeprecatedGlobalStorage), defaultValue?: unknown): unknown | undefined {
return this.context.globalState.get(`${extensionPrefix}:${key}`, defaultValue);
}
@debug({ logThreshold: 250 })
async delete(key: keyof (GlobalStorage & DeprecatedGlobalStorage)): Promise<void> {
await this.context.globalState.update(`${extensionPrefix}:${key}`, undefined);
this._onDidChange.fire({ key: key, workspace: false });
}
@debug({ args: { 1: false }, logThreshold: 250 })
async store<T extends keyof GlobalStorage>(key: T, value: GlobalStorage[T] | undefined): Promise<void> {
await this.context.globalState.update(`${extensionPrefix}:${key}`, value);
this._onDidChange.fire({ key: key, workspace: false });
}
@debug({ args: false, logThreshold: 250 })
async getSecret(key: SecretKeys): Promise<string | undefined> {
return this.context.secrets.get(key);
}
@debug({ args: false, logThreshold: 250 })
async deleteSecret(key: SecretKeys): Promise<void> {
return this.context.secrets.delete(key);
}
@debug({ args: false, logThreshold: 250 })
async storeSecret(key: SecretKeys, value: string): Promise<void> {
return this.context.secrets.store(key, value);
}
getWorkspace<T extends keyof WorkspaceStorage>(key: T): WorkspaceStorage[T] | undefined;
/** @deprecated */
getWorkspace<T extends keyof DeprecatedWorkspaceStorage>(key: T): DeprecatedWorkspaceStorage[T] | undefined;
getWorkspace<T extends keyof WorkspaceStorage>(key: T, defaultValue: WorkspaceStorage[T]): WorkspaceStorage[T];
@debug({ logThreshold: 25 })
getWorkspace(
key: keyof (WorkspaceStorage & DeprecatedWorkspaceStorage),
defaultValue?: unknown,
): unknown | undefined {
return this.context.workspaceState.get(`${extensionPrefix}:${key}`, defaultValue);
}
@debug({ logThreshold: 250 })
async deleteWorkspace(key: keyof (WorkspaceStorage & DeprecatedWorkspaceStorage)): Promise<void> {
await this.context.workspaceState.update(`${extensionPrefix}:${key}`, undefined);
this._onDidChange.fire({ key: key, workspace: true });
}
@debug({ args: { 1: false }, logThreshold: 250 })
async storeWorkspace(key: keyof WorkspaceStorage, value: unknown | undefined): Promise<void> {
await this.context.workspaceState.update(`${extensionPrefix}:${key}`, value);
this._onDidChange.fire({ key: key, workspace: true });
}
}
export type SecretKeys =
| `gitlens.integration.auth:${string}`
| 'gitlens.openai.key'
| `gitlens.plus.auth:${Environment}`;
export const enum SyncedStorageKeys {
Version = 'gitlens:synced:version',
PreReleaseVersion = 'gitlens:synced:preVersion',
HomeViewWelcomeVisible = 'gitlens:views:welcome:visible',
}
export type DeprecatedGlobalStorage = {
/** @deprecated */
[key in `disallow:connection:${string}`]: any;
};
export type GlobalStorage = {
avatars: [string, StoredAvatar][];
repoVisibility: [string, StoredRepoVisibilityInfo][];
'confirm:sendToOpenAI': boolean;
'deepLinks:pending': StoredDeepLinkContext;
'home:actions:completed': CompletedActions[];
'home:steps:completed': string[];
'home:sections:dismissed': string[];
'home:status:pinned': boolean;
'home:banners:dismissed': string[];
pendingWelcomeOnFocus: boolean;
pendingWhatsNewOnFocus: boolean;
'plus:migratedAuthentication': boolean;
'plus:discountNotificationShown': boolean;
'plus:renewalDiscountNotificationShown': boolean;
// Don't change this key name ('premium`) as its the stored subscription
'premium:subscription': Stored<Subscription>;
'synced:version': string;
// Keep the pre-release version separate from the released version
'synced:preVersion': string;
usages: Record<TrackedUsageKeys, TrackedUsage>;
version: string;
// Keep the pre-release version separate from the released version
preVersion: string;
'views:layout': StoredViewsLayout;
'views:welcome:visible': boolean;
'views:commitDetails:dismissed': CommitDetailsDismissed[];
} & { [key in `provider:authentication:skip:${string}`]: boolean };
export type DeprecatedWorkspaceStorage = {
/** @deprecated use `graph:filtersByRepo.excludeRefs` */
'graph:hiddenRefs': Record<string, StoredGraphExcludedRef>;
/** @deprecated use `views:searchAndCompare:pinned` */
'pinned:comparisons': Record<string, DeprecatedPinnedComparison>;
};
export type WorkspaceStorage = {
assumeRepositoriesOnStartup?: boolean;
'branch:comparisons': StoredBranchComparisons;
'confirm:sendToOpenAI': boolean;
'gitComandPalette:usage': RecentUsage;
gitPath: string;
'graph:banners:dismissed': Record<string, boolean>;
'graph:columns': Record<string, StoredGraphColumn>;
'graph:filtersByRepo': Record<string, StoredGraphFilters>;
'remote:default': string;
'starred:branches': StoredStarred;
'starred:repositories': StoredStarred;
'views:repositories:autoRefresh': boolean;
'views:searchAndCompare:keepResults': boolean;
'views:searchAndCompare:pinned': StoredPinnedItems;
'views:commitDetails:autolinksExpanded': boolean;
} & { [key in `connected:${string}`]: boolean };
export type StoredViewsLayout = 'gitlens' | 'scm';
export interface Stored<T, SchemaVersion extends number = 1> {
v: SchemaVersion;
data: T;
}
export interface StoredAvatar {
uri: string;
timestamp: number;
}
export type StoredRepositoryVisibility = 'private' | 'public' | 'local';
export interface StoredRepoVisibilityInfo {
visibility: StoredRepositoryVisibility;
timestamp: number;
remotesHash?: string;
}
export interface StoredBranchComparison {
ref: string;
notation: '..' | '...' | undefined;
type: Exclude<ViewShowBranchComparison, false> | undefined;
}
export interface StoredBranchComparisons {
[id: string]: string | StoredBranchComparison;
}
export interface StoredDeepLinkContext {
url?: string | undefined;
repoPath?: string | undefined;
}
export interface StoredGraphColumn {
isHidden?: boolean;
mode?: string;
width?: number;
}
export interface StoredGraphFilters {
includeOnlyRefs?: Record<string, StoredGraphIncludeOnlyRef>;
excludeRefs?: Record<string, StoredGraphExcludedRef>;
excludeTypes?: Record<string, boolean>;
}
export type StoredGraphRefType = 'head' | 'remote' | 'tag';
export interface StoredGraphExcludedRef {
id: string;
type: StoredGraphRefType;
name: string;
owner?: string;
}
export interface StoredGraphIncludeOnlyRef {
id: string;
type: StoredGraphRefType;
name: string;
owner?: string;
}
export interface StoredNamedRef {
label?: string;
ref: string;
}
export interface StoredPinnedComparison {
type: 'comparison';
timestamp: number;
path: string;
ref1: StoredNamedRef;
ref2: StoredNamedRef;
notation?: '..' | '...';
}
export interface StoredPinnedSearch {
type: 'search';
timestamp: number;
path: string;
labels: {
label: string;
queryLabel:
| string
| {
label: string;
resultsType?: { singular: string; plural: string };
};
};
search: StoredSearchQuery;
}
export type StoredPinnedItem = StoredPinnedComparison | StoredPinnedSearch;
export type StoredPinnedItems = Record<string, StoredPinnedItem>;
export type StoredStarred = Record<string, boolean>;
export type RecentUsage = Record<string, number>;
interface DeprecatedPinnedComparison {
path: string;
ref1: StoredNamedRef;
ref2: StoredNamedRef;
notation?: '..' | '...';
}

src/context.ts → src/system/context.ts View File

@ -1,6 +1,6 @@
import { EventEmitter } from 'vscode';
import type { ContextKeys } from './constants';
import { executeCoreCommand } from './system/command';
import type { ContextKeys } from '../constants';
import { executeCoreCommand } from './command';
const contextStorage = new Map<string, unknown>();

+ 2
- 6
src/system/decorators/resolver.ts View File

@ -21,9 +21,7 @@ function replacer(key: string, value: any): any {
if (isBranch(value) || isCommit(value) || isTag(value) || isViewNode(value)) {
return value.toString();
}
if (isContainer(value)) {
return '<container>';
}
if (isContainer(value)) return '<container>';
return value;
}
@ -58,9 +56,7 @@ export function defaultResolver(...args: any[]): string {
if (isBranch(arg0) || isCommit(arg0) || isTag(arg0) || isViewNode(arg0)) {
return arg0.toString();
}
if (isContainer(arg0)) {
return '<container>';
}
if (isContainer(arg0)) return '<container>';
return JSON.stringify(arg0, replacer);
}

+ 1
- 1
src/system/keyboard.ts View File

@ -1,8 +1,8 @@
import { Disposable } from 'vscode';
import type { Keys } from '../constants';
import { extensionPrefix, keys } from '../constants';
import { setContext } from '../context';
import { registerCommand } from './command';
import { setContext } from './context';
import { log } from './decorators/log';
import { Logger } from './logger';
import { getLogScope } from './logger.scope';

+ 111
- 0
src/system/storage.ts View File

@ -0,0 +1,111 @@
import type { Disposable, Event, ExtensionContext, SecretStorageChangeEvent } from 'vscode';
import { EventEmitter } from 'vscode';
import type {
DeprecatedGlobalStorage,
DeprecatedWorkspaceStorage,
GlobalStorage,
SecretKeys,
WorkspaceStorage,
} from '../constants';
import { extensionPrefix } from '../constants';
import { debug } from './decorators/log';
export type StorageChangeEvent =
| {
/**
* The key of the stored value that has changed.
*/
readonly key: keyof (GlobalStorage & DeprecatedGlobalStorage);
readonly workspace: false;
}
| {
/**
* The key of the stored value that has changed.
*/
readonly key: keyof (WorkspaceStorage & DeprecatedWorkspaceStorage);
readonly workspace: true;
};
export class Storage implements Disposable {
private _onDidChange = new EventEmitter<StorageChangeEvent>();
get onDidChange(): Event<StorageChangeEvent> {
return this._onDidChange.event;
}
private _onDidChangeSecrets = new EventEmitter<SecretStorageChangeEvent>();
get onDidChangeSecrets(): Event<SecretStorageChangeEvent> {
return this._onDidChangeSecrets.event;
}
private readonly _disposable: Disposable;
constructor(private readonly context: ExtensionContext) {
this._disposable = this.context.secrets.onDidChange(e => this._onDidChangeSecrets.fire(e));
}
dispose(): void {
this._disposable.dispose();
}
get<T extends keyof GlobalStorage>(key: T): GlobalStorage[T] | undefined;
/** @deprecated */
get<T extends keyof DeprecatedGlobalStorage>(key: T): DeprecatedGlobalStorage[T] | undefined;
get<T extends keyof GlobalStorage>(key: T, defaultValue: GlobalStorage[T]): GlobalStorage[T];
@debug({ logThreshold: 50 })
get(key: keyof (GlobalStorage & DeprecatedGlobalStorage), defaultValue?: unknown): unknown | undefined {
return this.context.globalState.get(`${extensionPrefix}:${key}`, defaultValue);
}
@debug({ logThreshold: 250 })
async delete(key: keyof (GlobalStorage & DeprecatedGlobalStorage)): Promise<void> {
await this.context.globalState.update(`${extensionPrefix}:${key}`, undefined);
this._onDidChange.fire({ key: key, workspace: false });
}
@debug({ args: { 1: false }, logThreshold: 250 })
async store<T extends keyof GlobalStorage>(key: T, value: GlobalStorage[T] | undefined): Promise<void> {
await this.context.globalState.update(`${extensionPrefix}:${key}`, value);
this._onDidChange.fire({ key: key, workspace: false });
}
@debug({ args: false, logThreshold: 250 })
async getSecret(key: SecretKeys): Promise<string | undefined> {
return this.context.secrets.get(key);
}
@debug({ args: false, logThreshold: 250 })
async deleteSecret(key: SecretKeys): Promise<void> {
return this.context.secrets.delete(key);
}
@debug({ args: false, logThreshold: 250 })
async storeSecret(key: SecretKeys, value: string): Promise<void> {
return this.context.secrets.store(key, value);
}
getWorkspace<T extends keyof WorkspaceStorage>(key: T): WorkspaceStorage[T] | undefined;
/** @deprecated */
getWorkspace<T extends keyof DeprecatedWorkspaceStorage>(key: T): DeprecatedWorkspaceStorage[T] | undefined;
getWorkspace<T extends keyof WorkspaceStorage>(key: T, defaultValue: WorkspaceStorage[T]): WorkspaceStorage[T];
@debug({ logThreshold: 25 })
getWorkspace(
key: keyof (WorkspaceStorage & DeprecatedWorkspaceStorage),
defaultValue?: unknown,
): unknown | undefined {
return this.context.workspaceState.get(`${extensionPrefix}:${key}`, defaultValue);
}
@debug({ logThreshold: 250 })
async deleteWorkspace(key: keyof (WorkspaceStorage & DeprecatedWorkspaceStorage)): Promise<void> {
await this.context.workspaceState.update(`${extensionPrefix}:${key}`, undefined);
this._onDidChange.fire({ key: key, workspace: true });
}
@debug({ args: { 1: false }, logThreshold: 250 })
async storeWorkspace<T extends keyof WorkspaceStorage>(
key: T,
value: WorkspaceStorage[T] | undefined,
): Promise<void> {
await this.context.workspaceState.update(`${extensionPrefix}:${key}`, value);
this._onDidChange.fire({ key: key, workspace: true });
}
}

+ 1
- 1
src/telemetry/usageTracker.ts View File

@ -1,8 +1,8 @@
import type { Disposable, Event } from 'vscode';
import { EventEmitter } from 'vscode';
import type { Container } from '../container';
import type { Storage } from '../storage';
import { updateRecordValue } from '../system/object';
import type { Storage } from '../system/storage';
export interface TrackedUsage {
count: number;

+ 1
- 1
src/trackers/documentTracker.ts View File

@ -11,13 +11,13 @@ import type {
} from 'vscode';
import { Disposable, EndOfLine, env, EventEmitter, Uri, window, workspace } from 'vscode';
import type { Container } from '../container';
import { setContext } from '../context';
import type { RepositoriesChangeEvent } from '../git/gitProviderService';
import type { GitUri } from '../git/gitUri';
import { isGitUri } from '../git/gitUri';
import type { RepositoryChangeEvent } from '../git/models/repository';
import { RepositoryChange, RepositoryChangeComparisonMode } from '../git/models/repository';
import { configuration } from '../system/configuration';
import { setContext } from '../system/context';
import { debug } from '../system/decorators/log';
import { once } from '../system/event';
import type { Deferrable } from '../system/function';

+ 1
- 1
src/trackers/trackedDocument.ts View File

@ -1,9 +1,9 @@
import type { Disposable, Event, TextDocument, TextEditor } from 'vscode';
import { EventEmitter } from 'vscode';
import type { Container } from '../container';
import { setContext } from '../context';
import { GitUri } from '../git/gitUri';
import { deletedOrMissing } from '../git/models/constants';
import { setContext } from '../system/context';
import type { Deferrable } from '../system/function';
import { debounce } from '../system/function';
import { Logger } from '../system/logger';

+ 1
- 1
src/uris/deepLinks/deepLinkService.ts View File

@ -1,4 +1,5 @@
import { Disposable, env, ProgressLocation, Uri, window, workspace } from 'vscode';
import type { StoredDeepLinkContext } from '../../constants';
import { Commands } from '../../constants';
import type { Container } from '../../container';
import { getBranchNameWithoutRemote } from '../../git/models/branch';
@ -7,7 +8,6 @@ import { createReference } from '../../git/models/reference';
import type { GitRemote } from '../../git/models/remote';
import { parseGitRemoteUrl } from '../../git/parsers/remoteParser';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol';
import type { StoredDeepLinkContext } from '../../storage';
import { executeCommand } from '../../system/command';
import { configuration } from '../../system/configuration';
import { once } from '../../system/event';

+ 1
- 1
src/views/commitsView.ts View File

@ -9,7 +9,6 @@ import type { CommitsViewConfig } from '../config';
import { ViewFilesLayout, ViewShowBranchComparison } from '../config';
import { Commands, GlyphChars } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { GitUri } from '../git/gitUri';
import type { GitCommit } from '../git/models/commit';
import { isCommit } from '../git/models/commit';
@ -19,6 +18,7 @@ import type { RepositoryChangeEvent } from '../git/models/repository';
import { Repository, RepositoryChange, RepositoryChangeComparisonMode } from '../git/models/repository';
import { executeCommand } from '../system/command';
import { configuration } from '../system/configuration';
import { setContext } from '../system/context';
import { gate } from '../system/decorators/gate';
import { debug } from '../system/decorators/log';
import { disposableInterval } from '../system/function';

+ 1
- 1
src/views/fileHistoryView.ts View File

@ -2,10 +2,10 @@ import type { ConfigurationChangeEvent, Disposable } from 'vscode';
import type { FileHistoryViewConfig } from '../config';
import { Commands } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import type { GitUri } from '../git/gitUri';
import { executeCommand } from '../system/command';
import { configuration } from '../system/configuration';
import { setContext } from '../system/context';
import { FileHistoryTrackerNode } from './nodes/fileHistoryTrackerNode';
import { LineHistoryTrackerNode } from './nodes/lineHistoryTrackerNode';
import { ViewBase } from './viewBase';

+ 1
- 1
src/views/lineHistoryView.ts View File

@ -2,9 +2,9 @@ import type { ConfigurationChangeEvent, Disposable } from 'vscode';
import type { LineHistoryViewConfig } from '../config';
import { Commands } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { executeCommand } from '../system/command';
import { configuration } from '../system/configuration';
import { setContext } from '../system/context';
import { LineHistoryTrackerNode } from './nodes/lineHistoryTrackerNode';
import { ViewBase } from './viewBase';
import { registerViewCommand } from './viewCommands';

+ 2
- 2
src/views/nodes/branchNode.ts View File

@ -1,9 +1,8 @@
import { MarkdownString, ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri, window } from 'vscode';
import type { ViewShowBranchComparison } from '../../config';
import { ViewBranchesLayout } from '../../config';
import type { Colors} from '../../constants';
import type { Colors } from '../../constants';
import { GlyphChars } from '../../constants';
import { getContext } from '../../context';
import type { GitUri } from '../../git/gitUri';
import type { GitBranch } from '../../git/models/branch';
import type { GitLog } from '../../git/models/log';
@ -12,6 +11,7 @@ import { PullRequestState } from '../../git/models/pullRequest';
import type { GitBranchReference } from '../../git/models/reference';
import { GitRemote, GitRemoteType } from '../../git/models/remote';
import type { GitUser } from '../../git/models/user';
import { getContext } from '../../system/context';
import { gate } from '../../system/decorators/gate';
import { debug, log } from '../../system/decorators/log';
import { map } from '../../system/iterable';

+ 2
- 2
src/views/nodes/commitNode.ts View File

@ -2,9 +2,8 @@ import type { Command } from 'vscode';
import { MarkdownString, ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import type { DiffWithPreviousCommandArgs } from '../../commands';
import { ViewFilesLayout } from '../../config';
import type { Colors} from '../../constants';
import type { Colors } from '../../constants';
import { Commands } from '../../constants';
import { getContext } from '../../context';
import { CommitFormatter } from '../../git/formatters/commitFormatter';
import type { GitBranch } from '../../git/models/branch';
import type { GitCommit } from '../../git/models/commit';
@ -14,6 +13,7 @@ import type { GitRemote } from '../../git/models/remote';
import type { RichRemoteProvider } from '../../git/remotes/richRemoteProvider';
import { makeHierarchical } from '../../system/array';
import { configuration } from '../../system/configuration';
import { getContext } from '../../system/context';
import { gate } from '../../system/decorators/gate';
import { joinPaths, normalizePath } from '../../system/path';
import type { Deferred } from '../../system/promise';

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

@ -1,12 +1,12 @@
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ViewShowBranchComparison } from '../../config';
import type { StoredBranchComparison, StoredBranchComparisons } from '../../constants';
import { GlyphChars } from '../../constants';
import type { GitUri } from '../../git/gitUri';
import type { GitBranch } from '../../git/models/branch';
import { createRevisionRange, shortenRevision } from '../../git/models/reference';
import { CommandQuickPickItem } from '../../quickpicks/items/common';
import { showReferencePicker } from '../../quickpicks/referencePicker';
import type { StoredBranchComparison, StoredBranchComparisons } from '../../storage';
import { gate } from '../../system/decorators/gate';
import { debug, log } from '../../system/decorators/log';
import { getSettledValue } from '../../system/promise';

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

@ -1,7 +1,7 @@
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import type { StoredNamedRef } from '../../constants';
import { GlyphChars } from '../../constants';
import { unknownGitUri } from '../../git/gitUri';
import type { StoredNamedRef } from '../../storage';
import type { SearchAndCompareView, SearchAndCompareViewNode } from '../searchAndCompareView';
import { ContextValues, ViewNode } from './viewNode';

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

@ -1,8 +1,8 @@
import { ThemeIcon, TreeItem, TreeItemCollapsibleState, window } from 'vscode';
import { md5 } from '@env/crypto';
import type { StoredNamedRef } from '../../constants';
import { GitUri } from '../../git/gitUri';
import { createRevisionRange, shortenRevision } from '../../git/models/reference';
import type { StoredNamedRef } from '../../storage';
import { gate } from '../../system/decorators/gate';
import { debug, log } from '../../system/decorators/log';
import { getSettledValue } from '../../system/promise';

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

@ -1,11 +1,11 @@
import type { TextEditor } from 'vscode';
import { Disposable, FileType, TreeItem, TreeItemCollapsibleState, window, workspace } from 'vscode';
import { setContext } from '../../context';
import type { GitCommitish } from '../../git/gitUri';
import { GitUri, unknownGitUri } from '../../git/gitUri';
import { isBranchReference, isSha } from '../../git/models/reference';
import { showReferencePicker } from '../../quickpicks/referencePicker';
import { UriComparer } from '../../system/comparers';
import { setContext } from '../../system/context';
import { gate } from '../../system/decorators/gate';
import { debug, log } from '../../system/decorators/log';
import type { Deferrable } from '../../system/function';

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

@ -1,12 +1,12 @@
import type { Selection } from 'vscode';
import { TreeItem, TreeItemCollapsibleState, window } from 'vscode';
import { setContext } from '../../context';
import type { GitCommitish } from '../../git/gitUri';
import { GitUri, unknownGitUri } from '../../git/gitUri';
import { deletedOrMissing } from '../../git/models/constants';
import { isBranchReference, isSha } from '../../git/models/reference';
import { showReferencePicker } from '../../quickpicks/referencePicker';
import { UriComparer } from '../../system/comparers';
import { setContext } from '../../system/context';
import { gate } from '../../system/decorators/gate';
import { debug, log } from '../../system/decorators/log';
import { debounce } from '../../system/function';

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

@ -1,6 +1,5 @@
import { MarkdownString, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri, window } from 'vscode';
import { GlyphChars } from '../../constants';
import { getContext } from '../../context';
import type { GitUri } from '../../git/gitUri';
import type { GitBranch } from '../../git/models/branch';
import type { GitLog } from '../../git/models/log';
@ -9,6 +8,7 @@ import { PullRequestState } from '../../git/models/pullRequest';
import { shortenRevision } from '../../git/models/reference';
import { GitRemote, GitRemoteType } from '../../git/models/remote';
import type { GitWorktree } from '../../git/models/worktree';
import { getContext } from '../../system/context';
import { gate } from '../../system/decorators/gate';
import { debug } from '../../system/decorators/log';
import { map } from '../../system/iterable';

+ 1
- 1
src/views/repositoriesView.ts View File

@ -4,7 +4,6 @@ import type { RepositoriesViewConfig } from '../config';
import { ViewBranchesLayout, ViewFilesLayout, ViewShowBranchComparison } from '../config';
import { Commands } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { getRemoteNameFromBranchName } from '../git/models/branch';
import type { GitCommit } from '../git/models/commit';
import { isCommit } from '../git/models/commit';
@ -20,6 +19,7 @@ import type { GitRemote } from '../git/models/remote';
import type { GitWorktree } from '../git/models/worktree';
import { executeCommand } from '../system/command';
import { configuration } from '../system/configuration';
import { setContext } from '../system/context';
import { gate } from '../system/decorators/gate';
import { BranchesNode } from './nodes/branchesNode';
import { BranchNode } from './nodes/branchNode';

+ 2
- 2
src/views/searchAndCompareView.ts View File

@ -2,9 +2,9 @@ import type { ConfigurationChangeEvent, Disposable } from 'vscode';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import type { SearchAndCompareViewConfig } from '../config';
import { ViewFilesLayout } from '../config';
import type { StoredNamedRef, StoredPinnedItem, StoredPinnedItems } from '../constants';
import { Commands } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { unknownGitUri } from '../git/gitUri';
import type { GitLog } from '../git/models/log';
import { isRevisionRange, shortenRevision, splitRevisionRange } from '../git/models/reference';
@ -12,10 +12,10 @@ import type { SearchQuery } from '../git/search';
import { getSearchQuery } from '../git/search';
import { ReferencesQuickPickIncludes, showReferencePicker } from '../quickpicks/referencePicker';
import { getRepositoryOrShowPicker } from '../quickpicks/repositoryPicker';
import type { StoredNamedRef, StoredPinnedItem, StoredPinnedItems } from '../storage';
import { filterMap } from '../system/array';
import { executeCommand } from '../system/command';
import { configuration } from '../system/configuration';
import { setContext } from '../system/context';
import { gate } from '../system/decorators/gate';
import { debug, log } from '../system/decorators/log';
import { updateRecordValue } from '../system/object';

+ 1
- 1
src/views/viewCommands.ts View File

@ -10,7 +10,6 @@ import type {
import { FileAnnotationType, ViewShowBranchComparison } from '../config';
import { Commands } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { browseAtRevision } from '../git/actions';
import * as BranchActions from '../git/actions/branch';
import * as CommitActions from '../git/actions/commit';
@ -33,6 +32,7 @@ import {
registerCommand,
} from '../system/command';
import { configuration } from '../system/configuration';
import { setContext } from '../system/context';
import { debug } from '../system/decorators/log';
import { sequentialize } from '../system/function';
import { openWorkspace, OpenWorkspaceLocation } from '../system/utils';

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

@ -2,8 +2,8 @@ import { Disposable, extensions, workspace } from 'vscode';
import type { LiveShare, LiveShareExtension, SessionChangeEvent } from '../@types/vsls';
import { Schemes } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { configuration } from '../system/configuration';
import { setContext } from '../system/context';
import { debug } from '../system/decorators/log';
import { timeout } from '../system/decorators/timeout';
import { once } from '../system/event';

+ 1
- 1
src/webviews/commitDetails/commitDetailsWebview.ts View File

@ -5,7 +5,6 @@ import type { CopyShaToClipboardCommandArgs } from '../../commands';
import type { CoreConfiguration } from '../../constants';
import { Commands } from '../../constants';
import type { Container } from '../../container';
import { getContext } from '../../context';
import type { CommitSelectedEvent } from '../../eventBus';
import { executeGitCommand } from '../../git/actions';
import {
@ -30,6 +29,7 @@ import type { GitRemote } from '../../git/models/remote';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol';
import { executeCommand, executeCoreCommand } from '../../system/command';
import { configuration } from '../../system/configuration';
import { getContext } from '../../system/context';
import type { DateTimeFormat } from '../../system/date';
import { debug } from '../../system/decorators/log';
import type { Deferrable } from '../../system/function';

+ 2
- 2
src/webviews/home/homeWebview.ts View File

@ -3,15 +3,15 @@ import { Disposable, window } from 'vscode';
import { getAvatarUriFromGravatarEmail } from '../../avatars';
import { ViewsLayout } from '../../commands/setViewsLayout';
import type { Container } from '../../container';
import { getContext, onDidChangeContext } from '../../context';
import type { RepositoriesVisibility } from '../../git/gitProviderService';
import type { SubscriptionChangeEvent } from '../../plus/subscription/subscriptionService';
import type { StorageChangeEvent } from '../../storage';
import type { Subscription } from '../../subscription';
import { executeCoreCommand, registerCommand } from '../../system/command';
import { configuration } from '../../system/configuration';
import { getContext, onDidChangeContext } from '../../system/context';
import type { Deferrable } from '../../system/function';
import { debounce } from '../../system/function';
import type { StorageChangeEvent } from '../../system/storage';
import type { IpcMessage } from '../protocol';
import { onIpc } from '../protocol';
import type { WebviewController, WebviewProvider } from '../webviewController';

+ 1
- 1
src/webviews/webviewController.ts View File

@ -3,8 +3,8 @@ import { Disposable, EventEmitter, Uri, ViewColumn, window, workspace } from 'vs
import { getNonce } from '@env/crypto';
import type { Commands, CustomEditorIds, WebviewIds, WebviewViewIds } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { executeCommand } from '../system/command';
import { setContext } from '../system/context';
import { debug, logName } from '../system/decorators/log';
import { serialize } from '../system/decorators/serialize';
import { isPromise } from '../system/promise';

||||||
x
 
000:0
Loading…
Cancel
Save