Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Document task filtering based on variables (#38642)

Chris Ewald52c467ea3aef
diff --git a/docs/src/tasks.md b/docs/src/tasks.md
index b30b7220071..f2986c9951f 100644
--- a/docs/src/tasks.md
+++ b/docs/src/tasks.md
@@ -132,6 +132,27 @@ Or explicitly include escaped quotes like so:
}
```
+### Task filtering based on variables
+
+Task definitions with variables which are not present at the moment the task list is determined are filtered out.
+For example, the following task will appear in the spawn modal only if there is a text selection:
+
+```json
+{
+ "label": "selected text",
+ "command": "echo \"$ZED_SELECTED_TEXT\""
+}
+```
+
+Set default values to such variables to have such tasks always displayed:
+
+```json
+{
+ "label": "selected text with default",
+ "command": "echo \"${ZED_SELECTED_TEXT:no text selected}\""
+}
+```
+
## Oneshot tasks
The same task modal opened via `task: spawn` supports arbitrary bash-like command execution: type a command inside the modal text field, and use `opt-enter` to spawn it.