mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix hover tooltips (#14561)
This commit is contained in:
@@ -274,8 +274,8 @@ export namespace MarkdownString {
|
|||||||
if (isCodeblock(markup)) {
|
if (isCodeblock(markup)) {
|
||||||
const { language, value } = markup;
|
const { language, value } = markup;
|
||||||
res = { value: '```' + language + '\n' + value + '\n```\n' };
|
res = { value: '```' + language + '\n' + value + '\n```\n' };
|
||||||
} else if (htmlContent.isMarkdownString(markup)) {
|
} else if (types.MarkdownString.isMarkdownString(markup)) {
|
||||||
res = markup;
|
res = { value: markup.value, isTrusted: markup.isTrusted, supportThemeIcons: markup.supportThemeIcons };
|
||||||
} else if (typeof markup === 'string') {
|
} else if (typeof markup === 'string') {
|
||||||
res = { value: markup };
|
res = { value: markup };
|
||||||
} else {
|
} else {
|
||||||
@@ -343,7 +343,7 @@ export namespace MarkdownString {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fromStrict(value: string | types.MarkdownString): undefined | string | htmlContent.IMarkdownString {
|
export function fromStrict(value: string | vscode.MarkdownString): undefined | string | htmlContent.IMarkdownString {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1276,7 +1276,9 @@ export class CodeLens {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@es5ClassCompat
|
@es5ClassCompat
|
||||||
export class MarkdownString extends BaseMarkdownString implements vscode.MarkdownString {
|
export class MarkdownString implements vscode.MarkdownString {
|
||||||
|
|
||||||
|
readonly #delegate: BaseMarkdownString;
|
||||||
|
|
||||||
static isMarkdownString(thing: any): thing is vscode.MarkdownString {
|
static isMarkdownString(thing: any): thing is vscode.MarkdownString {
|
||||||
if (thing instanceof MarkdownString) {
|
if (thing instanceof MarkdownString) {
|
||||||
@@ -1286,18 +1288,53 @@ export class MarkdownString extends BaseMarkdownString implements vscode.Markdow
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(value?: string, supportThemeIcons: boolean = false) {
|
constructor(value?: string, supportThemeIcons: boolean = false) {
|
||||||
super(value ?? '', { supportThemeIcons });
|
this.#delegate = new BaseMarkdownString(value, { supportThemeIcons });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get value(): string {
|
||||||
|
return this.#delegate.value;
|
||||||
|
}
|
||||||
|
set value(value: string) {
|
||||||
|
this.#delegate.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get isTrusted(): boolean | undefined {
|
||||||
|
return this.#delegate.isTrusted;
|
||||||
|
}
|
||||||
|
|
||||||
|
set isTrusted(value: boolean | undefined) {
|
||||||
|
this.#delegate.isTrusted = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get supportThemeIcons(): boolean | undefined {
|
||||||
|
return this.#delegate.supportThemeIcons;
|
||||||
|
}
|
||||||
|
|
||||||
|
appendText(value: string): vscode.MarkdownString {
|
||||||
|
this.#delegate.appendText(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
appendMarkdown(value: string): vscode.MarkdownString {
|
||||||
|
this.#delegate.appendMarkdown(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
appendCodeblock(value: string, language?: string): vscode.MarkdownString {
|
||||||
|
this.#delegate.appendCodeblock(language ?? '', value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@es5ClassCompat
|
@es5ClassCompat
|
||||||
export class ParameterInformation {
|
export class ParameterInformation {
|
||||||
|
|
||||||
label: string | [number, number];
|
label: string | [number, number];
|
||||||
documentation?: string | MarkdownString;
|
documentation?: string | vscode.MarkdownString;
|
||||||
|
|
||||||
constructor(label: string | [number, number], documentation?: string | MarkdownString) {
|
constructor(label: string | [number, number], documentation?: string | vscode.MarkdownString) {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.documentation = documentation;
|
this.documentation = documentation;
|
||||||
}
|
}
|
||||||
@@ -1307,11 +1344,11 @@ export class ParameterInformation {
|
|||||||
export class SignatureInformation {
|
export class SignatureInformation {
|
||||||
|
|
||||||
label: string;
|
label: string;
|
||||||
documentation?: string | MarkdownString;
|
documentation?: string | vscode.MarkdownString;
|
||||||
parameters: ParameterInformation[];
|
parameters: ParameterInformation[];
|
||||||
activeParameter?: number;
|
activeParameter?: number;
|
||||||
|
|
||||||
constructor(label: string, documentation?: string | MarkdownString) {
|
constructor(label: string, documentation?: string | vscode.MarkdownString) {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.documentation = documentation;
|
this.documentation = documentation;
|
||||||
this.parameters = [];
|
this.parameters = [];
|
||||||
@@ -1397,7 +1434,7 @@ export class CompletionItem implements vscode.CompletionItem {
|
|||||||
kind?: CompletionItemKind;
|
kind?: CompletionItemKind;
|
||||||
tags?: CompletionItemTag[];
|
tags?: CompletionItemTag[];
|
||||||
detail?: string;
|
detail?: string;
|
||||||
documentation?: string | MarkdownString;
|
documentation?: string | vscode.MarkdownString;
|
||||||
sortText?: string;
|
sortText?: string;
|
||||||
filterText?: string;
|
filterText?: string;
|
||||||
preselect?: boolean;
|
preselect?: boolean;
|
||||||
|
|||||||
@@ -642,4 +642,10 @@ suite('ExtHostTypes', function () {
|
|||||||
1, 0, 3, 3, (1 << 2) | (1 << 4)
|
1, 0, 3, 3, (1 << 2) | (1 << 4)
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Markdown codeblock rendering is swapped #111604', function () {
|
||||||
|
const md = new types.MarkdownString().appendCodeblock('<img src=0 onerror="alert(1)">', 'html');
|
||||||
|
assert.deepEqual(md.value, '\n```html\n<img src=0 onerror="alert(1)">\n```\n');
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user