lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
pez 2021-01-05T09:33:45.130900Z

Seems like clojure-lsp is causing clj-kondo to create cache files in .clj-kondo/cache, which causes a bit of confusion. Maybe this could be placed in something like .lsp/.clj-kondo-cache instead? See the comments on https://github.com/BetterThanTomorrow/calva/issues/917 for a bit more on this.

2021-01-05T09:42:10.132Z

Or it could make it under .cache like default clj-kondo?

pez 2021-01-05T09:46:09.133400Z

It seems to do that too, in fact. But maybe that can cause conflicts? If clj-kondo is also standalone? Like it currently is for most Calva users.

borkdude 2021-01-05T09:51:01.133900Z

I would vote for either .clj-kondo/.lsp-cache or .lsp/.clj-kondo-cache

2๐Ÿ‘
pez 2021-01-05T10:09:04.136200Z

I also think it would be nice to automatically create a .gitignore file inside the .lsp directory that is preconfigured for whatever cache files the lsp creates. I havenโ€™t thought this through a lot though, just seems like a reasonable help to provide when producing hundreds of cache files.

1๐Ÿ‘1
borkdude 2021-01-05T10:23:01.136500Z

clj-kondo could do this too

borkdude 2021-01-05T10:24:17.136700Z

https://github.com/clj-kondo/clj-kondo/issues/1113

practicalli-john 2021-01-05T10:43:07.140Z

@pez surely a .lsp directory pattern should be in a ~/.gitignore_global file, like other tool specific patterns.

pez 2021-01-05T11:12:24.141800Z

It feels a bit rude to edit this file, though.

practicalli-john 2021-01-05T12:19:11.143700Z

