diff --git a/assets/settings/default.json b/assets/settings/default.json index 6c784a067c..bab998f72f 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -221,6 +221,9 @@ }, "TSX": { "tab_size": 2 + }, + "Yaml": { + "tab_size": 2 } }, // LSP Specific settings. diff --git a/crates/zed/src/languages/python/config.toml b/crates/zed/src/languages/python/config.toml index a817de8e3b..45f20e25a3 100644 --- a/crates/zed/src/languages/python/config.toml +++ b/crates/zed/src/languages/python/config.toml @@ -11,7 +11,7 @@ brackets = [ ] auto_indent_using_last_non_empty_line = false -increase_indent_pattern = ":$" +increase_indent_pattern = ":\\s*$" decrease_indent_pattern = "^\\s*(else|elif|except|finally)\\b.*:" [overrides.comment] diff --git a/crates/zed/src/languages/yaml/config.toml b/crates/zed/src/languages/yaml/config.toml index ec08826ea3..08dac475b3 100644 --- a/crates/zed/src/languages/yaml/config.toml +++ b/crates/zed/src/languages/yaml/config.toml @@ -3,13 +3,15 @@ path_suffixes = ["yml", "yaml"] line_comment = "# " autoclose_before = ",]}" brackets = [ -{ start = "{", end = "}", close = true, newline = true }, -{ start = "[", end = "]", close = true, newline = true }, -{ start = "\"", end = "\"", close = true, newline = false }, + { start = "{", end = "}", close = true, newline = true }, + { start = "[", end = "]", close = true, newline = true }, + { start = "\"", end = "\"", close = true, newline = false }, ] +increase_indent_pattern = ":\\s*[|>]?\\s*$" + [overrides.string] brackets = [ -{ start = "{", end = "}", close = true, newline = true }, -{ start = "[", end = "]", close = true, newline = true }, + { start = "{", end = "}", close = true, newline = true }, + { start = "[", end = "]", close = true, newline = true }, ] diff --git a/crates/zed/src/languages/yaml/highlights.scm b/crates/zed/src/languages/yaml/highlights.scm index 0286a371c9..06081f63cb 100644 --- a/crates/zed/src/languages/yaml/highlights.scm +++ b/crates/zed/src/languages/yaml/highlights.scm @@ -1,17 +1,29 @@ (boolean_scalar) @boolean (null_scalar) @constant.builtin -(double_quote_scalar) @string -(single_quote_scalar) @string -((block_scalar) @string (#set! "priority" 99)) -(string_scalar) @string + +[ + (double_quote_scalar) + (single_quote_scalar) + (block_scalar) + (string_scalar) +] @string + (escape_sequence) @string.escape -(integer_scalar) @number -(float_scalar) @number + +[ + (integer_scalar) + (float_scalar) +] @number + (comment) @comment -(anchor_name) @type -(alias_name) @type -(tag) @type -(ERROR) @error + +[ + (anchor_name) + (alias_name) + (tag) +] @type + +key: (flow_node (plain_scalar (string_scalar) @property)) [ "," diff --git a/crates/zed/src/languages/yaml/outline.scm b/crates/zed/src/languages/yaml/outline.scm new file mode 100644 index 0000000000..e85eb1bf8a --- /dev/null +++ b/crates/zed/src/languages/yaml/outline.scm @@ -0,0 +1 @@ +(block_mapping_pair key: (flow_node (plain_scalar (string_scalar) @name))) @item \ No newline at end of file