Fork me on GitHub
#lsp
<
2022-07-25
>
daniel.flexiana12:07:37

Hi! Excellent job on lsp! Do you know if is it worth to implement sort-set? Just like sort-map... It might help some workflows etc.

ericdallo12:07:47

Thanks! it should be easier than sort-map, issue welcome

đź‘Ť 1
Josip Gracin15:07:19

Hi! I'm trying to start the REPL on clojure-lsp project (in Calva), but if I include :test alias, Calva complains that it cannot start REPL because ":test" alias includes :main-opts with "-m kaocha" which disables starting of the REPL. Is there any way to start the clojure-lsp REPL with all the tests in the classpath so that I can run tests from the REPL?

ericdallo15:07:18

On Emacs I use both dev and test alias and never had any issues

Josip Gracin15:07:21

thanks. if I remove :main-opts, it works, because Calva is able to add its own "-m nrepl.cmdline"

ericdallo15:07:15

I wonder why calva does that, I think it's different how cider does?

Josip Gracin15:07:35

Calva detects the problem and gives a warning about it, so it seems to be that way by design.

Lukas Domagala15:07:30

We have a ticket somewhere to do the same thing as cider, but for now I just have a :test alias that includes the sources and a :test-run alias that actually runs them

đź‘Ť 1
dpsutton16:07:02

CIDER used to have this problem. https://github.com/clojure-emacs/cider/issues/2941 . The problem is that if a profile specifies main opts, those “win” and any inline main opts at the end become further args i think? Now CIDER makes its own main args into an -Sdeps form and then ensures that that alias is last so those main opts “win”

dpsutton16:07:00

I think if -A would start ignoring main-opts (i believe this is a future behavior that is coming eventually) this problem goes away

seancorfield20:07:25

Another +1 for splitting your current :test alias in two: in all my projects I either have :test and :runner (with :main-opts only in the latter) so it's easier to start a REPL with test dependencies) or I use :exec-fn/`:exec-args` instead of :main-opts in :test so I can use -A:test for a REPL etc and -X:test to actually run tests.

seancorfield20:07:40

(in several projects, I've added build.clj and have my test running machinery in that, so that it's easier to do automated multi-version testing -- so :test will have no :main-opts and clojure -M:build test is how I run tests)

jacob.maine21:07:49

If you’re an earlier adopter of clojure-lsp—and if you’re in this channel, you probably are—I’d appreciate your help beta-testing the dep-graph queries feature that @ericdallo mentioned in the latest release notes. If you’re up for taking it for a spin, I’ll add a few details in this thread.

đź‘Ť 2
jacob.maine22:07:30

As the release notes said, you can turn the feature on by adding :experimental {:dep-graph-queries true} to your .lsp/config.edn file. It’s a pretty pervasive change to how clojure-lsp works so it’s hard to pinpoint exactly what to look for. If all goes well, your experience shouldn’t change much, except that clojure-lsp should respond faster as you’re using it, especially when getting completions or finding definitions, references, and implementations. The effect will be more noticeable for those of you who typically work in large projects. But, if you see results that seem incomplete or see errors in the logs, please report them here. I can help track down what’s going on. And even if you don’t notice any problems, it’d help if you reported back in a few days that things are going OK. We hope to take this feature out of beta soon, turning it on for everyone all the time, so we’d like a little proof that it’s stable.

dpsutton22:07:18

oh i put that change in .lsp/config.edn but it needs to go in .lsp/settings.edn?

dpsutton22:07:29

(and I work at Metabase so i’ll be using it on that large codebase)

dpsutton22:07:51

also, is there a way to verify that I’m using the new feature versus just “it feels faster” but i never hit the new codepath at all?

jacob.maine22:07:26

Ah thanks @U11BV7MTK… my bad. I meant .lsp/config.edn

🙏 1
jacob.maine22:07:14

The short answer is, no, there’s no easy way to verify the feature is on. You could check the performance of completion. I did a decent amount of testing of this feature on metabase, so I know that it speeds up completion quite a bit in that project. You may even try disabling the completion throttling in your editor. clojure-lsp scans its config.edn file for changes every few seconds, so another way to check is to run an action, toggle the flag in the config file, wait a few seconds, and then run the action again. If you notice a speed difference, then it’s working. But it’s a good point—it might be easier to confirm if we add a log line when the feature is detected. I’ll think about how to do that

ericdallo01:07:04

I think there is a better way to confirm: on emacs lsp-clojure-server-info should bring lots of info including the settings clojure-lsp is using final-settings if the dep-graphs setting is there, it's being used

đź‘Ť 2
dpsutton01:07:17

nice i see :experimental {:dep-graph-queries true}, in there. thanks @ericdallo

đź‘Ť 1
otfrom07:07:47

I'm giving it a go too

ericdallo12:07:35

Tagging some people I know may be interested on that @UMMMKKADU @UEENNMX0T @U02EMBDU2JU @U04V15CAJ

đź‘Ť 3
Noah Bogart13:07:28

I’ve already turned it on! Haven’t specifically noticed a difference yet but so far it works as expected. I’ll keep an eye out for speed increases when I load up my bigger projects today

đź‘Ť 2
otfrom14:07:24

yeah, seems to be transparently working for me atm. I'm not used to my new config enough to know if it is faster or slower

đź‘Ť 1
Dumch23:07:30

With the new lsp version I am not able to go to definition for java interop, like (Integer/parseInt "1"). I rolled back to previous release, and interop works again. Using neovim v0.7.0, https://github.com/neovim/nvim-lspconfig.

Dumch23:07:08

do you know about this or should I create an issue?

ericdallo01:07:37

@UL05W6AEM could you check server logs for java logs?

đź‘Ś 1
Dumch14:07:34

I add vim.lsp.set_log_level("debug") in vim init, opened clojure file with one of the lines containing (Integer/parseInt "1") and tried to go-to-definition

ericdallo14:07:34

This seems to be the log from nvim, could you get the server logs? https://clojure-lsp.io/troubleshooting/#server-log

Dumch14:07:50

set up {:log-path "/tmp/clojure-lsp.out"} Did the same, as above, here is the file.

ericdallo14:07:48

Right, so can you delete ~/.cache/clojure-lsp and .lsp/.cache , restart server and get that log?

Dumch15:07:01

It works after removing the cache

ericdallo15:07:30

Probably some conflict with a older version which saved a outdated cache, LMK if it happens again