(defn
get-completion-context
[symbol-length cursor-offset]
(when-let
[top-level-elem (get-focused-top-level)]
(let
[pos
(-> top-level-elem (get-cursor-position false) first)
prefix-start
(- pos cursor-offset)
text
(.-textContent top-level-elem)]
{:ns (get-nearest-ns top-level-elem),
:context-before (subs text 0 prefix-start),
:context-after (subs text (+ prefix-start symbol-length)),
:start-position prefix-start})))