Skip to content

Commit

Permalink
Add Zig project discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
stephan-cr committed Nov 2, 2024
1 parent e898a50 commit 8b5440c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* [#1892](https://github.com/bbatsov/projectile/pull/1892): Add category metadata to `completing-read`. (it's used by packages like `marginalia` and `embark`)
* [#1899](https://github.com/bbatsov/projectile/pull/1899): Add support for xmake build utility.
* [#1895](https://github.com/bbatsov/projectile/pull/1895): Modify projectile-mode to add a hook to `buffer-list-update-hook` such that any change in the buffer list will update the selected project.
* [#1918](https://github.com/bbatsov/projectile/pull/1895): Add Zig project discovery.

### Bugs fixed

Expand Down
7 changes: 7 additions & 0 deletions projectile.el
Original file line number Diff line number Diff line change
Expand Up @@ -3626,6 +3626,13 @@ a manual COMMAND-TYPE command is created with
:compile "dune build"
:test "dune runtest")

;; Zig
(projectile-register-project-type 'zig '("build.zig.zon")
:project-file "build.zig.zon"
:compile "zig build"
:test "zig build test"
:run "zig build run")

(defvar-local projectile-project-type nil
"Buffer local var for overriding the auto-detected project type.
Normally you'd set this from .dir-locals.el.")
Expand Down
11 changes: 10 additions & 1 deletion test/projectile-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,16 @@ Just delegates OPERATION and ARGS for all operations except for`shell-command`'.
"project/Project.toml")
(let ((projectile-indexing-method 'native))
(spy-on 'projectile-project-root :and-return-value (file-truename (expand-file-name "project/")))
(expect (projectile-detect-project-type) :to-equal 'julia))))))
(expect (projectile-detect-project-type) :to-equal 'julia)))))
(it "detects project-type for Zig projects"
(projectile-test-with-sandbox
(projectile-test-with-files
("project/"
"project/src/"
"project/build.zig.zon")
(let ((projectile-indexing-method 'native))
(spy-on 'projectile-project-root :and-return-value (file-truename (expand-file-name "project/")))
(expect (projectile-detect-project-type) :to-equal 'zig))))))

(describe "projectile-dirname-matching-count"
(it "counts matching dirnames ascending file paths"
Expand Down

0 comments on commit 8b5440c

Please sign in to comment.