1# YAML
2
3YAML support is available natively in Zed.
4
5- Tree Sitter: [zed-industries/tree-sitter-yaml](https://github.com/zed-industries/tree-sitter-yaml)
6- Language Server: [redhat-developer/yaml-language-server](https://github.com/redhat-developer/yaml-language-server)
7
8## Configuration
9
10You can configure various [yaml-language-server settings](https://github.com/redhat-developer/yaml-language-server?tab=readme-ov-file#language-server-settings) by adding them to your Zed settings.json in a `yaml-language-server` block under the `lsp` key. For example:
11
12```json
13 "lsp": {
14 "yaml-language-server": {
15 "initialization_options": {
16 "yaml": {
17 "keyOrdering": true,
18 "format": {
19 "singleQuote": true
20 },
21 "schemas": {
22 "http://json.schemastore.org/composer": ["/*"],
23 "../relative/path/schema.json": ["/config*.yaml"]
24 }
25 }
26 }
27 }
28 }
29```
30
31Note, settings keys must be nested, so `yaml.keyOrdering` becomes `{"yaml": { "keyOrdering": true }}`.
32
33## Schemas
34
35By default yaml-language-server will attempt to determine the correct schema for a given yaml file and retrieve the appropriate JSON Schema from [Json Schema Store].
36
37You can override this by [using an inlined schema] reference via a modeline comment at the top of your yaml file:
38
39```yaml
40# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
41name: Issue Assignment
42on:
43 issues:
44 types: [oppened]
45```
46
47You can disable this functionality entirely if desired:
48
49```json
50 "lsp": {
51 "yaml-language-server": {
52 "initialization_options": {
53 "yaml": {
54 "schemaStore": {
55 "enable": false
56 }
57 }
58 }
59 }
60 }
61```