lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
kwrooijen 2021-02-08T12:04:49.380500Z

Hey there, any idea how to disable automatically inserting namespaces? (When creating a new file)

kwrooijen 2021-02-08T12:05:20.381300Z

I think Cider (or clojure mode?) is already doing that. Now I'm getting 2 when I create a new file

ericdallo 2021-02-08T12:05:39.381500Z

auto-add-ns-to-new-files? false https://clojure-lsp.github.io/clojure-lsp/settings/ Or disable from clj-refactor:

ericdallo 2021-02-08T12:06:02.381800Z

cljr-add-ns-to-blank-clj-files nil

kwrooijen 2021-02-08T12:06:10.382100Z

Thanks, guess I didn't look hard enough πŸ™‚

πŸ˜‰ 1
ericdallo 2021-02-08T12:07:22.382400Z

in case need a example: https://github.com/ericdallo/dotfiles/blob/master/.doom.d/config.el#L97

kwrooijen 2021-02-08T12:07:24.382700Z

I think there might be a bug in lsp. When I create the following file: src/clj/gungnir/foobar.clj I get this:

kwrooijen 2021-02-08T12:07:45.383100Z

Oh this might be my project.clj :thinking_face:

ericdallo 2021-02-08T12:07:54.383300Z

hum, probably it's not finding the correct source path

kwrooijen 2021-02-08T12:08:04.383500Z

I have both "src" and "src/clj" in my path

kwrooijen 2021-02-08T12:08:08.383700Z

Let me try again

ericdallo 2021-02-08T12:08:18.383900Z

oh, probably removing src/clj should fix

ericdallo 2021-02-08T12:08:33.384100Z

but don't know if something will stop working from src/clj

kwrooijen 2021-02-08T12:08:46.384400Z

Have to remove src through πŸ™‚

kwrooijen 2021-02-08T12:08:51.384600Z

But that didn't solve it it seems

borkdude 2021-02-08T12:09:03.384800Z

I think this feature has done more harm than good in my own setup as well. I'll disable it

kwrooijen 2021-02-08T12:09:03.384900Z

:source-paths ["src/clj" "src/cljs" "src/cljc"]

ericdallo 2021-02-08T12:11:04.385200Z

@kevin.van.rooijen does just keep src works and remove the others?

borkdude 2021-02-08T12:11:24.385400Z

where do I put auto-add-ns-to-new-files? to globally apply it to all my projects?

kwrooijen 2021-02-08T12:11:29.385600Z

I need the others because src isn't the root of my namespaces

ericdallo 2021-02-08T12:11:39.385800Z

hum, got it

borkdude 2021-02-08T12:11:55.386Z

~/.lsp/config.edn?

1
ericdallo 2021-02-08T12:12:23.386300Z

so if is not root, why clj.gungnir.foobar is not the correct?

ericdallo 2021-02-08T12:12:39.386500Z

I'm trying to understand the logic here

ericdallo 2021-02-08T12:12:47.386700Z

so we could improve the feature

kwrooijen 2021-02-08T12:12:50.386900Z

Because the root starts at src/clj

kwrooijen 2021-02-08T12:13:11.387100Z

Any files in the src/clj directory are top level namespaces

ericdallo 2021-02-08T12:13:31.387300Z

got it, so the feature should check the source paths, probably is not checking correctly

kwrooijen 2021-02-08T12:14:14.387500Z

I think so yeah. Seems like "src" might be hardcoded since it's not in my source path (unless it's added automatically)

ericdallo 2021-02-08T12:15:41.387700Z

it's already checking for source paths, probably some bug

ericdallo 2021-02-08T12:15:49.387900Z

I'll keep debuging

kwrooijen 2021-02-08T12:16:06.388100Z

I could create a minimal example if you'd like

ericdallo 2021-02-08T12:16:42.388300Z

yeah, it'd be helpful if you create a issue with a minimal repro πŸ˜„

kwrooijen 2021-02-08T12:17:26.388500Z

Will do, currently working so I'll open an issue tonight. Thanks for the help πŸ‘

ericdallo 2021-02-08T12:17:42.388700Z

np, thanks!

ericdallo 2021-02-08T13:19:54.389400Z

I think I found the bug, it was introduced after kondo migration πŸ˜… I'll create missing tests for it

erwinrooijakkers 2021-02-08T14:02:05.390800Z

I now run CIDER and lsp in tandem. Can you also have a REPL using lsp?

borkdude 2021-02-08T14:02:59.391200Z

@erwinrooijakkers you can just use CIDER and hence nREPL along with lsp. is this not what you're asking?

erwinrooijakkers 2021-02-08T14:03:09.391400Z

Yes this is what I am asking

erwinrooijakkers 2021-02-08T14:03:22.391900Z

I thought CIDER and nREPL was an alternative

erwinrooijakkers 2021-02-08T14:03:27.392200Z

But you can use both

borkdude 2021-02-08T14:03:49.392700Z

I have heard some people who use spacemacs which makes and alternative solution between the two, which is imo weird. Why would anyone develop software without a REPL.

