Fork me on GitHub

@pesterhazy does this coexist peacefully with Cider, or is it orthogonal?


@shem I haven’t tried but I think they can be combined (like flycheck-joker can be combined with cider)


ok, will try it at some point.


@shem @pesterhazy CIDER in terms of features is already a super-set of the current Language Server Protocol, although CIDER is using nrepl rather than the LSP specification. If you are satisfied with CIDER then the only benefit at present seems to be the ability to do some things without the REPL running. If your computer is resource limited or you wish to have a large number of Clojure project open and have auto-complete, find definition and some refactoring available, then LSP would be very useful. I am still trying to find an LSP implementation for Clojure that actually implements the complete LSP specification. The options t have LSP functionality without a REPL I have tried so far include: • clj-kondo-standalone - this is clj-kondo lint tool for environments that dont support running clj-kondo binary (eg. android devices - yes some people run emacs on Android). This is not intended to be a full LSP implementation • anakondo - - a early stage static analysis tool that provides LSP features based on clj-kondo - this is very easy to install as an Emacs package and the clj-kondo binary There is also clojure-lsp - - this seems fairly complete although I have been unable to get this to work as yet so haven't tested it. Are there any others? Ideally LSP implementations for Clojure in Emacs would be folded into the CIDER orchard, providing a way to do all non-evaluation actions without a REPL and I believe there are no technical barriers to do so, someone just needs to contribute the work.


One thing to be aware of is that LSP implementations are typically based on static analysis, so the whole code base of a project and its dependencies will need to be evaluated before the LSP functions work. If the static analysis blocks Emacs UI whilst processing, then the user will need to wait for that analysis to complete. I have found analysis can take far longer than starting a REPL for some project. Obviously as LSP implementations mature, then these issues should be resolved. Any feedback and contributions you can give to these project I am sure would be most beneficial in making them more robust and performant.


i didn't think anakondo was lsp-based -- is it?


No it’s not. The only lsp on this list is untested


+1 on clojure-lsp, that is what I've been using. Its seemed the most complete when I was searching a couple months back.


clj-kondo-standalone is used via LSP, where as clj-kondo is a backend for flycheck. Although as stated it is not trying to be a full LSP implementation


I have got clojure-lsp to work now, using a similar config used for clj-kondo-standalone. The biggest drawback I have is a very slow startup time for Emacs now, taking over a minute the first time it carried out static analysis over my open projects. Most of my projects are small and have few dependencies, so will investigate why its taking so long. I think its a particular project that is taking up most of the time, that was the case when using anaconda to statically analyse my code. Consecutive restarts of Emacs also take about 30 seconds to start up, which is very noticable compared to the usual 3 seconds. clojure-lsp seems to be at least reviewing all the projects, I assume to check for changes. I assume its not running an analysis from scratch. Considering it takes less than 2 seconds to start a REPL and another couple to evaluate a project, there is a big up front cost to LSP for me compared to running a REPL. If there is anyway to reduce startup time then that would be good to know (apart from closing all the projects I regularly work on) I havent found a compelling reason to include LSP as part of my regular workflow yet, but hope that these small inconvieniences can be ironed out


> Consecutive restarts of Emacs also take about 30 seconds to start up this is wild. lsp-mode has not affected startup for me at all. the lsp process runs in the background and does slow emacs down when first visiting a file from a project


it was not what I was expecting, so am trying to diagnose over the next couple of weeks.


There was a note, I believe on the main github page regarding the startup times. Going from memory but I think it was something to do with some JSON parsing that is happening behind the scenese. The suggestion was to use Emacs v27 or higher as apparently the JSON parsing was much improved in that release. Sorry, don't remember the details at more fine grained level. I've been running it on 26.3 myself with no issues, but my laptop is new and it was pretty snappy so I didn't dig into it any further.


I'm not seeing startup perf problems, but sometimes editing/typing gets very slow, especially (?) when aggressive-indent-mode is active


I haven't figured out yet what's causing this dramatic slowdowns: sometimes with lsp-mode active it can take seconds for characters to appear on the screen


I'm now trying the settings suggested in the link above - seems better


I have a feeling it's related to autocompletion, but not sure


@pesterhazy - Yes that is the comment that I was trying to recall. It was definitely a startup time issue. The issue you mention while typing I have seen on an i5 pc inside a VM that is pretty constrained resources, something like 4G RAM and 2 cores where I was using LSP for Python. I haven't seen this on my other PCs, but they are i7 systems with a lot of cores and RAM so that didn't surprise me. Yeah, I agree with you, I think may be related to auto-complete, that is where I noticed it as well.


I'm going to disable company-mode. I don't think I want auto-completion anyway, and I've never liked the way it worked in Emacs (perhaps I also just never had it set up correctly)


i remember disabling autocomplete from lsp and using CIDERs


Thanks @snaffu I have a few projects that have some geojson files in, so if the clojure-clj binary is statically analysing those files it could explain a lot of problems. I had assumed that it would only part clojure files and not json when analysing a project. I have mostly finished with those projects with geojson files, so I will remove them from Emacs and see if it affects startup times.


@pesterhazy I had issues with Emacs not redrawing the cursor straight away, turned out it was due to the desktop compositor I was using. I disabled it and the lag was fixed instantly and Emacs felt even faster.


@dpsutton I use a snippet via auto-complete to add the fully qualified namespace when creating a new file. This seems to work with clojure-lsp and anakondo, so thats actually a plus point for LSP for me 🙂 I'll try and stick with LSP during the week, although I'm going to disable it for my live broadcasts at the weekends just so I have one less thing to be concerned about.


Auto creating the qualified ns at the top for new files work for me using CIDER as well. Did not configure anything.


The ns snippet was only adding the name of the current namespace when CIDER runs a REPL. With LSP or anakondo the ns snippet works without the need of a running REPL (actions without a REPL was one of the mentioned benefits of LSP that we were discussing)


Oh yes, that is a key difference. Good point.


I always leave the REPL running so never noticed that.


for sure! i'd love to watch a few live streams if you have a link that i can watch


All my videos and live streams are via I have a years worth of video, mostly done with Emacs/Spacemacs with Clojure if you are stuck for things to do during the pandemic.

❤️ 8
👍 8

I was looking for a live stream using spacemacs to get a feel how people usually work with vim bindings inside emacs.