Skip to content

Namespace inference when clojure project root is not git repo root #143

@tesujimath

Description

@tesujimath

I have a mixed Clojure/Rust project. My Clojure code is in clj, which means deps.edn is found at clj/deps.edn relative to repo root, and my top-level application namespace is at clj/src/limabean.clj.

To make namespace inference work I had to tweak just one thing in fact, adding src/ to the clojure-ts-directory-prefixes, like this:

(use-package clojure-ts-mode
  :custom
  (clojure-ts-directory-prefixes '("^\\(?:[^/]+/\\)*clj[csxd]*/" "src/")))

My earlier approach of using locate-dominating-file to define the Clojure project root as where the deps.edn file lived turned out to break Eglot, which had a different idea of the project root. It turns out that these prefixes are all that was required to fix namespace inference.

Anyway, thanks for clojure-ts-mode, and hoping this helps someone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions