Commit 839fbd3
committed
Improve leiningen project search
I have a problem when I use Calva's Jack In command - I have to run to
open my project.clj file in the root of the repo before I Jack In. If
I run the command when I have any source files open in the editor, the
Jack In fails.
The reason for this is that Calva will search from the directory
containing the current file down to the workspace root.
There are many projects named `project.clj` in the main CircleCI repo,
since a project one of our core domain objects:
```
marc@blaster ~/dev/circleci/circle $ find . -name project.clj
./project.clj
./src/circle/project.clj
./src/circle/http/api/v1/v1_0/project.clj
./src/circle/http/api/v1/v1_1/project.clj
./src/circle/http/api/v1/shared/project.clj
./src/circle/http/api/v2/insights/project.clj
./src/circle/http/api/v2/project.clj
./src/circle/http/api/v2/entities/insights/project.clj
./src/circle/http/api/v2/entities/project.clj
./src/circle/model/project.clj
./src/circle/model/api/project.clj
```
If I have any file open in `src/circle`, (which is the location of all
source files), Calva will find `src/circle/project.clj` before it
considers the project.clj in the root. As far as I understand, this is a
desirable search behaviour, since it allows folks to use Calva in
projects that contain multiple leiningen projects.
This change alters the search behaviour to only consider files that
don't begin with the string `(ns ` when attempting the determine the
project path.
Fixes #8711 parent 6952885 commit 839fbd3
1 file changed
+15
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
143 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
144 | 151 | | |
145 | 152 | | |
146 | 153 | | |
147 | 154 | | |
148 | 155 | | |
149 | | - | |
150 | | - | |
| 156 | + | |
| 157 | + | |
151 | 158 | | |
152 | 159 | | |
153 | 160 | | |
| |||
156 | 163 | | |
157 | 164 | | |
158 | 165 | | |
159 | | - | |
| 166 | + | |
160 | 167 | | |
161 | 168 | | |
162 | 169 | | |
| |||
192 | 199 | | |
193 | 200 | | |
194 | 201 | | |
195 | | - | |
196 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
197 | 206 | | |
198 | 207 | | |
199 | 208 | | |
| |||
0 commit comments