SCM - 💄 API cleanup (#209339)

* SCM - 💄 API cleanup

* Fix compilation
This commit is contained in:
Ladislau Szomoru 2024-04-02 14:51:36 +02:00 committed by GitHub
parent fba040af32
commit 8d1ecd7b94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 28 additions and 28 deletions

View file

@ -66,11 +66,11 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
this.currentHistoryItemGroup = {
id: `refs/heads/${this.repository.HEAD.name ?? ''}`,
label: this.repository.HEAD.name ?? '',
name: this.repository.HEAD.name ?? '',
base: this.repository.HEAD.upstream ?
{
id: `refs/remotes/${this.repository.HEAD.upstream.remote}/${this.repository.HEAD.upstream.name}`,
label: `${this.repository.HEAD.upstream.remote}/${this.repository.HEAD.upstream.name}`,
name: `${this.repository.HEAD.upstream.remote}/${this.repository.HEAD.upstream.name}`,
} : undefined
};
@ -101,8 +101,8 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
return {
id: commit.hash,
parentIds: commit.parents,
label: emojify(subject),
description: commit.authorName,
message: emojify(subject),
author: commit.authorName,
icon: new ThemeIcon('git-commit'),
timestamp: commit.authorDate?.getTime(),
statistics: commit.shortStat ?? { files: 0, insertions: 0, deletions: 0 },
@ -119,7 +119,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
}
const allChanges = await this.repository.diffBetweenShortStat(historyItemParentId, historyItemId);
return { id: historyItemId, parentIds: [historyItemParentId], label: '', statistics: allChanges };
return { id: historyItemId, parentIds: [historyItemParentId], message: '', statistics: allChanges };
}
async provideHistoryItemChanges(historyItemId: string, historyItemParentId: string | undefined): Promise<SourceControlHistoryItemChange[]> {

View file

@ -1493,15 +1493,15 @@ export type SCMRawResourceSplices = [
export interface SCMHistoryItemGroupDto {
readonly id: string;
readonly label: string;
readonly name: string;
readonly base?: Omit<SCMHistoryItemGroupDto, 'base'>;
}
export interface SCMHistoryItemDto {
readonly id: string;
readonly parentIds: string[];
readonly label: string;
readonly description?: string;
readonly message: string;
readonly author?: string;
readonly icon?: UriComponents | { light: UriComponents; dark: UriComponents } | ThemeIcon;
readonly timestamp?: number;
}

View file

@ -280,7 +280,7 @@ export class SCMActiveRepositoryContextKeyController implements IWorkbenchContri
private updateContextKeys(repository: ISCMRepository | undefined): void {
this.activeRepositoryNameContextKey.set(repository?.provider.name ?? '');
this.activeRepositoryBranchNameContextKey.set(repository?.provider.historyProvider?.currentHistoryItemGroup?.label ?? '');
this.activeRepositoryBranchNameContextKey.set(repository?.provider.historyProvider?.currentHistoryItemGroup?.name ?? '');
}
dispose(): void {

View file

@ -876,8 +876,8 @@ class HistoryItemActionRunner extends ActionRunner {
args.push({
id: context.id,
parentIds: context.parentIds,
label: context.label,
description: context.description,
message: context.message,
author: context.author,
icon: context.icon,
timestamp: context.timestamp,
statistics: context.statistics,
@ -940,7 +940,7 @@ class HistoryItemRenderer implements ICompressibleTreeRenderer<SCMHistoryItemTre
}
const [matches, descriptionMatches] = this.processMatches(historyItem, node.filterData);
templateData.label.setLabel(historyItem.label, historyItem.description, { matches, descriptionMatches });
templateData.label.setLabel(historyItem.message, historyItem.author, { matches, descriptionMatches });
templateData.actionBar.clear();
templateData.actionBar.context = historyItem;
@ -964,8 +964,8 @@ class HistoryItemRenderer implements ICompressibleTreeRenderer<SCMHistoryItemTre
}
return [
historyItem.label === filterData.label ? createMatches(filterData.score) : undefined,
historyItem.description === filterData.label ? createMatches(filterData.score) : undefined
historyItem.message === filterData.label ? createMatches(filterData.score) : undefined,
historyItem.author === filterData.label ? createMatches(filterData.score) : undefined
];
}
@ -1318,7 +1318,7 @@ export class SCMTreeKeyboardNavigationLabelProvider implements ICompressibleKeyb
// For a history item we want to match both the message and
// the author. A match in the message takes precedence over
// a match in the author.
return [element.label, element.description];
return [element.message, element.author];
} else if (isSCMViewSeparator(element)) {
return element.label;
} else {
@ -1418,7 +1418,7 @@ export class SCMAccessibilityProvider implements IListAccessibilityProvider<Tree
} else if (isSCMHistoryItemGroupTreeElement(element)) {
return element.ariaLabel ?? `${element.label.trim()}${element.description ? `, ${element.description}` : ''}`;
} else if (isSCMHistoryItemTreeElement(element)) {
return `${stripIcons(element.label).trim()}${element.description ? `, ${element.description}` : ''}`;
return `${stripIcons(element.message).trim()}${element.author ? `, ${element.author}` : ''}`;
} else if (isSCMHistoryItemChangeTreeElement(element)) {
const result = [basename(element.uri)];
const path = this.labelService.getUriLabel(dirname(element.uri), { relative: true, noPrefix: true });
@ -3623,8 +3623,8 @@ class SCMTreeDataSource implements IAsyncDataSource<ISCMViewService, TreeElement
// Only show "Incoming" node if there is a base branch
incomingHistoryItemGroup = currentHistoryItemGroup.base ? {
id: currentHistoryItemGroup.base.id,
label: currentHistoryItemGroup.base.label,
ariaLabel: localize('incomingChangesAriaLabel', "Incoming changes from {0}", currentHistoryItemGroup.base.label),
label: currentHistoryItemGroup.base.name,
ariaLabel: localize('incomingChangesAriaLabel', "Incoming changes from {0}", currentHistoryItemGroup.base.name),
icon: Codicon.arrowCircleDown,
direction: 'incoming',
ancestor: ancestor.id,
@ -3635,8 +3635,8 @@ class SCMTreeDataSource implements IAsyncDataSource<ISCMViewService, TreeElement
outgoingHistoryItemGroup = {
id: currentHistoryItemGroup.id,
label: currentHistoryItemGroup.label,
ariaLabel: localize('outgoingChangesAriaLabel', "Outgoing changes to {0}", currentHistoryItemGroup.label),
label: currentHistoryItemGroup.name,
ariaLabel: localize('outgoingChangesAriaLabel', "Outgoing changes to {0}", currentHistoryItemGroup.name),
icon: Codicon.arrowCircleUp,
direction: 'outgoing',
ancestor: ancestor.id,
@ -3702,7 +3702,7 @@ class SCMTreeDataSource implements IAsyncDataSource<ISCMViewService, TreeElement
children.push({
...historyItemsElement[0],
icon: historyItemsElement[0].icon ?? Codicon.files,
label: localize('allChanges', "All Changes"),
message: localize('allChanges', "All Changes"),
historyItemGroup: element,
type: 'allChanges'
} satisfies SCMHistoryItemTreeElement);

View file

@ -43,7 +43,7 @@ export interface ISCMHistoryOptions {
export interface ISCMHistoryItemGroup {
readonly id: string;
readonly label: string;
readonly name: string;
readonly base?: Omit<ISCMHistoryItemGroup, 'base'>;
}
@ -69,8 +69,8 @@ export interface ISCMHistoryItemStatistics {
export interface ISCMHistoryItem {
readonly id: string;
readonly parentIds: string[];
readonly label: string;
readonly description?: string;
readonly message: string;
readonly author?: string;
readonly icon?: URI | { light: URI; dark: URI } | ThemeIcon;
readonly timestamp?: number;
readonly statistics?: ISCMHistoryItemStatistics;

View file

@ -38,13 +38,13 @@ declare module 'vscode' {
export interface SourceControlHistoryItemGroup {
readonly id: string;
readonly label: string;
readonly name: string;
readonly base?: Omit<SourceControlRemoteHistoryItemGroup, 'base'>;
}
export interface SourceControlRemoteHistoryItemGroup {
readonly id: string;
readonly label: string;
readonly name: string;
}
export interface SourceControlHistoryItemStatistics {
@ -56,8 +56,8 @@ declare module 'vscode' {
export interface SourceControlHistoryItem {
readonly id: string;
readonly parentIds: string[];
readonly label: string;
readonly description?: string;
readonly message: string;
readonly author?: string;
readonly icon?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
readonly timestamp?: number;
readonly statistics?: SourceControlHistoryItemStatistics;