Fork me on GitHub
#lsp
<
2023-06-28
>
kishima19:06:38

Hi, how do I know where did clojure-lsp get the settings from? I’m assuming it prioritizes the project .lsp/config.edn over other, but I’m not sure and wanted to check it

ericdallo19:06:21

if using vscode or emacs you can request serverInfo (in emacs lsp-clojure-server-info), there it should print all settings used considering project, home etc

ericdallo19:06:59

but https://clojure-lsp.io/settings/#project the waterfall that clojure-lsp does

kishima16:06:28

Ah cool, thanks!

Alexander Kouznetsov19:06:10

Peter is right, when I stop clojure-lsp server, these stop happening. What’s causing them? Is something broken in my setup?

Alexander Kouznetsov19:06:18

I think I triggered these by enabling the following vscode settings:

"editor.codeActionsOnSave": {

    "source.organizeImports": true,
    "source.fixAll": true
  },

Alexander Kouznetsov19:06:40

cc @U0ETXRFEW if this is going through calva

ericdallo20:06:17

Hum, it's saying it's an error only because there is nothing to clear/import in the file like we do https://github.com/clojure-lsp/clojure-lsp/blob/b318465bec4932b9e05ab1f2d6535c64441c07d0/lib/src/clojure_lsp/feature/refactor.clj#L204-L207, but maybe we should not return an LSP error for clean-ns refactor

metal 2
pez20:06:58

In some message/screenshot I saw it looked like it was Calva’s output window where the command failed. There is no namespace there. But also, iirc, we exclude that file from clojure-lsp support…

ericdallo20:06:32

Feel free to open a issue in clojure-lsp about not returning an LSP error message if there is nothing to clear

pez20:06:24

I’m not sure I understand the situation enough to formulate a very good issue. Even if I have spent considerable amounts of hours trying to figure out a way to make Calva intercept and filter the messages, but there really seems to be no hook there for something like that. Usually when I think something can’t be done, @U9A1RLFNV shows me that it can, but with this not even he seems to see what we could do.

Alexander Kouznetsov21:06:58

Peter, with those settings above, were you able to reproduce the issue?

bringe03:06:17

Issue created here: https://github.com/clojure-lsp/clojure-lsp/issues/1603 @UHS6PHL31 Please add more details to the issue if you feel they would help.

pez07:06:45

@U9A1RLFNV, if you understand the issue well enough, maybe you can file the issue that @UKFSJSM38 asked about too? There’s a general layer to this symptom that Calva users would benefit from having addressed.

bringe16:06:39

That's what I filed ^

pez16:06:00

Yeah, I know what you filed. 😃

Alexander Kouznetsov19:06:12

I added some details to the issue. I although feel that if that’s controlled by Calva, maybe it can be fixed in Calva?

pez20:06:48

I don’t think Calva can control it.

bringe17:06:19

> Yeah, I know what you filed. 😃 > @U9A1RLFNV, if you understand the issue well enough, maybe you can file the issue that @UKFSJSM38 asked about too? I don't know what you're referring to above, then :thinking_face:

pez18:06:52

I think there is a more general pattern here. We keep seeing errors pop up, that don’t seem like they should pop up.

👍 2
bringe18:06:39

From myself: > We might be able to override vscode.window.showErrorMessage and filter out clojure-lsp errors. I'm not sure if anyone tried that yet - don't remember if I did.

ericdallo18:06:57

IMO vscode errors are too noisy as they show to the user, as big popups in the screen... vim/emacs show a message in the minibuffer which is a one line small buffer down there in the editor, that's why I think most users that are affected by those things are calva users

bringe20:06:42

> IMO vscode errors are too noisy as they show to the user, as big popups in the screen... Yes, I agree

bringe20:06:08

We just need to figure out how to silence those popups

ericdallo20:06:03

or how to show a less noisy popup, but yeah

bringe22:07:35

