hi there! I tried to integrate clojure-lsp-native with sublime text but unfortunatelly getting strange exception filed it here - https://github.com/clojure-lsp/clojure-lsp/issues/430
I've now deployed the latest version into Package Control, so instead of using the master branch, you can just update via Package Control. Probably need to restart ST. I've also updated the documentation at https://tutkain.flowthing.me/.
maybe someone already knows what is going on and how to fix this 🙂
Hey! it seems a missing graalvm reflection config, I can fix it
meanwhile you can test wit with the JVM embedded binary
It seems other editors (vim, emacs, vscode ) doesn't use that class for some reason
@delaguardo Fixed on master, besides the option mentioned above, you can build a new image following https://clojure-lsp.github.io/clojure-lsp/building/ or wait for the next release which should be soon
so far I just download clojure-lsp.jar and use it like that: ["java", "-jar", "/path/to/jar"]
wow 🙏 that was quick )
will test it right away )
thanks!
LMK if that works well with sublimeText 🙂
no it complain about org.eclipse.lsp4j.MarkdownCapabilities I’ll fix it and make a PR later today. Will check if anything else is missing
Odd... Well, try to follow my commit and check if there is anything left, thanks!
On the subject of Sublime Text, I've been working on a Clojure package for ST for the past year or so. I've recently been migrating it off of nREPL to socket REPL and adding ClojureScript support (shadow-cljs only for now). If you're interested in trying it out, let me know.
Sure, definitely will try it out
Is it tutkain package? https://tutkain.flowthing.me/
Then I already using it) smooth sailing so far
Great job! :thumbsup_all:
Yes, that’s it. 🙂 Are you using the master branch?
Just asking because the version that's in Package Control still uses nREPL -- it's pretty old now and I'll be dropping nREPL support in the next version.
From package control, yes. I will try master branch, thanks
OK, cool. Feel free to DM me if you come across any problems.
I sadly didn't have the time to get everything into shape for the ST4 release, so no documentation yet, but the long and short of it is that just run Tutkain: Connect to connect to a Clojure, shadow-cljs, or a Babashka socket REPL, run Tutkain: Edit Key Bindings to see a bunch of example key bindings, copy-paste and edit what you need, and you should be off to the races.
Hey guys, With lsp
installed and enabled and - with my point in Emacs on one of the core clojure symbols like defonce
, defn
, or println
- invoking lsp-find-definition
takes a long while and the performance of cider-find-var
has also regressed for me. In each instance, Emacs is blocked while a new LSP server seems to be starting up on a new port!
Hey @ericdallo, I debugged through the elisp code to see why it was doing so.
My lsp-session-file
contained my ~/.emacs.d directory from my LSP use a while ago.
I fixed that by clearing the session file; a cleanup was useful for my purposes anyway. 🙂
That fixed the behaviour on lsp-find-definition
.
However, it did not fix the issue with cider-find-var
.
I noted that since the session file reset, I’ve only opened one project with LSP but it seems to have automagically added an entry for my home directory as well; I am guessing because of the cider-find-var
invocation.
#s(lsp-session ("/Users/affan" "/Users/affan/scratch/clj/rdd-demo") nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()))
I always had issues with cider-find-var, sorry, maybe you can get that answer on #cider
Lsp-mode asks what's the root, you probably selected your home in the past
Can I reset that?
Yes, lsp-workspace-folders-remove I think
Ah, I’ll give that a shot. 🙂
Hm, after successful removal (both from the LSP completion list and the session file), it added it back in when I tried cider-find-var
.
lsp-mode has nothing related with cider, that command only removes the folder as root, so next time you lsp
it will ask what's the project root
The cider issue seems another issue
The reason this ends up related is because, like the recommended configuration, I’ve got lsp
activated through clojure-mode-hook
so when cider-find-var
takes me to a new Clojure file, lsp
kicks in.
And that’s when the session file is checked while deciding whether a new LSP server is needed. At any rate, I think I’ve worked out the cause for the home directory returning; this is because I’ve got lsp-auto-guess-root
enabled and in that case projectile state also needs cleaning up.
I see now, yes, lsp-auto-guess-root is not enabled by default for those kind of issues, I suggest disable it indeed
Ah, I see. I followed your useful guide[1] amongst other resources but did not come across that.
[1] — https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/
Good point, maybe I should add a mention to that on there :)
That sounds good; thanks Eric :)
I think I’d prefer lsp-find-definition
but I’m running into a significant slowdown (and UI blocking) on the first access to a file like clojure.core.clj
:
which-func-ff-hook error: (error "Timeout while waiting for response. Method: textDocument/documentSymbol")
Hum, it should be fast to go to that file :thinking_face:
It seems like my generally useful which-func-mode
is waiting for the symbol information from LSP (probably indirectly), hm…
I see; which-function creates the Imenu index for the buffer, if necessary.
It does so in its find-file hook.
Hum, so It keeps requesting document-symbols
Hm, it times out but only on the clojure.core.clj
file. At least, it’s fine on the small project files that I’ve tested lsp
with so far. :)
I was able to resolve this by lowering which-func-maxout
to 5000 with a setq-local
for my clojure-mode-hook
function.
Yeah, could you check your clojure-lsp.out log file? To get how much time it's taking the request
Ah, that’ll be useful because while find-file is no longer blocking (and that timeout error’s gone), there’s still a significant period of UI blocking immediately after the file loads up.
I’ve got the log-path
from lsp-clojure-server-info
.
Yes, thats correct
It’s a 39 line file; what would be the best way of sharing it with you?
Thanks Eric 🙂
I’ve created a Gist: https://gist.github.com/affan-salman/78568d35119bc483b8eeb899d4a32710
I can only see didOpen taking to much time, but I think it's ok since it's scanning clojure.core and it's a huge buffer
And here’s the original version -- without lowering which-func-maxout
:
https://gist.github.com/affan-salman/d9f71fb03d578d1ecd476810d3ffbaf1
DocumentSymbol seems quite fast
Right. 🙂 That ~28secs on didOpen does feel slightly painful. There’s a long while of UI not responding, of course 🙂
What do you mean with UI not responding?
I mean that trying to navigate in the file is prevented for a while. For instance, pressing C-n to move to the next line does not respond.
Input queued for a while.
Hum, that shouldn't happen as lsp-mode is just starting/opening a file, it shouldn't block emacs
You can try understand if it is some package of yours via lsp-start-plain.el
https://github.com/emacs-lsp/lsp-mode/blob/master/scripts/lsp-start-plain.el
Ah, cool … I’ll be able to resume tomorrow and this will be a useful starting point. Thanks, @ericdallo 🙃
Hi @ericdallo, I resolved the remaining part of it by setting lsp-enable-imenu
to nil
. (Without it, which-function
is triggered which waits on LSP thus freezing Emacs.)
Nice, I intend to spend some time taking a look on performance, that should help this issue as well
That sounds good. Thanks Eric :)
Do you have both lsp-mode and clojure-lso udpated?
we had a recent change that made use the lib as the same workspace avoiding connecting a new clojure-lsp as a new workspace
Thanks @ericdallo; I updated all my Emacs packages today. I’ll check the version and let you know.
Emacs package manager is using lsp-mode-<tel:2021052|2021052>1.446
I’m using the latest clojure-lsp release (2021.05.14-15.26.02) on macOS.
The “new workspace” path, in the case of lsp-find-definition
, ends up being ~/.emacs.d/workspace/.cache/.
And in CIDER’s case, ~/.m2/repository/org/clojure/clojure/1.10.2/clojure-1.10.2.jar:clojure/.
yes, I think that's correct
it should not start a new workspace session