Fork me on GitHub
#lsp
<
2021-03-26
>
devn03:03:49

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?

ericdallo03:03:12

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

ericdallo03:03:50

what is UI sidebar?

devn04:03:50

i meant lsp-ui-imenu

devn04:03:16

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

devn04:03:05

this doesn’t happen for you?

devn04:03:03

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

devn04:03:11

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.

devn04:03:39

(with saves)

devn04:03:50

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

devn04:03:31

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

ericdallo13:03:09

Yeah, it needs to be on to sync 😅

ericdallo13:03:23

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

ericdallo13:03:40

There is a lsp-mode wishlist issue

devn05:03:17

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.

ericdallo13:03:19

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

devn03:03:27

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

ericdallo03:03:34

lsp-treemacs-call-hierarchy

devn04:03:28

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

orestis13:03:41

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.

orestis13:03:23

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 Nievas13:03:54

doesn't it start automatically ?

orestis13:03:24

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

Aldo Nievas13:03:00

yes it happens with other languages

Aldo Nievas13:03:54

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.

orestis13:03:14

Is the executable in neovim's path?

orestis13:03:47

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

orestis13:03:17

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

orestis13:03:54

Also see what :LspInfo shows

Aldo Nievas13:03:26

ha got an error

Aldo Nievas13:03:36

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.

orestis13:03:20

I would ask @ericdallo about this error...

ericdallo13:03:33

How did you Installed clojure-lsp?

ericdallo13:03:09

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

ericdallo13:03:21

I wonder how did that happen

Aldo Nievas13:03:07

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

ericdallo13:03:46

Make sure to install it via official brew tap

Aldo Nievas13:03:04

ok will try it again

Aldo Nievas13:03:33

yes same error

Aldo Nievas13:03:12

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

Aldo Nievas13:03:39

Coming from Ruby Elixir JS

ericdallo13:03:15

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

ericdallo13:03:27

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

Aldo Nievas13:03:39

kk appreciate. Thanks !

ericdallo14:03:18

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
ericdallo14:03:52

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

ericdallo14:03:02

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

Aldo Nievas14:03:47

removing it from brew first ?

ericdallo14:03:54

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

ericdallo14:03:23

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

ericdallo14:03:29

I have no idea how to do that on vim

ericdallo15:03:27

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

Aldo Nievas15:03:46

good work, dude. Thanks !

👍 1
ericdallo13:03:24

@orestis latest release should not happen out of sync anymore

ericdallo13:03:42

We disabled the incremental text changes until fix it

orestis13:03:37

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

👍 1
dharrigan13:03:02

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.

orestis13:03:48

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()

orestis13:03:15

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.

snoe18:03:44

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.

borkdude22:03:08

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?

borkdude22:03:32

a bit like clj-kondo hooks

ericdallo22:03:10

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

ericdallo22:03:26

looks a interesting feature

borkdude22:03:12

I think you mentioned some custom code action recently?

ericdallo22:03:34

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

borkdude22:03:37

like how you did the lint-as feature

ericdallo22:03:56

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

borkdude22:03:18

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

ericdallo22:03:58

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

ericdallo22:03:20

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