lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
codeasone 2021-02-13T12:26:34.133200Z

I'm seeing 100s of the following type of error when clojure-lsp fires up on my work project:

[clojure-lsp.crawler:122] - Cannot find position data when analysing let* {:name let*, :filename "/home/mark/Code/Personal/clojure-lsp-issue/src/example.clj", :from example, :col nil, :from-var showcase, :arity 2, :bucket :var-usages, :row nil, :to clojure.core} nil
[clojure-lsp.crawler:122] - Cannot find position data when analysing fn* {:name fn*, :filename "/home/mark/Code/Personal/clojure-lsp-issue/src/example.clj", :from example, :col nil, :from-var showcase, :arity 2, :bucket :var-usages, :row nil, :to clojure.core} nil
Here's a minimal reproduction: https://github.com/codeasone/clojure-lsp-issue - are these innocuous?

ericdallo 2021-02-14T20:06:47.149600Z

Released @codeasone!

1🎉
ericdallo 2021-02-13T13:41:10.133500Z

This is a debug log, it's in my TODO improve that log, it confuses users indeed, it should not affect your work :)

ericdallo 2021-02-13T13:43:03.133700Z

Basically this happens because some kondo analysis don't return name positions which clojure-lsp uses

ericdallo 2021-02-13T13:43:51.133900Z

But after some tests, this is kind of expected for some specific analysis and don't affect user experience with clojure-lsp

codeasone 2021-02-13T13:50:59.134100Z

Great, thanks @ericdallo

snoe 2021-02-13T16:00:56.134300Z

@ericdallo it seemed weird to me that Kondo returned those. Is it a bug on that side or is there a reason/use for them?

ericdallo 2021-02-13T16:02:35.134500Z

Yeah, with some tests I did, not deep though, I realized it happens with some macros like fn* , let* ->

ericdallo 2021-02-13T16:03:10.134700Z

they don't contain :row nor :col

ericdallo 2021-02-13T16:03:52.134900Z

Do you know if is that expected @borkdude? some analysis don't contain :row and :col ?

snoe 2021-02-13T16:04:32.135100Z

That's macros that use those fns, not uses of fn* directly correct?

borkdude 2021-02-13T16:04:47.135300Z

this might be due to macro-expansion yes

1☝️
borkdude 2021-02-13T16:05:02.135500Z

"macro-expansion", clj-kondo's way of expanding these expressions

ericdallo 2021-02-13T18:56:40.137400Z

:clojure-lsp: Latest clojure-lsp release reduce native binaries size drastically from 118MB -> 29MB 🎉 LMK if any issues!

133💪5🦐
javahippie 2021-02-14T08:46:42.143600Z

Thanks so much for your work! I just downloaded the latest version (mac OS native) and it crashes: zsh: killed clojure-lsp

javahippie 2021-02-14T08:47:44.143800Z

Setting xattr doesn’t help, previous versions worked fine for me. Just reinstalled 2021.02.12-03.13.12 and it works. If there is any debug output I can generate to help, I’d be happy too.

borkdude 2021-02-14T09:25:41.144200Z

@javahippie Have you chmod+x it?

javahippie 2021-02-14T09:26:20.144400Z

Yes, I did that. The error message would’ve been different, too, I guess

borkdude 2021-02-14T09:26:41.144600Z

What if you execute it manually from a shell?

borkdude 2021-02-14T09:29:53.144800Z

I just tried it myself on macOS Mojave and it worked for me.

borkdude 2021-02-14T09:29:58.145Z

Are you perhaps using M1?

javahippie 2021-02-14T09:32:14.145200Z

This is the response when I start it from the commandline with zsh. I am on Big Sur, without M1

borkdude 2021-02-14T09:33:14.145400Z

Hmm, I'm also using macOS with zsh, but not Big Sur

ericdallo 2021-02-14T13:09:36.146Z

Hum, maybe UPX has some issue with macOS Big Sur? It'd be good to check if anyone has that too on Big Sur

ericdallo 2021-02-14T13:53:35.146200Z

@javahippie please open a issue so we check if there others with that issue, I found that also: https://github.com/upx/upx/issues/424

ericdallo 2021-02-14T13:58:06.146500Z

https://github.com/upx/upx/issues/450

ericdallo 2021-02-14T13:59:58.146800Z

It seems to be a issue with Big Sur and UPX indeed 😕 maybe we should rollback clojure-lsp to not use UPX for mac users ?:thinking_face:

javahippie 2021-02-14T14:16:02.147Z

