spacemacs

Spacemacs docs: http://develop.spacemacs.org/doc/DOCUMENTATION.html http://develop.spacemacs.org/layers/+lang/clojure/README.html https://practicalli.github.io/spacemacs/
borkdude 2020-04-13T07:18:13.242300Z

@nick.romer maybe leaving some notes in the clj-kondo repo might be nice if you think it’s valuable for others

niveauverleih 2020-04-13T07:24:59.243900Z

Of course. Do you mean a PR to the editor-integration.md?

practicalli-john 2020-04-13T07:50:27.247900Z

@nick.romer the syntax-checking layer provides the indicators in the fringe showing which lines have warnings, issues.

niveauverleih 2020-04-13T08:11:17.253600Z

@jr0cket I did uncomment syntax-checking. BTW in my screenshot you see a red line which imo comes from the syntax-checking layer. Can the fringe be activated separately?

practicalli-john 2020-04-13T08:12:42.255400Z

Oh, you don't have a fringe? It's there by default, so not sure how it's turned off/on

niveauverleih 2020-04-13T08:13:18.256300Z

@jr0cket... or is the fringe activated based on the screen size?

practicalli-john 2020-04-13T08:14:58.257500Z

I am guessing there is a toggle, under SPC T somewhere... Not at my laptop yet 😁

niveauverleih 2020-04-13T08:17:51.257900Z

Toggle: fringe This toggle is not supported.

practicalli-john 2020-04-13T08:37:18.258800Z

SPC T f toggles my fringe okay. Sounds like something is missing from you Spacemacs setup. I'll have a look at the .spacemacs file you posted.

niveauverleih 2020-04-13T08:38:38.259300Z

@jr0cket Thank you!

practicalli-john 2020-04-13T08:49:04.260900Z

@nick.romer Your .spacemacs file does seem to have some issues. First thought is that its from an older install, as it downloaded lots of packages in the elpa/develop file, rather than using the newer elpa/emacs-version/develop. Although I do seem to have a fringe, but do not see the clj-kondo marks there.

practicalli-john 2020-04-13T08:57:14.264700Z

I assume you are using the Spacemacs develop branch if you are using lsp, so suggest updating your .spacemacs file with the spacemacs.template, using SPC f e D . Use b to copy all changes from the template, except where you know you made those changes. You may want to backup .spacemacs before doing that just in case (but I havent had an issue doing this). Also Spacemacs will download all the packages again, so do this when you have 10 minutes to spare. I am having a look to see if I can find the specific config, or if its another layer required.

practicalli-john 2020-04-13T09:00:30.266200Z

On a side note, you might want to enable smartparens strict mode, dotspacemacs-smartparens-strict-mode t to prevent unbalanced parens

practicalli-john 2020-04-13T09:11:18.268200Z

I am not getting any clj-kondo errors at all when running your .spacemacs config, possibly because I am not running an LSP server. Do you have a pointer to instructions as to where I can install the LSP server for Clojure? Or is it just using the clj-kondo binary? Thanks

practicalli-john 2020-04-13T09:13:52.269100Z

Ah, I have my clj-kondo in a different place. Thanks

borkdude 2020-04-13T09:14:15.269500Z

@jr0cket The LSP server is not running using the binary

borkdude 2020-04-13T09:14:30.269800Z

You need to download the .jar file, as described in the linked docs

practicalli-john 2020-04-13T09:22:48.270800Z

Yes, once I actually read the docs it unsuprisingly worked 🙂 I like the very visual error messages, very handy.

practicalli-john 2020-04-13T09:23:07.271200Z

I'll add it to my own .spacemacs config and check it works there.

spfeiffer 2020-04-13T09:25:45.273100Z

Now i am getting curious: Is there an advantage running clj-kondo as lsp-server vs. running it as a linter?

borkdude 2020-04-13T09:26:11.273400Z

@spfeiffer This has been discussed in this channel not so long ago

spfeiffer 2020-04-13T09:26:21.273700Z

Sorry, will scroll back.

spfeiffer 2020-04-13T09:26:51.274600Z

I skipped most of it as it sounded more like a „I just want to prove it is possible“ thing.

borkdude 2020-04-13T09:27:31.275200Z

not really, it serves a real purpose, mostly for environments where the binary doesn't run. earlier this was Windows (no longer true), but there are also other (more fringe) architectures / OSes

👍 1
borkdude 2020-04-13T09:28:26.276400Z

