zed icon indicating copy to clipboard operation
zed copied to clipboard

elixir: Fix `mix test $ZED_SYMBOL` task

Open feliperenan opened this issue 1 year ago • 7 comments

$ZED_SYMBOL doesn't really work here once that will try to do something like this:

mix test MyModule.MyModuleTest

instead of using the path of the file:

mix test test/my_module/my_module_test.exs

Release Notes:

  • N/A

feliperenan avatar May 15 '24 23:05 feliperenan

We require contributors to sign our Contributor License Agreement, and we don't have @feliperenan on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

cla-bot[bot] avatar May 15 '24 23:05 cla-bot[bot]

@cla-bot check

feliperenan avatar May 15 '24 23:05 feliperenan

We require contributors to sign our Contributor License Agreement, and we don't have @feliperenan on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

cla-bot[bot] avatar May 15 '24 23:05 cla-bot[bot]

The cla-bot has been summoned, and re-checked this pull request!

cla-bot[bot] avatar May 15 '24 23:05 cla-bot[bot]

@cla-bot check

feliperenan avatar May 15 '24 23:05 feliperenan

The cla-bot has been summoned, and re-checked this pull request!

cla-bot[bot] avatar May 15 '24 23:05 cla-bot[bot]

This must have gotten broken during the recent move of elixir support into an extension. I already had my own elixir tasks so didn't notice. As you mention, it would be nice to have something like $ZED_RELATIVE_PATH. A relative path is also necessary for using the browse functionality of the Github CLI (https://cli.github.com/manual/gh_browse).

baldwindavid avatar May 16 '24 12:05 baldwindavid

I've added ZED_RELATIVE_FILE in https://github.com/zed-industries/zed/pull/12245

osiewicz avatar May 24 '24 13:05 osiewicz

Thank you @osiewicz. I just tested and it works like a charm. Just updated this PR to use ZED_RELATIVE_FILE as well.

feliperenan avatar May 31 '24 09:05 feliperenan

@feliperenan - I'm curious if you'd be open to a PR that renames the label for these tasks to not use the variables. I found that I had to redefine the tasks locally so that I could bind my keymaps to spawn them. Eg:

      ", r c": ["task::Spawn", { "task_name": "mix test nearest" }]

although using the task_name: mix test $ZED_RELATIVE_FILE:$ZED_ROW does work its a bit more obscure to find (had to search through the code to see what variables exactly were being used)

rossvz avatar Jul 10 '24 21:07 rossvz