I would not expect a tool to edit any git ignore files (certainly not without prompting me to confirm it's okay).

borkdude 2021-01-05T12:26:28.148100Z

@jr0cket what about clj-kondo issue 1113? do you think it's bad or good?

pez 2021-01-05T12:26:50.148200Z

Here we have some tools that create directories with files in them in your project, without prompting. They can do this with a bit less disruption by making one of the files tell git what should be ignored. I think that is nice.

practicalli-john 2021-01-05T12:35:31.157500Z

So the is a binary (clojure-lsp) that is causing another binary (clj-kondo) to create cache files in the second binaries dot config directory. Is there any reason either binaries dot directory would be committed to a projects git repository? Are these tools dot directories containing config exclusive to a project? Perhaps .gitignore_global and other user level configs are no longer as common as they used to be. That would be a sad loss.

borkdude 2021-01-05T12:36:49.158200Z

@jr0cket If you can explain why 1113 is a bad idea, I will just close the issue and not bother. Personally I haven't found it a problem to add .clj-kondo/.cache to project .gitignore.

borkdude 2021-01-05T12:37:11.158600Z

There is code in .clj-kondo that you should add to git

borkdude 2021-01-05T12:37:16.158800Z

but not the .cache dir

ericdallo 2021-01-05T12:43:20.161100Z

#1113 looks a good idea to me and we could do that for clojure-lsp too

practicalli-john 2021-01-05T12:45:16.164300Z

Posted a comment on the issue. I don't get polluting a project gitignore with tooling is valuable. I use the global git ignore file, so wouldn't affect me either way. Although hopefully any cache files are cleaned away at some point to avoid using up file space.

ericdallo 2021-01-05T12:45:19.164500Z

We can also fix the cache folder here to .clj-kondo/.cache or whatever you think its best: https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/feature/diagnostics.clj#L86 ATM is really pointing to .clj-kondo/cache

ericdallo 2021-01-05T12:47:11.165300Z

I see your point, but most users doesn't even known its possible to add a global_gitignore, and it'd be great to libs like clojure-lsp and clj-kondo just make things work without the need of user change anything, good defaults for a better UX

pez 2021-01-05T12:52:47.165500Z

The suggestion isnโ€™t to use the projectโ€™s .gitignore, though. Just so that is clear.

practicalli-john 2021-01-05T12:56:25.165700Z

@ericdallo that would be something fundamental missing from a person's skills with git. It is well documented. I did notice that Calva docs do not seem to be aware of the global ignore, so I was going to raise an issue / PR

practicalli-john 2021-01-05T12:58:10.165900Z

@pez so clojure-lsp is causing clj-kondo to create extra files and the solution is to creat another file to hide them from git? Is that right?

ericdallo 2021-01-05T12:58:12.166100Z

Not sure it's that fundamental ๐Ÿ˜• And if it's possible for the lib fix its own mess (cache dirs) with a .gitignore inside .clj-kondo or .lsp , it seems to me a quick win

pez 2021-01-05T13:08:45.166300Z

clojure-lsp also creates its own files, but yes, it is making clj-kondo create files. What many people will do (I know since it is what happens with Calva) when they see the change list, is to ignore the entire .clj-kondo directory, which is a mistake. They might even use the global gitignore file for this, but regardless, since clojure-lsp knows what should be ignored, it can tell git this.

1โ˜๏ธ
practicalli-john 2021-01-05T13:09:07.166500Z

@ericdallo There lies the problem I suspect.

ericdallo 2021-01-05T13:13:31.166800Z

Yes, I agree with @pez, we known what we need to ignore for sure, so we could do that

practicalli-john 2021-01-05T13:16:14.167Z

Perhaps I don't really understand the problem you are trying to solve. So many things I don't understand about LSP. I am sure you know what you are doing

ericdallo 2021-01-05T13:37:27.168Z

Released versionย 2021.01.05-13.31.52 which makesย `clojure-lsp`ย smarter suggesting more namespaces to add when it's a known ns likeย `clojure.string`ย or a knownย `refer` like deftestย ๐ŸŽ‰ Also, it adds the namespace name to be required now!

3๐Ÿค˜1๐ŸŽ‰
pez 2021-01-05T13:41:06.168900Z

Itโ€™s time we ask @jayzawrotny if he can craft a logo, me thinks. ๐Ÿ˜ƒ

ericdallo 2021-01-06T12:19:09.205800Z

Hum, it's a process that the clients (Emacs, VScode etc) run as background and they communicate their request and response json via socket

ericdallo 2021-01-06T12:19:20.206Z

Here there's a list with all official servers: https://microsoft.github.io/language-server-protocol/implementors/servers/

ericdallo 2021-01-06T12:22:38.206400Z

Most of them have no logo ๐Ÿ˜› but I like metals (scala LSP) logo which is similar to official scala but not the same hehe https://github.com/scalameta

pez 2021-01-06T12:23:25.206800Z

Coming from the client side of things, the first time I tested a Calva build with clojure-lsp in it (some year ago) I got this feeling that Clojure power just poured up into the client with 15 lines of integration code. No idea if that is a good image to relay, and if it is even possible, but a logo should speak to its users, so my view is valid. ๐Ÿ˜ƒ

11
pez 2021-01-06T12:25:51.207200Z

Not sure if Venom is familiar to you guys, but that was the feeling. The first time Peter Parker integrates with Venom and it enhances his Spiderman powers. That kind of feeling. Haha. Minus the maliciousness of Venom, of course. Haha.

ericdallo 2021-01-06T12:26:41.207400Z

hahahah nice analogy

pez 2021-01-06T12:31:49.207600Z

In an editor w/o any analysis of the Clojure code, it is just text, For a Clojure expert it might be second nature to find the structure there, but it is obvious how some cybernetics can help. Add some structural treatment and you get syntax highlighting and such. Start to analyse how the symbols fit together and you get magical powers. The text is suddenly semantic and you can examine the tokens and find much, much more meaning. The integration of human and machine creates something much more powerful than human+machine.

1โค๏ธ1โ˜๏ธ
2021-01-06T16:23:23.211100Z

Oooh thatโ€™s very helpful!

1๐Ÿ˜„
ericdallo 2021-01-05T13:42:39.169Z

That'd be great!

ericdallo 2021-01-05T13:43:01.169200Z

I created a random one on Gimp because we didn't have any ๐Ÿ˜†

pez 2021-01-05T13:45:29.169400Z

You also created a forbidden one. ๐Ÿ˜ƒ (I was asked by Alex Miller to not use the Clojure logo in the Calva logo, and that lead to the awesome Calva logo we have today, by @jayzawrotny).

ericdallo 2021-01-05T13:48:05.169600Z

Oh! I didn't know about that ๐Ÿ˜ž good to know! If @jayzawrotny can help us it'd be great, otherwise I'll have to create a really random one ๐Ÿ˜†

pez 2021-01-05T13:48:56.169800Z

Letโ€™s see if he hears we are summoning him. ๐Ÿ˜ƒ

1๐Ÿ˜„
anonimitoraf 2021-01-05T14:27:46.170100Z

Whoa. Thanks for this!

anonimitoraf 2021-01-05T14:28:17.170300Z

I think @jayzawrotny is more active in the doom emacs discord

ericdallo 2021-01-05T14:35:32.170500Z

I'm on that discord server too, I can dm him if he doesn't answer here ๐Ÿ˜…

pez 2021-01-05T14:39:13.170700Z

He showed up in the #calva channel on this Slack the other day. ๐Ÿ˜ƒ

borkdude 2021-01-05T15:47:33.172Z

That should work, I think

borkdude 2021-01-05T15:47:54.172400Z

I do use a lock, and it should work cross-process too, but some testing would be nice

2021-01-05T15:53:13.174400Z

Hey there. Iโ€™m available and interested, will need some more context though. ๐Ÿ™‚

12๐ŸŽ‰
ericdallo 2021-01-05T16:26:47.174600Z

Nice! thanks for that @jayzawrotny I can help you with all info you need ๐Ÿ˜„

2021-01-05T16:28:37.176100Z

Great! So first question: What would this logo be for? Clojure-lsp?

ericdallo 2021-01-05T16:30:43.176300Z

briefly, there is the https://microsoft.github.io/language-server-protocol/) that was created by Microsft to create a standard on how a language should behave on multiple IDEs soving the problem m languages for n IDEs To do that, there is a server for each language (which calculate and knows how a language works) and the client which are the IDEs (Emacs, VSCode, Sublime Text etc). The logo is for clojure-lsp , which is the server

ericdallo 2021-01-05T16:32:39.176600Z

It'd replace this terrible logo that I created ๐Ÿ˜‚ https://github.com/clojure-lsp/clojure-lsp#clojure-lsp

ericdallo 2021-01-05T16:33:10.176900Z

You're welcome! ๐Ÿ˜„

pez 2021-01-05T16:54:58.179100Z

What could speak against using the same directory is that clj-kondo starts to do things it doesnโ€™t do otherwise in the presence of the .clj-kondo directory. Not at all sure that matters a bit, just a thing to consider.

borkdude 2021-01-05T16:56:17.179700Z

clj-kondo uses the .clj-kondo directory to detect the project root (it needs the user to do this) and as a way to let the user say: yes, please fill the cache, at this location

pez 2021-01-05T17:03:43.180300Z

To me starting Calva with clojure-lsp was the first time I ever saw the .clj-kondo directory. ๐Ÿ˜ƒ

borkdude 2021-01-05T17:05:04.180700Z

@pez you never used a .clj-kondo/config.edn ??

pez 2021-01-05T17:05:51.181400Z

I think I have once or twice when having had some chat with you. ๐Ÿ˜ƒ

ericdallo 2021-01-05T17:06:10.181700Z

it's kind of a must if you have custom macros, like these: https://github.com/ericdallo/dotfiles/blob/master/.clj-kondo/config.edn#L10-L17

pez 2021-01-05T17:06:28.182200Z

To me the clj-kondo extensino just works. I love it.

3โค๏ธ
ericdallo 2021-01-05T17:07:15.183600Z

Yeah, IMO if user doesn't even needed to use the custom config.edn , probably means the defaults are very good tuned ๐Ÿ˜…

pez 2021-01-05T17:07:17.183700Z

Yes, I remember using it for some custom macro in some case. Or, rather, helping some Calva user with it.

pez 2021-01-05T17:07:52.184500Z

clj-kondo is an inspiration when it comes to nice defaults. Ux de-lux.

bringe 2021-01-05T17:09:04.185200Z

For the record I haven't used the .clj-kondo/config.edn either, at least not often if so.

borkdude 2021-01-05T17:10:32.185700Z

Maybe now that there is also #_:clj-kondo/ignore there is less need for it, although I use that as a last resort ;)

1๐Ÿ‘1โ˜๏ธ
ericdallo 2021-01-05T17:15:32.187800Z

Something that'd be great to improve, it's to have a feature like cursive has, where user can tell how the linter should lint an unknown macro, that probably would reduce a lot the need to change config.edn ๐Ÿ˜‰

bringe 2021-01-05T17:17:08.188400Z

I'm confused, isn't that what's done in the config.edn currently? How else does a user tell the linter how to lint an unknown macro?

bringe 2021-01-05T17:17:16.188600Z

(just curious)

ericdallo 2021-01-05T17:19:04.189800Z

Yes, but user doesn't even need to know about a config file, in Cursive, user interactively select how should lint and Cursive persists it for next sessions automatically

bringe 2021-01-05T17:23:31.190Z

Ohh interesting

borkdude 2021-01-05T17:29:57.190700Z

@ericdallo that can be done by saving :lint-as in an extra .clj-kondo/lsp-config.edn and then using that as extra configuration

borkdude 2021-01-05T17:30:11.191200Z

(as to not mess with the user-written one)

pez 2021-01-05T17:30:34.191600Z

Could be solved as that the editor integration writes into the config file, right?

pez 2021-01-05T17:31:02.192200Z

I mean, the use case as such.

borkdude 2021-01-05T17:31:25.192800Z

hmm, you could also add it to the .clj-kondo/config.edn using rewrite-clj(c) while preserving whitespace and comments

borkdude 2021-01-05T17:31:32.193Z

you are probably doing this already a lot in lsp anyway

borkdude 2021-01-05T17:31:42.193300Z

(I also made a small tool specifically for edn files: https://github.com/borkdude/rewrite-edn)

borkdude 2021-01-05T17:32:06.193800Z

I never bothered with this, since I hoped editor plugins would do this for me ;)

borkdude 2021-01-05T17:32:22.194100Z

And I can't possibly make editor plugins for all editors where clj-kondo runs

borkdude 2021-01-05T17:32:29.194300Z

So I'm happy you are thinking about this

ericdallo 2021-01-05T17:35:38.196400Z

Yes @borkdude I don't think it'd be difficult to implement, maybe the issue here, is that doesn't exists a standard for LSP to do that, maybe we could achieve it with a custom command from LSP though and clients (like Calva), call these custom commands with the user input or something like that

borkdude 2021-01-05T17:36:14.196800Z

Yeah, this is very editor specific

borkdude 2021-01-05T17:36:23.197Z

so maybe it should live in Calva itself

pez 2021-01-05T17:38:14.197800Z

A custom command sounds great though. The editor picks up the user input and uses the command to persist the setting. Something.

borkdude 2021-01-05T17:38:41.198300Z

Maybe some callback-like thingie that abstracts away the UI part

pez 2021-01-05T17:40:31.200700Z

clojure-lsp uses the workspace/executeCommand for some a bit similar things. wouldnโ€™t need a callback even?

1๐Ÿ‘
pez 2021-01-05T17:41:17.201900Z

Iโ€™ve been away playing Just Dance 2021 with my whole family for a while, so have to admit I can have missed some context here.

2๐Ÿ˜†1
ericdallo 2021-01-05T17:41:40.202400Z

the issue being editor specific is that all the logic become responsibility of client and lsp-mode for eample would need to duplicate that, a command in server would centralize that logic only needing the input

ericdallo 2021-01-05T17:42:46.203300Z

Exactly, this could be achieved via https://microsoft.github.io/language-server-protocol/specification#workspace_executeCommand just like we do for refactorings and server-info ๐Ÿ™‚

pez 2021-01-05T17:43:18.204200Z

Yeah, Iโ€™d like that. Of course could also be a cljc library, but not all editor integrations can easily reach that.

1
ericdallo 2021-01-05T19:46:56.204400Z

Using clojure-lsp with :emacs: !

14๐ŸŽ‰