This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (18)
- # aws (17)
- # babashka (19)
- # beginners (141)
- # calva (73)
- # cider (4)
- # clj-kondo (13)
- # cljs-dev (2)
- # clojure (97)
- # clojure-europe (6)
- # clojure-italy (5)
- # clojure-nl (1)
- # clojure-spec (25)
- # clojure-sweden (2)
- # clojure-uk (25)
- # clojured (3)
- # clojurescript (63)
- # core-typed (6)
- # cursive (23)
- # data-science (4)
- # datomic (74)
- # fulcro (19)
- # graalvm (18)
- # graphql (3)
- # hoplon (63)
- # jackdaw (1)
- # juxt (23)
- # london-clojurians (3)
- # meander (7)
- # off-topic (23)
- # om (1)
- # pathom (13)
- # pedestal (2)
- # perun (2)
- # re-frame (38)
- # reagent (3)
- # reitit (24)
- # shadow-cljs (91)
- # spacemacs (14)
- # sql (4)
- # tools-deps (8)
- # vim (3)
i also have an alternative implementation that matches on a regular expression:
but this is also a hack -- i'm not so sure there is going to be a practical method that can identify everything. at least statically, it seems unlikely unless there is a naming convention everyone follows.
(when-let [^js tree (get @trees uri)] (let [q (.query @clj-lang (str "((list " " (symbol) @head " " (symbol) @name) " " (match? @head \"^def[a-zA-Z]*\"))")) ms (.matches q (.-rootNode tree))]
In the tmLanguage grammar, that Calva shares with vscode default Clojure extension, and also Atom. There is a similar hack/assumption. In Calva we have adapted it slightly to allow for symbols starting with
@sogaiu sorry for lack of understanding, but does it mean you created vscode extension for clojure outline?
@slawek098, I happen to be able to answer that. 😃 @sogaiu made a proof of concept for a way to do Clojure grammar in vscode, and as part of that used it to make an outline. So, no, there is no such extension really. Yet.
One, Calva does not support outline (and Ctrl+Shift+O). Second, there are no per-workspace tags (Ctrl+T). Third, only vim keybinding I am able to use without huge perfromance impact is SimpleVim which does not even support
/ search - useful as last resort for navigation within a file.
I would love an outline. It will eventually be added. We just need to decide on what tooling we should use, and free some time for it.
Actually it does not work by default, because it's conflicting with Ctrl+F from SimpleVim - I had to rebind it to Ctrl+Alt+F.
I'm currently testing a thing that @slack1038 baked together, using clojure-lsp, that gives me outline, symbol lookup and workspace wide tags in Calva. It is currently in the POC phase of things, but anyway, there's hope! Let me know if you want to run this build.
Here: https://4103-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.78-feat-lsp-client-73a73615.vsix Things are a bit crazy with nrepl and lsp competing on serving features, but mostly things still work. See Installing VSIX Packages here, if you're not familiar with how its done: https://github.com/BetterThanTomorrow/calva/wiki/Testing-VSIX-Packages#installing-a-vsix-package (It is super easy).
Exception in thread "main" java.lang.UnsupportedClassVersionError: clojure_lsp/ClojureExtensions has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Ah, we should probably compile that jar using Java 1.8... I'll see if I can figure it out.
@pez beware of this if you are compiling yourself on java > 8 https://github.com/snoe/clojure-lsp/pull/89
It will take me a while to get the lsp in w/o causing chaos in Calva (mainly because of Calva providing many of the same features). But it is mindblowing how much power you have provided to Clojure coding with this project!
There is an issue that you might know something about. With the lsp I get a fix-lightbulb everywhere I place the cursor. The fix it offers is
add-missing-libspec, and it doesn't seem to do anything at all.
I'll be more than happy to provide a PR. Hooking Calva on lsp will mean much of my dev work will be in the lsp instead of in Calva directly, so I will need to learn how to hack there. 😃
depending on what level of accuracy one wants, how much work it might be in calva (or other extension) will likely vary. if you're happy with finding most things then i don't think it should be that much work.
for jumping to definitions in other files, i use this: https://github.com/sogaiu/alc.index-defs
that requires building the index manually but allows one to navigate among things even in one's dependencies (though it doesn't handle interop)
this last one uses clj-kondo internally as a library to identify things and has been pretty accurate in my use
@pez @slawek098 oh sorry for that i compiled it with adopt openjdk 12 myself i just checkout the clojure-lsp repo and used lein uberjar to get the standalone jar
@slawek098 try this VSIX instead. It uses the lsp jar from Releases in @snoe’s repo. https://4123-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.78-feat-lsp-client-01b7a2db.vsix
with that one there is a small problem with windows thats why i compiled it myself and used a jar instead 😉
Will this language server work when connecting to a repl and not starting it (connect vs jack-in)
Do you know if it's possible for Ctrl+T to match
common-foobar when typing
#common foobar or
#foobar common or
Remember that this is just a test build. There will be dragons. It will be quite some work getting it to play nicely in Calva.
Hello wonderful Calva people. I'm trying Calva every now and then and I'm super excited to see how far it progresses, seemingly every week 🙂
One thing that I couldn't find how to do -- I'm used to using the CIDER inspector or most often, the ability to pretty-print the result of an evaluation in a new bugger. Is there a way for Calva to do that?
@pez OK, so defnitely fuzzy search do work in
Go to symbol in file but not in
Go to symbol in workspace
@slawek098 the code for workspace-symbols is pretty simplistic, fuzzy find there would be nice! https://github.com/snoe/clojure-lsp/blob/master/src/clojure_lsp/handlers.clj#L401
@snoe @pez maybe I'd try to work on it - how I can test it? How's clojure-lsp integrated into calva?
@slawek098 it looks like there isn't an existing unit test in clojure-lsp but it would be pretty straightforward, you add "code" to
db/db then call
(handlers/workspace-symbols "search") to exercise
It's probably best to develop it using unit tests. Then to test in Calva would be to follow the regular Calva dev workflow, but replace the clojure-lsp.jar in the root folder.
It's in this branch: https://github.com/BetterThanTomorrow/calva/tree/feat/lsp-client
And this is the Calva dev workflow: https://github.com/BetterThanTomorrow/calva/wiki/How-to-Hack-on-Calva
@orestis, no inspector in Calva yet. I sometimes use the one in clojure. No pretty-print to buffer either. What I do is I hover on the inline result and click the Copy link (there is no visual feedback, but the result is indeed copied). Then paste in a new buffer and set that buffer to be of Clojure type.
Works nicely, thanks. The folding behaves interestingly in the case of a seq of maps: Since both the opening paren and the opening bracket are on the same line, you can't fold the first map...
While we are giving thanks, I am a convert form spacemacs and I love Calva 🙂