On Sunday, 14 June 2020 at 16:04:32 UTC, Jean-Louis Leroy wrote:
On Sunday, 14 June 2020 at 09:11:58 UTC, Andre Pany wrote:
On Saturday, 13 June 2020 at 19:27:53 UTC, Jean-Louis Leroy wrote:
On Monday, 18 November 2019 at 23:06:14 UTC, Per Nordlöw wrote:
Have anybody written support for DUB project types in Emacs' projectile?

See: https://www.projectile.mx/en/latest/projects/#adding-custom-project-types

Normally it should be as easy as this:

(projectile-register-project-type
 'dub '("dub.json" "dub.sdl")
 :compile "dub compile"
 :test "dub test"
 :run "dub run")

But it doesn't work for me and I cannot figure out why.

The command is `dub build` which will build the project from the current work dir. You can set another work dir with arg `--root FOLDER` if needed. Same for `dub test` and `dub run`.

Kind regards
Andre

`dub build` - right, sorry for that. But the real problem (and the reason why I never noticed the compile/build mistake) is that projectile deigns not recognize the project type. Yet I did try it in directories containing a dub project, IOW a `dub.json` was present. I just lived with it, entering the commands manually when I need to restart emacs (which happens maybe once in a week). I should debug this, maybe I'll do that today...

OK, projectile checks for the presence of *all* the files in the list. So there:

(defun projectile-dub-project-p ()
  "Check if a project contains a dub.json or dub.sdl file."
  (or (projectile-verify-file "dub.json")
      (projectile-verify-file "dub.sdl")))

(projectile-register-project-type
 'dub #'projectile-dub-project-p
 :compile "dub build"
 :test "dub test"
 :run "dub run")

Reply via email to