Fork me on GitHub
#calva
<
2024-01-15
>
ericdallo12:01:52

Hey friends, I just implemented a new custom feature on clojure-lsp's master which I think would be nice add to Calva :) LMK if need any help https://github.com/clojure-lsp/clojure-lsp/issues/1752#issuecomment-1892042702

pez12:01:35

Thanks for headsup! Looks awesome. I’d like som pointers on how to add it to Calva. Is it something included in the LSP spec or how is it supposed to be implemented by a client. I see this outline for project files, maybe that’s where it should show up?

ericdallo12:01:16

it's completly custom feature not support by the spec but since lsp4clj has all the hard stuff, it was easy to create a new clojure/workspace/projectTree/nodes request, @U0ETXRFEW you can check the integration documentation https://clojure-lsp.io/capabilities/#project-tree

ericdallo12:01:07

@U0ETXRFEW I was insipired by java vscode and intellij plugin, the create a specific window for that

ericdallo12:01:26

So I'd suggest doing something similar, a new section

pez12:01:34

Ah. I’ll look into it. Issue welcome!

👍 1
pez12:01:37

Great with that custom command too, I think might be something a #joyride script can make use of. Especially https://github.com/PEZ/backseat-driver I am currently playing with. 😃

ericdallo12:01:47

I think would be nice to support in Calva OOTB without any extra config BTW the original issue user was asking that feature to be used on Calva

pez12:01:29

Indeed. The support for the project tree outline should be Calva OOTB. The command is for Joyriders to have fun with.

ericdallo12:01:00

Got it! makes sense

ericdallo12:01:05

Also, this is not the first custom feature on clojure-lsp, we have the https://clojure-lsp.io/features/#test-tree as well which may be similar to implement :)

pez12:01:20

Yes, when I followed your first link, I saw that test tree. It is very interesting. We are already using clojure-lsp to populate our Test Explorer integration, and maybe this test tree is a better way to do it than we currently do. (Not that I remember how we do it right now, but anyway.)

ericdallo12:01:44

yeah, I'm not sure how it's done, but would be nice to clojure-lsp clients delegate these things to a single place like clojure-lsp if possible

ericdallo15:02:17

this feature was officially released on latest clojure-lsp

🙏 1
Bailey Kocin18:01:11

I updated to the latest version of Calva and I do not know if I messed with a setting or something but I have the correct workspace root chosen but when I go to run "Go To Definition" it always tries to append app/ to the beginning of the path even though the code is in src/ so the file does not open. Example: Tries to open src/my/namespace for the symbol my-func It tries to open app/src/my/namespace instead. I cannot see what settings would affect this but I feel like it has something to do with my workspace root? Any help or tips would be appreciated 😄

Bailey Kocin18:01:17

These are my Calva options if it helps

"calva.highlight.enableBracketColors": true,
  "calva.autoOpenREPLWindow": true,
  "calva.highlight.rainbowIndentGuides": true,
  "calva.fmt.newIndentEngine": true,
  "calva.evalOnSave": true,
  "calva.showDocstringInParameterHelp": true,
  "calva.paredit.defaultKeyMap": "strict",
  "calva.prettyPrintingOptions": {
    "printEngine": "pprint",
    "enabled": true,
    "width": 120,
    "maxLength": 50
  },
clojure-lsp is running just fine in the project root as well

Bailey Kocin15:01:25

Its a deps.edn project

Bailey Kocin22:01:17

It actually looks like its trying to open

Bailey Kocin22:01:36

Where is that coming from

pez23:01:09

That’s generally when looking up things in library code. Can you share your deps.edn? Or at least the parts of it having to do with classpath and such.

Bailey Kocin15:01:48

The only time I set paths are at the root

:paths ["src" "resources"]
And in a :dev alias
:extra-paths ["dev/src" "dev/resources"]
And for testing in a :test alias
:extra-paths ["test"]

pez15:01:36

Is deps.edn located in the project root?

pez15:01:42

If it works for you, we can have a quick huddle and look at the project together. It’s more effective than me blindly guessing async like this. 😃

Bailey Kocin18:01:30

I would have to redact some things but let me figure that out... The Clojure LSP classpath is actually fine. The problem is when I connect the REPL. When the REPL is connected look up by definitions does not work. When the REPL is not connected look up by definitions works....