mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 20:52:56 +01:00
Merge pull request #14 from kitsonk/feature-documentation
Add documentation support on hover
This commit is contained in:
commit
c8118cb17e
1 changed files with 10 additions and 1 deletions
|
|
@ -317,10 +317,19 @@ export class QuickInfoAdapter extends Adapter implements monaco.languages.HoverP
|
||||||
if (!info) {
|
if (!info) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let documentation = ts.displayPartsToString(info.documentation);
|
||||||
|
let tags = info.tags ? info.tags.map(tag => {
|
||||||
|
const label = `*@${tag.name}*`;
|
||||||
|
if (!tag.text) {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
return label + (tag.text.match(/\r\n|\n/g) ? ' \n' + tag.text : ` - ${tag.text}`);
|
||||||
|
})
|
||||||
|
.join(' \n\n') : '';
|
||||||
let contents = ts.displayPartsToString(info.displayParts);
|
let contents = ts.displayPartsToString(info.displayParts);
|
||||||
return {
|
return {
|
||||||
range: this._textSpanToRange(resource, info.textSpan),
|
range: this._textSpanToRange(resource, info.textSpan),
|
||||||
contents: [contents]
|
contents: [ contents, documentation + (tags ? '\n\n' + tags : '') ]
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue