4 ms·
The problem I see with clojure, isn't it missing autocompletes? You work with JVM/typescript libraries, but your editor isn't smart enough to pull types from th
by createaccount99 2y ago
The problem I see with clojure, isn't it missing autocompletes? You work with JVM/typescript libraries, but your editor isn't smart enough to pull types from those into clojure. That slows you down tremendously.
- ilikehurdles 2y agoNo. When working with JVM/typescript libraries you have their autocomplete information. If you need method autocomplete scoped to a type you can use the `..` macro for more concise call syntax: (ns my-project.core (:import (java.util ArrayList Collections))) (defn example [] (let [list (ArrayList.)] ; ArrayList constructor can be autocompleted (.. list (add "Hello") ; The .add method on ArrayLists will be autocompleted (add "World") (add "Clojure")) (Collections/sort list) ; The Collections.sort method will be autocompleted list)) this other form will a also autocomplete everything after the dot (.) to call a method on an object: (.toUpperCase some-str) but the trick with this arrangement is to write that variable some-str first, then if you write . in front of it the autocompletes will be relevant to that object. But I gratuitously used threading macros like .. or -> to make it match java-style code (in other words: (-> some-str (.toUpperCase))).
- createaccount99 2y agoThat's cool, I had no idea. In clojure itself I suppose you eval code and then get autocompeletes from the repl output? -- I mean for stuff with no types
- simongray 2y agoAutocomplete also works for the functions and vars in the namespaces. You don't really use methods in Clojure unless you're doing interop with Java or JS.
- FredrikMeyer 2y agoI use Emacs with Cider+clojure-lsp, and the autocomplete/refactoring tools are super good.
- ziftface 2y agoAutocomplete works for me with jvm imports
- cospaia 2y agoAs a Clojure editor tool smith it pains me that this is the case. Especially for ClojureScript where I spend most of my time. I really want to fix this. For JVM interop, I think Cursive (IntelliJ Clojure plugin) is smart enough to help with autocompleting Java libraries.
- sswezey 2y agoYea, Cursive is the best by far for doing Java interop. It is really good.