From 55dfb12827057edb2fe400e8c565fce2d0e3a11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Thu, 25 Jan 2024 17:05:46 +0800 Subject: [PATCH] Handle completion items without detail --- assets/js/hooks/cell_editor/live_editor.js | 11 +++++++---- .../hooks/cell_editor/live_editor/codemirror/theme.js | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/assets/js/hooks/cell_editor/live_editor.js b/assets/js/hooks/cell_editor/live_editor.js index 26e512561..79fb85d33 100644 --- a/assets/js/hooks/cell_editor/live_editor.js +++ b/assets/js/hooks/cell_editor/live_editor.js @@ -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"); diff --git a/assets/js/hooks/cell_editor/live_editor/codemirror/theme.js b/assets/js/hooks/cell_editor/live_editor/codemirror/theme.js index c43521cf7..f4c906a46 100644 --- a/assets/js/hooks/cell_editor/live_editor/codemirror/theme.js +++ b/assets/js/hooks/cell_editor/live_editor/codemirror/theme.js @@ -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}`, + }, }, },