mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
scm viewlet decorations
This commit is contained in:
@@ -236,7 +236,7 @@ export interface SCMProviderFeatures {
|
||||
supportsOriginalResource: boolean;
|
||||
}
|
||||
|
||||
export type SCMRawResource = [string /*uri*/];
|
||||
export type SCMRawResource = [string /*uri*/, string /*decoration icon*/, boolean /*strike through*/];
|
||||
export type SCMRawResourceGroup = [string /*id*/, string /*label*/, SCMRawResource[]];
|
||||
|
||||
export abstract class MainThreadSCMShape {
|
||||
|
||||
@@ -47,7 +47,23 @@ export class ExtHostSCM {
|
||||
const onDidChange = debounceEvent(provider.onDidChange, (l, e) => e, 200);
|
||||
const onDidChangeListener = onDidChange(resourceGroups => {
|
||||
const rawResourceGroups = resourceGroups.map(g => {
|
||||
const rawResources = g.resources.map(r => [r.uri.toString()] as SCMRawResource);
|
||||
const rawResources = g.resources.map(r => {
|
||||
const uri = r.uri.toString();
|
||||
let strikeThrough = false;
|
||||
let decorationIcon: string | undefined;
|
||||
|
||||
if (r.decorations) {
|
||||
if (typeof r.decorations.iconPath === 'string') {
|
||||
decorationIcon = URI.file(r.decorations.iconPath).toString();
|
||||
} else if (r.decorations.iconPath) {
|
||||
decorationIcon = `${r.decorations.iconPath}`;
|
||||
}
|
||||
|
||||
strikeThrough = !!r.decorations.strikeThrough;
|
||||
}
|
||||
|
||||
return [uri, decorationIcon, strikeThrough] as SCMRawResource;
|
||||
});
|
||||
return [g.id, g.label, rawResources] as SCMRawResourceGroup;
|
||||
});
|
||||
|
||||
|
||||
@@ -87,9 +87,17 @@ class MainThreadSCMProvider implements ISCMProvider {
|
||||
const [id, label, rawResources] = rawGroup;
|
||||
|
||||
const resources = rawResources.map(rawResource => {
|
||||
const [uri] = rawResource;
|
||||
const [uri, decorationIcon, strikeThrough] = rawResource;
|
||||
const decorations = {
|
||||
icon: decorationIcon && URI.parse(decorationIcon),
|
||||
strikeThrough
|
||||
};
|
||||
|
||||
return { uri: URI.parse(uri), resourceGroupId: id };
|
||||
return {
|
||||
resourceGroupId: id,
|
||||
uri: URI.parse(uri),
|
||||
decorations
|
||||
};
|
||||
});
|
||||
|
||||
return { id, label, resources };
|
||||
|
||||
Reference in New Issue
Block a user