Color Decorator sits together with Color Picker.

This commit is contained in:
rebornix
2017-08-22 20:49:52 -07:00
committed by Peng Lyu
parent f4ccc31770
commit 9937bcf6ec
11 changed files with 220 additions and 85 deletions

View File

@@ -734,8 +734,7 @@ class ColorProviderAdapter {
return {
color: [ci.color.red, ci.color.green, ci.color.blue, ci.color.alpha] as [number, number, number, number],
availableFormats: availableFormats,
range: TypeConverters.fromRange(ci.range),
renderDecorator: ci.renderDecorator
range: TypeConverters.fromRange(ci.range)
};
});
@@ -1040,9 +1039,16 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
registerColorProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentColorProvider): vscode.Disposable {
const handle = this._nextHandle();
const eventHandle = typeof provider.onDidChangeColors === 'function' ? this._nextHandle() : undefined;
this._adapter.set(handle, new ColorProviderAdapter(this._proxy, this._documents, this._colorFormatCache, provider));
this._proxy.$registerDocumentColorProvider(handle, selector);
return this._createDisposable(handle);
this._proxy.$registerDocumentColorProvider(handle, selector, eventHandle);
let result = this._createDisposable(handle);
if (eventHandle !== undefined) {
const subscription = provider.onDidChangeColors(_ => this._proxy.$emitColorsEvent(eventHandle));
result = Disposable.from(result, subscription);
}
return result;
}
$provideDocumentColors(handle: number, resource: URI): TPromise<IRawColorInfo[]> {