mirror of
https://github.com/danbulant/monaco-yaml
synced 2026-05-24 12:21:53 +00:00
Merge pull request #114 from remcohaszing/remove-hover-content-checks
Remove checks for hover content
This commit is contained in:
commit
0f2e5536bf
1 changed files with 1 additions and 38 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
import {
|
import {
|
||||||
editor,
|
editor,
|
||||||
IDisposable,
|
IDisposable,
|
||||||
IMarkdownString,
|
|
||||||
languages,
|
languages,
|
||||||
MarkerSeverity,
|
MarkerSeverity,
|
||||||
Position,
|
Position,
|
||||||
|
|
@ -253,42 +252,6 @@ export function createCompletionItemProvider(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMarkupContent(thing: unknown): thing is ls.MarkupContent {
|
|
||||||
return thing && typeof thing === 'object' && typeof (thing as ls.MarkupContent).kind === 'string';
|
|
||||||
}
|
|
||||||
|
|
||||||
function toMarkdownString(entry: ls.MarkedString | ls.MarkupContent): IMarkdownString {
|
|
||||||
if (typeof entry === 'string') {
|
|
||||||
return {
|
|
||||||
value: entry,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (isMarkupContent(entry)) {
|
|
||||||
if (entry.kind === 'plaintext') {
|
|
||||||
return {
|
|
||||||
value: entry.value.replace(/[!#()*+.[\\\]_`{}-]/g, '\\$&'),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
value: entry.value,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return { value: `\`\`\`${entry.language}\n${entry.value}\n\`\`\`\n` };
|
|
||||||
}
|
|
||||||
|
|
||||||
function toMarkedStringArray(
|
|
||||||
contents: ls.MarkedString | ls.MarkedString[] | ls.MarkupContent,
|
|
||||||
): IMarkdownString[] {
|
|
||||||
if (!contents) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Array.isArray(contents)) {
|
|
||||||
return contents.map(toMarkdownString);
|
|
||||||
}
|
|
||||||
return [toMarkdownString(contents)];
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- hover ------
|
// --- hover ------
|
||||||
|
|
||||||
export function createHoverProvider(getWorker: WorkerAccessor): languages.HoverProvider {
|
export function createHoverProvider(getWorker: WorkerAccessor): languages.HoverProvider {
|
||||||
|
|
@ -303,7 +266,7 @@ export function createHoverProvider(getWorker: WorkerAccessor): languages.HoverP
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
range: toRange(info.range),
|
range: toRange(info.range),
|
||||||
contents: toMarkedStringArray(info.contents),
|
contents: [{ value: (info.contents as ls.MarkupContent).value }],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue