Merge branch 'main' into collab-panel

This commit is contained in:
Max Brunsfeld 2023-08-07 11:41:41 -07:00
commit c537cf2a57
92 changed files with 2015 additions and 1591 deletions

View file

@ -1,5 +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"]
path_suffixes = ["sh", "bash", "bashrc", "bash_profile", "bash_aliases", "bash_logout", "profile", "zsh", "zshrc", "zshenv", "zsh_profile", "zsh_aliases", "zsh_histfile", "zlogin"]
line_comment = "# "
first_line_pattern = "^#!.*\\b(?:ba|z)?sh\\b"
brackets = [
{ start = "[", end = "]", close = true, newline = false },

View file

@ -54,5 +54,5 @@
(
(command (_) @constant)
(.match? @constant "^-")
(#match? @constant "^-")
)

View file

@ -86,7 +86,7 @@
(identifier) @variable
((identifier) @constant
(.match? @constant "^_*[A-Z][A-Z\\d_]*$"))
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
(call_expression
function: (identifier) @function)
@ -106,3 +106,4 @@
(primitive_type)
(sized_type_specifier)
] @type

View file

@ -1,7 +1,7 @@
(preproc_def
value: (preproc_arg) @content
(.set! "language" "c"))
(#set! "language" "c"))
(preproc_function_def
value: (preproc_arg) @content
(.set! "language" "c"))
(#set! "language" "c"))

View file

@ -31,13 +31,13 @@
declarator: (field_identifier) @function)
((namespace_identifier) @type
(.match? @type "^[A-Z]"))
(#match? @type "^[A-Z]"))
(auto) @type
(type_identifier) @type
((identifier) @constant
(.match? @constant "^_*[A-Z][A-Z\\d_]*$"))
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
(field_identifier) @property
(statement_identifier) @label

View file

@ -1,7 +1,7 @@
(preproc_def
value: (preproc_arg) @content
(.set! "language" "c++"))
(#set! "language" "c++"))
(preproc_function_def
value: (preproc_arg) @content
(.set! "language" "c++"))
(#set! "language" "c++"))

View file

@ -46,7 +46,7 @@
(property_name)
(plain_value)
] @variable.special
(.match? @variable.special "^--")
(#match? @variable.special "^--")
)
[

View file

@ -3,7 +3,7 @@
operator: "@"
operand: (call
target: (identifier) @unary
(.match? @unary "^(doc)$"))
(#match? @unary "^(doc)$"))
) @context
.
(call
@ -18,10 +18,10 @@
target: (identifier) @name)
operator: "when")
])
(.match? @name "^(def|defp|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp)$")) @item
(#match? @name "^(def|defp|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp)$")) @item
)
(call
target: (identifier) @name
(arguments (alias) @name)
(.match? @name "^(defmodule|defprotocol)$")) @item
(#match? @name "^(defmodule|defprotocol)$")) @item

View file

@ -54,13 +54,13 @@
(sigil_name) @__name__
quoted_start: _ @string
quoted_end: _ @string
(.match? @__name__ "^[sS]$")) @string
(#match? @__name__ "^[sS]$")) @string
(sigil
(sigil_name) @__name__
quoted_start: _ @string.regex
quoted_end: _ @string.regex
(.match? @__name__ "^[rR]$")) @string.regex
(#match? @__name__ "^[rR]$")) @string.regex
(sigil
(sigil_name) @__name__
@ -69,7 +69,7 @@
(
(identifier) @comment.unused
(.match? @comment.unused "^_")
(#match? @comment.unused "^_")
)
(call
@ -91,7 +91,7 @@
operator: "|>"
right: (identifier))
])
(.match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$"))
(#match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$"))
(binary_operator
operator: "|>"
@ -99,15 +99,15 @@
(call
target: (identifier) @keyword
(.match? @keyword "^(def|defdelegate|defexception|defguard|defguardp|defimpl|defmacro|defmacrop|defmodule|defn|defnp|defoverridable|defp|defprotocol|defstruct)$"))
(#match? @keyword "^(def|defdelegate|defexception|defguard|defguardp|defimpl|defmacro|defmacrop|defmodule|defn|defnp|defoverridable|defp|defprotocol|defstruct)$"))
(call
target: (identifier) @keyword
(.match? @keyword "^(alias|case|cond|else|for|if|import|quote|raise|receive|require|reraise|super|throw|try|unless|unquote|unquote_splicing|use|with)$"))
(#match? @keyword "^(alias|case|cond|else|for|if|import|quote|raise|receive|require|reraise|super|throw|try|unless|unquote|unquote_splicing|use|with)$"))
(
(identifier) @constant.builtin
(.match? @constant.builtin "^(__MODULE__|__DIR__|__ENV__|__CALLER__|__STACKTRACE__)$")
(#match? @constant.builtin "^(__MODULE__|__DIR__|__ENV__|__CALLER__|__STACKTRACE__)$")
)
(unary_operator
@ -121,7 +121,7 @@
(sigil)
(boolean)
] @comment.doc))
(.match? @__attribute__ "^(moduledoc|typedoc|doc)$"))
(#match? @__attribute__ "^(moduledoc|typedoc|doc)$"))
(comment) @comment
@ -150,4 +150,4 @@
((sigil
(sigil_name) @_sigil_name
(quoted_content) @embedded)
(.eq? @_sigil_name "H"))
(#eq? @_sigil_name "H"))

View file

@ -3,5 +3,5 @@
((sigil
(sigil_name) @_sigil_name
(quoted_content) @content)
(.eq? @_sigil_name "H")
(.set! language "heex"))
(#eq? @_sigil_name "H")
(#set! language "heex"))

View file

@ -1,7 +1,7 @@
(call
target: (identifier) @context
(arguments (alias) @name)
(.match? @context "^(defmodule|defprotocol)$")) @item
(#match? @context "^(defmodule|defprotocol)$")) @item
(call
target: (identifier) @context
@ -23,4 +23,4 @@
")" @context.extra))
operator: "when")
])
(.match? @context "^(def|defp|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp)$")) @item
(#match? @context "^(def|defp|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp)$")) @item

View file

@ -1,2 +1,2 @@
((glsl_content) @content
(.set! "language" "glsl"))
(#set! "language" "glsl"))

View file

@ -1,7 +1,7 @@
((code) @content
(.set! "language" "ruby")
(.set! "combined"))
(#set! "language" "ruby")
(#set! "combined"))
((content) @content
(.set! "language" "html")
(.set! "combined"))
(#set! "language" "html")
(#set! "combined"))

View file

@ -74,7 +74,7 @@
(sized_type_specifier) @type
((identifier) @constant
(.match? @constant "^[A-Z][A-Z\\d_]*$"))
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
(identifier) @variable
@ -114,5 +114,5 @@
(
(identifier) @variable.builtin
(.match? @variable.builtin "^gl_")
(#match? @variable.builtin "^gl_")
)

View file

@ -5,9 +5,9 @@
(expression_value)
(ending_expression_value)
] @content)
(.set! language "elixir")
(.set! combined)
(#set! language "elixir")
(#set! combined)
)
((expression (expression_value) @content)
(.set! language "elixir"))
(#set! language "elixir"))

View file

@ -1,7 +1,7 @@
(script_element
(raw_text) @content
(.set! "language" "javascript"))
(#set! "language" "javascript"))
(style_element
(raw_text) @content
(.set! "language" "css"))
(#set! "language" "css"))

View file

@ -44,7 +44,7 @@
; Special identifiers
((identifier) @type
(.match? @type "^[A-Z]"))
(#match? @type "^[A-Z]"))
(type_identifier) @type
(predefined_type) @type.builtin
@ -53,7 +53,7 @@
(shorthand_property_identifier)
(shorthand_property_identifier_pattern)
] @constant
(.match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
(#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
; Literals
@ -214,4 +214,4 @@
"type"
"readonly"
"override"
] @keyword
] @keyword

View file

@ -127,7 +127,7 @@
(identifier) @variable
((identifier) @variable.special
(.eq? @variable.special "self"))
(#eq? @variable.special "self"))
(variable_list
attribute: (attribute
@ -137,7 +137,7 @@
;; Constants
((identifier) @constant
(.match? @constant "^[A-Z][A-Z_0-9]*$"))
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
(vararg_expression) @constant
@ -158,7 +158,7 @@
[
"{"
"}"
] @method.constructor)
] @constructor)
;; Functions
@ -180,7 +180,7 @@
(function_call
(identifier) @function.builtin
(.any-of? @function.builtin
(#any-of? @function.builtin
;; built-in functions in Lua 5.1
"assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs"
"load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print"
@ -195,4 +195,4 @@
(number) @number
(string) @string
(string) @string

View file

@ -43,15 +43,15 @@
(relative_scope) @variable.builtin
((name) @constant
(.match? @constant "^_?[A-Z][A-Z\\d_]+$"))
(#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
((name) @constant.builtin
(.match? @constant.builtin "^__[A-Z][A-Z\d_]+__$"))
(#match? @constant.builtin "^__[A-Z][A-Z\d_]+__$"))
((name) @method.constructor
(.match? @method.constructor "^[A-Z]"))
((name) @constructor
(#match? @constructor "^[A-Z]"))
((name) @variable.builtin
(.eq? @variable.builtin "this"))
(#eq? @variable.builtin "this"))
(variable_name) @variable

View file

@ -1,3 +1,3 @@
((text) @content
(.set! "language" "html")
(.set! "combined"))
(#set! "language" "html")
(#set! "combined"))

View file

@ -18,16 +18,16 @@
; Identifier naming conventions
((identifier) @type
(.match? @type "^[A-Z]"))
(#match? @type "^[A-Z]"))
((identifier) @constant
(.match? @constant "^_*[A-Z][A-Z\\d_]*$"))
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
; Builtin functions
((call
function: (identifier) @function.builtin)
(.match?
(#match?
@function.builtin
"^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
@ -122,4 +122,4 @@
"yield"
"match"
"case"
] @keyword
] @keyword

File diff suppressed because one or more lines are too long

View file

@ -6,5 +6,5 @@
(symbol) @name
(list . (symbol) @name)
]
(.match? @start-symbol "^define")
) @item
(#match? @start-symbol "^define")
) @item

View file

@ -11,4 +11,4 @@
(begin "begin" @open "end" @close)
(module "module" @open "end" @close)
(_ . "def" @open "end" @close)
(_ . "class" @open "end" @close)
(_ . "class" @open "end" @close)

View file

@ -33,12 +33,12 @@
(identifier) @variable
((identifier) @keyword
(.match? @keyword "^(private|protected|public)$"))
(#match? @keyword "^(private|protected|public)$"))
; Function calls
((identifier) @function.method.builtin
(.eq? @function.method.builtin "require"))
(#eq? @function.method.builtin "require"))
"defined?" @function.method.builtin
@ -60,7 +60,7 @@
] @property
((identifier) @constant.builtin
(.match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
(#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
(file) @constant.builtin
(line) @constant.builtin
@ -71,7 +71,7 @@
) @constant.builtin
((constant) @constant
(.match? @constant "^[A-Z\\d_]+$"))
(#match? @constant "^[A-Z\\d_]+$"))
(constant) @type

View file

@ -38,11 +38,11 @@
; Assume uppercase names are types/enum-constructors
((identifier) @type
(.match? @type "^[A-Z]"))
(#match? @type "^[A-Z]"))
; Assume all-caps names are constants
((identifier) @constant
(.match? @constant "^_*[A-Z][A-Z\\d_]*$"))
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
[
"("

View file

@ -1,7 +1,7 @@
(macro_invocation
(token_tree) @content
(.set! "language" "rust"))
(#set! "language" "rust"))
(macro_rule
(token_tree) @content
(.set! "language" "rust"))
(#set! "language" "rust"))

View file

@ -14,7 +14,7 @@
(directive)] @comment
((symbol) @operator
(.match? @operator "^(\\+|-|\\*|/|=|>|<|>=|<=)$"))
(#match? @operator "^(\\+|-|\\*|/|=|>|<|>=|<=)$"))
(list
.
@ -23,6 +23,6 @@
(list
.
(symbol) @keyword
(.match? @keyword
(#match? @keyword
"^(define-syntax|let\\*|lambda|λ|case|=>|quote-splicing|unquote-splicing|set!|let|letrec|letrec-syntax|let-values|let\\*-values|do|else|define|cond|syntax-rules|unquote|begin|quote|let-syntax|and|if|quasiquote|letrec|delay|or|when|unless|identifier-syntax|assert|library|export|import|rename|only|except|prefix)$"
))

View file

@ -6,5 +6,5 @@
(symbol) @name
(list . (symbol) @name)
]
(.match? @start-symbol "^define")
) @item
(#match? @start-symbol "^define")
) @item

View file

@ -2,27 +2,27 @@
; --------------
(script_element
(raw_text) @content
(.set! "language" "javascript"))
(#set! "language" "javascript"))
((script_element
(start_tag
(attribute
(quoted_attribute_value (attribute_value) @_language)))
(raw_text) @content)
(.eq? @_language "ts")
(.set! "language" "typescript"))
(#eq? @_language "ts")
(#set! "language" "typescript"))
((script_element
(start_tag
(attribute
(quoted_attribute_value (attribute_value) @_language)))
(raw_text) @content)
(.eq? @_language "typescript")
(.set! "language" "typescript"))
(#eq? @_language "typescript")
(#set! "language" "typescript"))
(style_element
(raw_text) @content
(.set! "language" "css"))
(#set! "language" "css"))
((raw_text_expr) @content
(.set! "language" "javascript"))
(#set! "language" "javascript"))

View file

@ -43,11 +43,11 @@
; Special identifiers
((identifier) @method.constructor
(.match? @method.constructor "^[A-Z]"))
((identifier) @constructor
(#match? @constructor "^[A-Z]"))
((identifier) @type
(.match? @type "^[A-Z]"))
(#match? @type "^[A-Z]"))
(type_identifier) @type
(predefined_type) @type.builtin
@ -56,7 +56,7 @@
(shorthand_property_identifier)
(shorthand_property_identifier_pattern)
] @constant
(.match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
(#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
; Literals
@ -218,4 +218,4 @@
"type"
"readonly"
"override"
] @keyword
] @keyword

View file

@ -981,7 +981,9 @@ mod tests {
.await;
let project = Project::test(app_state.fs.clone(), ["/root".as_ref()], cx).await;
let (_, workspace) = cx.add_window(|cx| Workspace::test_new(project, cx));
let workspace = cx
.add_window(|cx| Workspace::test_new(project, cx))
.root(cx);
let entries = cx.read(|cx| workspace.file_project_paths(cx));
let file1 = entries[0].clone();
@ -1293,7 +1295,9 @@ mod tests {
.await;
let project = Project::test(app_state.fs.clone(), ["/root".as_ref()], cx).await;
let (window_id, workspace) = cx.add_window(|cx| Workspace::test_new(project, cx));
let window = cx.add_window(|cx| Workspace::test_new(project, cx));
let workspace = window.root(cx);
let window_id = window.window_id();
// Open a file within an existing worktree.
workspace
@ -1334,7 +1338,9 @@ mod tests {
let project = Project::test(app_state.fs.clone(), ["/root".as_ref()], cx).await;
project.update(cx, |project, _| project.languages().add(rust_lang()));
let (window_id, workspace) = cx.add_window(|cx| Workspace::test_new(project, cx));
let window = cx.add_window(|cx| Workspace::test_new(project, cx));
let workspace = window.root(cx);
let window_id = window.window_id();
let worktree = cx.read(|cx| workspace.read(cx).worktrees(cx).next().unwrap());
// Create a new untitled buffer
@ -1427,7 +1433,9 @@ mod tests {
let project = Project::test(app_state.fs.clone(), [], cx).await;
project.update(cx, |project, _| project.languages().add(rust_lang()));
let (window_id, workspace) = cx.add_window(|cx| Workspace::test_new(project, cx));
let window = cx.add_window(|cx| Workspace::test_new(project, cx));
let workspace = window.root(cx);
let window_id = window.window_id();
// Create a new untitled buffer
cx.dispatch_action(window_id, NewFile);
@ -1478,7 +1486,9 @@ mod tests {
.await;
let project = Project::test(app_state.fs.clone(), ["/root".as_ref()], cx).await;
let (window_id, workspace) = cx.add_window(|cx| Workspace::test_new(project, cx));
let window = cx.add_window(|cx| Workspace::test_new(project, cx));
let workspace = window.root(cx);
let window_id = window.window_id();
let entries = cx.read(|cx| workspace.file_project_paths(cx));
let file1 = entries[0].clone();
@ -1552,7 +1562,9 @@ mod tests {
.await;
let project = Project::test(app_state.fs.clone(), ["/root".as_ref()], cx).await;
let (_, workspace) = cx.add_window(|cx| Workspace::test_new(project.clone(), cx));
let workspace = cx
.add_window(|cx| Workspace::test_new(project.clone(), cx))
.root(cx);
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
let entries = cx.read(|cx| workspace.file_project_paths(cx));
@ -1829,7 +1841,9 @@ mod tests {
.await;
let project = Project::test(app_state.fs.clone(), ["/root".as_ref()], cx).await;
let (_, workspace) = cx.add_window(|cx| Workspace::test_new(project, cx));
let workspace = cx
.add_window(|cx| Workspace::test_new(project, cx))
.root(cx);
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
let entries = cx.read(|cx| workspace.file_project_paths(cx));
@ -2071,7 +2085,8 @@ mod tests {
cx.foreground().run_until_parked();
let (window_id, _view) = cx.add_window(|_| TestView);
let window = cx.add_window(|_| TestView);
let window_id = window.window_id();
// Test loading the keymap base at all
assert_key_bindings_for(
@ -2241,7 +2256,8 @@ mod tests {
cx.foreground().run_until_parked();
let (window_id, _view) = cx.add_window(|_| TestView);
let window = cx.add_window(|_| TestView);
let window_id = window.window_id();
// Test loading the keymap base at all
assert_key_bindings_for(