lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
devn 2021-03-26T03:31:49.108400Z

Idea: Is it possible to display additional information in the UI sidebar? For example, marking private vars as such, noting a macro, showing # of references, etc.? That might be kind of cool. Something I noticed: References are counted when the function calls itself from a separate arity. Is that intentional?

ericdallo 2021-03-26T13:27:09.112600Z

Yeah, it needs to be on to sync 😅

ericdallo 2021-03-26T13:28:23.113500Z

BTW lsp-ui-menu only show documentSymbol, but yeah, you can bring this idea to lsp-mode and see what they think, we could have multiple functions that call different lap methods am show on the sidebar or a summary one

ericdallo 2021-03-26T13:28:40.114200Z

There is a lsp-mode wishlist issue

devn 2021-03-27T05:16:17.137900Z

just as a note: I think it’s generally a bit unclear what packages you need installed to get the feature, or which M-x cmd matches which feature, or if there’s a default binding for it, etc. There may be a good reason for this, I don’t know.

ericdallo 2021-03-27T13:25:19.139100Z

I think lsp-mode has which integration which shows all features via keybindings?

devn 2021-03-26T03:46:27.108900Z

also, how do I display the call graph? (I’m in emacs)

ericdallo 2021-03-26T03:52:12.109Z

> Something I noticed: > References are counted when the function calls itself from a separate arity. Is that intentional? IMO looks correct

ericdallo 2021-03-26T03:52:34.109200Z

lsp-treemacs-call-hierarchy

ericdallo 2021-03-26T03:52:50.109400Z

what is UI sidebar?

devn 2021-03-26T04:07:28.109600Z

yeah, my bad, just had to install the lsp-treemacs package

devn 2021-03-26T04:08:50.109800Z

i meant lsp-ui-imenu

devn 2021-03-26T04:12:16.110Z

that’s the one i mentioned, but perhaps lsp-treemacs-symbols could achieve something similar

devn 2021-03-26T04:14:05.110200Z

this doesn’t happen for you?

devn 2021-03-26T04:18:03.110600Z

hrm, seems to now be doing it even when i remove the foo. will clear .cache and sqlite and look again

devn 2021-03-26T04:23:11.110800Z

this is me changing it to call itself, do a lsp-lens-hide and lsp-lens-show, then changing it back and doing it again.

devn 2021-03-26T04:23:39.111200Z

(with saves)

devn 2021-03-26T04:25:50.111400Z

annddd, looking at the source i guess lens-show is what updates the overlay

devn 2021-03-26T04:28:31.111600Z

anddddd, now my stupidity is revealed. I just needed to turn lsp-lens-mode on 🤦 i’m 0/2 tonight

Aldo Nievas 2021-03-26T13:26:56.112500Z

hi anyone using neovim 5and clojure-lsp and nvim-lspconfig? no coc-nvim

orestis 2021-03-26T13:28:41.114400Z

I do. There’s still a little bit of brittleness here and there meaning I have to start a new neovim instance to reset state.

orestis 2021-03-26T13:29:23.115700Z

But I like the experience and I’ll keep using it. I actually run Clojure-lsp from source to be able to debug some stuff.

Aldo Nievas 2021-03-26T13:29:54.116200Z

doesn't it start automatically ?

orestis 2021-03-26T13:30:24.116700Z

It does. It just that some times thing end up out of sync or LSP stops working entirely.

Aldo Nievas 2021-03-26T13:31:00.117Z

yes it happens with other languages

ericdallo 2021-03-26T13:31:23.117100Z

Maybe @dharrigan or @rafaeldelboni

👍 1
Aldo Nievas 2021-03-26T13:31:54.117500Z

I'm using this pretty basic setup https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#clojure_lsp but no luck. LSP does not start so no autocomplete etc etc.

ericdallo 2021-03-26T13:32:24.117700Z

@orestis latest release should not happen out of sync anymore

ericdallo 2021-03-26T13:32:42.117800Z

We disabled the incremental text changes until fix it

dharrigan 2021-03-26T13:35:29.118200Z

Unforutnately no, I'm still on neovim 4 (stable) and coc

👍 1
orestis 2021-03-26T13:37:37.119200Z

I don't trust the NeoVim client too much @ericdallo 🙂 I think clojure-lsp is mostly OK these days.

👍 1
orestis 2021-03-26T13:38:14.119400Z

Is the executable in neovim's path?

orestis 2021-03-26T13:38:47.119700Z

I would check the Neovim lsp logs to see...

orestis 2021-03-26T13:39:17.119900Z

lua vim.cmd(":e"..vim.lsp.get_log_path())

orestis 2021-03-26T13:39:54.120700Z

Also see what :LspInfo shows

dharrigan 2021-03-26T13:40:02.121100Z

My experience of using neovim (4), conjure, clojure-lsp and coc is rock solid. I know others use deoplete instead of coc and they have a good experience too.

orestis 2021-03-26T13:40:48.121600Z

I have these functions defined to fiddle with the neovim client

function! LSPLog()
    lua vim.cmd(":e"..vim.lsp.get_log_path())
endfunction
command LSPLog call LSPLog()
function! LSPDev()
    lua vim.lsp.stop_client(vim.lsp.get_active_clients())
    lua require('lspconfig').clojure_lsp_dev.autostart()
endfunction
command LSPDev call LSPDev()

Aldo Nievas 2021-03-26T13:41:26.121700Z

ha got an error

Aldo Nievas 2021-03-26T13:41:36.121900Z

