Handle completion items without detail

This commit is contained in:
Jonatan Kłosko 2024-01-25 17:05:46 +08:00
parent 2b5171fe92
commit 55dfb12827
2 changed files with 11 additions and 5 deletions

View file

@ -430,10 +430,13 @@ export default class LiveEditor {
// to not distract the user too much as they are typing
return wait(350).then(() => {
const node = document.createElement("div");
const detail = document.createElement("div");
detail.classList.add("cm-completionInfoDetail");
detail.innerHTML = highlight(item.detail, this.language);
node.appendChild(detail);
if (item.detail) {
const detail = document.createElement("div");
detail.classList.add("cm-completionInfoDetail");
detail.innerHTML = highlight(item.detail, this.language);
node.appendChild(detail);
}
if (item.documentation) {
const docs = document.createElement("div");

View file

@ -238,8 +238,11 @@ function buildEditorTheme(colors, { dark }) {
},
"& .cm-completionInfoDocs": {
borderTop: `1px solid ${colors.separator}`,
padding: "6px",
"&:not(:first-child)": {
borderTop: `1px solid ${colors.separator}`,
},
},
},