Add logic for managing language and theme extensions (#7467)
This PR adds the initial support for loading extensions in Zed.
### Extensions Directory
Extensions are loaded from the extensions directory.
The extensions directory has the following structure:
```
extensions/
installed/
extension-a/
grammars/
languages/
extension-b/
themes/
manifest.json
```
The `manifest.json` file is used internally by Zed to keep track of
which extensions are installed. This file should be maintained
automatically, and shouldn't require any direct interaction with it.
Extensions can provide Tree-sitter grammars, languages, and themes.
Release Notes:
- N/A
---------
Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
co-authored by
Marshall
parent
6b598a07d9
commit
6edeea7c8a
@@ -1,4 +1,5 @@
|
||||
name = "Shell Script"
|
||||
grammar = "bash"
|
||||
path_suffixes = ["sh", "bash", "bashrc", "bash_profile", "bash_aliases", "bash_logout", "profile", "zsh", "zshrc", "zshenv", "zsh_profile", "zsh_aliases", "zsh_histfile", "zlogin", "zprofile", ".env"]
|
||||
line_comments = ["# "]
|
||||
first_line_pattern = "^#!.*\\b(?:ba|z)?sh\\b"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
name = "Beancount"
|
||||
grammar = "beancount"
|
||||
path_suffixes = ["beancount"]
|
||||
brackets = [{ start = "\"", end = "\"", close = false, newline = false }]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "C"
|
||||
grammar = "c"
|
||||
path_suffixes = ["c"]
|
||||
line_comments = ["// "]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "C++"
|
||||
grammar = "cpp"
|
||||
path_suffixes = ["cc", "cpp", "h", "hpp", "cxx", "hxx", "inl"]
|
||||
line_comments = ["// "]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "CSharp"
|
||||
grammar = "c_sharp"
|
||||
path_suffixes = ["cs"]
|
||||
line_comments = ["// "]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "CSS"
|
||||
grammar = "css"
|
||||
path_suffixes = ["css"]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
brackets = [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Elixir"
|
||||
grammar = "elixir"
|
||||
path_suffixes = ["ex", "exs"]
|
||||
line_comments = ["# "]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Elm"
|
||||
grammar = "elm"
|
||||
path_suffixes = ["elm"]
|
||||
line_comments = ["-- "]
|
||||
block_comment = ["{- ", " -}"]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "ERB"
|
||||
grammar = "embedded_template"
|
||||
path_suffixes = ["erb"]
|
||||
autoclose_before = ">})"
|
||||
brackets = [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Erlang"
|
||||
grammar = "erlang"
|
||||
# TODO: support parsing rebar.config files
|
||||
# # https://github.com/WhatsApp/tree-sitter-erlang/issues/3
|
||||
path_suffixes = ["erl", "hrl", "app.src", "escript", "xrl", "yrl", "Emakefile", "rebar.config"]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Git Commit"
|
||||
grammar = "git_commit"
|
||||
path_suffixes = [
|
||||
# Refer to https://github.com/neovim/neovim/blob/master/runtime/lua/vim/filetype.lua#L1286-L1290
|
||||
"TAG_EDITMSG",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Gleam"
|
||||
grammar = "gleam"
|
||||
path_suffixes = ["gleam"]
|
||||
line_comments = ["// ", "/// "]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "GLSL"
|
||||
grammar = "glsl"
|
||||
path_suffixes = ["vert", "frag", "tesc", "tese", "geom", "comp"]
|
||||
line_comments = ["// "]
|
||||
block_comment = ["/* ", " */"]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Go"
|
||||
grammar = "go"
|
||||
path_suffixes = ["go"]
|
||||
line_comments = ["// "]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Go Mod"
|
||||
grammar = "go"
|
||||
path_suffixes = ["mod"]
|
||||
line_comments = ["//"]
|
||||
autoclose_before = ")"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Go Work"
|
||||
grammar = "go_work"
|
||||
path_suffixes = ["work"]
|
||||
line_comments = ["//"]
|
||||
autoclose_before = ")"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Haskell"
|
||||
grammar = "haskell"
|
||||
path_suffixes = ["hs"]
|
||||
autoclose_before = ",=)}]"
|
||||
line_comments = ["-- "]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "HCL"
|
||||
grammar = "hcl"
|
||||
path_suffixes = ["hcl"]
|
||||
line_comments = ["# ", "// "]
|
||||
block_comment = ["/*", "*/"]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "HEEX"
|
||||
grammar = "heex"
|
||||
path_suffixes = ["heex"]
|
||||
autoclose_before = ">})"
|
||||
brackets = [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "HTML"
|
||||
grammar = "html"
|
||||
path_suffixes = ["html", "htm", "shtml"]
|
||||
autoclose_before = ">})"
|
||||
block_comment = ["<!-- ", " -->"]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "JavaScript"
|
||||
grammar = "tsx"
|
||||
path_suffixes = ["js", "jsx", "mjs", "cjs"]
|
||||
first_line_pattern = '^#!.*\bnode\b'
|
||||
line_comments = ["// "]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "JSON"
|
||||
grammar = "json"
|
||||
path_suffixes = ["json"]
|
||||
line_comments = ["// "]
|
||||
autoclose_before = ",]}"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Lua"
|
||||
grammar = "lua"
|
||||
path_suffixes = ["lua"]
|
||||
line_comments = ["-- "]
|
||||
autoclose_before = ",]}"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Markdown"
|
||||
grammar = "markdown"
|
||||
path_suffixes = ["md", "mdx"]
|
||||
word_characters = ["-"]
|
||||
brackets = [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Nix"
|
||||
grammar = "nix"
|
||||
path_suffixes = ["nix"]
|
||||
line_comments = ["# "]
|
||||
block_comment = ["/* ", " */"]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Nu"
|
||||
grammar = "nu"
|
||||
path_suffixes = ["nu"]
|
||||
line_comments = ["# "]
|
||||
autoclose_before = ";:.,=}])>` \n\t\""
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "OCaml Interface"
|
||||
grammar = "ocaml_interface"
|
||||
path_suffixes = ["mli"]
|
||||
block_comment = ["(* ", "*)"]
|
||||
autoclose_before = ";,=)}"
|
||||
@@ -8,6 +9,6 @@ brackets = [
|
||||
{ start = "[", end = "]", close = true, newline = true },
|
||||
{ start = "(", end = ")", close = true, newline = true },
|
||||
{ start = "sig", end = " end", close = true, newline = true },
|
||||
# HACK: For some reason `object` alone does not work
|
||||
# HACK: For some reason `object` alone does not work
|
||||
{ start = "object ", end = "end", close = true, newline = true },
|
||||
]
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
name = "OCaml"
|
||||
grammar = "ocaml"
|
||||
path_suffixes = ["ml"]
|
||||
block_comment = ["(* ", "*)"]
|
||||
autoclose_before = ";,=)}]"
|
||||
brackets = [
|
||||
brackets = [
|
||||
{ start = "{", end = "}", close = true, newline = true },
|
||||
{ start = "<", end = ">", close = true, newline = true },
|
||||
{ start = "[", end = "]", close = true, newline = true },
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "PHP"
|
||||
grammar = "php"
|
||||
path_suffixes = ["php"]
|
||||
first_line_pattern = '^#!.*php'
|
||||
line_comments = ["// ", "# "]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "proto"
|
||||
grammar = "proto"
|
||||
path_suffixes = ["proto"]
|
||||
line_comments = ["// "]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "PureScript"
|
||||
grammar = "purescript"
|
||||
path_suffixes = ["purs"]
|
||||
autoclose_before = ",=)}]"
|
||||
line_comments = ["-- "]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Python"
|
||||
grammar = "python"
|
||||
path_suffixes = ["py", "pyi", "mpy"]
|
||||
first_line_pattern = '^#!.*\bpython[0-9.]*\b'
|
||||
line_comments = ["# "]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Racket"
|
||||
grammar = "racket"
|
||||
path_suffixes = ["rkt"]
|
||||
line_comments = ["; "]
|
||||
autoclose_before = "])"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Ruby"
|
||||
grammar = "ruby"
|
||||
path_suffixes = [
|
||||
"rb",
|
||||
"Gemfile",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Rust"
|
||||
grammar = "rust"
|
||||
path_suffixes = ["rs"]
|
||||
line_comments = ["// ", "/// ", "//! "]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Scheme"
|
||||
grammar = "scheme"
|
||||
path_suffixes = ["scm", "ss"]
|
||||
line_comments = ["; "]
|
||||
autoclose_before = "])"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Svelte"
|
||||
grammar = "svelte"
|
||||
path_suffixes = ["svelte"]
|
||||
block_comment = ["<!-- ", " -->"]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Terraform"
|
||||
grammar = "terraform"
|
||||
path_suffixes = ["tf", "tfvars"]
|
||||
line_comments = ["# ", "// "]
|
||||
block_comment = ["/*", "*/"]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "TOML"
|
||||
grammar = "toml"
|
||||
path_suffixes = ["Cargo.lock", "toml"]
|
||||
line_comments = ["# "]
|
||||
autoclose_before = ",]}"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "TSX"
|
||||
grammar = "tsx"
|
||||
path_suffixes = ["tsx"]
|
||||
line_comments = ["// "]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "TypeScript"
|
||||
grammar = "typescript"
|
||||
path_suffixes = ["ts", "cts", "d.cts", "d.mts", "mts"]
|
||||
line_comments = ["// "]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Uiua"
|
||||
grammar = "uiua"
|
||||
path_suffixes = ["ua"]
|
||||
line_comments = ["# "]
|
||||
autoclose_before = ")]}\""
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Vue.js"
|
||||
grammar = "vue"
|
||||
path_suffixes = ["vue"]
|
||||
block_comment = ["<!-- ", " -->"]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "YAML"
|
||||
grammar = "yaml"
|
||||
path_suffixes = ["yml", "yaml"]
|
||||
line_comments = ["# "]
|
||||
autoclose_before = ",]}"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name = "Zig"
|
||||
grammar = "zig"
|
||||
path_suffixes = ["zig"]
|
||||
line_comments = ["// "]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
|
||||
Reference in New Issue
Block a user