提交 6afb0f47 编写于 作者: J Johannes Rieken

allow to define gutter and content icons paths as string OR uri, #12111

上级 9e4d4ece
...@@ -301,8 +301,10 @@ class DecorationRenderHelper { ...@@ -301,8 +301,10 @@ class DecorationRenderHelper {
if (typeof opts !== 'undefined') { if (typeof opts !== 'undefined') {
DecorationRenderHelper.collectBorderSettingsCSSText(opts, cssTextArr); DecorationRenderHelper.collectBorderSettingsCSSText(opts, cssTextArr);
if (typeof opts.contentIconPath !== 'undefined') { if (typeof opts.contentIconPath === 'string') {
cssTextArr.push(strings.format(this._CSS_MAP.contentIconPath, URI.parse(opts.contentIconPath).toString())); cssTextArr.push(strings.format(this._CSS_MAP.contentIconPath, URI.file(opts.contentIconPath).toString()));
} else if(opts.contentIconPath instanceof URI) {
cssTextArr.push(strings.format(this._CSS_MAP.contentIconPath, opts.contentIconPath.toString()));
} }
if (typeof opts.contentText !== 'undefined') { if (typeof opts.contentText !== 'undefined') {
let escaped = opts.contentText.replace(/\"/g, '\\\"'); let escaped = opts.contentText.replace(/\"/g, '\\\"');
...@@ -324,7 +326,11 @@ class DecorationRenderHelper { ...@@ -324,7 +326,11 @@ class DecorationRenderHelper {
let cssTextArr = []; let cssTextArr = [];
if (typeof opts.gutterIconPath !== 'undefined') { if (typeof opts.gutterIconPath !== 'undefined') {
cssTextArr.push(strings.format(this._CSS_MAP.gutterIconPath, URI.parse(opts.gutterIconPath).toString())); if (typeof opts.gutterIconPath === 'string') {
cssTextArr.push(strings.format(this._CSS_MAP.gutterIconPath, URI.file(opts.gutterIconPath).toString()));
} else {
cssTextArr.push(strings.format(this._CSS_MAP.gutterIconPath, opts.gutterIconPath.toString()));
}
if (typeof opts.gutterIconSize !== 'undefined') { if (typeof opts.gutterIconSize !== 'undefined') {
cssTextArr.push(strings.format(this._CSS_MAP.gutterIconSize, opts.gutterIconSize)); cssTextArr.push(strings.format(this._CSS_MAP.gutterIconSize, opts.gutterIconSize));
} }
......
...@@ -3788,7 +3788,7 @@ export interface IThemeDecorationRenderOptions { ...@@ -3788,7 +3788,7 @@ export interface IThemeDecorationRenderOptions {
color?: string; color?: string;
letterSpacing?: string; letterSpacing?: string;
gutterIconPath?: string; gutterIconPath?: string | URI;
gutterIconSize?: string; gutterIconSize?: string;
overviewRulerColor?: string; overviewRulerColor?: string;
...@@ -3802,7 +3802,7 @@ export interface IThemeDecorationRenderOptions { ...@@ -3802,7 +3802,7 @@ export interface IThemeDecorationRenderOptions {
*/ */
export interface IContentDecorationRenderOptions { export interface IContentDecorationRenderOptions {
contentText?: string; contentText?: string;
contentIconPath?: string; contentIconPath?: string | URI;
border?: string; border?: string;
textDecoration?: string; textDecoration?: string;
......
...@@ -782,9 +782,10 @@ declare namespace vscode { ...@@ -782,9 +782,10 @@ declare namespace vscode {
letterSpacing?: string; letterSpacing?: string;
/** /**
* An **absolute path** to an image to be rendered in the gutterIconPath. * An **absolute path** to an image to be rendered in the gutterIconPath or
* an URI.
*/ */
gutterIconPath?: string; gutterIconPath?: string | Uri;
/** /**
* Specifies the size of the gutter icon. * Specifies the size of the gutter icon.
...@@ -815,9 +816,9 @@ declare namespace vscode { ...@@ -815,9 +816,9 @@ declare namespace vscode {
*/ */
contentText?: string; contentText?: string;
/** /**
* An **absolute path** to an image to be rendered in the attachment. Either an icon or a text can be shown, but not both. * An **absolute path** to an image to be rendered in the attachment or an URI. Either an icon or a text can be shown, but not both.
*/ */
contentIconPath?: string; contentIconPath?: string | Uri;
/** /**
* CSS styling property that will be applied to the decoration attachment. * CSS styling property that will be applied to the decoration attachment.
*/ */
......
...@@ -143,7 +143,7 @@ export function fromRangeOrRangeWithMessage(ranges: vscode.Range[] | vscode.Deco ...@@ -143,7 +143,7 @@ export function fromRangeOrRangeWithMessage(ranges: vscode.Range[] | vscode.Deco
return { return {
range: fromRange(r.range), range: fromRange(r.range),
hoverMessage: r.hoverMessage, hoverMessage: r.hoverMessage,
renderOptions: r.renderOptions renderOptions: <any> /* URI vs Uri*/ r.renderOptions
}; };
}); });
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册