diff options
Diffstat (limited to 'src/vs/workbench/contrib/scm/browser/scm.contribution.ts')
-rw-r--r-- | src/vs/workbench/contrib/scm/browser/scm.contribution.ts | 74 |
1 files changed, 58 insertions, 16 deletions
diff --git a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts index 27fa26a947d..956e867a21f 100644 --- a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts +++ b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts @@ -7,7 +7,7 @@ import { localize } from 'vs/nls'; import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { DirtyDiffWorkbenchController } from './dirtydiffDecorator'; -import { VIEWLET_ID, ISCMRepository, ISCMService, VIEW_PANE_ID, ISCMProvider, ISCMViewService, REPOSITORIES_VIEW_PANE_ID } from 'vs/workbench/contrib/scm/common/scm'; +import { VIEWLET_ID, ISCMService, VIEW_PANE_ID, ISCMProvider, ISCMViewService, REPOSITORIES_VIEW_PANE_ID } from 'vs/workbench/contrib/scm/common/scm'; import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; import { SCMActiveResourceContextKeyController, SCMStatusController } from './activity'; @@ -83,7 +83,7 @@ viewsRegistry.registerViews([{ containerIcon: sourceControlViewIcon, openCommandActionDescriptor: { id: viewContainer.id, - mnemonicTitle: localize({ key: 'miViewSCM', comment: ['&& denotes a mnemonic'] }, "S&&CM"), + mnemonicTitle: localize({ key: 'miViewSCM', comment: ['&& denotes a mnemonic'] }, "Source &&Control"), keybindings: { primary: 0, win: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyG }, @@ -118,7 +118,7 @@ Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench) Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({ id: 'scm', order: 5, - title: localize('scmConfigurationTitle', "SCM"), + title: localize('scmConfigurationTitle', "Source Control"), type: 'object', scope: ConfigurationScope.RESOURCE, properties: { @@ -161,6 +161,25 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis description: localize('scm.diffDecorationsGutterAction', "Controls the behavior of Source Control diff gutter decorations."), default: 'diff' }, + 'scm.diffDecorationsGutterPattern': { + type: 'object', + description: localize('diffGutterPattern', "Controls whether a pattern is used for the diff decorations in gutter."), + additionalProperties: false, + properties: { + 'added': { + type: 'boolean', + description: localize('diffGutterPatternAdded', "Use pattern for the diff decorations in gutter for added lines."), + }, + 'modified': { + type: 'boolean', + description: localize('diffGutterPatternModifed', "Use pattern for the diff decorations in gutter for modified lines."), + }, + }, + default: { + 'added': false, + 'modified': true + } + }, 'scm.diffDecorationsIgnoreTrimWhitespace': { type: 'string', enum: ['true', 'false', 'inherit'], @@ -215,14 +234,14 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis enumDescriptions: [ localize('scm.defaultViewSortKey.name', "Sort the repository changes by file name."), localize('scm.defaultViewSortKey.path', "Sort the repository changes by path."), - localize('scm.defaultViewSortKey.status', "Sort the repository changes by SCM status.") + localize('scm.defaultViewSortKey.status', "Sort the repository changes by Source Control status.") ], - description: localize('scm.defaultViewSortKey', "Controls the default Source Control repository sort mode."), + description: localize('scm.defaultViewSortKey', "Controls the default Source Control repository changes sort order when viewed as a list."), default: 'path' }, 'scm.autoReveal': { type: 'boolean', - description: localize('autoReveal', "Controls whether the SCM view should automatically reveal and select files when opening them."), + description: localize('autoReveal', "Controls whether the Source Control view should automatically reveal and select files when opening them."), default: true }, 'scm.inputFontFamily': { @@ -237,9 +256,20 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis }, 'scm.alwaysShowRepositories': { type: 'boolean', - markdownDescription: localize('alwaysShowRepository', "Controls whether repositories should always be visible in the SCM view."), + markdownDescription: localize('alwaysShowRepository', "Controls whether repositories should always be visible in the Source Control view."), default: false }, + 'scm.repositories.sortOrder': { + type: 'string', + enum: ['discovery time', 'name', 'path'], + enumDescriptions: [ + localize('scm.repositoriesSortOrder.discoveryTime', "Repositories in the Source Control Repositories view are sorted by discovery time. Repositories in the Source Control view are sorted in the order that they were selected."), + localize('scm.repositoriesSortOrder.name', "Repositories in the Source Control Repositories and Source Control views are sorted by repository name."), + localize('scm.repositoriesSortOrder.path', "Repositories in the Source Control Repositories and Source Control views are sorted by repository path.") + ], + description: localize('repositoriesSortOrder', "Controls the sort order of the repositories in the source control repositories view."), + default: 'discovery time' + }, 'scm.repositories.visible': { type: 'number', description: localize('providersVisible', "Controls how many repositories are visible in the Source Control Repositories section. Set to `0` to be able to manually resize the view."), @@ -247,7 +277,7 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis }, 'scm.showActionButton': { type: 'boolean', - markdownDescription: localize('showActionButton', "Controls whether an action button can be shown in the SCM view."), + markdownDescription: localize('showActionButton', "Controls whether an action button can be shown in the Source Control view."), default: true } } @@ -255,44 +285,56 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'scm.acceptInput', - description: { description: localize('scm accept', "SCM: Accept Input"), args: [] }, + description: { description: localize('scm accept', "Source Control: Accept Input"), args: [] }, weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.has('scmRepository'), primary: KeyMod.CtrlCmd | KeyCode.Enter, handler: accessor => { const contextKeyService = accessor.get(IContextKeyService); const context = contextKeyService.getContext(document.activeElement); - const repository = context.getValue<ISCMRepository>('scmRepository'); + const repositoryId = context.getValue<string | undefined>('scmRepository'); + + if (!repositoryId) { + return Promise.resolve(null); + } + + const scmService = accessor.get(ISCMService); + const repository = scmService.getRepository(repositoryId); - if (!repository || !repository.provider.acceptInputCommand) { + if (!repository?.provider.acceptInputCommand) { return Promise.resolve(null); } + const id = repository.provider.acceptInputCommand.id; const args = repository.provider.acceptInputCommand.arguments; - const commandService = accessor.get(ICommandService); + return commandService.executeCommand(id, ...(args || [])); } }); const viewNextCommitCommand = { - description: { description: localize('scm view next commit', "SCM: View Next Commit"), args: [] }, + description: { description: localize('scm view next commit', "Source Control: View Next Commit"), args: [] }, weight: KeybindingWeight.WorkbenchContrib, handler: (accessor: ServicesAccessor) => { const contextKeyService = accessor.get(IContextKeyService); + const scmService = accessor.get(ISCMService); const context = contextKeyService.getContext(document.activeElement); - const repository = context.getValue<ISCMRepository>('scmRepository'); + const repositoryId = context.getValue<string | undefined>('scmRepository'); + const repository = repositoryId ? scmService.getRepository(repositoryId) : undefined; repository?.input.showNextHistoryValue(); } }; const viewPreviousCommitCommand = { - description: { description: localize('scm view previous commit', "SCM: View Previous Commit"), args: [] }, + description: { description: localize('scm view previous commit', "Source Control: View Previous Commit"), args: [] }, weight: KeybindingWeight.WorkbenchContrib, handler: (accessor: ServicesAccessor) => { const contextKeyService = accessor.get(IContextKeyService); + const scmService = accessor.get(ISCMService); const context = contextKeyService.getContext(document.activeElement); - const repository = context.getValue<ISCMRepository>('scmRepository'); + const repositoryId = context.getValue<string | undefined>('scmRepository'); + const repository = repositoryId ? scmService.getRepository(repositoryId) : undefined; repository?.input.showPreviousHistoryValue(); } }; |