lsp

erwinrooijakkers 2025-04-23T14:28:51.137559Z

Two questions about LSP mode in Spacemacs: 1. Why do my normally white variables turn green orange (? red green colorblind but I guess it's green orange) when LSP is on? How do I prevent this and keep original color? I tried lsp-enable-on-type-formatting nil but did not change. 2. How do I prevent the linter from saying "Unresolved var" on things that are in the requires. Like honeysql/format and http-kit/post.

ericdallo 2025-04-23T14:38:30.373529Z

1. That feature is called https://clojure-lsp.io/features/#semantic-tokens, basically with better understanding of what each token is, clojure-lsp can color it better since it knows if it's a var or a symbol etc, usually it helps and most people like this feature, you can disable via lsp-semantic-tokens-enable .

erwinrooijakkers 2025-04-23T14:39:33.882399Z

ah yes, I just want to keep those regular variables white πŸ™‚

ericdallo 2025-04-23T14:39:42.776029Z

2. unresolved-var here means, it found the alias, but that var format is unknown, is that really correct?

erwinrooijakkers 2025-04-23T14:39:58.154329Z

it's not unknown I can jump to it

borkdude 2025-04-23T14:41:12.409369Z

Is the var defined in a special way?

erwinrooijakkers 2025-04-23T14:44:00.364409Z

it's defn format in honeysql

borkdude 2025-04-23T14:45:06.562799Z

Can you wipe .clj-kondo/.cache and restart LSP ? Perhaps it will help

πŸ‘ 1
erwinrooijakkers 2025-04-23T14:45:45.828189Z

oh wait it might be old honeysql

erwinrooijakkers 2025-04-23T14:45:58.199779Z

but it's a defn, not a macro

borkdude 2025-04-23T14:47:14.218869Z

If it persists repro in the form of a github repo welcome. Also try linting from the command line to see if you get the same issue

erwinrooijakkers 2025-04-23T14:47:35.839619Z

alright removing the cache solved it, good to know

erwinrooijakkers 2025-04-23T14:47:46.695869Z

only color of letters i would like to change and then i am converted

borkdude 2025-04-23T14:47:48.928289Z

If you still have the cache make a backup, I can try to inspect what’s in the transit file… too late. ;)

πŸ‘ 1
erwinrooijakkers 2025-04-23T14:47:54.880609Z

haha sorry

erwinrooijakkers 2025-04-23T14:56:32.602809Z

thanks for the help!

ag 2025-04-23T19:16:58.736799Z

How does lsp sets the lsp-clients? I'm going through the "python hate phase" right now. Recently I found myself having to go through some shitty python code and I shopped a bit for good lsp server choices, turns out basedpyright serves all my needs for the moment. Initially it worked just fine with lsp-pyright package. But then I had to deal with some breaking dependencies in one of the projects, and for whatever reason it's no longer working. It just keeps wanting to use node-based pyright, instead of what I want (pip-installed basedpyright). I removed lsp-pyright and now I'm trying to use lsp-bridge, the docs state that it should pick up basepyright on default, that's not happening. lsp says:

LSP :: The following servers support current file but do not have automatic installation: semgrep-ls ruff pylsp pyls
You may find the installation instructions at .
(If you have already installed the server check *lsp-log*).
Do I need to manually register a new client?

ag 2025-04-23T19:19:55.159769Z

I tried registering new client like so:

(lsp-register-client
     (make-lsp-client
      :new-connection (lsp-stdio-connection "basedpyright")
      :activation-fn (lsp-activate-on "python")
      :server-id 'basedpyright))
but it's failing to start:
[2025-04-23T19:17:52Z INFO  emacs_lsp_booster::app] Running server "/Users/ag/.local/share/mise/installs/python/3.11.12/bin/basedpyright"
[2025-04-23T19:17:52Z INFO  emacs_lsp_booster::app] Will convert server json to bytecode! bytecode options: BytecodeOptions { object_type: Plist, null_value: Nil, false_value: Nil }
thread '<unnamed>' panicked at /github/workspace/src/app.rs:145:18:
called `Result::unwrap()` on an `Err` value: Server->client read thread failed

Caused by:
    Invalid header format
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Process basedpyright stderr finished

ericdallo 2025-04-23T19:35:56.406869Z

unfortunately, I didn't try yet lsp-bridge so not sure exactly what's your problem but your error looks like some ser/deser issue with json which is weird

ag 2025-04-23T20:04:31.730219Z

I'll figure this out, right now I just can't figure out how to properly register new client. Python just refuses to use it

ag 2025-04-23T20:05:56.526149Z

it keeps saying: LSP :: The following servers support current file but do not have automatic installation: basedpyright. something todo with :new-connection key in make-lsp-client. Just can't figure out the correct incantation for it

ag 2025-04-23T21:42:27.723209Z

Holy swiveling motherducking flapdoodles. This turned out to be such an imbecilic waste of time. Check this out. The only reason why I went on a tangent of "fixing my lsp setup for Python", is because lsp-format-buffer stopped working, telling me that the server "doesn't support that feature". I started investigating and found out that despite lsp-pyright-langserver-command being set on (pip-installed) "basedpyright", it still tries to npm install pyright server. And lsp-describe-session indeed says it's running pyright. So that convinced me that pyright doesn't support the feature. But it worked before, so then I guessed that for whatever reason, it switched to pyright. I spent hours trying to figure out why it's not connecting to basepyright. After figuring out how to create my own custom client, explicitly set on basepyright, I tried formatting python buffer, and I was shocked to see that this one doesn't support it either. Turns out, neither of them support that feature, and I used to have "ruff" (which lsp-mode connects to for formatting and linting), and when I was dealing with conflicting python dependencies in a project, I accidentally removed it. I didn't have to do all that shit β€” trying to figure out lsp-pyright; then switching to lsp-bridge, which fucked up my regular lsp keybinds and doesn't properly register a client; then trying to make a new client, etc. I just needed to reinstall ruff. And stupid lsp-pyright still npm installs pyright, even when I told it to use basedpyright. And I'm still honestly confused, which one is it using. Why does it need pyright node package at all? And how do people use format-buffer feature when using eglot, which afaik doesn't support multiple servers simultaneously. This shit is so stupid and confusing for no real reason - multiple lsp-server choices for Python and none of them are truly painless and nice; many different linters, but how do they even differ? Why can't an lsp-server just call a linter directly? And I haven't even yet started writing any serious Python. Really makes me appreciate the consistency and pragmatics of clojure-lsp.

ag 2025-04-23T22:04:25.372609Z

darn... how do I use .venv bullshit in eshell now?... sigh... upd: found mise.el, worked like a charm. Fucking Clojure. Turn me into a delusional programmer. I forgot that "real-world programming" is a bunch of shit not working for some arbitrary and stupid reasons and that is "normal" and "business as usual". Why the fuck when something breaks in Clojure, at least it feels it's breaking for some observable, practical reasons, not for some fiddlesticks made of horseshit?

ericdallo 2025-04-23T19:43:53.669459Z

clojure-lsp Released clojure-lsp https://github.com/clojure-lsp/clojure-lsp/releases/tag/2025.04.23-18.16.46 with some fixes β€’ General β—¦ Fix unused-public-var false positives when :ignore-test-references? true. β—¦ Bump clj-kondo to 2025.04.07. β€’ Editor β—¦ Improve timbre context log. β—¦ Fix suggestion for add require code action. https://github.com/clojure-lsp/clojure-lsp/issues/2017 β—¦ Improve find definition so it works on declare forms too. https://github.com/clojure-lsp/clojure-lsp/issues/1986

2
πŸ™ 2
πŸŽ‰ 5