ワンクリックで
editor-syntaxes
How to maintain editor syntax definitions for Dang. Use when adding or removing keywords, tokens, or language constructs.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
How to maintain editor syntax definitions for Dang. Use when adding or removing keywords, tokens, or language constructs.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
Dang language reference for writing, editing, and reviewing `.dang` code — syntax, types/nullability, prototype objects, copy-on-write mutation, control flow, errors, GraphQL interop, stdlib, and CLI. Use when authoring or reviewing `.dang` files or Dang modules, or any time precise Dang language behavior matters.
How to add or modify builtin functions and methods in `pkg/dang/stdlib.go`. Use when extending Dang's standard library.
Non-obvious invariants in Dang's compiler — multi-pass hoisting, the Fork/Clone/dynamic-scope-cell model, and `Module.Eq` subtyping. Use when editing `pkg/dang/` infer/eval/scope code, adding a new type-like declaration, or debugging mutation/scoping issues.
How to run tests, add error tests, update golden files, and report nice errors in Dang. Use when running or writing tests.
SOC 職業分類に基づく
| name | editor-syntaxes |
| description | How to maintain editor syntax definitions for Dang. Use when adding or removing keywords, tokens, or language constructs. |
Dang has syntax definitions for three editors. When the language grammar changes (keywords added/removed, tokens renamed, new constructs), all three must be updated in sync.
editors/vscode/syntaxes/dang.tmLanguage.json — TextMate grammarkeyword-control pattern as a \b(...)\b regexeditors/zed/languages/dang/highlights.scm — tree-sitter highlightshttps://github.com/vito/zed-dangeditors/nvim/queries/dang/highlights.scm — tree-sitter highlightshttps://github.com/vito/dang.nvimThe two .scm files are nearly identical but use different capture
names (Zed uses @keyword.control, @variable.special, etc.; Neovim
uses @keyword, @variable.builtin, etc.). Edit both when making
changes.
Keywords are listed as (foo_token) nodes inside [ ... ] @keyword
blocks. To add or remove a keyword, add or remove the corresponding
(foo_token) line in both files.
Keywords live in the keyword-control repository entry as a single
regex. To add or remove a keyword, edit the \b(...)\b alternation.
Since Zed and Neovim are submodules:
# 1. Commit in each submodule
cd editors/zed && git add -A && git commit -m "..." && cd ../..
cd editors/nvim && git add -A && git commit -m "..." && cd ../..
# 2. Commit submodule pointers + VSCode changes in parent
git add editors/zed editors/nvim editors/vscode/syntaxes/dang.tmLanguage.json
git commit -m "chore(editors): ..."
The REPL highlights its input with the same Zed highlights.scm, embedded
into the binary at pkg/dang/highlights.scm (a generated copy, since
go:embed can't follow the treesitter/queries/highlights.scm symlink into
the submodule). ./hack/generate (via go generate ./...) refreshes it with
cp, so it tracks the query automatically — just re-run generation after
editing the Zed query. New capture names also need a case in captureClass
in pkg/dang/highlight_common.go (kept in lockstep with
docs/go/highlight.go).
pkg/dang/danglang binds the generated parser by #include-ing
treesitter/src/parser.c across package directories, and Go's build cache
does not track that file. After ./hack/generate regenerates the
grammar, cached builds keep linking the old parser; the first symptom is
the embedded highlight query failing to compile ("Invalid node type
<new_token>") and the REPL silently rendering plain text
(TestHighlightCodeStylesAndPreservesText fails). Force one rebuild:
go test -a ./pkg/dang/ -run TestHighlight
(-a recomputes the cache entry; subsequent normal builds are fine.)
When a language keyword or token changes:
editors/zed/languages/dang/highlights.scmeditors/nvim/queries/dang/highlights.scmeditors/vscode/syntaxes/dang.tmLanguage.json./hack/generate to refresh the embedded pkg/dang/highlights.scmtreesitter/test/corpus/ and editors/highlights/corpus/
cases for the new construct (tree-sitter test --update,
go test ./editors/ -run TestNeovimHighlights -update)