mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-10 16:58:55 -05:00
Added git\src\model tooltip for decorations.
This commit is contained in:
@@ -119,6 +119,28 @@ export class Resource implements SourceControlResourceState {
|
||||
}
|
||||
}
|
||||
|
||||
private getTooltip(): string {
|
||||
switch (this.type) {
|
||||
case Status.INDEX_MODIFIED: return localize('index modified', "Index Modified");
|
||||
case Status.MODIFIED: return localize('modified', "Modified");
|
||||
case Status.INDEX_ADDED: return localize('index added', "Index Added");
|
||||
case Status.INDEX_DELETED: return localize('index deleted', "Index Deleted");
|
||||
case Status.DELETED: return localize('deleted', "Deleted");
|
||||
case Status.INDEX_RENAMED: return localize('index renamed', "Index Renamed");
|
||||
case Status.INDEX_COPIED: return localize('index copied', "Index Copied");
|
||||
case Status.UNTRACKED: return localize('untracked', "Untracked");
|
||||
case Status.IGNORED: return localize('ignored', "Ignored");
|
||||
case Status.BOTH_DELETED: return localize('both deleted', "Both Deleted");
|
||||
case Status.ADDED_BY_US: return localize('added by us', "Added By Us");
|
||||
case Status.DELETED_BY_THEM: return localize('deleted by them', "Deleted By Them");
|
||||
case Status.ADDED_BY_THEM: return localize('added by them', "Added By Them");
|
||||
case Status.DELETED_BY_US: return localize('deleted by us', "Deleted By Us");
|
||||
case Status.BOTH_ADDED: return localize('both added', "Both Added");
|
||||
case Status.BOTH_MODIFIED: return localize('both modified', "Both Modified");
|
||||
default: return '';
|
||||
}
|
||||
}
|
||||
|
||||
private get strikeThrough(): boolean {
|
||||
switch (this.type) {
|
||||
case Status.DELETED:
|
||||
@@ -141,10 +163,11 @@ export class Resource implements SourceControlResourceState {
|
||||
get decorations(): SourceControlResourceDecorations {
|
||||
const light = { iconPath: this.getIconPath('light') };
|
||||
const dark = { iconPath: this.getIconPath('dark') };
|
||||
const tooltip = this.getTooltip();
|
||||
const strikeThrough = this.strikeThrough;
|
||||
const faded = this.faded;
|
||||
|
||||
return { strikeThrough, faded, light, dark };
|
||||
return { strikeThrough, faded, tooltip, light, dark };
|
||||
}
|
||||
|
||||
constructor(
|
||||
|
||||
6
src/vs/vscode.d.ts
vendored
6
src/vs/vscode.d.ts
vendored
@@ -4838,6 +4838,12 @@ declare module 'vscode' {
|
||||
*/
|
||||
readonly faded?: boolean;
|
||||
|
||||
/**
|
||||
* The title for a specific
|
||||
* [source control resource state](#SourceControlResourceState).
|
||||
*/
|
||||
readonly tooltip?: string;
|
||||
|
||||
/**
|
||||
* The light theme decorations.
|
||||
*/
|
||||
|
||||
@@ -156,12 +156,13 @@ class MainThreadSCMProvider implements ISCMProvider {
|
||||
}
|
||||
|
||||
group.resources = resources.map(rawResource => {
|
||||
const [handle, sourceUri, command, icons, strikeThrough, faded] = rawResource;
|
||||
const [handle, sourceUri, command, icons, tooltip, strikeThrough, faded] = rawResource;
|
||||
const icon = icons[0];
|
||||
const iconDark = icons[1] || icon;
|
||||
const decorations = {
|
||||
icon: icon && URI.parse(icon),
|
||||
iconDark: iconDark && URI.parse(iconDark),
|
||||
tooltip,
|
||||
strikeThrough,
|
||||
faded
|
||||
};
|
||||
|
||||
@@ -324,6 +324,7 @@ export type SCMRawResource = [
|
||||
string /*resourceUri*/,
|
||||
modes.Command /*command*/,
|
||||
string[] /*icons: light, dark*/,
|
||||
string /*tooltip*/,
|
||||
boolean /*strike through*/,
|
||||
boolean /*faded*/
|
||||
];
|
||||
|
||||
@@ -119,10 +119,11 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
|
||||
icons.push(darkIconPath);
|
||||
}
|
||||
|
||||
const tooltip = r.decorations.tooltip;
|
||||
const strikeThrough = r.decorations && !!r.decorations.strikeThrough;
|
||||
const faded = r.decorations && !!r.decorations.faded;
|
||||
|
||||
return [handle, sourceUri, command, icons, strikeThrough, faded] as SCMRawResource;
|
||||
return [handle, sourceUri, command, icons, tooltip, strikeThrough, faded] as SCMRawResource;
|
||||
});
|
||||
|
||||
this._proxy.$updateGroupResourceStates(this._sourceControlHandle, this._handle, rawResources);
|
||||
|
||||
@@ -197,6 +197,7 @@ class ResourceRenderer implements IRenderer<ISCMResource, ResourceTemplate> {
|
||||
|
||||
if (icon) {
|
||||
template.decorationIcon.style.backgroundImage = `url('${icon}')`;
|
||||
template.decorationIcon.title = resource.decorations.tooltip;
|
||||
} else {
|
||||
template.decorationIcon.style.backgroundImage = '';
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ export const DefaultSCMProviderIdStorageKey = 'settings.workspace.scm.defaultPro
|
||||
export interface ISCMResourceDecorations {
|
||||
icon?: URI;
|
||||
iconDark?: URI;
|
||||
tooltip?: string;
|
||||
strikeThrough?: boolean;
|
||||
faded?: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user