This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-08
Channels
- # babashka (1)
- # babashka-sci-dev (42)
- # beginners (3)
- # calva (9)
- # clj-kondo (1)
- # cljs-dev (1)
- # clojure (52)
- # clojure-europe (3)
- # clojure-spec (6)
- # clojurescript (35)
- # defnpodcast (1)
- # guix (1)
- # honeysql (3)
- # hugsql (4)
- # humbleui (1)
- # introduce-yourself (3)
- # jobs (1)
- # jobs-discuss (9)
- # lsp (57)
- # off-topic (65)
- # polylith (4)
- # portal (11)
- # releases (1)
- # remote-jobs (2)
- # shadow-cljs (19)
- # tools-deps (4)
- # vim (11)
- # xtdb (8)
Is it possible to tell lsp to add the classpath from a alias of my ~/.config/clojure/deps.edn ?
I hope LSP would look up alias names added to :source-aliases
from the project deps.edn and user level deps.edn files. With aliases in the project deps.edn taking precedence if both deps.edn files contain the exact same alias.
I haven't tested this yet though
How does keyword completion in clojure-lsp
work (with lsp-mode
in emacs)? That is, if I type :foo|<tab>
, should I get completion suggestions for suitable keywords found in a) only the current namespace, b) the current namespace + all its require
'd namespaces, or c) the whole project?
backstory: I was comparing the completion functionality of cider and clojure lsp and decided to check how completion works if I remove cider from completion-at-point-functions
.
at the moment it feels like completion with just lsp works like the a) case above. But I'm not certain if this is how it's supposed to work or if there's something wrong with my emacs/lsp config.
Yes, we had some improvements on keyword completions some time ago andonly a) should work. If you have aliased keywords or namespaces keywords though, clojure-lsp should bring properly as well following the namespace
I notice when creating #joyride scripts, that I have no lookup, etcetera help from clojure-lsp. The scripts are located in .joyride/scripts
in the project root. The desired workflow is to be able have the project root open and to author both these scripts and code in my project, with retained clojure-lsp support. Is this possible to configure?
What do you mean with lookup help? Go to definition? these clojure files are not related with the project, they are not on the classpath or are source paths, right? even though, basic features like lint and things that doesn't rely on other files should work, do you have a example?
Yes, I mean things like documentation, and go to definition. And yes, the files are not part of the project. Linting works. An example is the Joyride Examples directory: https://github.com/BetterThanTomorrow/joyride/tree/master/examples Even if there is no project there, yet. 😃
yeah, that's why, without a valid project root, clojure-lsp won't find classpath, if you create a deps.edn or project.clj, it should find a classpath and those features may work
It doesn't help creating a deps.edn in the project root. Unless I add the joyride scripts to the classpath there, but that's not an option...
You want to find a definition from a cljs file in the scripts folder that is in other file on that scripts folder?
if so, yeah, it won't work as clojure-lsp has no idea of those files because they are not on project classpath
Adding a deps.edn in the .joyride
directory doesn't help either. Unless I open that directory as the project root. But then I can script my project using the Joyride REPL...
try adding this config:
.lsp/config.edn
{:source-paths #{".joyride/scripts"}}
along with a empty deps.edn on the rootcould you share a file/function you were trying that was not working so I can test it as well?
it does work for me with only a deps.edn if I try to find the definition of .joyride/scripts/ignore_form.cljs:26:11
(promessa.core/do!)
What does clojure-lsp use as project root uri, for you? For me:
"project-root-uri": "file:///Users/pez/Projects/joyride/examples",
oh wait a sec, my project root was file:///Users/pez/Projects/joyride/
probably becuase I imported joyride first
find definition or hover of pomessa/*
won't work because, in your classpath there is no promessa
lib
and clojure-lsp won't find definition of z-joylib.editor-utils
functions unless you open that file manually, because it's not on any source paths, we can fix it though with that lsp config I mentioned above
I have that config. And it makes these internal things work. But clojure core and other external stuff does not...
good question, I can repro that too, even if clojure.core is on classpath checking server logs
Would be sweet if we could find a way to tell clojure-lsp about classpath things for this non-project directory, similar to how we can inform about the source path.
I think the issue with core symbols is that for example for this code:
(map :foo [])
the map
is a var-usage from cljs.core, but there is only clojure.core on classpaththat's the issue indeed, clojurescript analysis are not available on classpath, if you clojure -Spath
you will see no cljs lib is available, that's why clojure-lsp doesn't know about that
I see. And can I do something about it? That :project-specs
override sounds interesting. 😃
or, override the project-specs with a custom classpath command that includes cljs but that sounds a little bit more tricky
What I want a recipe that Joyride users can follow. Adding cljs to their project's deps.edn might not be an option.