Fork me on GitHub
#lsp
<
2021-11-16
>
Drew Verlee14:11:06

How would I go about getting a richer more interactive menu for references in LSP? For example, Intellij doesn't just show the files in a temporary (click away and it disappears) list. It opens a permanent hierarchy/tree of files with the reference as the last node in the tree. It also opens an accompanying window pane so i can see some range of code around the reference. The later is really nice to have. Would this be an editor advancement?

ericdallo14:11:16

You want intelliJ behavior on emacs, is that right?

ericdallo14:11:57

this is something to be improved on client side (editor level), for example: https://github.com/emacs-lsp/lsp-mode/issues/316

Drew Verlee14:11:26

Correct, the intelliji feature is richer and i would assume universally preferred. I'm guessing the change is a matter of configuration options passed to a emacs window manager (helm?). Brb

ericdallo14:11:41

I think help/ivy already support a larger preview of code, I already saw that on doom-emacs at least

ericdallo14:11:58

but for a more intellij like behavior probably only using lsp-treemacs

ericdallo14:11:04

I think we already have it

ericdallo14:11:31

Like lsp-treemacs-errors-list:

ericdallo14:11:44

there is already lsp-treemacs-references , but for some reason is not working for me

Drew Verlee16:11:49

Awesome. lsp treemacs view is what i would want, a list that sticks around.

ericdallo16:11:57

yeah, lsp-treemacs is cool, I use for one or 2 features, it needs some bugfix though, but overall it works fine

Drew Verlee16:11:26

@ericdallo do you have a minute to pair with me to see if we can learn why this re-name doesn't work on my project? Or what diagnostics could i send your way?

ericdallo16:11:07

Sure, I'm releasing a new clojure-lsp version in a couple of hours that improve rename, I think it should fix a lot of cases where rename doesn't work

ericdallo16:11:21

if that doesn't fix/help we can debug it

Drew Verlee16:11:32

ok. i'll wait for that.

Drew Verlee16:11:46

Here is what seems to be a bug that caught me the other day. lsp-show references is showing incorrectly showing one less reference then lsp-treemacs view

ericdallo16:11:00

isn't the definition itself that is missing?

ericdallo17:11:04

there are 2 ways that LSP find the references can return, all the references and another with all the references + the definition itself

ericdallo17:11:15

AFAIK lsp-show-references doesn't include the definition

ericdallo17:11:29

maybe via lsp-treemacs it's calling passing the arg to include the definition

Drew Verlee17:11:06

This was a keyword, fwiw.

ericdallo17:11:09

could you provide the code that you tried? or a sample that reproduce the issue?

Drew Verlee17:11:29

hmm. Ok, i see what happened here. This is interesting. It is considering the keyword i said it missed as a definition. That is, it goes to it when i use lsp-find-defination. In this case, we are re-using that keyword for both re-frame/reg-event-fx and re-frame/reg-fx a pattern i'm not sure I think is worth it. As it makes even basic text searches a bit confusing.

Drew Verlee17:11:37

That it finds the re-frame event definition via "find definition" is btw, amazing.

ericdallo17:11:09

yeah, maybe we can improve that behavior

Drew Verlee17:11:19

This is a fairly rare case, i just was worried it was more common.

ericdallo17:11:52

yeah not sure it's common as well

ericdallo17:11:02

clojure-lsp Released clojure-lsp https://github.com/clojure-lsp/clojure-lsp/releases/tag/2021.11.16-16.52.14, improving mostly code actions and completion! We had a huge improvement on keyword completions and snippets, the rename feature now should work for most projects even for not correctly configured source-paths, we also fixed some code parsing which should reflect on most features. • General ◦ Improve rename feature to not heavily rely on valid source-paths for most cases. ◦ Fix setTrace exception logs for graalvm native images. ◦ Huge improvements on namespaces renames and namespaces references find. https://github.com/clojure-lsp/clojure-lsp/issues/573 ◦ Fix/Remove warnings during datalevin access. ◦ Improve freezing for some MacOS cases. https://github.com/clojure-lsp/clojure-lsp/pull/631 ◦ Bump clj-kondo to `2021.10.20-20211116.110002-7` improving code parsing and other fixes. • Editor ◦ Fix "Add require" code actions adding multiple requires instead of the selected. ◦ Improve "Add require" wording, making it easier to understand what each different action will do. ◦ Smart check all available refers to require, adding refer options to `Add require` code actions. https://github.com/clojure-lsp/clojure-lsp/issues/627 ◦ Big improvements on keyword completions. https://github.com/clojure-lsp/clojure-lsp/issues/630 ◦ Add setting `keep-parens-when-threading?` to keep parens for single arity functions when threading. https://github.com/clojure-lsp/clojure-lsp/issues/636 ◦ Avoid adding duplicate requires when adding a new require via code action. https://github.com/clojure-lsp/clojure-lsp/issues/640 ◦ Improve common known snippets to replace completion items, improving completion UX. https://github.com/clojure-lsp/clojure-lsp/issues/638

🎉 12
🚀 5
catjam 2