Closed holyjak closed 3 months ago
The following in VS Code + Calva (|
denotes the position of the cursor):
(intern *ns* 'interned-var (fn [] "It's alive!"))
(interne|)
gives me autocompletion proposal for interned-var
. However, clj-kondo wanrs about Unresolved symbol
.
The same thing does not work in Cursive, i.e. interned-var
is not among completions. Not surprising, since Curisve uses a static code analysis.
See https://github.com/scicloj/wolframite/issues/36
The clj-kondo linter cannot know these dynamic vars b/c it only does static code analysis.
Perhaps we should have a fn that can generate a Clojure ns into a .clj file, based on the loaded symbols (or loading them as well, if not loaded already). Thus users could dump the symbols into a file on their dev-only classpath (something like dev/w.clj
, where dev/
in on the classpath only in dev mode), and get auto-completion in all IDEs, and make clj-kondo stop complaining. We could make a variant of load-all-syms, which loads them if not loaded, checks the dumped file for existence, and writes it or overrides it if symbols have changed since last...
Having such a file on the classpath may be necessary to be able to (require ...)
or load-file
files that use these symbols and do not have the load-all-symbols
at the top level or already executed elsewhere - f.ex. our tests had to do eval + quote trickery to deal with this problem. Having the Wolfram symbol vars ns on the classpath would have prevented it.
load-all-symbols
creates vars with docs in a namespace. But none of Cursive/kondo/Calva seems to "see" these and use them for autocompletion. Can we do anything to help them? Autocompl. would be helpful for UX.