When you say "noisy" do you mean the frequency of the popups or the content?

ericdallo22:07:24

the way they show in the editor, as a popup that is pretty big enough to bother users. This is the emacs minibuffer where those things show to user

ericdallo22:07:46

and most important, doesn't require an action from user, like close a popup

ericdallo22:07:14

but I think this is how vscode is, not sure there is a cleaner way to present things to user

bringe22:07:57

I was just wondering what you meant by: > or how to show a less noisy popup IMO, any VS Code popup for these errors is too noisy / annoying, but I think we're on the same page there.

👍 2
bringe22:07:41

There may be a cleaner way, like output channels, but these errors are already shown in the client<->server output channel. However, that has to be enabled, and the user has to look there. Maybe we could pop that open / bring it up when an error happens to it's in their view automatically, but I'm not sure how easy / possible that is.

👍 2
ericdallo22:07:07

Anyway, I made clojure-lsp not show those "errors" when there is nothing to clean, at least that refactor won't bother anymore

🎉 4
gratitude-thank-you 2
pez22:07:11

> Maybe we could pop that open / bring it up when an error happens to it’s in their view automatically, but I’m not sure how easy / possible that is. That was what I was referring to above when I said I have spent many, many hours trying to do. It could still be easy, of course. But it ain’t for lack of trying that we are not doing it already.

👍 4
2
pez05:07:26

At least the VS Code team now confirmed that it can’t be done from the lsp client setup: https://github.com/microsoft/vscode-discussions/discussions/579

👍 3
didibus19:06:13

Wasn't there a way to have LSP infer the imports?

ericdallo20:06:21

there is, check https://clojure-lsp.io/features/#clojure-lsp-extra-commands the add-missing-import code action or command

didibus20:06:17

Oh I see, I guess in Emacs it's called add-missing-libspec? Maybe that's why I could not find it

ericdallo20:06:25

yep, but I strongly suggest you not use manual commands, but the code actions lsp-execute-code-action because it shows all available actions for that line with a way better UX

ericdallo20:06:18

ah, and I think add-missing-libspec works only for requires, not imports, one more reason to rely on code actions, you don't need to know those internal things

didibus21:06:24

The code action doesn't show up though.

(Instant/now)
When I code action on that it doesn't have the option

didibus22:06:00

Same for (Date.)

ericdallo22:06:41

What's you server version?

didibus06:06:44

:server-version "2022.12.09-15.51.10", :clj-kondo-version "2022.12.08"

didibus06:06:26

I updated, and I still can't see it: :server-version "2023.05.04-19.38.01", :clj-kondo-version "2023.04.15-SNAPSHOT"

didibus07:07:11

I tried, it also doesn't work in that sample project.

didibus07:07:42

(Date.) and code actions, I don't see anything about importing java.util.Date

ericdallo11:07:23

that's weird, here's a gif of the working for me on that project. Could you share the output of your lsp-clojure-server-info plz, it should print in the messages buffer?

didibus23:07:07