@ericdallo Just filed a Bug: https://github.com/clojure-lsp/clojure-lsp/issues/322

ericdallo 2021-02-14T14:16:18.147300Z

thank you!

javahippie 2021-02-14T14:19:31.147500Z

Just updated one more thing, exit code is 137

1👍
borkdude 2021-02-14T14:51:33.147800Z

137 means out of memory

ericdallo 2021-02-14T15:00:51.148Z

@javahippie Could you check your OS memory while running clojure-lsp?

javahippie 2021-02-14T15:03:51.148200Z

I cannot really see any changes as the process crashes instantly

ericdallo 2021-02-14T15:07:01.148400Z

I see, probably UPX bug indeed

2021-02-14T16:36:14.148700Z

> @andre.peric WDYT about creating a `clojure-lsp/homebrew-brew` repo with clojure-lsp custom formula? Yes, this looks saner. Great ideia. Will have a look at that after the holidays.

1👍
ericdallo 2021-02-14T20:06:33.149300Z

Fixed on latest release @javahippie 🙂

javahippie 2021-02-14T22:54:01.149800Z

Very nice, thank you very much!

borkdude 2021-02-14T23:00:29.150Z

Maybe upx isn't worth the bother, since the releases are already zipped and disk space is usually not a concern when it comes to 100mb files

ericdallo 2021-02-14T23:01:20.150200Z

Yeah I thought about that, the zip with UPX is almost the same size of the zip without upx

borkdude 2021-02-14T23:02:34.150400Z

upx is basically "unzip on run"

1👍
ericdallo 2021-02-13T18:59:14.137600Z

@borkdude is there any way to know is that analysis is a macro expansion? with that we could just don't log for those cases

ericdallo 2021-02-13T19:01:20.137800Z

• set a new flag during build related to dynaload • Use https://upx.github.io/ to compress binary size (it increases the startup time by ~300ms but the tradeoff looks good for clojure-lsp case)

borkdude 2021-02-13T19:05:14.138400Z

There are a few built-in ones, like -> and ->>, etc.

borkdude 2021-02-13T19:05:35.138600Z

this is in src/clj_kondo/impl/macroexpand.clj

ericdallo 2021-02-13T19:06:04.138800Z

Nice, will not log for those so

borkdude 2021-02-13T19:24:26.139400Z

@ericdallo Is it an idea to start distributing clojure-lsp through brew ?

ericdallo 2021-02-13T19:25:57.139700Z

Actually, it's already available but

ericdallo 2021-02-13T19:26:15.139900Z

very outdated, I had this Idea which @andre.peric is helping me though: https://github.com/clojure-lsp/clojure-lsp/pull/286

ericdallo 2021-02-13T19:26:39.140200Z

but homebrew core doesn't support graalvm yet

borkdude 2021-02-13T19:26:55.140400Z

I would not recommend going the homebrew core route. Even clojure core isn't doing that anymore. Unless you like bureaucracy. Just make a tap

ericdallo 2021-02-13T19:26:59.140600Z

and we are having a hard time to make this PR pass on tests: https://github.com/Homebrew/homebrew-core/pull/69929

ericdallo 2021-02-13T19:27:51.140900Z

Yeah, thanks for the advice, I was really thinking to use the other homebrew way

borkdude 2021-02-13T19:28:04.141100Z

Here are all my packages. They download directly from Github. https://github.com/borkdude/homebrew-brew

ericdallo 2021-02-13T19:28:04.141300Z

but I'm not a MacOS user, so don't know too much about homebrew

borkdude 2021-02-13T19:28:21.141700Z

Well, brew also works for linux, so you will also help linux users

ericdallo 2021-02-13T19:28:30.141900Z

yeah, this looks way more easy, and we could get the binary from release

ericdallo 2021-02-13T19:30:57.142100Z

@borkdude why do you need a separated repo for the formulas? what users need to do to install via homebrew but poiting to your repo?

borkdude 2021-02-13T19:32:13.142300Z

@ericdallo for a tap your repo must start with the name homebrew-<x> and then x is the name of your tap. Then people can install the package using: brew install borkdude/brew/babashka

ericdallo 2021-02-13T19:32:31.142600Z

oh, really easy indeed

ericdallo 2021-02-13T19:33:04.142800Z

@andre.peric WDYT about creating a clojure-lsp/homebrew-brew repo with clojure-lsp custom formula?

5❤️
ericdallo 2021-02-13T21:22:23.143100Z

Fixed, It'll be available one next release @codeasone 🙂