diff --git a/editor2/src/main/maria/editor/code/completions.cljs b/editor2/src/main/maria/editor/code/completions.cljs index 16cc725f..219e78bb 100644 --- a/editor2/src/main/maria/editor/code/completions.cljs +++ b/editor2/src/main/maria/editor/code/completions.cljs @@ -57,15 +57,14 @@ (when (and ns name) (try (let [sym-name (c/name name) - ns-name-str (or (when imported-from - ;; omit imported-from name if equal to sym-name - (if (= (c/name imported-from) sym-name) - (namespace imported-from) - (str imported-from))) - (sci.ns/sci-ns-name ns))] + var-sym (or imported-from + (symbol (str ns) sym-name)) + detail (if (= sym-name (c/name var-sym)) + (namespace var-sym) + (str var-sym))] #js{:label sym-name - :sym (symbol ns-name-str sym-name) - :detail ns-name-str + :sym var-sym + :detail detail ;; :type "y" ;; indicates icon ;; :detail ;; short string shown after label ;; :info ;; shown when completion is selected diff --git a/editor2/src/main/maria/editor/extensions/emmy.cljs b/editor2/src/main/maria/editor/extensions/emmy.cljs index 16b29252..57fa66f4 100644 --- a/editor2/src/main/maria/editor/extensions/emmy.cljs +++ b/editor2/src/main/maria/editor/extensions/emmy.cljs @@ -4,13 +4,16 @@ [emmy.value] [emmy.expression] [emmy.operator] + [emmy.abstract.function] [emmy.series] + [emmy.modint] [emmy.portal.css :refer [inject!] :rename {inject! inject-css!}] [emmy.viewer.css :refer [css-map]] [emmy.mafs] [maria.editor.extensions.reagent :as ext.reagent] [maria.editor.code.show-values :as show :refer [show]] - [sci.ctx-store :refer [get-ctx]])) + [sci.ctx-store :refer [get-ctx]] + [yawn.view :as v])) (defn show-frozen [opts x] (show opts (emmy.value/freeze x))) @@ -21,16 +24,22 @@ (defn show-string [opts x] (str x)) +(defn show-number-string [opts x] + (v/x [:span.text-number (str x)])) + (def viewers-by-type {emmy.expression/Literal show-expression-of emmy.operator/Operator show-frozen emmy.series/PowerSeries show-frozen - emmy.series/Series show-frozen - js/BigInt show-string}) + emmy.series/Series (fn [opts x] (show opts (seq x))) + emmy.abstract.function/Function show-frozen + emmy.modint/ModInt show-frozen + emmy.quaternion/Quaternion show-frozen + js/BigInt show-number-string}) (defn show-emmy [opts x] (if (instance? Fraction x) - (str x) + (show-number-string opts x) (if-let [viewer (viewers-by-type (type x))] (viewer opts x) (when-let [m (meta x)]