language: Accept multiple values in line_comment language knob. (#6713)

This opens up a possibility of supporting multiple comment continuation
flavours in editor, e.g. doc comments for Rust (which we seize as well
in this commit). Only the first `line_comment` value is used for
Editor::ToggleComments

Fixes: https://github.com/zed-industries/zed/issues/6692

Release Notes:
- Added support for doc-comment continuations in Rust language.
This commit is contained in:
Piotr Osiewicz 2024-01-25 19:25:21 +01:00 committed by GitHub
parent dd25902aeb
commit e9edad1d51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 95 additions and 73 deletions

View file

@ -1,6 +1,6 @@
name = "Shell Script"
path_suffixes = ["sh", "bash", "bashrc", "bash_profile", "bash_aliases", "bash_logout", "profile", "zsh", "zshrc", "zshenv", "zsh_profile", "zsh_aliases", "zsh_histfile", "zlogin", "zprofile"]
line_comment = "# "
line_comments = ["# "]
first_line_pattern = "^#!.*\\b(?:ba|z)?sh\\b"
brackets = [
{ start = "[", end = "]", close = true, newline = false },

View file

@ -1,6 +1,6 @@
name = "C"
path_suffixes = ["c"]
line_comment = "// "
line_comments = ["// "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,6 +1,6 @@
name = "C++"
path_suffixes = ["cc", "cpp", "h", "hpp", "cxx", "hxx", "inl"]
line_comment = "// "
line_comments = ["// "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,6 +1,6 @@
name = "Elixir"
path_suffixes = ["ex", "exs"]
line_comment = "# "
line_comments = ["# "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,6 +1,6 @@
name = "Elm"
path_suffixes = ["elm"]
line_comment = "-- "
line_comments = ["-- "]
block_comment = ["{- ", " -}"]
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,6 +1,6 @@
name = "GLSL"
path_suffixes = ["vert", "frag", "tesc", "tese", "geom", "comp"]
line_comment = "// "
line_comments = ["// "]
block_comment = ["/* ", " */"]
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,6 +1,6 @@
name = "Go"
path_suffixes = ["go"]
line_comment = "// "
line_comments = ["// "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,7 +1,7 @@
name = "JavaScript"
path_suffixes = ["js", "jsx", "mjs", "cjs"]
first_line_pattern = '^#!.*\bnode\b'
line_comment = "// "
line_comments = ["// "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },
@ -18,7 +18,7 @@ scope_opt_in_language_servers = ["tailwindcss-language-server"]
prettier_parser_name = "babel"
[overrides.element]
line_comment = { remove = true }
line_comments = { remove = true }
block_comment = ["{/* ", " */}"]
[overrides.string]

View file

@ -1,6 +1,6 @@
name = "JSON"
path_suffixes = ["json"]
line_comment = "// "
line_comments = ["// "]
autoclose_before = ",]}"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,6 +1,6 @@
name = "Lua"
path_suffixes = ["lua"]
line_comment = "-- "
line_comments = ["-- "]
autoclose_before = ",]}"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,6 +1,6 @@
name = "Nix"
path_suffixes = ["nix"]
line_comment = "# "
line_comments = ["# "]
block_comment = ["/* ", " */"]
autoclose_before = ";:.,=}])>` \n\t\""
brackets = [

View file

@ -1,6 +1,6 @@
name = "Nu"
path_suffixes = ["nu"]
line_comment = "# "
line_comments = ["# "]
autoclose_before = ";:.,=}])>` \n\t\""
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,7 +1,7 @@
name = "PHP"
path_suffixes = ["php"]
first_line_pattern = '^#!.*php'
line_comment = "// "
line_comments = ["// "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,7 +1,7 @@
name = "Python"
path_suffixes = ["py", "pyi", "mpy"]
first_line_pattern = '^#!.*\bpython[0-9.]*\b'
line_comment = "# "
line_comments = ["# "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,6 +1,6 @@
name = "Racket"
path_suffixes = ["rkt"]
line_comment = "; "
line_comments = ["; "]
autoclose_before = "])"
brackets = [
{ start = "[", end = "]", close = true, newline = false },

View file

@ -1,7 +1,7 @@
name = "Ruby"
path_suffixes = ["rb", "Gemfile"]
first_line_pattern = '^#!.*\bruby\b'
line_comment = "# "
line_comments = ["# "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,6 +1,6 @@
name = "Rust"
path_suffixes = ["rs"]
line_comment = "// "
line_comments = ["// ", "/// ", "//! "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,6 +1,6 @@
name = "Scheme"
path_suffixes = ["scm", "ss"]
line_comment = "; "
line_comments = ["; "]
autoclose_before = "])"
brackets = [
{ start = "[", end = "]", close = true, newline = false },

View file

@ -1,6 +1,6 @@
name = "TOML"
path_suffixes = ["Cargo.lock", "toml"]
line_comment = "# "
line_comments = ["# "]
autoclose_before = ",]}"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,6 +1,6 @@
name = "TSX"
path_suffixes = ["tsx"]
line_comment = "// "
line_comments = ["// "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },
@ -17,7 +17,7 @@ scope_opt_in_language_servers = ["tailwindcss-language-server"]
prettier_parser_name = "typescript"
[overrides.element]
line_comment = { remove = true }
line_comments = { remove = true }
block_comment = ["{/* ", " */}"]
[overrides.string]

View file

@ -1,6 +1,6 @@
name = "TypeScript"
path_suffixes = ["ts", "cts", "d.cts", "d.mts", "mts"]
line_comment = "// "
line_comments = ["// "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -1,6 +1,6 @@
name = "Uiua"
path_suffixes = ["ua"]
line_comment = "# "
line_comments = ["# "]
autoclose_before = ")]}\""
brackets = [
{ start = "{", end = "}", close = true, newline = false},

View file

@ -1,6 +1,6 @@
name = "YAML"
path_suffixes = ["yml", "yaml"]
line_comment = "# "
line_comments = ["# "]
autoclose_before = ",]}"
brackets = [
{ start = "{", end = "}", close = true, newline = true },