This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-13
Channels
- # babashka (3)
- # beginners (91)
- # calva (10)
- # cherry (1)
- # clj-commons (1)
- # clj-kondo (8)
- # clojure (19)
- # clojure-australia (1)
- # clojure-china (1)
- # clojure-europe (16)
- # clojure-filipino (1)
- # clojure-hk (1)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-norway (2)
- # clojure-sg (1)
- # clojure-taiwan (1)
- # cursive (12)
- # data-science (4)
- # datalevin (3)
- # emacs (16)
- # events (9)
- # hyperfiddle (1)
- # juxt (1)
- # lsp (2)
- # missionary (2)
- # music (1)
- # nbb (14)
- # off-topic (15)
- # pathom (5)
- # releases (1)
- # shadow-cljs (41)
- # sql (10)
- # squint (13)
- # vim (7)
- # xtdb (35)
Hello, I’m getting into Clojure via Calva and I’m not sure if this autocompletion (see attached screenshot) is failing because “we’re not there yet”, or some issue with my system.
I’m in a .clj
file, the lsp is running, the REPL is running and jacked-in using deps.edn
profile. I also loaded the namespace in the REPL, but it should not be necessary for autocompletion to work, right?
There’s currently no autocomplete for type hints in nrepl or clojure-lsp, so Calva doesn’t have it either. Have you tried to autocomplete on other stuff?
Cool, good to know.
Autocompletion of functions in a namespace (`http/…`), local variables, and possibly other things works.
That sounds like a good feature suggestion for clojure-lsp, we could provide at least java most used classes completions which we do have, feel free to create a issue there
@UKFSJSM38 Thanks for the prompt, I’ll do. I’d think it is possible to complete according to the (:import …)
option of the ns
macro, as it’s already providing a list of available classes after entering <space> and a letter after the package name (1st screenshot), or after I enter a dot right after the packagename.
(2nd screenshot) 😃 If the Clojure convention is that ^CapitalizedCamelCase
is interpreted as ^{:type CapitalizedCamelCase}
, then maybe LSP can guess we’re talking about a Java class… :thinking_face: and use the :import
statements to behave smartly.
I think you can also type hint stuff that you don't import, so it's more complicated
@U03SQC4A7GF yes, we added recently :java-class-usages
from kondo analysis, so that is possible I guess
@UKFSJSM38 I’ve tried a few things in preparation of the feature-request and I’m thinking there are two (possibly independent) issues here; I’d like to have your feedback as to frame the problem(s) in the most useful way. The first issue is that imported Java classes are not included in the list of suggested symbols. This is testable by triggering suggestions for a value of the metadata map (1st picture). The second issue is that a ^ not followed by a map causes either an invalid syntax or an error which then results in no symbols being suggested (I do get words suggestions in one case). See 2nd and following pictures. Shall I create two separate feature requests? If LSP is supposed to assist in editing partial code, should the broken syntax case be filed as a bug?