hey all im trying out polylith (using vscode and calva) i noticed that when i setup calva on the root folder (the workspace) it doesn't track nested projects (components) and i need to tell it to track it is it something that i can configure?
What does “doesn’t track” mean in this context?
I use VS Code/Calva with a massive Polylith repo -- over 200 bases and components -- and I don't understand your question. Can you elaborate @itai?
i have created a new namespace (`test.clj` ) inside the user component but it didn't add the (ns ...) to it
i thought that it doesn't offer autocomplete, but it does work now, it's just the auto insert of ns
as you can see here, when the lsp tracks the entire project it didn't add the ns definition, but when i added the inner project (the component) it did add it
Thanks! I have also noted that sometimes the auto-add of the ns form doesn’t work, but never saw a pattern to it. I think it could be some kind of race condition in VS Code, but it could also be a limitation of clojure-lsp. It would be great with a reproduction project. You think you can create one?
i can just push the one i'm working on, it's the polylith tutorial @pez https://github.com/itai-spiritt/polylith-tutorial
At work, I just added a new file -- foo.clj in components/src/ws/affiliate -- and it correctly added (ns ws.affiliate.foo) in the new file. How did you create the new file? I right-clicked affiliate in the explorer and selected New File.
the same way... the lsp is configured only to watch the root folder?
.lsp/config.edn:
{:source-aliases #{:dev :test}
:paths-ignore-regex [".*/googlepay/java.clj"]
:clean
{:ns-inner-blocks-indentation :same-line
:ns-import-classes-indentation :same-line
:sort {:refer {:max-line-length 1}}}}I don't know what you mean about "configured only to watch the root folder".
i dont' have this file
under .lsp i have only .cache
i just added the same config to my repo but still no ns is generated
Have you added those components to the root deps.edn?
yes i did
{:aliases {:dev {:extra-paths ["development/src"]
:extra-deps {poly/user {:local/root "components/user"}
org.clojure/clojure {:mvn/version "1.12.2"}}}
:test {:extra-paths ["components/user/test"]}
:poly {:main-opts ["-m" "polylith.clj.core.poly-cli.core"]
:jvm-opts ["--enable-native-access=ALL-UNNAMED"]
:extra-deps {polylith/clj-poly {:mvn/version "0.3.31"}}}}}Hmm then I have no idea what is wrong, I run insiders but that should not matter. I also remembering settings someting in calva so it only starts a lsp server for the project in root
> so it only starts a lsp server for the project in root So that could be the problem. In the screenshot above we can see two servers running. Maybe it’s a race condition between those… in any case, in a poly project only the top level server should be started.
when only the top level server is running nothing happens, only when i turn on the second one as well (the inner) it worked which configurations can i try?
i have just restarted the pc and it seems to work... 🤷 thank you all for your time and effort, i can't explain this voodoo...
I only have one LSP server running and it's at the workspace root. Glad it is now working for you tho'...
VS Code can get stale strangenesses that only a restart fixes. We’ve seen that before.
When I write (let [^Future fut ...] ...) in "Code actions" instead of suggesting to import java.util.concurrent.Future it suggests that I create a private function Future. Is it bug in Calva or in one of the dependencies?
Code actions are provided by clojure-lsp.
Thanks, filed an issue: https://github.com/clojure-lsp/clojure-lsp/issues/2156