-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
task: Add task contexts #8675
task: Add task contexts #8675
Conversation
Co-authored-by: Anthony <[email protected]>
Co-authored-by: Anthony <[email protected]>
Co-authored-by: Anthony <[email protected]>
Provide ZED_WORKSPACE_ROOT Co-authored-by: Anthony <[email protected]>
Nice. I'm assuming a future PR will then add a The thing I'm most looking forward to is being able to do things like |
Hey, thanks for the suggestion! I think we can add col/row in this PR as well. |
That would be amazing. Filename and line number are definitely the keys for me. As an aside, there's some similar functionality open in a PR over on helix. Here are a few that they're considering that might be helpful in the future in Zed...
|
Co-authored-by: Anthony <[email protected]>
Co-authored-by: Anthony <[email protected]>
The task dilemma from PR description comes down to this: when you run a task that uses a variable from a context, should |
@osiewicz Seems reasonable. This is probably a question for a different PR (i.e. could leverage the param here), but I do wonder if this could be a different command name altogether such as:
|
Eh, I don't really think "Rerun" and "Run Last *" like I mentioned is clear enough so 🤷 |
I am gonna follow up in other PRs to let folks play with it on nightly. Thank you @Anthony-Eid for pairing and @baldwindavid for your incredibly valuable feedback - please don't be shy to share more in the future PRs :) |
🥳 @osiewicz The work here is greatly appreciated. This will unlock a ton of potential workflows. Thanks so much. |
This PR supplements tasks with additional environment variables; ideally we'll be able to write a task like:
cargo test -p $ZED_CURRENT_PACKAGE -- $ZED_CURRENT_FUNCTION
task: rerun
reevaluate contexts for tasks?This PR introduced the following variables:
and the following, which are available for buffers with associated files:
mod tests > fn test_task_contexts
should be equal to ZED_SYMBOL oftest_task_contexts
). Note that this isn't necessarily a test function or a function at all.Also, you can use them in
cwd
field of definitions (note though that we're using https://docs.rs/subst/latest/subst/#features for that, so don't expect a full shell functionality to work); the syntax should match up with your typical Unix shell.Release Notes: