Fork me on GitHub
#cider
<
2024-06-02
>
hifumi12303:06:14

Does cider-enrich-classpath work in deps.edn projects? I normally set up Leiningen projects, but I am quickly experimenting with something, so I am simply using an empty deps.edn file as a project. I have cider-enrich-classpath set to t but I notice that completion for java.* classes does not work inside :import clauses of ns forms. This has always worked for me with Leiningen projects since I ever started with Clojure (and CIDER). Using Emacs 29.2 and CIDER 1.15.0-snapshot

oyakushev07:06:40

A couple of points here. • Classname completion never required enrich-classpath. It works out of the box in CIDER, but you have to enable flex completion style (it used to be done via other functions and hooks, now flex style is the proper way). Please see https://docs.cider.mx/cider/usage/code_completion.html#fuzzy-candidate-matching • Sometime ago the completion Classname -> fully.qualified.Classname started working anywhere in the file, not just inside :import clause. GIve it a try sometime!

oyakushev07:06:14

Can you confirm that classname completion still works in your Leiningen projects?

hifumi12308:06:42

Yeah it does.

hifumi12308:06:54

Also curiously, both project types "just work" when autocompleting outside of the :import clause

hifumi12308:06:20

This is gonna be tough to make a MRE for. There is probably something wrong with my Emacs config

vemv08:06:29

Enrich helps with other things like displaying documentation during completion, and adding sources so that jump to definition works

oyakushev09:06:59

@U0479UCF48H Could you please do M-x nrepl-toggle-message-logging, try triggering completion inside :import form, then switch to *nrepl-messages* buffer, and check the response for op "complete"?

hifumi12322:06:22

Here is one example message

(-->
  id                        "40"
  op                        "complete"
  session                   "aa5ed3cd-8bcf-47c0-8cb8-e67765215f9b"
  time-stamp                "2024-06-02 15:15:15.808837000"
  context                   "(ns user
  (:import (java.util.zip GZIPInputStream)
        ..."
  enhanced-cljs-completion? "t"
  ns                        #("user" 0 4 (face font-lock-type-face cider-block-dynamic-font-lock t cider-locals nil fontified t))
  prefix                    #("java.util" 0 9 (cider-block-dynamic-font-lock t cider-locals nil fontified t))
)
(<--
  id          "40"
  session     "aa5ed3cd-8bcf-47c0-8cb8-e67765215f9b"
  time-stamp  "2024-06-02 15:15:15.819986000"
  completions nil
  status      ("done")
)
the context is the following code
(ns user
  (:import (java.util.zip GZIPInputStream)
           (java.util |))
  (:require [clojure.java.io :as io]))
the | indicates where my cursor was when I pushed the tab key

oyakushev13:06:04

Two new fun features have landed into CIDER rolling MELPA, both related to CIDER Inspector. Toggleable view mode The inspector now has a keybinding for toggling between the "view modes" – v . Just two view modes are currently present: :normal (default) and :object. In object view mode, any value, even if it's a recognizable "data" value (collection, string, etc.), will be rendered as a Java object together with its fields. This can be of great use when you develop custom data structures or want to explore how Clojure's and Java's own data structures are implemented. See the screenshots for examples. Note: view mode is reset back to :normal when you drill down to another value in the inspector; but it will switch to the previous mode if you go back to the value with l. Note: On JDK 17+, the private fields that belong to the JDK classes will unfortunately be empty (or even missing) unless you add a bunch of --add-opens statements to your startup command. Class hierarchy When inspecting a class, you'll now see all its class hierarchy at once. At the top, there will always be a chain of superclasses, and the rest are interfaces that the class directly or transitively implements. All the classes in the hierarchy are clickable, so they can be drilled down further.

💯 9
cider 2
🚀 3
vemv14:06:58

> Note: On JDK 17+, the private fields that belong to the JDK classes will unfortunately be empty (or even missing) unless you add a bunch of --add-opens statements to your startup command. We could do this in enrich-classpath as we already do for other purposes - issue/PR welcome