This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-12
Channels
- # announcements (1)
- # aws (1)
- # babashka (63)
- # beginners (108)
- # calva (12)
- # cider (6)
- # cljdoc (2)
- # cljsrn (33)
- # clojure (150)
- # clojure-europe (28)
- # clojure-nl (13)
- # clojure-spain (1)
- # clojure-spec (8)
- # clojure-uk (25)
- # clojurescript (16)
- # conjure (7)
- # cursive (7)
- # datomic (15)
- # duct (2)
- # eastwood (2)
- # figwheel (1)
- # figwheel-main (1)
- # fulcro (6)
- # graalvm (1)
- # graalvm-mobile (1)
- # helix (6)
- # honeysql (23)
- # integrant (6)
- # introduce-yourself (4)
- # jobs (10)
- # lsp (132)
- # malli (4)
- # meander (1)
- # membrane (1)
- # off-topic (223)
- # pathom (23)
- # pedestal (3)
- # re-frame (18)
- # reagent (13)
- # releases (1)
- # remote-jobs (2)
- # shadow-cljs (68)
- # tools-deps (217)
- # vim (19)
- # xtdb (79)
I’ve been getting that error too, and have been meaning to ask about it. Thank you for fixing it!
Released https://github.com/clojure-lsp/clojure-lsp/releases/tag/2021.07.12-12.30.59 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. https://github.com/clojure-lsp/clojure-lsp/issues/466 • 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 https://github.com/reviewdog/reviewdog
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
just to have a visual feedback of what happened, without this it will output all the files and the edits it made
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?
:hummmm:
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
and probably only add to the input map instead of returning a completely new map, so options are preserved for the next function
> The newest clojure CLI also supports running multiple functions in a threaded fashion Do you have an example of this?
> and use namespaced keywords to avoid conflicts between return values agree would be better, but that'd make the input to verbose IMO
exactly my thought here: https://clojurians.slack.com/archives/C6QH853H8/p1626102675257500
opened a new issue about extra line breaks in documentation hover: https://github.com/clojure-lsp/clojure-lsp/issues/473
cool, i’ll do that
11:37:24 AM DEBUG [connection] - send to vim: [
"call",
"coc#api#call",
[
"call_function",
[
"coc#float#create_cursor_float",
[
0,
0,
[
"web.auth/active-user?",
"",
"[user]",
"---",
"",
"Returns the given user if it exists and is not banned",
"",
"---",
"",
"/Users/noah/Personal/netrunner/src/clj/web/auth.clj",
"",
"/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": [
"n"
],
"maxWidth": 80,
"autohide": 1
}
]
]
],
-482
]
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
you can check that getting the markdown form clojure-lsp and pasting in some markdown preview like github
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
ah okay, lemme see what i can pull out
well, this is the log from the node backend of coc.nvim i think
ah, this is between coc.nvim and vim, not between coc.vim and lsp, my apologies
this is what clojure-lsp returns to me:
clojure\nclojure-lsp.handlers/did-open [{:keys [textDocument]}]\n\n----\n*[/home/greg/dev/clojure-lsp/src/clojure_lsp/handlers.clj](/home/greg/dev/clojure-lsp/src/clojure_lsp/handlers.clj)*
Replacing \n
with enter:
clojure
clojure-lsp.handlers/did-open [{:keys [textDocument]}]
----
*[/home/greg/dev/clojure-lsp/src/clojure_lsp/handlers.clj](/home/greg/dev/clojure-lsp/src/clojure_lsp/handlers.clj)*
with a docstring:
clojure
clojure-lsp.handlers/did-open [{:keys [textDocument]}]
----
Some docstring here
----
*[/home/greg/dev/clojure-lsp/src/clojure_lsp/handlers.clj](/home/greg/dev/clojure-lsp/src/clojure_lsp/handlers.clj)*
Something funny is definitely happening cuz coc.nvim also strips the markdown links too
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
My guess is that vim is adding the new lines when returning to coc or something like that
okay, this took entirely too long because reasons
"
clojure\nweb.auth/active-user?\n\n
clojure\n[user]\n\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)*"
“kind”: “markdown”
yeah, digging into that now. thanks so much for all the help so far, lol
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
thanks for the help
will do!
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 🙂
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!
No, tools.build is java compilation as program, just like badigeon etc. americano is build as data.
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.
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
Absolutely
Because you can use a RELEASE version in your personal config. ;)
Sure, but it's my personal config, not a project dependency. It'd be to keep things like clj-new up to date. 😛
Granted that also kinda goes out the window if we're moving to -T
clj-kondo as a -T tool when? /s
Yeah, I like that. Besides that the only reason I use maven is because it's easier than finding and copying the sha
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
@U5NCUG8NR there is a clojure-lsp issue for that feature
That's cool, but unfortunately I have never been able to get clojure-lsp to work on my nix machine 😅
So I'd love to have it as a separate tool too.
@ericdallo does clojure-lsp use muslc compilation?
but @U5NCUG8NR there is a nix derivation
https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/misc/clojure-lsp/default.nix
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
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 ;)
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
I eventually got it working with help but it was no fun
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.
Lol, it's all perspective, I'd have no idea where to start on something like lsp.
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 😛
Well to be fair I went to school for games development in C and C++
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.
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.
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