{:final-settings
 {:source-aliases #{:test :dev},
  :uri-format
  {:upper-case-drive-letter? false, :encode-colons-in-path? false},
  :cljfmt-config-path ".cljfmt.edn",
  :document-formatting? true,
  :source-paths
  ["/home/didier/documents/clojure-sample/test"
   "/home/didier/documents/clojure-sample/resources"
   "/home/didier/documents/clojure-sample/src"],
  :text-document-sync-kind nil,
  :project-specs
  ({:project-path "project.clj",
    :classpath-cmd
    ["/usr/local/bin/lein" "with-profile" "+test,+dev" "classpath"]}
   {:project-path "deps.edn",
    :classpath-cmd
    ["/home/linuxbrew/.linuxbrew/bin/clojure" "-A:test:dev" "-Spath"]}
   {:project-path "build.boot",
    :classpath-cmd ["boot" "show" "--fake-classpath"]}
   {:project-path "shadow-cljs.edn",
    :classpath-cmd
    ["/home/didier/.npm-global/bin/npx" "shadow-cljs" "classpath"]}
   {:project-path "bb.edn",
    :classpath-cmd
    ["/home/linuxbrew/.linuxbrew/bin/bb"
     "print-deps"
     "--format"
     "classpath"]}),
  :dependency-scheme "jar",
  :show-docs-arity-on-same-line? true,
  :document-range-formatting? true},
 :classpath
 #{"/home/didier/.m2/repository/org/checkerframework/checker-qual/2.0.0/checker-qual-2.0.0.jar"
   "/home/didier/.m2/repository/joda-time/joda-time/2.10/joda-time-2.10.jar"
   "/home/didier/.m2/repository/org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0.jar"
   "/home/didier/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar"
   "/home/didier/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar"
   "/home/didier/.m2/repository/org/clojure/tools.reader/1.3.6/tools.reader-1.3.6.jar"
   "/home/didier/.m2/repository/org/ow2/asm/asm/9.2/asm-9.2.jar"
   "/home/didier/.m2/repository/clj-tuple/clj-tuple/0.2.2/clj-tuple-0.2.2.jar"
   "/home/didier/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar"
   "/home/didier/.m2/repository/org/clojure/core.async/1.5.648/core.async-1.5.648.jar"
   "/home/didier/.m2/repository/potemkin/potemkin/0.4.4/potemkin-0.4.4.jar"
   "/home/didier/.m2/repository/fipp/fipp/0.6.17/fipp-0.6.17.jar"
   "/home/didier/.m2/repository/org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2.jar"
   "/home/didier/.m2/repository/slingshot/slingshot/0.12.2/slingshot-0.12.2.jar"
   "/home/didier/.m2/repository/midje/midje/1.10.4/midje-1.10.4.jar"
   "/home/didier/.m2/repository/org/clojure/core.unify/0.5.7/core.unify-0.5.7.jar"
   "/home/didier/.m2/repository/com/google/jsinterop/base/1.0.0/base-1.0.0.jar"
   "/home/didier/.m2/repository/org/clojars/brenton/google-diff-match-patch/0.1/google-diff-match-patch-0.1.jar"
   "/home/didier/.m2/repository/com/google/errorprone/error_prone_annotations/2.3.1/error_prone_annotations-2.3.1.jar"
   "/home/didier/.m2/repository/org/clojure/core.specs.alpha/0.2.56/core.specs.alpha-0.2.56.jar"
   "/home/didier/.m2/repository/org/clojure/google-closure-library-third-party/0.0-20191016-6ae1f72f/google-closure-library-third-party-0.0-20191016-6ae1f72f.jar"
   "/home/didier/.m2/repository/com/google/guava/guava/25.1-jre/guava-25.1-jre.jar"
   "/home/didier/.m2/repository/com/cognitect/transit-java/0.8.332/transit-java-0.8.332.jar"
   "/home/didier/.m2/repository/nubank/matcher-combinators/3.3.1/matcher-combinators-3.3.1.jar"
   "/home/didier/.m2/repository/com/google/protobuf/protobuf-java/3.11.1/protobuf-java-3.11.1.jar"
   "/home/didier/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.8.7/jackson-core-2.8.7.jar"
   "/home/didier/.m2/repository/marick/suchwow/6.0.2/suchwow-6.0.2.jar"
   "src"
   "/home/didier/.m2/repository/org/clojure/core.cache/1.0.225/core.cache-1.0.225.jar"
   "/home/didier/.m2/repository/com/google/javascript/closure-compiler-externs/v20200315/closure-compiler-externs-v20200315.jar"
   "/home/didier/.m2/repository/com/google/code/gson/gson/2.7/gson-2.7.jar"
   "/home/didier/.m2/repository/clj-time/clj-time/0.15.1/clj-time-0.15.1.jar"
   "/home/didier/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar"
   "/home/didier/.m2/repository/com/rpl/specter/1.0.5/specter-1.0.5.jar"
   "/home/didier/.m2/repository/mvxcvi/arrangement/1.2.0/arrangement-1.2.0.jar"
   "/home/didier/.m2/repository/org/msgpack/msgpack/0.6.12/msgpack-0.6.12.jar"
   "/home/didier/.m2/repository/colorize/colorize/0.1.1/colorize-0.1.1.jar"
   "/home/didier/.m2/repository/org/clojure/core.rrb-vector/0.0.14/core.rrb-vector-0.0.14.jar"
   "/home/didier/.m2/repository/mvxcvi/puget/1.1.2/puget-1.1.2.jar"
   "/home/didier/.m2/repository/org/clojure/data.priority-map/1.1.0/data.priority-map-1.1.0.jar"
   "/home/didier/.m2/repository/com/cognitect/transit-clj/0.8.309/transit-clj-0.8.309.jar"
   "/home/didier/.m2/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar"
   "/home/didier/.m2/repository/flare/flare/0.2.9/flare-0.2.9.jar"
   "/home/didier/.m2/repository/com/google/javascript/closure-compiler-unshaded/v20200315/closure-compiler-unshaded-v20200315.jar"
   "/home/didier/.m2/repository/org/clojure/spec.alpha/0.2.194/spec.alpha-0.2.194.jar"
   "/home/didier/.m2/repository/org/clojure/math.combinatorics/0.1.6/math.combinatorics-0.1.6.jar"
   "/home/didier/.m2/repository/org/tcrawley/dynapath/1.0.0/dynapath-1.0.0.jar"
   "/home/didier/.m2/repository/com/google/re2j/re2j/1.3/re2j-1.3.jar"
   "/home/didier/.m2/repository/org/clojure/tools.macro/0.1.5/tools.macro-0.1.5.jar"
   "/home/didier/.m2/repository/org/clojure/test.check/0.10.0-alpha3/test.check-0.10.0-alpha3.jar"
   "/home/didier/.m2/repository/riddley/riddley/0.1.12/riddley-0.1.12.jar"
   "/home/didier/.m2/repository/io/aviso/pretty/0.1.37/pretty-0.1.37.jar"
   "/home/didier/.m2/repository/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar"
   "/home/didier/.m2/repository/org/clojure/tools.namespace/0.3.0/tools.namespace-0.3.0.jar"
   "/home/didier/.m2/repository/org/clojure/clojurescript/1.10.758/clojurescript-1.10.758.jar"
   "/home/didier/.m2/repository/org/clojure/java.classpath/0.2.3/java.classpath-0.2.3.jar"
   "/home/didier/.m2/repository/org/clojure/google-closure-library/0.0-20191016-6ae1f72f/google-closure-library-0.0-20191016-6ae1f72f.jar"
   "/home/didier/.m2/repository/org/clojure/data.json/0.2.6/data.json-0.2.6.jar"
   "/home/didier/.m2/repository/org/clojure/core.memoize/1.0.253/core.memoize-1.0.253.jar"
   "/home/didier/.m2/repository/com/google/elemental2/elemental2-core/1.0.0-RC1/elemental2-core-1.0.0-RC1.jar"
   "/home/didier/.m2/repository/com/google/jsinterop/jsinterop-annotations/1.0.2/jsinterop-annotations-1.0.2.jar"
   "resources"
   "/home/didier/.m2/repository/environ/environ/1.1.0/environ-1.1.0.jar"
   "/home/didier/.m2/repository/args4j/args4j/2.0.26/args4j-2.0.26.jar"
   "test"
   "/home/didier/.m2/repository/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar"},
 :cljfmt-raw "{}",
 :client-settings
 {:dependency-scheme "jar",
  :show-docs-arity-on-same-line? true,
  :text-document-sync-kind nil,
  :source-paths nil,
  :source-aliases nil,
  :cljfmt-config-path ".cljfmt.edn",
  :document-formatting? true,
  :document-range-formatting? true},
 :project-root-uri "file:///home/didier/documents/clojure-sample",
 :port "NREPL only available on :debug profile (`bb debug-cli`)",
 :project-settings {},
 :server-version "2023.05.04-19.38.01",
 :clj-kondo-version "2023.04.15-SNAPSHOT",
 :log-path "/tmp/clojure-lsp.12540916746229275776.out",
 :classpath-settings nil}

