zed icon indicating copy to clipboard operation
zed copied to clipboard

Ability to pass current file name to a task

Open JosephTLyons opened this issue 1 year ago • 4 comments

Check for existing issues

  • [X] Completed

Describe the feature

{
  "label": "run",
  "command": "python",
  "args": ["{current_file}"],
}

If applicable, add mockups / screenshots to help present your vision of the feature

No response

JosephTLyons avatar Feb 24 '24 06:02 JosephTLyons

We already have ZED_FILE, though we might want to enhance it with things like "worktree-relative path", "path-to-parent-directory" and so on.

osiewicz avatar Mar 21 '24 14:03 osiewicz

There is a bug with the ZED_FILE, it only works for some extensions and doesn't work for other extensions.

wmstack avatar Apr 17 '24 23:04 wmstack

Could you recheck this on Zed 0.132 (or above, if happens later) and, if the issue persists, provide more details — which language extensions do and do not have it for you?

SomeoneToIgnore avatar Apr 18 '24 07:04 SomeoneToIgnore

Well, I am still on 0.131.6 and I don't think I can update it from Zed. However, it doesn't work with java files and text files.

I have a simple echo task, that outputs "$ZED_FILE" and it is often a blank line. It seems to work fine with python, markdown, and rust but the important part is that with Java, Julia, and text files it is just blank. It is also a blank line for files that don't have an extension at the end.

wmstack avatar Apr 19 '24 00:04 wmstack

I'm going to close this issue out because we now support ZED_FILE - @wmstack, can you open up a new issue for the problem you are encountering?

JosephTLyons avatar Apr 19 '24 05:04 JosephTLyons

Thanks, indeed files with languages that do not have tasks, have blank ZED_FILE on Stable and Preview improves the general logic, filtering such tasks away entirely.

I'll work on a fix, so maybe an issue is note really needed.

SomeoneToIgnore avatar Apr 19 '24 06:04 SomeoneToIgnore

https://github.com/zed-industries/zed/pull/10764

SomeoneToIgnore avatar Apr 19 '24 07:04 SomeoneToIgnore