lsp

István Karaszi 2026-02-17T14:21:35.642159Z

Extracting to def, extracting to function

István Karaszi 2026-03-30T12:09:45.300789Z

@ericdallo what about the private question, I took a look on the configs, but I could not find anything that I could use to disable that. The closest is :use-metadata-for-privacy? but that only configures the way how the visibility shoulb be set

ericdallo 2026-03-30T12:11:49.489699Z

Ah we have no option for that, also not sure it's really worth it to be honest

István Karaszi 2026-03-30T12:12:39.267349Z

Since we are not using these visibility attributes therefore it is quite annoying to remove them all the time

ericdallo 2026-03-30T12:13:06.240279Z

There are code actions to toggle private in a function which may help

ericdallo 2026-03-30T12:13:18.234689Z

Feel free to open a issue to add a flag for that tho

István Karaszi 2026-03-30T12:17:20.498839Z

https://github.com/clojure-lsp/clojure-lsp/issues/2258

István Karaszi 2026-03-30T12:17:22.677439Z

Thank you!

ericdallo 2026-03-30T12:34:28.984939Z

@ikaraszi just pushed to master this via :private-by-default-on-extract? setting, would be nice if you could test the nightly build available in a few mins in #clojure-lsp-builds

István Karaszi 2026-03-30T12:34:45.251139Z

Wow! Amazing, sure thing!

🎉 1
István Karaszi 2026-03-30T12:37:15.256449Z

$ ./install --version nightly --dir ~/bin
Downloading  to /var/folders/rp/rmpzy6ls5clcgzlw2bymxnqh0000gn/T/tmp.bMPTkecmrl
[clojure-lsp-native-macos-aarch64.zip]
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of clojure-lsp-native-macos-aarch64.zip or
        clojure-lsp-native-macos-aarch64.zip.zip, and cannot find clojure-lsp-native-macos-aarch64.zip.ZIP, period.

István Karaszi 2026-03-30T12:37:45.804189Z

I believe the master install script is broken

ericdallo 2026-03-30T12:38:10.630009Z

usually this happens when nightly build didn't finish yet

István Karaszi 2026-03-30T12:59:52.221929Z

I set the :private-by-default-on-extract? to true in my .lsp/config.edn

István Karaszi 2026-03-30T13:00:11.782179Z

haha, it should be false

😅 1
István Karaszi 2026-03-30T13:02:20.879749Z

It does not work for me 😞

István Karaszi 2026-03-30T13:02:59.378419Z

Neither for the Extract to def, nor for Extract function

István Karaszi 2026-03-30T13:03:25.230969Z

clojure-lsp 2026.03.30-12.34.10-nightly
clj-kondo 2026.01.20-SNAPSHOT

István Karaszi 2026-03-30T13:03:39.672639Z

.lsp/config.edn:

{:clean {:ns-import-classes-indentation :same-line
         :sort {:ns true
                :require true
                :import true
                :import-classes {:classes-per-line -1}
                :refer {:max-line-length 120}}}
 :private-by-default-on-extract? false
 :test-locations-regex #{"^/test/metric/"}}

ericdallo 2026-03-30T13:03:57.079269Z

what function are you trying so I can test the same

István Karaszi 2026-03-30T13:04:26.028559Z

lsp-execute-code-action

ericdallo 2026-03-30T13:04:42.729479Z

I mean the code, can you try a simpler function and paste here

István Karaszi 2026-03-30T13:05:06.213529Z

(defn x []
  (prn :foo))

István Karaszi 2026-03-30T13:05:23.967839Z

My cursor is at the opening paren of (prn :foo)

István Karaszi 2026-03-30T13:06:48.590649Z

Wait, it started the wrong lsp

István Karaszi 2026-03-30T13:09:04.362099Z

Works, like a charm!

István Karaszi 2026-03-30T13:09:29.312019Z

(I had an explicit lsp-clojure-custom-server-command set because of our devenv setup)

ericdallo 2026-03-30T13:09:41.696329Z

good!

István Karaszi 2026-03-30T13:12:13.553239Z

Thank you very much!

ericdallo 2026-03-30T13:13:38.762819Z

youre welcome!

István Karaszi 2026-02-17T14:23:09.656739Z

I have two questions here related to this functionality: 1. Can I somehow configure clojure-lsp to not use private defs or defns when I do extraction? 2. Wouldn’t it be better instead of coming up with new-value and new-function it would prompt how to name these? The TypeScript LSP does something like that

István Karaszi 2026-02-17T14:23:45.326969Z

Because these are really great features and I use them often, but I need to remove the visibility and rename them every time

István Karaszi 2026-02-17T14:25:15.254279Z

(Perhaps this is a divisive opinion, but I believe visibility only matters for public libraries, but for private ones they are in the way and they don’t help much)

2026-02-17T14:27:07.899169Z

for the names, you can pass in a name with your codeAction request and it'll use that. it takes [file-uri, row, col, name] and the name is optional

István Karaszi 2026-02-17T14:28:23.702569Z

I guess then my Emacs integration needs to be changed somehow

2026-02-17T14:39:42.339909Z

i don't know how emacs works, but for vim, i could either run "call codeAction at cursor" and then it would prompt for which code action to run and execute without any name prompts, or i could write a custom function to prompt for the name and then call the specific action myself

István Karaszi 2026-02-17T14:40:53.032819Z

I’ll check how that can be done with Emacs, thanks for the directions!

👍 1
ericdallo 2026-02-17T15:15:01.406879Z

This is something I want to add in the future somehow, the worst thing is the LSP spec not supporting prompts in code actions that's why we don't do that, but I think we can try some workaround to the spec to achieve that

🙏 1
István Karaszi 2026-02-17T16:15:04.232989Z

The way how the TypeScript LSP (or the integration) does is that it first extracts the thing then let’s you rename that

ericdallo 2026-02-17T17:01:41.371859Z

Yeah that sounds like an interesting approach