mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-12 19:39:20 -05:00
deco - remove opacity, use colors only, remove provider label from proposed api
This commit is contained in:
@@ -21,7 +21,7 @@ class GitIgnoreDecorationProvider implements DecorationProvider {
|
||||
|
||||
constructor(private repository: Repository) {
|
||||
this.disposables.push(
|
||||
window.registerDecorationProvider(this, '.gitignore'),
|
||||
window.registerDecorationProvider(this),
|
||||
filterEvent(workspace.onDidSaveTextDocument, e => e.fileName.endsWith('.gitignore'))(_ => this._onDidChangeDecorations.fire())
|
||||
//todo@joh -> events when the ignore status actually changes, not only when the file changes
|
||||
);
|
||||
@@ -72,7 +72,7 @@ class GitDecorationProvider implements DecorationProvider {
|
||||
|
||||
constructor(private repository: Repository) {
|
||||
this.disposables.push(
|
||||
window.registerDecorationProvider(this, repository.root),
|
||||
window.registerDecorationProvider(this),
|
||||
repository.onDidRunOperation(this.onDidRunOperation, this)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -183,8 +183,6 @@ export class Resource implements SourceControlResourceState {
|
||||
get resourceDecoration(): DecorationData | undefined {
|
||||
const title = this.tooltip;
|
||||
switch (this.type) {
|
||||
case Status.IGNORED:
|
||||
return { priority: 3, title, opacity: 0.75 };
|
||||
case Status.UNTRACKED:
|
||||
return { priority: 1, title, abbreviation: localize('untracked, short', "U"), bubble: true, color: new ThemeColor('git.color.untracked') };
|
||||
case Status.INDEX_MODIFIED:
|
||||
|
||||
3
src/vs/vscode.proposed.d.ts
vendored
3
src/vs/vscode.proposed.d.ts
vendored
@@ -178,7 +178,6 @@ declare module 'vscode' {
|
||||
bubble?: boolean;
|
||||
abbreviation?: string;
|
||||
color?: ThemeColor;
|
||||
opacity?: number;
|
||||
}
|
||||
|
||||
export interface DecorationProvider {
|
||||
@@ -187,7 +186,7 @@ declare module 'vscode' {
|
||||
}
|
||||
|
||||
export namespace window {
|
||||
export function registerDecorationProvider(provider: DecorationProvider, label: string): Disposable;
|
||||
export function registerDecorationProvider(provider: DecorationProvider): Disposable;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
@@ -29,23 +29,22 @@ export class MainThreadDecorations implements MainThreadDecorationsShape {
|
||||
this._provider.clear();
|
||||
}
|
||||
|
||||
$registerDecorationProvider(handle: number, label: string): void {
|
||||
$registerDecorationProvider(handle: number): void {
|
||||
let emitter = new Emitter<URI[]>();
|
||||
let registration = this._decorationsService.registerDecorationsProvider({
|
||||
label,
|
||||
label: 'extension-provider',
|
||||
onDidChange: emitter.event,
|
||||
provideDecorations: (uri) => {
|
||||
return this._proxy.$providerDecorations(handle, uri).then(data => {
|
||||
if (!data) {
|
||||
return undefined;
|
||||
}
|
||||
const [weight, bubble, title, letter, opacity, themeColor] = data;
|
||||
const [weight, bubble, title, letter, themeColor] = data;
|
||||
return {
|
||||
weight: weight || 0,
|
||||
bubble: bubble || false,
|
||||
title,
|
||||
letter,
|
||||
opacity,
|
||||
color: themeColor && themeColor.id
|
||||
};
|
||||
});
|
||||
|
||||
@@ -378,8 +378,8 @@ export function createApiFactory(
|
||||
sampleFunction: proposedApiFunction(extension, () => {
|
||||
return extHostMessageService.showMessage(extension, Severity.Info, 'Hello Proposed Api!', {}, []);
|
||||
}),
|
||||
registerDecorationProvider: proposedApiFunction(extension, (provider: vscode.DecorationProvider, label: string) => {
|
||||
return extHostDecorations.registerDecorationProvider(provider, label);
|
||||
registerDecorationProvider: proposedApiFunction(extension, (provider: vscode.DecorationProvider) => {
|
||||
return extHostDecorations.registerDecorationProvider(provider, extension.id);
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
@@ -602,7 +602,7 @@ export interface ExtHostDebugServiceShape {
|
||||
}
|
||||
|
||||
|
||||
export type DecorationData = [number, boolean, string, string, number, ThemeColor];
|
||||
export type DecorationData = [number, boolean, string, string, ThemeColor];
|
||||
|
||||
export interface ExtHostDecorationsShape {
|
||||
$providerDecorations(handle: number, uri: URI): TPromise<DecorationData>;
|
||||
|
||||
@@ -41,7 +41,7 @@ export class ExtHostDecorations implements ExtHostDecorationsShape {
|
||||
$providerDecorations(handle: number, uri: URI): TPromise<DecorationData> {
|
||||
const provider = this._provider.get(handle);
|
||||
return asWinJsPromise(token => provider.provideDecoration(uri, token)).then(data => {
|
||||
return data && <DecorationData>[data.priority, data.bubble, data.title, data.abbreviation, data.opacity, data.color];
|
||||
return data && <DecorationData>[data.priority, data.bubble, data.title, data.abbreviation, data.color];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ export const IDecorationsService = createDecorator<IDecorationsService>('IFileDe
|
||||
export interface IDecorationData {
|
||||
readonly weight?: number;
|
||||
readonly color?: ColorIdentifier;
|
||||
readonly opacity?: number;
|
||||
readonly letter?: string;
|
||||
readonly title?: string;
|
||||
readonly bubble?: boolean;
|
||||
|
||||
@@ -23,8 +23,8 @@ class DecorationRule {
|
||||
if (Array.isArray(data)) {
|
||||
return data.map(DecorationRule.keyOf).join(',');
|
||||
} else {
|
||||
const { color, opacity, letter } = data;
|
||||
return `${color}/${opacity}/${letter}`;
|
||||
const { color, letter } = data;
|
||||
return `${color}/${letter}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,9 +49,9 @@ class DecorationRule {
|
||||
}
|
||||
|
||||
private _appendForOne(data: IDecorationData, element: HTMLStyleElement, theme: ITheme): void {
|
||||
const { color, opacity, letter } = data;
|
||||
const { color, letter } = data;
|
||||
// label
|
||||
createCSSRule(`.${this.labelClassName}`, `color: ${theme.getColor(color) || 'inherit'}; opacity: ${opacity || 1};`, element);
|
||||
createCSSRule(`.${this.labelClassName}`, `color: ${theme.getColor(color) || 'inherit'};`, element);
|
||||
createCSSRule(`.focused .selected .${this.labelClassName}`, `color: inherit; opacity: inherit;`, element);
|
||||
// badge
|
||||
if (letter) {
|
||||
@@ -62,8 +62,8 @@ class DecorationRule {
|
||||
|
||||
private _appendForMany(data: IDecorationData[], element: HTMLStyleElement, theme: ITheme): void {
|
||||
// label
|
||||
const { color, opacity } = data[0];
|
||||
createCSSRule(`.${this.labelClassName}`, `color: ${theme.getColor(color) || 'inherit'}; opacity: ${opacity || 1};`, element);
|
||||
const { color } = data[0];
|
||||
createCSSRule(`.${this.labelClassName}`, `color: ${theme.getColor(color) || 'inherit'};`, element);
|
||||
createCSSRule(`.focused .selected .${this.labelClassName}`, `color: inherit; opacity: inherit;`, element);
|
||||
|
||||
// badge
|
||||
|
||||
Reference in New Issue
Block a user