From cd89d3318dfa50c2dd984d4596cb9b97e3ab38af Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Mon, 14 Oct 2024 15:23:31 +0200 Subject: [PATCH] autocomplete: search docs fix --- frontend/components/CellInput/pluto_autocomplete.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/components/CellInput/pluto_autocomplete.js b/frontend/components/CellInput/pluto_autocomplete.js index e4729ed72..141db39ed 100644 --- a/frontend/components/CellInput/pluto_autocomplete.js +++ b/frontend/components/CellInput/pluto_autocomplete.js @@ -84,10 +84,9 @@ let update_docs_from_autocomplete_selection = (on_update_doc_query) => { let text_to_apply = selected_option.completion.apply ?? selected_option.completion.label if (typeof text_to_apply !== "string") return - // Option.source is now the source, we find to find the corresponding ActiveResult - // https://github.com/codemirror/autocomplete/commit/6d9f24115e9357dc31bc265cd3da7ce2287fdcbd + // Option.source is now the source, we find to find the corresponding ActiveResult (internal type) const active_result = update.view.state.field(completionState).active.find((a) => a.source == selected_option.source) - if (!active_result?.from) return // not an ActiveResult instance + if (active_result?.hasResult?.() !== true) return // not an ActiveResult instance const from = active_result.from, to = Math.min(active_result.to, update.state.doc.length)