1049 [ ERROR ] 2021-03-26T10:35:29-0300 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:458 ]> "rpc">"clojure-lsp">"stderr"> "Mar 26, 2021 10:35:29 AM org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError\nSEVERE: Unable to invoke no-args constructor for class org.eclipse.lsp4j.ShowDocumentCapabilities.

orestis 2021-03-26T13:42:15.122700Z

I should try coc after @dharrigan enthusastic approval. I think deoplete is just for autocompletion though, still relies on the built-in neovim LSP client.

orestis 2021-03-26T13:43:20.122800Z

I would ask @ericdallo about this error...

ericdallo 2021-03-26T13:45:33.123Z

How did you Installed clojure-lsp?

ericdallo 2021-03-26T13:46:09.123200Z

It's indeed a graalvm missing reflect config, but I can repro with both integration tests and emacs

ericdallo 2021-03-26T13:46:21.123400Z

I wonder how did that happen

Aldo Nievas 2021-03-26T13:50:07.123600Z

first try using brewthen I removed it and got the latest zip release

rafaeldelboni 2021-03-26T13:51:01.123800Z

Yeah me neither, I'm waiting 5 go to stable to make the move.

dharrigan 2021-03-26T13:51:19.124Z

ditto

ericdallo 2021-03-26T13:51:46.124200Z

Make sure to install it via official brew tap

Aldo Nievas 2021-03-26T13:52:04.124400Z

ok will try it again

ericdallo 2021-03-26T13:52:13.124600Z

https://clojure-lsp.github.io/clojure-lsp/installation/#macos

👍 1
Aldo Nievas 2021-03-26T13:56:33.125Z

yes same error

Aldo Nievas 2021-03-26T13:57:12.125200Z

anyway no rush. I'm a newbie setting up my environment to start playing w clojure.

Aldo Nievas 2021-03-26T13:57:39.125400Z

Coming from Ruby Elixir JS

ericdallo 2021-03-26T13:59:15.125600Z

Ok, I'm not on pc right now, but I can take a look in 30mins

ericdallo 2021-03-26T13:59:27.125800Z

It's easy to fix it, but I'd like to repro the error

Aldo Nievas 2021-03-26T13:59:39.126Z

kk appreciate. Thanks !

ericdallo 2021-03-26T14:29:48.126200Z

:thanks:

ericdallo 2021-03-26T14:37:18.126400Z

Found the issue, it's a feature lsp-mode (:emacs:) has https://github.com/emacs-lsp/lsp-mode/issues/2459, I'm fixing on clojure-lsp side

👍 1
ericdallo 2021-03-26T14:53:52.126800Z

@aldo.nievas fixed on master, before I release it, could you test with a local release?

ericdallo 2021-03-26T14:54:02.127Z

is just clone clojure-lsp repo and run make debug-bin

Aldo Nievas 2021-03-26T14:54:47.127200Z

removing it from brew first ?

ericdallo 2021-03-26T14:56:54.127400Z

you don't need to remove, you can point on nvim to the generated binary on clojure-lsp root

Aldo Nievas 2021-03-26T14:57:22.127600Z

ok

ericdallo 2021-03-26T14:57:23.127800Z

actually, you will need to point to it to use the generated, otherwise it will not find on your PATH

ericdallo 2021-03-26T14:57:29.128Z

I have no idea how to do that on vim

Aldo Nievas 2021-03-26T14:57:50.128200Z

kk

Aldo Nievas 2021-03-26T15:02:43.128400Z

Perfect !

ericdallo 2021-03-26T15:04:39.128800Z

Nice 🙂

ericdallo 2021-03-26T15:05:27.129Z

I should release that fix soon, then you can use it via brew again, I'll just include other fix/features before

Aldo Nievas 2021-03-26T15:05:46.129200Z

good work, dude. Thanks !

👍 1
snoe 2021-03-26T18:27:44.130Z

I've been using coc for a couple years now. its basically a compilation of the vscode implementation which is why it's so rock solid. There's a lot to it and my experience with the neovim project leads me to think it will be 2-3 years before they have a solid, matching implementation.

borkdude 2021-03-26T22:41:08.131800Z

I've been thinking of writing a sci + rewrite-clj scripting tool (compiled with GraalVM) for instantly rewriting Clojure code from the command line: but here's another thought: what if users can plug in their own scripts into clojure-lsp for customly rewriting code and hook it up to some action in their editor?

borkdude 2021-03-26T22:41:32.132Z

a bit like clj-kondo hooks

ericdallo 2021-03-26T22:43:10.132800Z

It could work, it'd need to implement things not following LSP spec and implement it on every client side editor though

ericdallo 2021-03-26T22:43:26.133200Z

looks a interesting feature

borkdude 2021-03-26T22:44:12.133500Z

I think you mentioned some custom code action recently?

ericdallo 2021-03-26T22:44:34.134Z

yes, it'd would need to be something like that, but a lot of more work

borkdude 2021-03-26T22:44:37.134200Z

like how you did the lint-as feature

ericdallo 2021-03-26T22:45:56.134900Z

looks nice, we could elaborate and think how that would work

borkdude 2021-03-26T22:46:18.135300Z

as of now it's just a vague thought, but might be nice to keep in the back our mind

ericdallo 2021-03-26T22:46:58.136100Z

sure, I know lsp-mode is quite extensible for those kind of things as well, but other editors like vim and Calva may have a hard time

ericdallo 2021-03-26T22:47:20.136600Z

so we'd need to think the best "protocol" to work nice for client and server