ericdallo12:07:46

Could you update clojure-lsp to latest released this week + show a print of what happens when you type lsp-execute-code-action ?

didibus01:07:35

I tried deleting my .emacs.d, and installig lsp fresh. I get the same thing, but I see in the Message buffer: error in process sentinel: Attempt to accept output from process Compiling: /home/didier/.emacs.d/elpa/28.2/develop/lsp-mode-20230628.1609/lsp-fortran.el locked to thread #<thread 0x55ce5e2eb020> [2 times] error in process sentinel: Attempt to accept output from process Compiling: /home/didier/.emacs.d/elpa/28.2/develop/lsp-mode-20230628.1609/lsp-graphql.el locked to thread #<thread 0x55ce5e2eb020> [2 times] error in process sentinel: Attempt to accept output from process Compiling: /home/didier/.emacs.d/elpa/28.2/develop/lsp-mode-20230628.1609/lsp-fsharp.el locked to thread #<thread 0x55ce5e2eb020> [2 times] error in process sentinel: Attempt to accept output from process Compiling: /home/didier/.emacs.d/elpa/28.2/develop/lsp-mode-20230628.1609/lsp-groovy.el locked to thread #<thread 0x55ce5e2eb020> [2 times] error in process sentinel: Attempt to accept output from process Compiling: /home/didier/.emacs.d/elpa/28.2/develop/lsp-mode-20230628.1609/lsp-haxe.el locked to thread #<thread 0x55ce5e2eb020> [2 times] error in process sentinel: Attempt to accept output from process Compiling: /home/didier/.emacs.d/elpa/28.2/develop/lsp-treemacs-20230703.629/lsp-treemacs.el locked to thread #<thread 0x55ce5e2eb020> [2 times] error in process sentinel: Attempt to accept output from process Compiling: /home/didier/.emacs.d/elpa/28.2/develop/lsp-mode-20230628.1609/lsp-openscad.el locked to thread #<thread 0x55ce5e2eb020> [2 times] error in process sentinel: Attempt to accept output from process Compiling: /home/didier/.emacs.d/elpa/28.2/develop/lsp-mode-20230628.1609/lsp-ocaml.el locked to thread #<thread 0x55ce5e2eb020> [2 times] error in process sentinel: Attempt to accept output from process Compiling: /home/didier/.emacs.d/elpa/28.2/develop/lsp-mode-20230628.1609/lsp-lua.el locked to thread #<thread 0x55ce5e2eb020> [2 times] error in process sentinel: Attempt to accept output from process Compiling: /home/didier/.emacs.d/elpa/28.2/develop/lsp-mode-20230628.1609/lsp-kotlin.el locked to thread #<thread 0x55ce5e2eb020> [2 times] error in process sentinel: Attempt to accept output from process Compiling: /home/didier/.emacs.d/elpa/28.2/develop/lsp-mode-20230628.1609/lsp-json.el locked to thread #<thread 0x55ce5e2eb020> [2 times] Not sure if related

didibus02:07:03

Meh, I tried to uninstall and reinstall again, and I didn't get those errors, but still don't see import

didibus02:07:35

Also tried to use the one from brew instead, and still I don't see import

ericdallo11:07:23

Oh, that 's weird, it seems your cursor is not in the same line of the Date. :thinking_face: Also you don't need to visual select it. Just having the cursor in the same line is enough