diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2020-09-22 23:01:19 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.lauf@yahoo.de> | 2020-10-10 15:31:51 +0200 |
| commit | 45397ebbd9fb2bb13b14824e917158d2e02f960a (patch) | |
| tree | 38b9057059289edf861f6e80d15f24de084ea7a3 /queries/rust | |
| parent | Shorten module reference shell_command_selectors to shell. (diff) | |
| download | nvim-treesitter-45397ebbd9fb2bb13b14824e917158d2e02f960a.tar nvim-treesitter-45397ebbd9fb2bb13b14824e917158d2e02f960a.tar.gz nvim-treesitter-45397ebbd9fb2bb13b14824e917158d2e02f960a.tar.bz2 nvim-treesitter-45397ebbd9fb2bb13b14824e917158d2e02f960a.tar.lz nvim-treesitter-45397ebbd9fb2bb13b14824e917158d2e02f960a.tar.xz nvim-treesitter-45397ebbd9fb2bb13b14824e917158d2e02f960a.tar.zst nvim-treesitter-45397ebbd9fb2bb13b14824e917158d2e02f960a.zip | |
fix(highlights): Add TSNamespace highlight
Start adding highlights for
- C++
- Rust (including other scoped_identifier/scoped_type_identifier fixes)
- JS (only namespace_import)
Addresses #516
Diffstat (limited to 'queries/rust')
| -rw-r--r-- | queries/rust/highlights.scm | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index 01994555f..fa81ffbc7 100644 --- a/queries/rust/highlights.scm +++ b/queries/rust/highlights.scm @@ -13,12 +13,16 @@ (type_identifier) @type (primitive_type) @type.builtin (field_identifier) @field - +(mod_item + name: (identifier) @namespace) ; Function calls (call_expression function: (identifier) @function) (call_expression + function: (scoped_identifier + (identifier) @function .)) +(call_expression function: (field_expression field: (field_identifier) @function)) @@ -36,6 +40,16 @@ (#match? @constant "^[A-Z]")) ; Assume that uppercase names in paths are types +(scoped_identifier + path: (identifier) @namespace) +(scoped_identifier + (scoped_identifier + name: (identifier) @namespace)) +(scoped_type_identifier + path: (identifier) @namespace) +(scoped_type_identifier + (scoped_identifier + name: (identifier) @namespace)) ((scoped_identifier path: (identifier) @type) (#match? @type "^[A-Z]")) @@ -43,6 +57,13 @@ name: (identifier) @type) (#match? @type "^[A-Z]")) +(crate) @namespace +(scoped_use_list + path: (identifier) @namespace) +(scoped_use_list + path: (scoped_identifier + (identifier) @namespace)) +(use_list (scoped_identifier (identifier) @namespace . (_))) (use_list (identifier) @type (#match? @type "^[A-Z]")) (use_as_clause alias: (identifier) @type (#match? @type "^[A-Z]")) @@ -60,8 +81,10 @@ (#eq? @type "derive")) (macro_invocation - macro: (identifier) @function.macro - "!" @function.macro) + macro: (identifier) @function.macro) +(macro_invocation + macro: (scoped_identifier + (identifier) @function.macro .)) ; Function definitions @@ -100,6 +123,11 @@ (self) @variable.builtin [ + "use" + "mod" +] @include + +[ "break" "const" "default" @@ -111,7 +139,6 @@ "let" "macro_rules!" "match" -"mod" "move" "pub" "ref" @@ -124,7 +151,6 @@ "unsafe" "async" "await" -"use" "where" (mutable_specifier) (super) |
