lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
ericdallo 2021-01-07T12:32:47.214Z

Release version 2021.01.07-12.28.44 which adds a new "add-import-to-namespace" refactoring and if it's a common import clojure-lsp will suggest to add via code action πŸŽ‰ ATM it'll suggest only classes from java.util package, but my idea is to add a settings to customize that

πŸŽ‰ 3
bringe 2021-01-07T17:26:58.216400Z

@ericdallo Is it intended that the file path is shown in hovers? I just noticed this, but feel like I didn't see it before :thinking_face:

bringe 2021-01-07T17:27:58.217700Z

This is with version 2021.01.07-12.28.44 (latest, currently)

ericdallo 2021-01-07T17:30:03.218800Z

Yes, It was implemented few releases ago, it's common to show that on hover and it was something that cider documentation had that we didn't have yet

ericdallo 2021-01-07T17:30:12.219Z

Any issues with that?

ericdallo 2021-01-07T17:31:18.219200Z

Another example of that in other LSPs:

bringe 2021-01-07T17:35:54.219700Z

Oh I see, and I had just seen the release+note before reading this πŸ˜„ . No issue, just thought it looked odd at first and wanted to make sure it was intended.

ericdallo 2021-01-07T17:37:33.219900Z

I see, in VSCode looks odd indeed, not sure how to improve that on vscode, we could have a flag to disable that, but IMO i't s a nice feature and I'd like to avoid too many feature flags

pez 2021-01-07T17:43:40.220100Z

Let’s run with it for a while and see how odd it looks after that. πŸ˜ƒ

ericdallo 2021-01-07T17:52:16.220400Z

I took a look how Dart VSCode extension handles that, and it looks better indeed:

ericdallo 2021-01-07T17:52:30.220800Z

Somehow when hovering, they hide the docs

pez 2021-01-07T17:53:25.221Z

We want docs on hover, right?

πŸ‘ 1
bringe 2021-01-07T17:55:31.221200Z

I think if we can put it in a separate section under the doc string, at the bottom of the hover, that would be ideal. Not saying it needs to be changed immediately

bringe 2021-01-07T17:55:37.221400Z

Maybe something to try though

bringe 2021-01-07T17:55:48.221600Z

I meant the file path ^

bringe 2021-01-07T17:56:22.221800Z

Notice in my screenshot the path is right under the args, then the doc string is in a separate section at the bottom, but I'd expect maybe the opposite

ericdallo 2021-01-07T17:56:32.222Z

Yeah, but the way clojure-lsp is sending, it's the same way dart is sending, shoudn't this be handled on VSCode?

bringe 2021-01-07T17:57:27.222200Z

Perhaps :thinking_face: . I forgot what makes those separate sections. I thought I saw that each was from a different provider, but not sure if that makes sense here. I'll need to look into it

ericdallo 2021-01-07T17:57:52.222400Z

This is how Dart shows to me on Emacs

ericdallo 2021-01-07T17:58:23.223500Z

and this is how clojure-lsp is doing:

ericdallo 2021-01-07T17:58:38.223900Z

I wonder how this behave different in VSCode extension :thinking_face:

ericdallo 2021-01-07T17:58:51.224100Z

@brandon.ringe it's markdown ---

ericdallo 2021-01-07T17:59:38.224300Z

We could change that to add the file path after the --- , but I only don't understands why it's a different behavior

bringe 2021-01-07T17:59:45.224500Z

Oh I see. We can actually intercept the hover and change it to how we want I think.

ericdallo 2021-01-07T18:00:06.224700Z

Oh, that'd be great

bringe 2021-01-07T18:00:25.224900Z

It looks like the same behavior between vs code and emacs, it's just slightly different spacing

bringe 2021-01-07T18:01:22.225100Z

Well.. I may hold off on intercepting + transforming, because this could break things if clojure-lsp changes what it sends later.

pez 2021-01-07T18:01:29.225300Z

We can only intercept and change if it is very structured, right?

ericdallo 2021-01-07T18:02:01.225500Z

Yeah, not sure Calva change the markdown manually would be a good idea

bringe 2021-01-07T18:02:07.225700Z

I mean, I think we can intercept and change no matter what, but it wouldn't be a good idea unless structured

pez 2021-01-07T18:02:08.225900Z

Yeah, it was future comparability I had in mind too.

bringe 2021-01-07T18:02:17.226100Z

Exactly

ericdallo 2021-01-07T18:02:46.226300Z

Maybe move on clojure-lsp to after the --- can works good for both editors πŸ˜‰

bringe 2021-01-07T18:03:14.226500Z

However, imo I think the doc string directly below the args with the path below the line at the bottom would look better.

bringe 2021-01-07T18:03:26.226900Z

^ yeah

ericdallo 2021-01-07T18:04:32.227100Z

It's quite simple to do that, this is the code: https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/feature/hover.clj#L46-L49 LMK if any of you want to take a look on that

bringe 2021-01-07T18:04:34.227400Z

Because how I see it now my brain is used to seeing doc string below the args, so it's like "oh what does this function do... jar:file:///...." o_O

πŸ‘ 1
bringe 2021-01-07T18:05:11.227700Z

Yeah I can make that change some time and have you review if that's fine with you

ericdallo 2021-01-07T18:05:28.228Z

np, help is always very welcome πŸ˜‰

✌️ 1
bringe 2021-01-07T18:05:56.228300Z

This way we won't work on the same thing like yesterday πŸ˜†

ericdallo 2021-01-07T18:07:59.228600Z

yes! hahhaah

bringe 2021-01-07T20:33:50.230Z

@ericdallo Is all of this code supposed to be in the hover? It seems it's including the first arity's implementation.

bringe 2021-01-07T20:34:29.230300Z

Also something to note is that when is highlighted. I'm not sure it should be as it's not a link, and the doc string shouldn't be code highlighted I think.

bringe 2021-01-07T20:34:46.230600Z

Referring to the doc string, of course, lol

ericdallo 2021-01-07T20:37:34.230800Z

1. Yeah that's how it's implemented right now, we have a setting that IMO i prefer that is https://github.com/ericdallo/dotfiles/blob/master/.lsp/config.edn#L109 but for functions with multiple arity, this behave odd indeed 2. Hum, not sure what is the correct for the docs, with or without markdown

bringe 2021-01-07T20:38:59.231200Z

Yeah, I don't think it should be showing an implementation in the hover, odd indeed

bringe 2021-01-07T20:39:46.231400Z

Markdown is good for the doc string, but I don't see why it would be highlighting the word "when" if it's not code. But maybe some doc strings include code so it's necessary to wrap with clojure highlighting? Idk

ericdallo 2021-01-07T20:41:42.232100Z

> Yeah, I don't think it should be showing an implementation in the hover, odd indeed Oh, just realized that is showing the implementation, not the arity

πŸ‘ 1
ericdallo 2021-01-07T20:42:11.232400Z

I'll take a look on this late today

ericdallo 2021-01-07T20:42:39.232600Z

about the docstring on docs, if when is highlighted it's because probably is wrapped with

ericdallo 2021-01-07T20:42:47.232800Z

you can debug the LSP response that returns markdown

ericdallo 2021-01-07T20:42:58.233Z

textDocument/hover response

bringe 2021-01-07T20:44:49.233200Z

Yeah, I'm aware. Must resist getting sidetracked πŸ˜›

πŸ˜‚ 1