Skip to content

Commit

Permalink
Align signatures with other providers.
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Sep 8, 2017
1 parent f0ecb26 commit 3753e0e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions extensions/css/client/src/cssMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ export function activate(context: ExtensionContext) {
});
});
},
resolveColor(color: Color, colorFormat: ColorFormat): Thenable<string> | string {
resolveDocumentColor(color: Color, colorFormat: ColorFormat): Thenable<string> | string {
switch (colorFormat) {
case ColorFormat.RGB:
if (color.alpha === 1) {
return `rgb(${Math.round(color.red * 255)}, ${Math.round(color.green * 255)}, ${Math.round(color.blue * 255)})`;
} else {
return `rgb(${Math.round(color.red * 255)}, ${Math.round(color.green * 255)}, ${Math.round(color.blue * 255)}, ${color.alpha})`;
return `rgba(${Math.round(color.red * 255)}, ${Math.round(color.green * 255)}, ${Math.round(color.blue * 255)}, ${color.alpha})`;
}
case ColorFormat.HEX:
if (color.alpha === 1) {
Expand Down
4 changes: 2 additions & 2 deletions extensions/html/client/src/htmlMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ export function activate(context: ExtensionContext) {
});
});
},
resolveColor(color: Color, colorFormat: ColorFormat): Thenable<string> | string {
resolveDocumentColor(color: Color, colorFormat: ColorFormat): Thenable<string> | string {
switch (colorFormat) {
case ColorFormat.RGB:
if (color.alpha === 1) {
return `rgb(${Math.round(color.red * 255)}, ${Math.round(color.green * 255)}, ${Math.round(color.blue * 255)})`;
} else {
return `rgb(${Math.round(color.red * 255)}, ${Math.round(color.green * 255)}, ${Math.round(color.blue * 255)}, ${color.alpha})`;
return `rgba(${Math.round(color.red * 255)}, ${Math.round(color.green * 255)}, ${Math.round(color.blue * 255)}, ${color.alpha})`;
}
case ColorFormat.HEX:
if (color.alpha === 1) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/json/client/src/jsonMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export function activate(context: ExtensionContext) {
});
});
},
resolveColor(color: Color, colorFormat: ColorFormat): Thenable<string> | string {
resolveDocumentColor(color: Color, colorFormat: ColorFormat): Thenable<string> | string {
if (color.alpha === 1) {
return `#${_toTwoDigitHex(Math.round(color.red * 255))}${_toTwoDigitHex(Math.round(color.green * 255))}${_toTwoDigitHex(Math.round(color.blue * 255))}`;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/contrib/colorPicker/common/colorFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class RGBFormatter implements IColorFormatter {
if (rgb.a === 1) {
return `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`;
} else {
return `rgb(${rgb.r}, ${rgb.g}, ${rgb.b}, ${rgb.a})`;
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${rgb.a})`;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ declare module 'vscode' {
/**
* Provide the string representation for a color.
*/
resolveColor(color: Color, colorFormat: ColorFormat): ProviderResult<string>;
resolveDocumentColor(color: Color, colorFormat: ColorFormat): ProviderResult<string>;
}

export namespace languages {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
});
},
resolveColor: (color, format, token) => {
return wireCancellationToken(token, proxy.$resolveColor(handle, color, format));
return wireCancellationToken(token, proxy.$resolveDocumentColor(handle, color, format));
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/node/extHost.protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ export interface ExtHostLanguageFeaturesShape {
$provideDocumentLinks(handle: number, resource: URI): TPromise<modes.ILink[]>;
$resolveDocumentLink(handle: number, link: modes.ILink): TPromise<modes.ILink>;
$provideDocumentColors(handle: number, resource: URI): TPromise<IRawColorInfo[]>;
$resolveColor(handle: number, color: modes.IColor, colorFormat: modes.ColorFormat): TPromise<string>;
$resolveDocumentColor(handle: number, color: modes.IColor, colorFormat: modes.ColorFormat): TPromise<string>;
}

export interface ExtHostQuickOpenShape {
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/node/extHostLanguageFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ class ColorProviderAdapter {
}

resolveColor(color: modes.IColor, colorFormat: modes.ColorFormat): TPromise<string> {
return asWinJsPromise(token => this._provider.resolveColor(color, colorFormat));
return asWinJsPromise(token => this._provider.resolveDocumentColor(color, colorFormat));
}
}

Expand Down Expand Up @@ -1042,7 +1042,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return this._withAdapter(handle, ColorProviderAdapter, adapter => adapter.provideColors(resource));
}

$resolveColor(handle: number, color: modes.IColor, colorFormat: modes.ColorFormat): TPromise<string> {
$resolveDocumentColor(handle: number, color: modes.IColor, colorFormat: modes.ColorFormat): TPromise<string> {
return this._withAdapter(handle, ColorProviderAdapter, adapter => adapter.resolveColor(color, colorFormat));
}

Expand Down

0 comments on commit 3753e0e

Please sign in to comment.