News for hackers. Stuff that matters.
Re:Try Clojure by createaccount99 on Thursday May 23, 2024 @01:44AM (#40450888)
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.
Re:Try Clojure by cospaia on Thursday May 23, 2024 @02:57AM (#40451377)
As 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.

Re:Try Clojure by sswezey on Thursday May 23, 2024 @07:30AM (#40453368)
Yea, Cursive is the best by far for doing Java interop. It is really good.
Re:Try Clojure by ziftface on Thursday May 23, 2024 @02:49AM (#40451311)
Autocomplete works for me with jvm imports
Re:Try Clojure by FredrikMeyer on Thursday May 23, 2024 @02:14AM (#40451065)
I use Emacs with Cider+clojure-lsp, and the autocomplete/refactoring tools are super good.
Re:Try Clojure by ilikehurdles on Thursday May 23, 2024 @02:02AM (#40451005)
No. 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))).
Re:Try Clojure by createaccount99 on Thursday May 23, 2024 @02:22AM (#40451133)
That'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
Re:Try Clojure by simongray on Thursday May 23, 2024 @02:51AM (#40451330)
Autocomplete 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.