add
This commit is contained in:
1 parent
bd49911eca
commit
e3de01bde8
3742 files changed
+64316
No files matched your search
@@ -0,0 +1,95 @@
|
||||
theme = "monokai_custom"
|
||||
|
||||
[editor]
|
||||
auto-save.focus-lost = true # default: false
|
||||
auto-save.after-delay.enable = true # default: false
|
||||
auto-save.after-delay.timeout = 500 # range: [0; u64::MAX] default: 3000
|
||||
color-modes = true
|
||||
bufferline = "multiple"
|
||||
preview-completion-insert = false
|
||||
completion-replace = true
|
||||
|
||||
[editor.lsp]
|
||||
display-inlay-hints = true
|
||||
display-messages = true
|
||||
|
||||
[editor.cursor-shape]
|
||||
insert = "bar"
|
||||
normal = "block"
|
||||
select = "underline"
|
||||
|
||||
[editor.file-picker]
|
||||
hidden = false
|
||||
|
||||
[editor.indent-guides]
|
||||
render = true
|
||||
|
||||
[editor.statusline]
|
||||
left = ["mode", "spinner", "version-control", "spacer", "diagnostics"]
|
||||
center = ["file-name"]
|
||||
right = ["position", "total-line-numbers", "separator", "file-encoding", "file-line-ending", "file-type"]
|
||||
separator = "│"
|
||||
mode.normal = "NORMAL"
|
||||
mode.insert = "INSERT"
|
||||
mode.select = "SELECT"
|
||||
|
||||
[editor.inline-diagnostics]
|
||||
cursor-line = "hint"
|
||||
other-lines = "error"
|
||||
|
||||
[keys.normal]
|
||||
"S-A-e" = ":fmt"
|
||||
"C-h" = "toggle_comments"
|
||||
"C-c" = ":clipboard-yank"
|
||||
"C-x" = [":clipboard-yank", "delete_selection"]
|
||||
"C-v" = ":clipboard-paste-replace"
|
||||
|
||||
# custom movements and key swaps
|
||||
"n" = "move_char_right"
|
||||
"s" = "move_char_left"
|
||||
"h" = "move_visual_line_down"
|
||||
"l" = "move_visual_line_up"
|
||||
|
||||
"j" = "select_regex"
|
||||
"C-i" = "page_cursor_half_down"
|
||||
|
||||
"C-d" = ["search_selection", "select_mode", "extend_search_next", "normal_mode"]
|
||||
"tab" = "indent"
|
||||
"S-tab" = "unindent"
|
||||
A-down = ["extend_to_line_bounds", "delete_selection", "paste_after"]
|
||||
A-up = ["extend_to_line_bounds", "delete_selection", "move_line_up", "paste_before"]
|
||||
|
||||
"C-q" = ":quit"
|
||||
|
||||
[keys.select]
|
||||
"S-A-e" = ":fmt"
|
||||
"C-h" = "toggle_comments"
|
||||
"C-c" = ":clipboard-yank"
|
||||
"C-x" = [":clipboard-yank", "delete_selection"]
|
||||
"C-v" = ":clipboard-paste-replace"
|
||||
|
||||
# custom movements and key swaps
|
||||
"n" = "extend_char_right"
|
||||
"s" = "extend_char_left"
|
||||
"h" = "extend_visual_line_down"
|
||||
"l" = "extend_visual_line_up"
|
||||
|
||||
"j" = "select_regex"
|
||||
"k" = "extend_search_next"
|
||||
"K" = "extend_search_prev"
|
||||
|
||||
"tab" = "indent"
|
||||
"S-tab" = "unindent"
|
||||
|
||||
[keys.insert]
|
||||
"S-A-e" = ":fmt"
|
||||
"C-h" = "toggle_comments"
|
||||
"C-c" = ":clipboard-yank"
|
||||
"C-x" = [":clipboard-yank", "delete_selection"]
|
||||
"C-v" = ":clipboard-paste-replace"
|
||||
|
||||
"C-space" = "completion"
|
||||
|
||||
A-down = ["extend_to_line_bounds", "delete_selection", "paste_after", "move_line_down"]
|
||||
A-up = ["extend_to_line_bounds", "delete_selection", "move_line_up", "paste_before", "move_line_up"]
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
target/**
|
||||
@@ -0,0 +1,84 @@
|
||||
[language-server]
|
||||
emmet-ls = { command = "emmet-ls", args = [ "--stdio" ]}
|
||||
|
||||
[language-server.eslint]
|
||||
command = "vscode-eslint-language-server"
|
||||
args = ["--stdio"]
|
||||
|
||||
[language-server.eslint.config]
|
||||
codeActionsOnSave = { mode = "all", "source.fixAll.eslint" = true }
|
||||
format = { enable = true }
|
||||
nodePath = ""
|
||||
quiet = false
|
||||
rulesCustomizations = []
|
||||
run = "onType"
|
||||
validate = "on"
|
||||
experimental = {}
|
||||
problems = { shortenToSingleLine = false }
|
||||
|
||||
[language-server.eslint.config.codeAction]
|
||||
disableRuleComment = { enable = true, location = "separateLine" }
|
||||
showDocumentation = { enable = true }
|
||||
|
||||
[language-server.eslint.config.workingDirectory]
|
||||
mode = "location"
|
||||
|
||||
[language-server.vscode-json-language-server.config]
|
||||
json = { validate = { enable = true }, format = { enable = true } }
|
||||
provideFormatter = true
|
||||
|
||||
[language-server.vscode-css-language-server.config]
|
||||
css = { validate = { enable = true } }
|
||||
scss = { validate = { enable = true } }
|
||||
less = { validate = { enable = true } }
|
||||
provideFormatter = true
|
||||
|
||||
[language-server.cssmodules]
|
||||
command = "cssmodules-language-server"
|
||||
args = []
|
||||
|
||||
[language-server.rust-analyzer]
|
||||
config = { cargo = { features = "all" } }
|
||||
|
||||
[language-server.gpt]
|
||||
command = "helix-gpt"
|
||||
args = ["--handler", "copilot", "--copilotApiKey", "KEY_HERE"]
|
||||
|
||||
[[language]]
|
||||
name = "typescript"
|
||||
indent = { tab-width = 4, unit = " " }
|
||||
language-servers = [ "typescript-language-server", "eslint", "emmet-ls" ]
|
||||
|
||||
[[language]]
|
||||
name = "tsx"
|
||||
indent = { tab-width = 4, unit = " " }
|
||||
language-servers = [ "typescript-language-server", "eslint", "cssmodules", "emmet-ls" ]
|
||||
# auto-format = true
|
||||
|
||||
[[language]]
|
||||
name = "rust"
|
||||
indent = { tab-width = 4, unit = " " }
|
||||
formatter = { command = "rustfmt" }
|
||||
auto-format = false
|
||||
|
||||
[[language]]
|
||||
name = "scss"
|
||||
indent = { tab-width = 4, unit = " " }
|
||||
language-servers = [ "vscode-css-language-server", "cssmodules" ]
|
||||
auto-format = true
|
||||
|
||||
[[grammar]]
|
||||
name = "scss"
|
||||
# source = { path = "/home/julien/code/tree-sitter-scss" }
|
||||
source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-scss", rev = "8f47fa8be72ac299cab4c6aa02668635f2dcd4be" }
|
||||
|
||||
[[language]]
|
||||
name = "toml"
|
||||
language-servers = [
|
||||
"gpt",
|
||||
]
|
||||
|
||||
[[language]]
|
||||
name = "ocaml"
|
||||
indent = { tab-width = 4, unit = " " }
|
||||
formatter = { command = "ocamlformat", args=["-", "--impl", "--enable-outside-detected-project"] }
|
||||
@@ -0,0 +1,38 @@
|
||||
; Opening elements
|
||||
; ----------------
|
||||
|
||||
(jsx_opening_element (identifier) @tag)
|
||||
|
||||
; Closing elements
|
||||
; ----------------
|
||||
|
||||
(jsx_closing_element (identifier) @tag)
|
||||
|
||||
; Self-closing elements
|
||||
; ---------------------
|
||||
|
||||
(jsx_self_closing_element (identifier) @tag)
|
||||
|
||||
; Attributes
|
||||
; ----------
|
||||
|
||||
(jsx_attribute (property_identifier) @attribute.jsx)
|
||||
|
||||
; Punctuation
|
||||
; -----------
|
||||
|
||||
; Handle attribute delimiter (<Component color="red"/>)
|
||||
(jsx_attribute "=" @operator)
|
||||
|
||||
; <Component>
|
||||
(jsx_opening_element ["<" ">"] @punctuation.bracket)
|
||||
|
||||
; </Component>
|
||||
(jsx_closing_element ["</" ">"] @punctuation.bracket)
|
||||
|
||||
; <Component />
|
||||
(jsx_self_closing_element ["<" "/>"] @punctuation.bracket)
|
||||
|
||||
; Brackets inside jsx ({children})
|
||||
(jsx_expression ["{" "}"] @punctuation.embedded.jsx)
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
"sizeof" @keyword
|
||||
|
||||
[
|
||||
"enum"
|
||||
"struct"
|
||||
"typedef"
|
||||
"union"
|
||||
] @keyword.storage.type
|
||||
|
||||
[
|
||||
"extern"
|
||||
"register"
|
||||
(type_qualifier)
|
||||
(storage_class_specifier)
|
||||
] @keyword.storage.modifier
|
||||
|
||||
[
|
||||
"goto"
|
||||
"break"
|
||||
"continue"
|
||||
] @keyword.control
|
||||
|
||||
[
|
||||
"do"
|
||||
"for"
|
||||
"while"
|
||||
] @keyword.control.repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
"case"
|
||||
"default"
|
||||
] @keyword.control.conditional
|
||||
|
||||
"return" @keyword.control.return
|
||||
|
||||
[
|
||||
"defined"
|
||||
"#define"
|
||||
"#elif"
|
||||
"#else"
|
||||
"#endif"
|
||||
"#if"
|
||||
"#ifdef"
|
||||
"#ifndef"
|
||||
"#include"
|
||||
] @keyword
|
||||
|
||||
(preproc_directive) @keyword.directive
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"++"
|
||||
"--"
|
||||
"%"
|
||||
"=="
|
||||
"!="
|
||||
">"
|
||||
"<"
|
||||
">="
|
||||
"<="
|
||||
"&&"
|
||||
"||"
|
||||
"!"
|
||||
"&"
|
||||
"|"
|
||||
"^"
|
||||
"~"
|
||||
"<<"
|
||||
">>"
|
||||
"="
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"<<="
|
||||
">>="
|
||||
"&="
|
||||
"^="
|
||||
"|="
|
||||
"?"
|
||||
] @operator
|
||||
|
||||
(conditional_expression ":" @operator)
|
||||
|
||||
"..." @punctuation
|
||||
|
||||
["," "." ":" ";" "->" "::"] @punctuation.delimiter
|
||||
|
||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
|
||||
[(true) (false)] @constant.builtin.boolean
|
||||
|
||||
(enumerator name: (identifier) @type.enum.variant)
|
||||
|
||||
(string_literal) @string
|
||||
(system_lib_string) @string
|
||||
|
||||
(null) @constant
|
||||
(number_literal) @constant.numeric
|
||||
(char_literal) @constant.character
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function))
|
||||
(call_expression (argument_list (identifier) @variable))
|
||||
(function_declarator
|
||||
declarator: [(identifier) (field_identifier)] @function)
|
||||
(parameter_declaration
|
||||
declarator: (identifier) @variable.parameter)
|
||||
(parameter_declaration
|
||||
(pointer_declarator
|
||||
declarator: (identifier) @variable.parameter))
|
||||
(preproc_function_def
|
||||
name: (identifier) @function.special)
|
||||
|
||||
(attribute
|
||||
name: (identifier) @attribute)
|
||||
|
||||
(field_identifier) @variable.other.member
|
||||
(statement_identifier) @label
|
||||
(type_identifier) @type
|
||||
(primitive_type) @type.builtin
|
||||
(sized_type_specifier) @type.builtin
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(comment) @comment
|
||||
|
||||
; -----
|
||||
; custom string
|
||||
; -----
|
||||
(string_literal [
|
||||
"\""
|
||||
"'"
|
||||
] @string.delimiter)
|
||||
@@ -0,0 +1,159 @@
|
||||
; Modules
|
||||
;--------
|
||||
|
||||
[(module_name) (module_type_name)] @namespace
|
||||
|
||||
; Types
|
||||
;------
|
||||
|
||||
(
|
||||
(type_constructor) @type.builtin
|
||||
(#match? @type.builtin "^(int|char|bytes|string|float|bool|unit|exn|array|list|option|int32|int64|nativeint|format6|lazy_t)$")
|
||||
)
|
||||
|
||||
[(class_name) (class_type_name) (type_constructor)] @type
|
||||
|
||||
[(constructor_name) (tag)] @constructor
|
||||
|
||||
; Functions
|
||||
;----------
|
||||
|
||||
(let_binding
|
||||
pattern: (value_name) @function
|
||||
(parameter))
|
||||
|
||||
(let_binding
|
||||
pattern: (value_name) @function
|
||||
body: [(fun_expression) (function_expression)])
|
||||
|
||||
(value_specification (value_name) @function)
|
||||
|
||||
(external (value_name) @function)
|
||||
|
||||
(method_name) @function.method
|
||||
|
||||
; Application
|
||||
;------------
|
||||
|
||||
(
|
||||
(value_name) @function.builtin
|
||||
(#match? @function.builtin "^(raise(_notrace)?|failwith|invalid_arg)$")
|
||||
)
|
||||
|
||||
(infix_expression
|
||||
left: (value_path (value_name) @function)
|
||||
operator: (concat_operator) @operator
|
||||
(#eq? @operator "@@"))
|
||||
|
||||
(infix_expression
|
||||
operator: (rel_operator) @operator
|
||||
right: (value_path (value_name) @function)
|
||||
(#eq? @operator "|>"))
|
||||
|
||||
(application_expression
|
||||
function: (value_path (value_name) @function))
|
||||
|
||||
; Variables
|
||||
;----------
|
||||
|
||||
[(value_name) (type_variable)] @variable
|
||||
|
||||
(value_pattern) @variable.parameter
|
||||
|
||||
; Properties
|
||||
;-----------
|
||||
|
||||
[(label_name) (field_name) (instance_variable_name)] @variable.other.member
|
||||
|
||||
; Constants
|
||||
;----------
|
||||
|
||||
(boolean) @constant.builtin.boolean
|
||||
|
||||
[(number) (signed_number)] @constant.numeric
|
||||
|
||||
[(string) (character)] @string
|
||||
|
||||
(quoted_string "{" @string "}" @string) @string
|
||||
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
(conversion_specification) @string.special
|
||||
|
||||
; Operators
|
||||
;----------
|
||||
|
||||
(match_expression (match_operator) @keyword)
|
||||
|
||||
(value_definition [(let_operator) (let_and_operator)] @keyword)
|
||||
|
||||
[
|
||||
(prefix_operator)
|
||||
(sign_operator)
|
||||
(pow_operator)
|
||||
(mult_operator)
|
||||
(add_operator)
|
||||
(concat_operator)
|
||||
(rel_operator)
|
||||
(and_operator)
|
||||
(or_operator)
|
||||
(assign_operator)
|
||||
(hash_operator)
|
||||
(indexing_operator)
|
||||
(let_operator)
|
||||
(let_and_operator)
|
||||
(match_operator)
|
||||
] @operator
|
||||
|
||||
["*" "#" "::" "<-"] @operator
|
||||
|
||||
; Keywords
|
||||
;---------
|
||||
|
||||
[
|
||||
"and" "as" "assert" "begin" "class" "constraint" "do" "done" "downto" "else"
|
||||
"end" "exception" "external" "for" "fun" "function" "functor" "if" "in"
|
||||
"include" "inherit" "initializer" "lazy" "let" "match" "method" "module"
|
||||
"mutable" "new" "nonrec" "object" "of" "open" "private" "rec" "sig" "struct"
|
||||
"then" "to" "try" "type" "val" "virtual" "when" "while" "with"
|
||||
] @keyword
|
||||
|
||||
; Punctuation
|
||||
;------------
|
||||
|
||||
(attribute ["[@" "]"] @punctuation.special)
|
||||
(item_attribute ["[@@" "]"] @punctuation.special)
|
||||
(floating_attribute ["[@@@" "]"] @punctuation.special)
|
||||
(extension ["[%" "]"] @punctuation.special)
|
||||
(item_extension ["[%%" "]"] @punctuation.special)
|
||||
(quoted_extension ["{%" "}"] @punctuation.special)
|
||||
(quoted_item_extension ["{%%" "}"] @punctuation.special)
|
||||
|
||||
"%" @punctuation.special
|
||||
|
||||
["(" ")" "[" "]" "{" "}" "[|" "|]" "[<" "[>"] @punctuation.bracket
|
||||
|
||||
(object_type ["<" ">"] @punctuation.bracket)
|
||||
|
||||
[
|
||||
"," "." ";" ":" "=" "|" "~" "?" "+" "-" "!" ">" "&"
|
||||
"->" ";;" ":>" "+=" ":=" ".."
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Attributes
|
||||
;-----------
|
||||
|
||||
(attribute_id) @tag
|
||||
|
||||
; Comments
|
||||
;---------
|
||||
|
||||
[(comment) (line_number_directive) (directive) (shebang)] @comment
|
||||
|
||||
; -----
|
||||
; custom string
|
||||
; -----
|
||||
(string [
|
||||
"\""
|
||||
"'"
|
||||
] @string.delimiter)
|
||||
@@ -0,0 +1,429 @@
|
||||
; -------
|
||||
; Tree-Sitter doesn't allow overrides in regards to captures,
|
||||
; though it is possible to affect the child node of a captured
|
||||
; node. Thus, the approach here is to flip the order so that
|
||||
; overrides are unnecessary.
|
||||
; -------
|
||||
|
||||
; -------
|
||||
; Types
|
||||
; -------
|
||||
|
||||
(type_parameters
|
||||
(type_identifier) @type.parameter)
|
||||
(constrained_type_parameter
|
||||
left: (type_identifier) @type.parameter)
|
||||
(optional_type_parameter
|
||||
name: (type_identifier) @type.parameter)
|
||||
|
||||
; ---
|
||||
; Primitives
|
||||
; ---
|
||||
|
||||
(escape_sequence) @constant.character.escape
|
||||
(primitive_type) @type.builtin
|
||||
(boolean_literal) @constant.builtin.boolean
|
||||
(integer_literal) @constant.numeric.integer
|
||||
(float_literal) @constant.numeric.float
|
||||
(char_literal) @constant.character
|
||||
[
|
||||
(string_literal)
|
||||
(raw_string_literal)
|
||||
(string_content)
|
||||
] @string
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @comment
|
||||
|
||||
; ---
|
||||
; Extraneous
|
||||
; ---
|
||||
|
||||
(self) @variable.builtin.self
|
||||
(enum_variant (identifier) @type.enum.variant)
|
||||
|
||||
(field_initializer
|
||||
(field_identifier) @variable.other.member)
|
||||
(shorthand_field_initializer
|
||||
(identifier) @variable.other.member)
|
||||
(shorthand_field_identifier) @variable.other.member
|
||||
|
||||
(lifetime
|
||||
"'" @string.delimiter
|
||||
(identifier) @type)
|
||||
(label
|
||||
"'" @label
|
||||
(identifier) @label)
|
||||
|
||||
; ---
|
||||
; Punctuation
|
||||
; ---
|
||||
|
||||
[
|
||||
";"
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"::"
|
||||
"."
|
||||
":"
|
||||
] @punctuation.delimiter.rust
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"#"
|
||||
] @punctuation.bracket
|
||||
(type_arguments
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket)
|
||||
(type_parameters
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket)
|
||||
(closure_parameters
|
||||
"|" @punctuation.bracket)
|
||||
|
||||
; ---
|
||||
; Variables
|
||||
; ---
|
||||
|
||||
(let_declaration
|
||||
pattern: [
|
||||
((identifier) @variable)
|
||||
((tuple_pattern
|
||||
(identifier) @variable))
|
||||
])
|
||||
|
||||
; It needs to be anonymous to not conflict with `call_expression` further below.
|
||||
(_
|
||||
value: (field_expression
|
||||
value: (identifier)? @variable
|
||||
field: (field_identifier) @variable.other.member))
|
||||
|
||||
(parameter
|
||||
pattern: (identifier) @variable.parameter)
|
||||
(closure_parameters
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; -------
|
||||
; Keywords
|
||||
; -------
|
||||
|
||||
(for_expression
|
||||
"for" @keyword.control.repeat)
|
||||
((identifier) @keyword.control
|
||||
(#match? @keyword.control "^yield$"))
|
||||
|
||||
"in" @keyword.control
|
||||
|
||||
[
|
||||
"match"
|
||||
"if"
|
||||
"else"
|
||||
"try"
|
||||
] @keyword.control.conditional
|
||||
|
||||
[
|
||||
"while"
|
||||
"loop"
|
||||
] @keyword.control.repeat
|
||||
|
||||
[
|
||||
"break"
|
||||
"continue"
|
||||
"return"
|
||||
"await"
|
||||
] @keyword.control.return
|
||||
|
||||
"use" @keyword.control.import
|
||||
(mod_item "mod" @keyword.control.import !body)
|
||||
(use_as_clause "as" @keyword.control.import)
|
||||
|
||||
(type_cast_expression "as" @keyword.operator)
|
||||
|
||||
[
|
||||
(crate)
|
||||
(super)
|
||||
"as"
|
||||
"pub"
|
||||
"mod"
|
||||
"extern"
|
||||
|
||||
"impl"
|
||||
"where"
|
||||
"trait"
|
||||
"for"
|
||||
|
||||
"default"
|
||||
"async"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"struct"
|
||||
"enum"
|
||||
"union"
|
||||
"type"
|
||||
] @keyword.storage.type
|
||||
|
||||
"let" @keyword.storage
|
||||
"fn" @keyword.function
|
||||
"unsafe" @keyword.special
|
||||
"macro_rules!" @function.macro
|
||||
|
||||
(mutable_specifier) @keyword.storage.modifier.mut
|
||||
|
||||
(reference_type "&" @keyword.storage.modifier.ref)
|
||||
(self_parameter "&" @keyword.storage.modifier.ref)
|
||||
|
||||
[
|
||||
"static"
|
||||
"const"
|
||||
"ref"
|
||||
"move"
|
||||
"dyn"
|
||||
] @keyword.storage.modifier
|
||||
|
||||
; TODO: variable.mut to highlight mutable identifiers via locals.scm
|
||||
|
||||
; -------
|
||||
; Constructors
|
||||
; -------
|
||||
; TODO: this is largely guesswork, remove it once we get actual info from locals.scm or r-a
|
||||
|
||||
(struct_expression
|
||||
name: (type_identifier) @constructor)
|
||||
|
||||
(tuple_struct_pattern
|
||||
type: [
|
||||
(identifier) @constructor
|
||||
(scoped_identifier
|
||||
name: (identifier) @constructor)
|
||||
])
|
||||
(struct_pattern
|
||||
type: [
|
||||
((type_identifier) @constructor)
|
||||
(scoped_type_identifier
|
||||
name: (type_identifier) @constructor)
|
||||
])
|
||||
(match_pattern
|
||||
((identifier) @constructor) (#match? @constructor "^[A-Z]"))
|
||||
(or_pattern
|
||||
((identifier) @constructor)
|
||||
((identifier) @constructor)
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
; -------
|
||||
; Guess Other Types
|
||||
; -------
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
; ---
|
||||
; PascalCase identifiers in call_expressions (e.g. `Ok()`)
|
||||
; are assumed to be enum constructors.
|
||||
; ---
|
||||
|
||||
(call_expression
|
||||
function: [
|
||||
((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
(scoped_identifier
|
||||
name: ((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]")))
|
||||
])
|
||||
|
||||
; ---
|
||||
; PascalCase identifiers under a path which is also PascalCase
|
||||
; are assumed to be constructors if they have methods or fields.
|
||||
; ---
|
||||
|
||||
(field_expression
|
||||
value: (scoped_identifier
|
||||
path: [
|
||||
(identifier) @type
|
||||
(scoped_identifier
|
||||
name: (identifier) @type)
|
||||
]
|
||||
name: (identifier) @constructor
|
||||
(#match? @type "^[A-Z]")
|
||||
(#match? @constructor "^[A-Z]")))
|
||||
|
||||
; ---
|
||||
; Other PascalCase identifiers are assumed to be structs.
|
||||
; ---
|
||||
|
||||
((identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
; -------
|
||||
; Functions
|
||||
; -------
|
||||
|
||||
(call_expression
|
||||
function: [
|
||||
((identifier) @function)
|
||||
(scoped_identifier
|
||||
name: (identifier) @function)
|
||||
(field_expression
|
||||
field: (field_identifier) @function)
|
||||
])
|
||||
(generic_function
|
||||
function: [
|
||||
((identifier) @function)
|
||||
(scoped_identifier
|
||||
name: (identifier) @function)
|
||||
(field_expression
|
||||
field: (field_identifier) @function.method)
|
||||
])
|
||||
|
||||
(function_item
|
||||
name: (identifier) @function)
|
||||
|
||||
(function_signature_item
|
||||
name: (identifier) @function)
|
||||
|
||||
; ---
|
||||
; Macros
|
||||
; ---
|
||||
|
||||
(attribute
|
||||
(identifier) @special
|
||||
arguments: (token_tree (identifier) @type)
|
||||
(#eq? @special "derive")
|
||||
)
|
||||
|
||||
(attribute
|
||||
(identifier) @function.macro)
|
||||
(attribute
|
||||
[
|
||||
(identifier) @function.macro
|
||||
(scoped_identifier
|
||||
name: (identifier) @function.macro)
|
||||
]
|
||||
(token_tree (identifier) @function.macro)?)
|
||||
|
||||
(inner_attribute_item) @attribute
|
||||
|
||||
(macro_definition
|
||||
name: (identifier) @function.macro)
|
||||
(macro_invocation
|
||||
macro: [
|
||||
((identifier) @function.macro)
|
||||
(scoped_identifier
|
||||
name: (identifier) @function.macro)
|
||||
]
|
||||
"!" @function.macro)
|
||||
|
||||
(metavariable) @variable.parameter
|
||||
(fragment_specifier) @type
|
||||
|
||||
; -------
|
||||
; Operators
|
||||
; -------
|
||||
|
||||
[
|
||||
"*"
|
||||
"'"
|
||||
"->"
|
||||
"=>"
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
"!"
|
||||
"!="
|
||||
"%"
|
||||
"%="
|
||||
"&"
|
||||
"&="
|
||||
"&&"
|
||||
"|"
|
||||
"|="
|
||||
"||"
|
||||
"^"
|
||||
"^="
|
||||
"*"
|
||||
"*="
|
||||
"-"
|
||||
"-="
|
||||
"+"
|
||||
"+="
|
||||
"/"
|
||||
"/="
|
||||
">"
|
||||
"<"
|
||||
">="
|
||||
">>"
|
||||
"<<"
|
||||
">>="
|
||||
"<<="
|
||||
"@"
|
||||
".."
|
||||
"..="
|
||||
"'"
|
||||
] @operator
|
||||
|
||||
; -------
|
||||
; Paths
|
||||
; -------
|
||||
|
||||
(use_declaration
|
||||
argument: (identifier) @namespace)
|
||||
(use_wildcard
|
||||
(identifier) @namespace)
|
||||
(extern_crate_declaration
|
||||
name: (identifier) @namespace
|
||||
alias: (identifier)? @namespace)
|
||||
(mod_item
|
||||
name: (identifier) @namespace)
|
||||
(scoped_use_list
|
||||
path: (identifier)? @namespace)
|
||||
(use_list
|
||||
(identifier) @namespace)
|
||||
(use_as_clause
|
||||
path: (identifier)? @namespace
|
||||
alias: (identifier) @namespace)
|
||||
|
||||
; ---
|
||||
; Remaining Paths
|
||||
; ---
|
||||
|
||||
(scoped_identifier
|
||||
path: (identifier)? @namespace
|
||||
name: (identifier) @namespace)
|
||||
(scoped_type_identifier
|
||||
path: (identifier) @namespace)
|
||||
|
||||
; -------
|
||||
; Remaining Identifiers
|
||||
; -------
|
||||
|
||||
"?" @special
|
||||
|
||||
(type_identifier) @type
|
||||
(identifier) @variable
|
||||
(field_identifier) @variable.other.member
|
||||
|
||||
; -----
|
||||
; custom string
|
||||
; -----
|
||||
(string_literal [
|
||||
"\""
|
||||
"'"
|
||||
] @string.delimiter)
|
||||
|
||||
(lifetime
|
||||
"'" @string.delimiter)
|
||||
|
||||
(lifetime
|
||||
(identifier) @type)
|
||||
@@ -0,0 +1,127 @@
|
||||
[
|
||||
"@at-root"
|
||||
"@debug"
|
||||
"@error"
|
||||
"@extend"
|
||||
"@forward"
|
||||
"@mixin"
|
||||
"@use"
|
||||
"@warn"
|
||||
"@media"
|
||||
"="
|
||||
] @keyword
|
||||
|
||||
"@function" @keyword.function
|
||||
|
||||
"@return" @keyword.return
|
||||
|
||||
"@include" @keyword.import
|
||||
|
||||
[
|
||||
"@while"
|
||||
"@each"
|
||||
"@for"
|
||||
"from"
|
||||
"through"
|
||||
"in"
|
||||
] @keyword.repeat
|
||||
|
||||
(js_comment) @comment @spell
|
||||
(comment) @comment
|
||||
|
||||
(function_name) @function
|
||||
|
||||
[
|
||||
">="
|
||||
"<="
|
||||
] @operator
|
||||
|
||||
(mixin_statement
|
||||
name: (identifier) @function)
|
||||
|
||||
(mixin_statement
|
||||
(parameters
|
||||
(parameter) @variable.parameter))
|
||||
|
||||
(function_statement
|
||||
name: (identifier) @function)
|
||||
|
||||
(function_statement
|
||||
(parameters
|
||||
(parameter) @variable.parameter))
|
||||
|
||||
((plain_value) @variable.scss
|
||||
(#match? @variable.scss "^--.+"))
|
||||
|
||||
((property_name) @variable.scss
|
||||
(#match? @variable.scss "^--.+"))
|
||||
|
||||
((property_name) @variable.scss
|
||||
(#match? @variable.scss "^$.+"))
|
||||
|
||||
(plain_value) @type
|
||||
|
||||
(string_value) @string
|
||||
|
||||
(selectors
|
||||
(pseudo_element_selector
|
||||
(tag_name) @attribute.jsx))
|
||||
|
||||
(selectors
|
||||
(pseudo_class_selector
|
||||
(class_name) @attribute.jsx))
|
||||
|
||||
|
||||
(nesting_selector) @keyword
|
||||
|
||||
(tag_name) @tag
|
||||
|
||||
(keyword_query) @function
|
||||
|
||||
(identifier) @variable.scss.ident
|
||||
|
||||
(variable) @variable.scss
|
||||
|
||||
(argument) @variable.parameter
|
||||
|
||||
(arguments
|
||||
(variable) @variable.parameter)
|
||||
|
||||
(integer_value) @constant.numeric.integer
|
||||
|
||||
(integer_value
|
||||
(unit) @keyword)
|
||||
|
||||
(class_name) @classname
|
||||
(id_name) @idname
|
||||
|
||||
(attribute_name) @attribute.jsx
|
||||
|
||||
(class_selector
|
||||
"." @punctuation.italic)
|
||||
(id_selector
|
||||
"#" @punctuation.italic)
|
||||
|
||||
(pseudo_class_selector
|
||||
":" @punctuation.italic)
|
||||
"::" @punctuation.italic
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
":"
|
||||
";"
|
||||
"#{"
|
||||
","
|
||||
"("
|
||||
")"
|
||||
] @punctuation
|
||||
|
||||
|
||||
(include_statement
|
||||
(identifier) @function)
|
||||
@@ -0,0 +1,2 @@
|
||||
; ([(comment) (single_line_comment)] @injection.content
|
||||
; (#set! injection.language "comment"))
|
||||
@@ -0,0 +1,32 @@
|
||||
inherits = "monokai_pro"
|
||||
|
||||
"constant" = "purple"
|
||||
"variable.builtin" = "base8"
|
||||
"constant.builtin" = "purple"
|
||||
"constant.character.escape" = "purple"
|
||||
"constant.character" = "yellow"
|
||||
|
||||
# classes, types, primitives
|
||||
"type" = "blue"
|
||||
"type.builtin" = "blue"
|
||||
|
||||
"punctuation.embedded.jsx" = "orange"
|
||||
|
||||
# Custom
|
||||
"tag" = "red"
|
||||
"attribute.jsx" = { fg = "blue", modifiers = ["italic"] }
|
||||
"ui.virtual.indent-guide" = "base3"
|
||||
"ui.statusline.select" = { fg = "base4", bg = "red" }
|
||||
"ui.statusline.separator" = "base6"
|
||||
|
||||
"variable.scss" = { fg = "orange", modifiers = ["italic"] }
|
||||
"variable.scss.ident" = "green"
|
||||
|
||||
"classname" = { fg = "green", modifiers = ["italic"] }
|
||||
"idname" = { fg = "orange", modifiers = ["italic"] }
|
||||
"punctuation.italic" = { fg = "base6", modifiers = ["italic"] }
|
||||
|
||||
"string.delimiter" = "base6"
|
||||
"punctuation.delimiter.rust" = "red"
|
||||
|
||||
"variable.builtin.self" = { fg = "base7", modifiers = ["italic"] }
|
||||
Reference in new issue
Block a user