and LSP is the most natural thing in VSCode so pretty much anyone who used the binary before, now runs LSP there

borkdude 2020-04-13T09:28:52.276600Z

https://marketplace.visualstudio.com/items?itemName=borkdude.clj-kondo <- almost 15k installs already 🙂

spfeiffer 2020-04-13T09:29:47.277800Z

Was thinking in the spacemacs context now. clj-kondo is running fine as a linter, never bothered with lsp.

borkdude 2020-04-13T09:30:09.278100Z

it's probably not so interesting for you then. I'm also still using the binary in emacs

👍 1
practicalli-john 2020-04-13T10:14:13.283700Z

I have it working, although used a slight variation as I didn't want to hard code the path to the jar file in my Spacemacs config. So I put this in .spacemacs dotspacemacs/user-config

(use-package lsp-mode
    :ensure t
    :hook ((clojure-mode . lsp))
    :commands lsp
    :custom ((lsp-clojure-server-command '("clojure-lsp-server-clj-kondo")))
    :config (dolist (m '(clojure-mode clojurescript-mode)) (add-to-list 'lsp-language-id-configuration `(,m . "clojure"))))) 
The clojure-lsp-server-clj-kondo is a script on my path to call the java -jar clj-kondo-lsp-server-standalone.jar command using a relative path.
#!/bin/sh
java -jar ~/.local/apps/clj-kondo-lsp-server-2020.04.05-standalone.jar
This makes the emacs code more portable to other accounts and computers.

borkdude 2020-04-13T10:14:59.284700Z

makes sense

practicalli-john 2020-04-13T10:31:13.295600Z

@spfeiffer the only differences I am aware of between clj-kondo and clj-kondo-lsp-server for Emacs are: • Using lsp I am prompted to spawn an LSP process for every project I have open (I have a lot), although you can skip it for each project. SPC a p lists 22 clojure-lsp processes for me at the moment (although these use very minimal resources). LSP does remembers which you have run and will run them again if you restart Emacs, which does add a few seconds to the startup time (although I rarely restart Emacs) • UI difference. With LSP the text of the clj-kondo error is printed to the right hand side of the buffer when you move the cursor over an error. clj-kondo used a popup. I assume this is probably configurable somewhere. • clj-kondo is part of the Clojure layer, so only needs a variable set on that layer. clj-kondo-lsp-server requires a dotspacemacs/user-config configuration (although this could be added to the Clojure layer as a variable too with a bit of work. Ideally an external script would be used to launch the lsp server (as in the script above). So apart from supporting environments where clj-kondo binary does not run, I concur that there no benefit to lsp over a working clj-kondo with the Clojure layer.

👍 2
practicalli-john 2020-04-13T11:07:24.298200Z

@nick.romer apart from having an older .spacemacs file, I didn't notice any specific configuration that would stop the fringe being displayed. I notice you added lsp-mode as an additional package, this is not required as the lsp layer includes the lsp-mode package. The only other difference was using Ivy, but I dont see how that would stop the fringe being shown.

spfeiffer 2020-04-13T13:20:33.298300Z

Thanks for the great summary!

practicalli-john 2020-04-13T13:26:03.298600Z

It's useful for my book too 😁

niveauverleih 2020-04-13T15:20:07.303100Z

@jr0cket I removed lsp-mode and it still works. Question: I had to set the variable dotspacemacs-install-packages to used-but-keep-unused , otherwise some dependencies would be removed during startup and immediately reinstalled. What is the value on your system?

practicalli-john 2020-04-13T15:24:35.303800Z

@nick.romer My config is shared at https://github.com/practicalli/spacemacs.d/

practicalli-john 2020-04-13T15:24:52.304200Z

The specific config I added for LSP is at https://github.com/practicalli/spacemacs.d/commit/6187e11fe6c998afd39de91377a17a628bbfe37d

practicalli-john 2020-04-13T15:25:50.304600Z

The install packages config is dotspacemacs-install-packages 'used-only

practicalli-john 2020-04-13T15:28:17.306300Z

With your .spacemacs, you can remove the lsp layer, as you are bringing in lsp-mode as an additional package. Although I recommend using a layer where available, rather than individual packages.

niveauverleih 2020-04-13T22:22:38.308800Z

@practicalli fyi emacs doesn't support fringes in terminals https://stackoverflow.com/questions/35865400/why-doesnt-emacs-have-a-fringe-mode-in-terminal. Thank you for sharing your config!