Fork me on GitHub

I’ve been getting that error too, and have been meaning to ask about it. Thank you for fixing it!

👍 2

clojure-lsp Released with a lot of fixes and improvements 🚀 Editor • Make semantic-tokens return no token for unknown symbols which has `:clj-kondo/unknown-namespace` on its analysis. • Fix file uri location when hovering a symbol. (c/c @brandon.ringe) • Add reference code lens to keyword definitions, e.g. `re-frame.core/reg-sub`. • Add `:semantic-tokens` debug information to `cursor-info` response. API/CLI • Fix corner case when ns form does not match filename. • Fix errors with project-root on graalvm binary • Improve API usage avoiding exceptions and returning just data instead. • Improve analysis cache to multiple API calls. • Add new `--raw` option allowing to display only raw data. Useful to integrate with other tools like

🚀 10
🤯 2
clojure-lsp 2

Hey I'm using the lsp library to execute format! and clean-ns! together as a deps.edn alias:

:lsp {:extra-paths ["test"]
                 :extra-deps {com.github.clojure-lsp/clojure-lsp {:mvn/version "2021.07.12-12.30.59"}}
                 :main-opts ["-e" "(require,'clojure-lsp.api),{:file-formats (count (:edits (clojure-lsp.api/format! {}))) :ns-cleaned (count (:edits (clojure-lsp.api/clean-ns! {})))}"]}
Is there a better/prettier way to do this?


probably having two separate aliases and running like:

clojure -X:clean-ns
clojure -X:format


you should use the dry? trueflag


in this case I want to replace my lint-fix alias

👍 2

to not make changes, unless you really want to make changes hehe


why you are counting the edits manually?


just to have a visual feedback of what happened, without this it will output all the files and the edits it made


hum, maybe we should improve that


a helper fn, that does all the lints, or where I could pass what I want to be done via args would be cool 🙂


are you open to PRs for a fn like that?


even so, the return of the functions may be different :thinking_face:


myabe a clean api function that would call format, clean-ns and any other feature that would clean the project


The newest clojure CLI also supports running multiple functions in a threaded fashion

☝️ 2

yeah, maybe that is a better way


the way to implement this is to receive and return maps


even so, you would not be able to get the output of both, probably only one


those functions already receive and return maps


and probably only add to the input map instead of returning a completely new map, so options are preserved for the next function

👍 2

yeah, that'd need to be done ☝️


and use namespaced keywords to avoid conflicts between return values


> The newest clojure CLI also supports running multiple functions in a threaded fashion Do you have an example of this?


Best to ask in #tools-deps


I haven't used this much yet


> and use namespaced keywords to avoid conflicts between return values agree would be better, but that'd make the input to verbose IMO

Noah Bogart15:07:56

opened a new issue about extra line breaks in documentation hover:


not sure it's a bug, in lsp-mode/emacs it seems to work:


check client <-> server logs and check what is being returned from hover request

Noah Bogart15:07:02

cool, i’ll do that

Noah Bogart15:07:02

