zed
zed copied to clipboard
Zed Task Variable Aliases
Check for existing issues
- [X] Completed
Describe the feature
Currently Zed has four environment variables that are set when zed tasks are ran. Which are ZED_ROW, ZED_COLUMN, ZED_FILE, ZED_WORKTREE_ROOT, and ZED_SYMBOL.
Because tasks are in other editors such as vscode, it would be a good idea to allow integration of vscode env variables with zeds. This would be helpful if users have a script they would like to run using zeds tasks, but the script expects different environment variable names.
I'm very interested in implementing this issue if the Zed team decides to approve it.
If applicable, add mockups / screenshots to help present your vision of the feature
@SomeoneToIgnore @osiewicz - curious to get either of your opinions here.
I think it's a good idea to have as seamless of a switch experience as possible, but I wonder if it wouldn't be easier to just align our naming with Code. On the other hand, there are other editors than Code, so maybe we do need to somehow alias the variables anyways depending on the detected format of task definitions. But yeah, IMHO the idea is sound in it's essence - I'd be happy to help should any questions arise :)
@Anthony-Eid Seems like a great idea and very flexible. Just tossing out another potential option that is a bit more opinionated. Perhaps Zed could already have knowledge of these mappings and then the configuration is something like...
"aliases": "vscode"
It could have knowledge of VSCode, JetBrains, SublimeText, etc. And then, if need be, that same per alias customization could be configured...
"aliases": {
"ZED_SELECTED_TEXT": "SOME_ALIAS_FOR_SOME_EDITOR",
}
This might make it a little easier on end-users, a bit less verbose, and more resilient to potential changes/additions to the set of environment vars in both Zed and other editors.
Out of the two options having Zed preconfigured with mappings for different editors would be better in my opinion. However, if both options were implement they should have different names within the json structure. Such as this.
"var_schema": "vscode",
"aliases": {
"ZED_SELECTED_TEXT": "SOME_ALIAS_FOR_SOME_EDITOR",
}
That way it's clear to the user what they're doing, and I think it would make the implementation logic a bit easier as well. I also think there are better names than var_schema, but I couldn't think of any.
@Anthony-Eid perhaps some precedent with "base_keymap" in the settings with...
"alias_map": "VSCode"
In terms of precedent, also noticing that these are the available names for "base_keymap", so probably worthwhile to use the same convention.
// 1. "VSCode"
// 2. "JetBrains"
// 3. "SublimeText"
// 4. "Atom"
Update: I started a draft for this issue here #9048