borkdude 2021-02-08T14:04:08.393200Z

There is no reason you can't use both at the same time.

☝️ 1
erwinrooijakkers 2021-02-08T14:04:12.393300Z

Yes that’s what got me confused in the first place, you can pick the backend

ericdallo 2021-02-08T14:04:46.394100Z

Yep, I try to clarify that here: https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/

erwinrooijakkers 2021-02-08T14:05:06.394600Z

(clojure :variables
              clojure-backend 'lsp ;; or 'cider...

borkdude 2021-02-08T14:06:20.395100Z

just use lsp without this setup. package-install lsp-mode, install the lsp binary on your machine and get going

borkdude 2021-02-08T14:07:26.395400Z

(if that is possible in spacemacs at all?)

ericdallo 2021-02-08T14:08:55.395900Z

we should fix that on spacemacs if is not clear for users πŸ˜•

erwinrooijakkers 2021-02-08T14:18:08.396900Z

Very nice this LSP stuff, reminds me of the extensive IDE functionality of Visual Studio with ReSharper for C#!

πŸŽ‰ 1
teodorlu 2021-02-08T14:32:51.399300Z

Hello! πŸ‘‹ I haven't used clojure-lsp yet, but reliable rename + find usage + find definition sounds fantastic. I might try to use clojure-lsp in Emacs next time I have a bit of Clojure coding to do. Thanks for your work!

ericdallo 2021-02-08T14:33:30.399400Z

Thank you @teodorlu ! LMK what you think after give a try πŸ˜„

πŸ‘ 1
erwinrooijakkers 2021-02-08T15:21:38.399900Z

Are these squiggly lines lsp related?

borkdude 2021-02-08T15:22:47.400300Z

I think so yes, I disabled this

borkdude 2021-02-08T15:23:06.400500Z

lsp-headerline-breadcrumb-enable nil

borkdude 2021-02-08T15:23:48.400900Z

I also disabled lenses and lsp-diagnostics-provider (since I'm running clj-kondo myself)

borkdude 2021-02-08T15:23:57.401100Z

and also lsp-enable-indentation nil

borkdude 2021-02-08T15:24:03.401300Z

since I'm using clojure-mode already

erwinrooijakkers 2021-02-08T15:24:45.401700Z

ah yes i use aggressive-indent-mode and that needed also to be disabled

erwinrooijakkers 2021-02-08T15:26:32.401800Z

My friend (non programmer) is also impressed and gives compliments

❀️ 1
erwinrooijakkers 2021-02-08T15:28:05.402500Z

ah without the lsp-headerline-breadcrumb-enable the whole breadcrumbs disappear πŸ™‚ I meant the squiggly lines, seems there is some spellchecking going on

borkdude 2021-02-08T15:28:48.403400Z

@erwinrooijakkers I think it indicates that there are diagnostics in these parts of your app

erwinrooijakkers 2021-02-08T15:28:53.403600Z

aaaaah ok

borkdude 2021-02-08T15:29:10.404Z

welcome @martinklepsch!

πŸ’™ 3
πŸ’š 3
❀️ 4
πŸŽ‰ 4
πŸ‘‹ 4
ericdallo 2021-02-08T15:32:09.406700Z

That could be disabled without disable the headerline @erwinrooijakkers

erwinrooijakkers 2021-02-12T09:09:52.109400Z

Thanks!

erwinrooijakkers 2021-02-12T09:38:41.111900Z

lsp-headerline-breadcrumb-enable-diagnostics

martinklepsch 2021-02-08T15:33:12.407600Z

Hey y’all, this clojure-lsp thing is looking pretty sweet :star-struck: I’m installed coc.nvim for it but I’m not quite sure how to use it πŸ˜„ How would I do some basic stuff like go to definition & search defs more generally?

dharrigan 2021-02-09T08:54:17.421700Z

I control all my dotfiles etc., via ansible and templating, which I deploy across all my computers

dharrigan 2021-02-09T08:54:45.421900Z

every machine of mine (vms, physical) all have the same setup - makes moving from one to the other easy πŸ™‚

ericdallo 2021-02-08T15:33:13.407700Z

Check for lsp-headerline-breadcrumb-diagnostic or something like that

martinklepsch 2021-02-08T15:33:26.407900Z

Do I need this file? https://github.com/snoe/dotfiles/blob/master/home/.vim/coc-settings.json

martinklepsch 2021-02-08T15:33:51.408200Z

(It looks kind of specific to a developer of the lsp server?)

borkdude 2021-02-08T15:33:58.408400Z

@rahul080327 probably knows as well as he's using nvim + clojure-lsp as well

ericdallo 2021-02-08T15:34:11.409Z

Thank you! Hum, I have no experience with coc.vim :/ But @rafaeldelboni or @snoe use it with coc.vim

borkdude 2021-02-08T15:35:14.410Z

oh, those haven't been updated since 2017, sorry

lispyclouds 2021-02-08T15:35:29.410600Z

I haven’t yet gotten to put it yet πŸ˜•

rafaeldelboni 2021-02-08T15:35:34.410900Z

Yes you do need this file to make a custom lsp provider: https://github.com/rafaeldelboni/dotfiles/blob/master/config/nvim/coc-settings.json#L17-L25

πŸ‘ 1
❀️ 1
lispyclouds 2021-02-08T15:35:41.411400Z

Will share it sometime soon

rafaeldelboni 2021-02-08T15:36:14.411600Z

You can access it from anywhere in nvim typing :CocConfig

dharrigan 2021-02-08T15:39:38.412100Z

You don't need the "command" bash

borkdude 2021-02-08T15:39:48.412300Z

yeah, I wondered about that, it seems superfluous

dharrigan 2021-02-08T15:40:01.412600Z

"languageserver": {
    "clojure-lsp": {
      "command": "clojure-lsp",
      "filetypes": ["clojure"],
      "disableDiagnostics": true,
      "rootPatterns": ["deps.edn", "project.clj"],
      "additionalSchemes": ["jar", "zipfile"],
      "trace.server": "verbose",
      "initializationOptions": {
        "project-specs": [{
          "project-path": "deps.edn",
          "classpath-cmd": ["clj", "-Spath"]
        }],
        "use-metadata-for-privacy?": true,
        "ignore-classpath-directories": true
      }
    }
  }

rafaeldelboni 2021-02-08T15:40:55.412800Z

thanks gonna update mine

dharrigan 2021-02-08T15:41:55.413Z

This is mine: https://gist.github.com/dharrigan/6b55013de0d4d8b8447b5cff2f36e030

rafaeldelboni 2021-02-08T15:46:31.413200Z

We could do a coc-clojure-lsp, like https://github.com/fannheyward/coc-rust-analyzer or https://github.com/clangd/coc-clangd, the interesting part is the auto download and build of the dependencies, but I never did this before.

ericdallo 2021-02-08T15:49:38.413700Z

Looks good ☝️

martinklepsch 2021-02-08T15:52:37.413900Z

thanks @dharrigan I updated my ~/.config/nvim/coc-settings.json to match yours. If you’re feeling generous, would you mind sharing a bit on how you use all this?

dharrigan 2021-02-08T15:53:25.414100Z

I do use neovim, conjure, coc and clojure-lsp (and a few other sprinklings of plugins)

dharrigan 2021-02-08T15:53:28.414300Z

Do you use neovim?

martinklepsch 2021-02-08T15:57:29.414500Z

My setup is pretty similar actually (nvim, conjure, coc, clojure-lsp)

dharrigan 2021-02-08T15:58:01.414700Z

I have been thinking for a while to put my settings up somewhere, but laziness has got the better of me.

dharrigan 2021-02-08T15:58:08.414900Z

I should do it

dharrigan 2021-02-08T15:58:51.415100Z

I think it would invaluable to learn from each other, perhaps there's a setting that I've overlooked, that someone uses and makes their experience stellar.

martinklepsch 2021-02-08T16:02:50.415300Z

Totally, I’ll virtually treat you to a beer if that provides any motivation πŸ˜„

dharrigan 2021-02-08T16:03:34.415500Z

πŸ™‚ I don't drink

dharrigan 2021-02-08T16:03:45.415700Z

You can virtually buy me some fancy chocolate.

πŸ˜‚ 1
martinklepsch 2021-02-08T16:04:43.416Z

haha, for a moment I was considering that beer may not be your choice but then I went with it anyways β€” chocolate it is 😊

martinklepsch 2021-02-08T16:05:06.416200Z

when you publish something somewhere, send me your address πŸ™‚

dharrigan 2021-02-08T18:12:00.416400Z

Tada! https://wepl.blog/

πŸ™Œ 1
ericdallo 2021-02-08T18:13:11.416700Z

Really cool @dharrigan!

ericdallo 2021-02-08T18:13:43.416900Z

What do you think about the @rafaeldelboni idea about a common repo for those settings + auto download ?

dharrigan 2021-02-08T18:14:12.417100Z

Sounds good, or maybe a repo with links to various other people's settings? I'm easy!

ericdallo 2021-02-08T18:15:30.417300Z

I like the way coc-rust-analyzer centralize all settings and allow add more features https://github.com/fannheyward/coc-rust-analyzer

dharrigan 2021-02-08T18:15:58.417600Z

brb

dharrigan 2021-02-08T18:16:00.417800Z

din dins

ericdallo 2021-02-08T18:43:20.418Z

Fixed on master @kevin.van.rooijen!

kwrooijen 2021-02-08T19:18:28.418900Z

Awesome I'll try it out πŸ˜„

ericdallo 2021-02-08T19:18:53.419100Z

still need to release πŸ˜… probably I will do tonight after other fixes

kwrooijen 2021-02-08T19:44:23.419400Z

Built it locally. Now only 1 namespace gets added (and it's correct)

kwrooijen 2021-02-08T19:45:03.419600Z

Althoough I'd think 2 would get added since I didn't disable clj-refactor :thinking_face: Oh well it works, thanks!

ericdallo 2021-02-08T20:06:47.419800Z

hahaha nice!