11:37:24 AM DEBUG [connection] - send to vim: [
          "Returns the given user if it exists and is not banned",
          "/Users/noah/Personal/netrunner/src/clj/web/auth.clj: file:///Users/noah/Personal/netrunner/src/clj/web/auth.clj"
          "pumAlignTop": false,
          "preferTop": false,
          "offsetX": 0,
          "title": "",
          "close": 0,
          "codes": [
              "filetype": "clojure",
              "startLine": 0,
              "endLine": 1
              "filetype": "clojure",
              "startLine": 2,
              "endLine": 3
          "highlights": [
              "hlGroup": "CocMarkdownLink",
              "lnum": 9,
              "colStart": 0,
              "colEnd": 51
              "hlGroup": "CocMarkdownLink",
              "lnum": 11,
              "colStart": 0,
              "colEnd": 51
          "modes": [
          "maxWidth": 80,
          "autohide": 1

Noah Bogart15:07:44

that’s what coc.nvim logs when I call the “hover” lsp command


that seems correct, my guess is that coc.nvim is not handling the markdown entire correctly


the --- has no \n


that's why we add a blank line


but nvim is adding a \n on the end of --- probably


you can check that getting the markdown form clojure-lsp and pasting in some markdown preview like github

Noah Bogart15:07:50

looks like it’s joining each string with a \n, which makes it look so awkward


yeah, but that's is nvim output, we would need to check the json log between client and server


there must be a way to check that on vim

Noah Bogart15:07:29

ah okay, lemme see what i can pull out

Noah Bogart15:07:57

well, this is the log from the node backend of coc.nvim i think


let me try to check the logs from here

Noah Bogart15:07:32

ah, this is between coc.nvim and vim, not between coc.vim and lsp, my apologies

👍 2

this is what clojure-lsp returns to me:

clojure\nclojure-lsp.handlers/did-open [{:keys [textDocument]}]\n


Replacing \n with enter:

clojure clojure-lsp.handlers/did-open [{:keys [textDocument]}]


looks correct to me , WDYT?


with a docstring:

clojure clojure-lsp.handlers/did-open [{:keys [textDocument]}]
Some docstring here



there is just one line break after the docstring which doesn seems to be a issue

Noah Bogart16:07:04

Something funny is definitely happening cuz coc.nvim also strips the markdown links too


oh, maybe it doesn have support for markdown?


there is a flag that clients should send when they have support to markdown


we can confirm that if you manage to get the json log

👍 2
Noah Bogart16:07:24

Good idea, I’ll look into that. It supports highlighting of some kind cuz the typescript doc window has all sorts of highlighting and links


yeah, seems right


My guess is that vim is adding the new lines when returning to coc or something like that

Noah Bogart18:07:50

okay, this took entirely too long because reasons

Noah Bogart18:07:20

\n----\nReturns the given user if it exists and is not banned\n\n----\n*[/Users/noah/Personal/netrunner/src/clj/web/auth.clj](file:///Users/noah/Personal/netrunner/src/clj/web/auth.clj)*" 

Noah Bogart18:07:34

“kind”: “markdown”


seems correct to me, probably a issue how vim display the markdown

Noah Bogart18:07:20

yeah, digging into that now. thanks so much for all the help so far, lol

Noah Bogart19:07:22

seems it’s some sort of error with how coc.nvim handles markdown, turning it off makes the window a little uglier but much less intrusive

Noah Bogart19:07:28

thanks for the help


Nice, if you open an issue there, please link the clojure-lsp issue one, thanks!

Joshua Suskalo15:07:30

Hey @ericdallo, it's really cool to see you using americano in clojure-lsp! How have you liked it so far? Are there any features you'd like to be added to it to more fully support your usecase?


I really liked 😄 it was something I was really missing from deps.edn, I need to confess it was on my personal backlog implement a lib that does that haha


I used to use a external jar just for those classes, now I can have it in src-java folder on the same project 🙂


I think it's supporting my use case really well, thank you for that!


ah the Java compilation thing, yeah, that's cool


it might soon be obsoleted by though?

Joshua Suskalo15:07:05

Yeah, I made it specifically because I had to do some java compilation for farolero and I saw that nobody had done a java-compilation-as-data library yet. I'm glad it's working out well for you!

👍 2
Joshua Suskalo15:07:26

No, is java compilation as program, just like badigeon etc. americano is build as data.


oooh right :)

Joshua Suskalo15:07:11

And the new update to the Clojure CLI actually helps americano even more because you can set up a prep alias, which means you can depend on stuff that compiles java as a source dependency.

Joshua Suskalo15:07:57

Which means once there's wide adoption of that update I can change farolero to do that prep on the user machine and not have a separate artifact for the java.lang.Error class.


it might even be possible to compile complete Java libraries with this prep thing right


I mean, why even bother with mvn anymore ;)

❤️ 2

that sounds great

Joshua Suskalo15:07:12

Because you can use a RELEASE version in your personal config. ;)


clj-kondo will frown upon that 😆

Joshua Suskalo15:07:57

Sure, but it's my personal config, not a project dependency. It'd be to keep things like clj-new up to date. 😛

Joshua Suskalo15:07:20

Granted that also kinda goes out the window if we're moving to -T


yeah, I do this all the time ;)

Joshua Suskalo15:07:05

clj-kondo as a -T tool when? /s


no, the RELEASE hack ;)

