clojure-emacs / clojure-emacs/clojure-ts-mode

Namespace inference when clojure project root is not git repo root

Open
#143 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Emacs Lisp
Stars
188
Forks
21
Avg merge
12m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.