It would seem very much handy for tool makers if the cljs analysis (i.e. the object that has a :cljs.analyzer/namespaces key, among others included a :form when descring a var
e.g. I'm asking for a :form to be associated here:
{:meta {,,,},
:form (def foo 42) ;; <--------------
:name shadow.remote.runtime.api/foo,
:file "shadow/remote/runtime/api.cljc",
:end-column 30,
:column 8,
:line 13}
is this a FAQ / something you'd consider?you should be able to get that from the line/col metadata? well the string at least. https://github.com/clojure/clojurescript/blob/1b6d4e559bfaa716052c557f6fa31111384eb336/src/main/clojure/cljs/repl.cljc#L1495
thanks! Good leads, I'l try making use of those
An edge case being, forms defined at the repl / interactively, those cannot be fetched from source+line+col Given that those would be like < 1% off all cases, it would not be memory-expensive to include them
well there is also the extra concern for cache related things
currently this data is written to disk as transit per namespaces (for shadow-cljs at least)
which would also cost performance I guess
what would you do with the form in the first place though? should probably first provide a proper use case before anything is decided 😛
Thanks. The use case would be "arbitrary tooling stuff". The usual suspects: offering better completions, refactorings, info, and such.
otherwise it might increase memory use? and may contain not easily serialized stuff, e.g. regexes are not part of EDN or transit by default