lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
orestis 2021-03-01T10:24:25.305100Z

What a fantastic project, many thanks to everyone ๐Ÿ˜„

โค๏ธ 2
borkdude 2021-03-01T12:11:40.306500Z

@ericdallo Does LSP emacs support something like an interactive finding of a var? I just want to enter (part of the) name

borkdude 2021-03-01T12:11:48.306800Z

without hovering over it in a buffer for example

ericdallo 2021-03-01T12:12:28.307400Z

Yes. the textDocument/workspaceSymbol should handle that

borkdude 2021-03-01T12:12:50.308200Z

e.g. right now I am trying to find the var syntax-label but I forgot in which namespace this var was defined, but lsp knows all of this

ericdallo 2021-03-01T12:12:54.308400Z

in emacs there is: lsp-ivy-workspace-symbol

ericdallo 2021-03-01T12:13:54.308700Z

https://github.com/emacs-lsp/lsp-ivy

ericdallo 2021-03-01T12:14:24.309100Z

Or if you use helm : helm-lsp-workspace-symbol via the helm-lsp package

borkdude 2021-03-01T12:15:17.309500Z

I don't use either but I'll try ivy

borkdude 2021-03-01T12:15:31.309700Z

doesn't work though

borkdude 2021-03-01T12:16:28.309900Z

I'll just use grep :/

ericdallo 2021-03-01T12:16:57.310100Z

It works for me:

borkdude 2021-03-01T12:17:25.310700Z

why did you type *clj?

ericdallo 2021-03-01T12:17:28.310800Z

I don't know too much about the ivy filters

ericdallo 2021-03-01T12:17:42.311Z

but It needs some prefix

borkdude 2021-03-01T12:18:04.311200Z

eh, this is too hard for me on Monday ;)

๐Ÿ˜† 1
borkdude 2021-03-01T12:18:48.312300Z

can we maybe have lsp-clojure-find-var-interactively and then type some string which filters over the vars using some fuzzyness?

ericdallo 2021-03-01T12:18:52.312400Z

For some reason it seems to need a first anything param :man-shrugging:

ericdallo 2021-03-01T12:19:31.313100Z

that command should do that, we just need to fix that search, not sure it's a lsp-mode bug or related how the server is returning the data

ericdallo 2021-03-01T12:21:02.313800Z

I tested with Dart lang and it worked perfectly, so I need to investigate why clojure-lsp is returning the symbol filtered only when it has 2 params

ericdallo 2021-03-01T12:22:05.314200Z

For now you can use it with . syntax-label ,it should work

borkdude 2021-03-01T12:25:33.314900Z

@ericdallo Confirming that works with lsp-ivy-workspace-symbol. I tried lsp-ivy-global-workspace-symbol which didn't work

ericdallo 2021-03-01T12:27:22.315600Z

the global one get symbols from all active projects, not so useful and may have performance issue I suppose

borkdude 2021-03-01T12:27:51.316200Z

ok. so it only finds symbols from the source paths right? if I type concat it doesn't return clojure.core/concat for example

ericdallo 2021-03-01T12:28:35.316500Z

yes

ericdallo 2021-03-01T12:28:47.316800Z

But maybe we should add support for it as well

ericdallo 2021-03-01T12:29:05.317Z

It makes sense to me

reefersleep 2021-03-01T13:37:05.317500Z

Hey guys

reefersleep 2021-03-01T13:38:02.318900Z

Iโ€™m considering using lsp and kondo for a very specific feature, but it seems like a lot of setup for something so little. I havenโ€™t delved into lsp before. Cursive users, do you think that LSP gives you some very valuable feature that you donโ€™t get from Cursive out of the box?

orestis 2021-03-01T13:38:30.320Z

Hm, I got curious and tried the workspace-symbol from NeoVim and it doesn't seem to take the query into account -> I get all the symbols of my workspace back instead.

reefersleep 2021-03-01T13:38:35.320200Z

Sell it to me ๐Ÿ™‚

reefersleep 2021-03-01T13:38:52.320700Z

If you can be bothered!

borkdude 2021-03-01T13:39:01.320900Z

@reefersleep There are already people using the clj-kondo LSP plugin with Cursive, so at least diagnostics work for sure

borkdude 2021-03-01T13:39:19.321200Z

Without clj-kondo you probably get less diagnostics from Cursive only

ericdallo 2021-03-01T13:40:01.321900Z

I was a Cursive user before Emacs, most features LSP features are available on Cursive, there is a specific one that I think only LSP has like get all references of a a keyword

borkdude 2021-03-01T13:40:02.322100Z

My favorite clojure-lsp feature is probably finding keywords, although TIL that Cursive also has this

ericdallo 2021-03-01T13:40:35.322500Z

Oh Cursive has too ๐Ÿ˜… https://clojurians.slack.com/archives/CPABC1H61/p1614606002322100

borkdude 2021-03-01T13:40:42.323100Z

And what you don't get with Cursive (I think) is being able to define custom (clj-kondo) hooks for your macros so the IDE "gets" them

โ˜๏ธ 1
reefersleep 2021-03-01T13:41:00.323700Z

Thatโ€™s the interesting part for me. But I wonder if there are other killer features ๐Ÿ™‚

borkdude 2021-03-01T13:41:35.324Z

Namespace cleanup maybe?

borkdude 2021-03-01T13:41:59.324500Z

https://clojure-lsp.github.io/clojure-lsp/features/

ericdallo 2021-03-01T13:42:08.324800Z

not sure Cursive supports all clojure-lsp code actions

reefersleep 2021-03-01T13:46:47.325500Z

