details wrap normal unless they contain newlines, https://github.com/microsoft/vscode/issues/99370

This commit is contained in:
Johannes Rieken
2020-10-27 14:18:23 +01:00
parent 47623e6c53
commit 162d2c5bfd
2 changed files with 10 additions and 1 deletions
@@ -354,6 +354,11 @@
padding: 4px 0 12px 5px;
}
.monaco-editor .suggest-details>.monaco-scrollable-element>.body>.header>.type.auto-wrap {
white-space: normal;
}
.monaco-editor .suggest-details>.monaco-scrollable-element>.body>.docs {
margin: 0;
padding: 4px 5px;
@@ -142,12 +142,16 @@ export class SuggestDetailsWidget {
this.domNode.classList.remove('no-docs', 'no-type');
let detailsLines = 0;
// --- details
if (detail) {
const cappedDetail = detail.length > 100000 ? `${detail.substr(0, 100000)}` : detail;
this._type.textContent = cappedDetail;
this._type.title = cappedDetail;
dom.show(this._type);
detailsLines = count(cappedDetail, '\n');
this._type.classList.toggle('auto-wrap', detailsLines === 0);
} else {
dom.clearNode(this._type);
this._type.title = '';
@@ -186,7 +190,7 @@ export class SuggestDetailsWidget {
let heightInLines = 0;
if (detail) {
heightInLines += 2 + count(detail, '\n');
heightInLines += 2 + detailsLines;
}
if (documentation) {
heightInLines += 5;