---
title: "Syntax-Aware Task Spawning With Tree-Sitter"
description: "Zed Tasks run shell commands from the editor using variables such as $ZED_SYMBOL (filled from Tree-sitter with the enclosing symbol), $ZED_FILE and $ZED_SELECTED_TEXT."
url: "https://swe.quest/articles/syntax-aware-task-spawning-with-tree-sitter-c8a0858f66d9d4d1"
canonical: "https://zed.dev/blog/zed-decoded-tasks"
source: "Zed"
published: "2024-05-21"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 8
tags: ["developer-tools","developer-productivity"]
---

# Syntax-Aware Task Spawning With Tree-Sitter

A post on [Zed](https://swe.quest/sources/zed.md), published 2024-05-21, 8 min read, Deep dive. Original: [https://zed.dev/blog/zed-decoded-tasks](https://zed.dev/blog/zed-decoded-tasks)

## Summary

Zed Tasks run shell commands from the editor using variables such as $ZED\_SYMBOL (filled from Tree-sitter with the enclosing symbol), $ZED\_FILE and $ZED\_SELECTED\_TEXT. Tasks can be defined in project or global tasks.json templates, bound to keys, and rerun with reevaluate\_context so variables pick up the current selection or file. Language extensions can ship runnables.scm Tree-sitter queries that tag syntax nodes such as test functions. Zed matches those tags against the tags on task definitions and places clickable play buttons in the gutter to run them.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)
- [Developer productivity](https://swe.quest/tags/developer-productivity.md) (Engineering practices)

## Prerequisites

- code editor basics ([easy posts on Developer tools](https://swe.quest/tags/developer-tools.md?difficulty=easy))
- Tree-sitter queries

## Keywords

Zed, Tree-sitter, Zed Tasks, runnables.scm, tasks.json

## Related posts

- [Enabling low-latency, syntax-aware editing using Tree-sitter](https://swe.quest/articles/enabling-low-latency-syntax-aware-editing-using-tree-sitter-9ffe8225d976568b.md): Zed · 2023-03-27 · Medium · 10 min read · Developer tools, Compilers, Data structures, Rust
  Zed builds its syntax-aware features on Tree-sitter, a GLR-based incremental parsing framework with error recovery that produces concrete syntax trees.
- [Zed Weekly: #17](https://swe.quest/articles/zed-weekly-17-390d0b1828377e87.md): Zed · 2023-08-22 · Easy · 7 min read · Developer tools, LLMs, Rust
  Weekly team update from the Zed editor team covering AI features, channels, language support and UI work.
- [Zed Has Rainbow Brackets](https://swe.quest/articles/zed-has-rainbow-brackets-56d1fa479c442850.md): Zed · 2025-12-03 · Medium · 6 min read · Developer tools, Rust, Caching, Performance engineering, Testing
  Zed implements rainbow brackets without language servers or a persistent syntax tree by running each language's tree-sitter brackets.scm queries over independent 50-row chunks and coloring pairs by nesting depth across 7 cycling theme accent colors.
- [Building a Text Editor in the Times of AI](https://swe.quest/articles/building-a-text-editor-in-the-times-of-ai-5830d5c3aedf2a31.md): Zed · 2024-03-26 · Easy · 31 min read · AI for coding, Developer tools, LLMs, Algorithms
  Zed's co-founders Nathan, Max and Antonio describe how they use AI for programming.
- [Copilot x Zed](https://swe.quest/articles/copilot-x-zed-48f53be12c312262.md): Zed · 2023-04-20 · Medium · 2 min read · Developer tools, AI for coding
  GitHub Copilot is now available in Zed v0.82, integrated by reusing the undocumented, minified Copilot LSP server shipped in the Neovim plugin, which Zed's built-in LSP support could drive directly.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
