Merge remote-tracking branch 'origin/main' into assistant-2

This commit is contained in:
Antonio Scandurra 2023-06-07 09:34:16 +02:00
commit 0dae8f2dd8
35 changed files with 343 additions and 238 deletions

View file

@ -1,20 +1,5 @@
["when" "and" "or" "not" "in" "not in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword
(unary_operator
operator: "@" @comment.doc
operand: (call
target: (identifier) @comment.doc.__attribute__
(arguments
[
(string) @comment.doc
(charlist) @comment.doc
(sigil
quoted_start: _ @comment.doc
quoted_end: _ @comment.doc) @comment.doc
(boolean) @comment.doc
]))
(#match? @comment.doc.__attribute__ "^(moduledoc|typedoc|doc)$"))
(unary_operator
operator: "&"
operand: (integer) @operator)
@ -84,6 +69,11 @@
quoted_start: _ @string.special
quoted_end: _ @string.special) @string.special
(
(identifier) @comment.unused
(#match? @comment.unused "^_")
)
(call
target: [
(identifier) @function
@ -99,17 +89,12 @@
(binary_operator
left: (identifier) @function
operator: "when")
(binary_operator
operator: "|>"
right: (identifier))
])
(#match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$"))
(call
target: (identifier) @keyword
(arguments
(binary_operator
operator: "|>"
right: (identifier)))
(#match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$"))
(binary_operator
operator: "|>"
right: (identifier) @function)
@ -127,10 +112,18 @@
(#match? @constant.builtin "^(__MODULE__|__DIR__|__ENV__|__CALLER__|__STACKTRACE__)$")
)
(
(identifier) @comment.unused
(#match? @comment.unused "^_")
)
(unary_operator
operator: "@" @comment.doc
operand: (call
target: (identifier) @__attribute__ @comment.doc
(arguments
[
(string)
(charlist)
(sigil)
(boolean)
] @comment.doc))
(#match? @__attribute__ "^(moduledoc|typedoc|doc)$"))
(comment) @comment

View file

@ -1,6 +1,4 @@
[
(call)
] @indent
(call) @indent
(_ "[" "]" @end) @indent
(_ "{" "}" @end) @indent

View file

@ -8,9 +8,19 @@
(arguments
[
(identifier) @name
(call target: (identifier) @name)
(call
target: (identifier) @name
(arguments
"(" @context.extra
_* @context.extra
")" @context.extra))
(binary_operator
left: (call target: (identifier) @name)
left: (call
target: (identifier) @name
(arguments
"(" @context.extra
_* @context.extra
")" @context.extra))
operator: "when")
])
(#match? @context "^(def|defp|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp)$")) @item

View file

@ -6,7 +6,7 @@ use gpui::AppContext;
use language::{LanguageRegistry, LanguageServerBinary, LanguageServerName, LspAdapter};
use node_runtime::NodeRuntime;
use serde_json::json;
use settings::{keymap_file_json_schema, SettingsJsonSchemaParams, SettingsStore};
use settings::{KeymapFile, SettingsJsonSchemaParams, SettingsStore};
use smol::fs;
use staff_mode::StaffMode;
use std::{
@ -143,7 +143,7 @@ impl LspAdapter for JsonLspAdapter {
},
{
"fileMatch": [schema_file_match(&paths::KEYMAP)],
"schema": keymap_file_json_schema(&action_names),
"schema": KeymapFile::generate_json_schema(&action_names),
}
]
}

View file

@ -14,11 +14,11 @@
(list_marker_parenthesis)
] @punctuation.list_marker
[
(indented_code_block)
(fenced_code_block)
(code_span)
] @text.literal
(code_span) @text.literal
(fenced_code_block
(info_string
(language) @text.literal))
(link_destination) @link_uri
(link_text) @link_text

View file

@ -327,10 +327,10 @@ mod tests {
.map(|item| (item.text.as_str(), item.depth))
.collect::<Vec<_>>(),
&[
("function a ( )", 0),
("async function a2 ( )", 1),
("function a()", 0),
("async function a2()", 1),
("let b", 0),
("function getB ( )", 0),
("function getB()", 0),
("const d", 0),
]
);