Fork me on GitHub
#lsp
<
2021-09-29
>
dharrigan14:09:14

You know if I create a new namespace, and lsp fills in some of the requires automatically, where does it derive that list from?, i.e., I just created a new test namespace, and this was populated:

ericdallo14:09:40

clojure-lsp doesn't add any requires if you didn't ask to

ericdallo14:09:48

this is probably a feature from another plugin

ericdallo15:09:10

clojure-lsp only create the ns form if the setting is enabled (which is on by default), but not requires/imports

dharrigan15:09:54

ah interesting, okay, thank you. I'll do some looking around

👍 1
dharrigan15:09:13

Found it. Since I use vim-projectionist, I see that someone has snuck in a .projections.json into our repo

dharrigan15:09:39

that, on buffer creation, injects a template, of which those requires are there.

ericdallo15:09:10

I ssee, BTW this is something I intend to add soon to clojure-lsp :p

ericdallo15:09:19

but configurable

dharrigan15:09:38

vim-projectionist has this setup that did that for me:

dharrigan15:09:51

"test/*_test.clj": {
    "alternate": "src/{}.clj",
    "type": "test",
    "template": [
      "(ns {dot|hyphenate}-test",
      "  (:require [{dot|hyphenate} :as {basename|hyphenate}]",
      "            [clojure.test :as t :refer [deftest testing is are run-tests]]))",
      ""
    ]
  },

👍 1
😢 1
dharrigan14:09:28

(ns foo.api.user.routes-test
  (:require [foo.api.user.routes :as routes]
            [clojure.test :as t :refer [deftest testing is are run-tests]]))

dharrigan14:09:50

I don't want the clojure.test..... put in (I use expectations)