Joshua Suskalo15:07:36

Yeah, I like that. Besides that the only reason I use maven is because it's easier than finding and copying the sha

Joshua Suskalo15:07:09

What I'd really like is a tool which allows me to "add dependency" with a tag version and it'd use rewrite-clj to add a new dependency to the deps.edn which copies the sha for that tag.


you could even do this with babashka since it has rewrite-clj included. rewrite-edn also works with this as a lib


and then put this script in your bin folder


and invoke it from the command line anywhere


@U5NCUG8NR there is a clojure-lsp issue for that feature

Joshua Suskalo15:07:38

That's cool, but unfortunately I have never been able to get clojure-lsp to work on my nix machine 😅

Joshua Suskalo15:07:47

So I'd love to have it as a separate tool too.


what issues you have with nix? I'm a nixos user as well 🙂


@ericdallo does clojure-lsp use muslc compilation?


as in, static?


then it should work with nix


nope, static flag doesn't work yet because of sqlite lib that is not static


but @U5NCUG8NR there is a nix derivation

Joshua Suskalo15:07:13

I can try that again and see if it works this time.


Actually, I need to bump the derivation to lastest version to work, there was a bug on that release

Joshua Suskalo15:07:58

I love nix in concept but in practice it's given me nothing but pain (possibly because my hobbies include writing game engines, which rely super heavily on loading libraries at runtime)


> I love nix in concept but in practice it's given me nothing but pain I'm also afraid of this ;)


yeah, I had a bad time setupping Unity + emacs on my nixos, but it works 🙂

Joshua Suskalo15:07:46

Oh yeah, I don't use unity. I write my own engines from scratch on top of opengl/vulkan+openal+assimp+several others, which means that for things like opengl/vulkan/openal the implementations have to be able to dynamically load the library from a fixed path on initialization

Joshua Suskalo15:07:20

I eventually got it working with help but it was no fun


yeah, that sounds cool and a problem indeed haha

Joshua Suskalo16:07:34

That's not to say I've never used Unity, I have an I enjoyed it, including with Arcadia, but I like having a little more control over how game code is run so now I have my own Clojure game engine which uses its own ECS which uses reducers and other things to increase the concurrency of the engine to make up for some of the performance lost by being mostly purely functional and working in Clojure.


yeah. that looks cool but too dificult to me I think 😛

Joshua Suskalo16:07:58

Lol, it's all perspective, I'd have no idea where to start on something like lsp.

Joshua Suskalo16:07:32

Or at the moment, a compiler. I'm trying to finally get my clojure->glsl compiler up to snuff and it's taking a lot of thought to even get started for version 2.


hahaha LSP is easy compared to that, but yeah, everything depends on how much time you want spend to understand that thing


I spent a lot of time making my dotfiles with nix where I can just change my notebook, run nix and everything is the smae 😛


I have macOS time-machine for that ;)


hehe, but I understand the point, nixos is really cool when you have it working

Joshua Suskalo16:07:27

Well to be fair I went to school for games development in C and C++

Joshua Suskalo17:07:37

Taking that knowledge over to Clojure, even with manual memory and resource management, isn't too hard. It's why I'm also planning on building out a library (tentatively named coffi) for using Project Panama to allow transparently calling C functions from Clojure, and passing Clojure functions as C function pointers.

😮 4

I hope this will work from babashka, that would be pretty cool

Joshua Suskalo17:07:24

As far as I know it should be fine as long as you mark the classes that Panama uses to be included in the graal image. There's a number of different classes needed. I can create an issue with all the classes needed once I get started on it.

Joshua Suskalo17:07:16

Although Graal itself may need to add some support for it, but that'll be a natural part of what happens once they add support for java 17