Maybe not all, but it seems to me like thereโ€™s a big overlap. Thatโ€™s why itโ€™d be cool if Cursive users could highlight the golden differences ๐Ÿ™‚

๐Ÿ‘ 1
ericdallo 2021-03-01T14:35:21.325700Z

yes, I found the issue, we don't filter on server-side only on front-end

ericdallo 2021-03-01T14:35:30.325900Z

I'll fix it soon

ericdallo 2021-03-01T14:35:35.326100Z

add a fuzzy search

orestis 2021-03-01T14:41:27.326300Z

Thanks ๐Ÿ™‚ glad to be providing NeoVim info ๐Ÿ™‚

2021-03-01T19:03:10.326900Z

Is there any way I can manually change the project root?

ericdallo 2021-03-01T19:07:21.327100Z

are you using Emacs?

ericdallo 2021-03-01T19:07:48.327300Z

lsp-workspace-folder-remove and then lsp , it'll ask for the new project-root

2021-03-01T19:08:09.327500Z

yes, emacs

2021-03-01T19:08:10.327700Z

thx

ericdallo 2021-03-01T19:48:53.329300Z

@borkdude @orestis latest release should fix the workspaceSymbols querying issue and the rename on a refer (bumping clj-kondo)

borkdude 2021-03-01T19:49:12.329600Z

updating ๐Ÿ™

ericdallo 2021-03-01T19:53:41.329700Z

BTW the auto update brew action didn't work, but we have an idea to auto sed and commit to the repo

borkdude 2021-03-01T19:55:13.329900Z

yeah, I'm doing something like that but then locally

borkdude 2021-03-01T19:55:40.330400Z

https://github.com/borkdude/homebrew-brew/blob/master/update-babashka

๐Ÿ‘ 1
borkdude 2021-03-01T19:57:29.330900Z

so are you saying I should download the bin manually?

ericdallo 2021-03-01T19:57:45.331100Z

for now, yep

borkdude 2021-03-01T19:58:09.331300Z

You can also do a script like this: https://github.com/clj-kondo/clj-kondo/blob/master/script/install-clj-kondo

ericdallo 2021-03-01T19:59:13.332200Z

oh, we have one similar to that

ericdallo 2021-03-01T20:00:27.333400Z

but it's quite simple

borkdude 2021-03-01T20:01:24.333600Z

It still doesn't return symbols from clojure.core etc for me.

ericdallo 2021-03-01T20:02:02.334Z

Yes, I didn't change that, it s a lsp-mode issue since lsp-mode need to open the buffer for each symbol I think

ericdallo 2021-03-01T20:02:34.334200Z

And then Emacs prompt with a lot of questions if you want to import the root of that jar

borkdude 2021-03-01T20:02:50.334400Z

Then why did you poke me with > latest release should fix the workspaceSymbols querying issue ? :)

ericdallo 2021-03-01T20:02:54.334600Z

So for now, until know how to fix that, I didn't enable the all analysis

ericdallo 2021-03-01T20:03:21.334800Z

It fixes the querying, using fuzzy search

borkdude 2021-03-01T20:03:32.335Z

ooh kk

borkdude 2021-03-01T20:03:35.335200Z

thanks!

ericdallo 2021-03-01T20:03:35.335400Z

so you don't need a prefix like before

borkdude 2021-03-01T20:05:02.336300Z

you mean, I don't have to type the leading . ?

ericdallo 2021-03-01T20:05:11.336700Z

yes

ericdallo 2021-03-01T20:05:21.337100Z

and the search now use fuzzy search on server side

borkdude 2021-03-01T20:05:49.337500Z

When I don't give a leading dot, the search results don't seem to be related at all.

kommen 2021-03-01T20:05:50.337900Z

Iโ€™m running into an issue where I get different diagnostics between latest version of clj-kondo and clojure-lsp with regard to clojure-lsp not finding some macro used in cljs code. kondo seems to find the definitions and doesnโ€™t emit warnings. how to best debug what is going on?

ericdallo 2021-03-02T12:39:48.356900Z

@kommen please check the issue above โ˜๏ธ it could be related with your issue indeed

kommen 2021-03-02T14:36:34.357100Z

@ericdallo thank you, confirmed this is the same issue I was seeing and adding a lint-as makes it all good. Thank you!

ericdallo 2021-03-02T14:40:01.357300Z

Great ๐Ÿ˜„ thank you!

ericdallo 2021-03-01T20:08:58.338100Z

Hum, yeah, we may improve the fuzzy logic

borkdude 2021-03-01T20:10:12.338300Z

I mean, there are dozens of symbols which literally have the word concat in them, which do show with . concat ;)

ericdallo 2021-03-01T20:11:09.338500Z

on server side we just use the . concat to the fuzzy search

ericdallo 2021-03-01T20:11:17.338700Z

have no idea how this works now hahah

borkdude 2021-03-01T20:12:21.338900Z

it just returns the first results without any matching it seems

ericdallo 2021-03-01T20:12:32.339100Z

hum, first, remove the .lsp/sqlite.db of your project

ericdallo 2021-03-01T20:12:43.339300Z

and .clj-kondo/.cache

ericdallo 2021-03-01T20:13:30.339500Z

yes, also, I know lsp-mode has a filtering on the front-end

kommen 2021-03-01T20:17:07.339700Z

did both and restarted clojure-lsp, same result

ericdallo 2021-03-01T20:18:20.339900Z

if you can use clj-kondo on command line and it works and on clojure-lsp doesn't, please open a issue with a minimal repro, then I can test it and check why is not working if it's really a issue on clojure-lsp

kommen 2021-03-01T20:18:51.340100Z

ok, thanks, will try to build a minimal repro

๐Ÿ‘ 1