in package/src/languageFeatures.ts [510:536]
private formatDocLink(docString?: string): monaco.languages.CompletionItem['documentation'] {
// If the docString is empty, we want to return undefined to prevent an empty documentation popup.
if (!docString) {
return undefined;
}
const { documentationBaseUrl = DEFAULT_DOCS_BASE_URL, documentationSuffix } = this.languageSettings;
const urisProxy = new Proxy(
{},
{
get(_target, prop, _receiver) {
// The link comes with a postfix of ".md" that we want to remove
let url = prop.toString().replace('.md', '');
// Sometimes we get the link as a full URL. For example in the main doc link of the item
if (!url.startsWith('https')) {
url = `${documentationBaseUrl}/${url}`;
}
const monacoUri = monaco.Uri.parse(url);
if (documentationSuffix) {
// We need to override the toString method to add the suffix, otherwise it gets encoded and page doesn't open
monacoUri.toString = () => url + documentationSuffix;
}
return monacoUri;
},
}
);
return { value: docString, isTrusted: true, uris: urisProxy };
}