1
0
mirror of https://github.com/helix-editor/helix.git synced 2024-12-23 08:21:54 +04:00
Commit Graph

63 Commits

Author SHA1 Message Date
Frans Skarman
f9aae99379
Highlight types and enum members in the rust prelude ()
* Add some rust builtins

* rust queries: Add everything in the 2021 prelude

* Update runtime/queries/rust/highlights.scm

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2024-08-14 19:43:31 +02:00
Luv-Ray
752ed8eb15
add try keyword to rust highlights () 2024-04-30 13:13:27 +09:00
Pedro Fedricci
0546273570
chore: update tree-sitter-rust to v0.21.0 ()
* chore: update tree-sitter-rust to 0.21.0

* fix: pretty print and textobject tests
2024-04-15 18:07:15 +02:00
Daniel S Poulin
1abb64e48d
Add textobject for entries/elements of list-like things () 2024-03-31 11:53:15 -05:00
Michael Davis
c099dde2a7 Rust: Highlight extern crate aliases
For example `extern crate alloc as myalloc;`
2024-03-22 00:20:29 +09:00
Vivek Kethineni
3e963b3c1b
Add Rust fields as argument textobject ()
* added field_declaration_list and field_initializer_list as parameter textobjects

* removed field_declaration_listt from textobjects.scm
2024-02-17 17:08:44 +01:00
Tobias Hunger
a1272bdb17
slint: Update treesitter parser and queries ()
* slint: Update treesitter parser and queries

* slint: Port over suggestions from nvim review
2024-02-07 19:36:29 +01:00
Rose Hudson
a680b2e409
rust highlights: clean up constructor logic ()
Enum variants and (tuple) structs are indistinguishable in general, so we
mark any PascalCase pattern or expression as a "constructor", which
covers all three.
2024-01-02 16:38:13 +01:00
Joey Hain
70bbbd7d19
add highlight scope for type parameters ()
* rust: add highlight scope for type parameters

* handle optional type parameters
2023-11-03 22:21:01 +01:00
Ryan Mehri
c24a67c0e4
Add rust html injection query () 2023-10-26 11:39:22 +09:00
Jesse Luehrs
d56638ba9a fix formatting in the rust textobject query file
looks like two lines were unintentionally joined - it doesn't appear to
affect the functionality, but it's confusing to read
2023-08-14 07:45:58 -04:00
Daniel Ebert
36a59e4482 Improve C, Rust & Python indent queries & add @align captures. 2023-08-11 23:44:02 +09:00
Cole Helbling
6dd5054da4
Highlight sqlx's query_scalar{,_unchecked} macros as SQL ()
* Highlight sqlx's `query_scalar{,_unchecked}` macros as SQL

* Update injections.scm

* fixup copy-pasta
2023-04-27 14:37:17 +09:00
Maxicarlos08
3d230e701d
Also highlight unchecked variants of the sqlx query methods () 2023-03-10 16:57:52 -06:00
Chickenkeeper
486c3ab0d5
Fix Broken Attribute Highlights ()
* Update highlights.scm

* Update highlights.scm

* Update themes.md
2023-01-09 11:26:08 +09:00
Chickenkeeper
c4263d6a56
Fix & Tweak Rust's Syntax Highlighting () 2022-12-21 17:10:45 -06:00
Blaž Hrastnik
bae890d8fa
Update tree-sitter-scheme 2022-12-12 17:50:12 +09:00
Alexis (Poliorcetics) Bourget
e232333d4a fix: Outdated Rust queries after TS update
Ref: 3ddebf46e6
2022-11-11 18:43:55 -06:00
Anton Romanov
07d3157273
[rust highlights] fix scoped attribute macro matching ()
Without this scoped attribute macros are not matched as macros.
Eg
```
  #[path::macro]
```
2022-11-08 13:41:09 -06:00
Poliorcetics
2935e9da19
feat: Categorize Rust's keywords using more specific scopes () 2022-10-29 10:36:26 -05:00
Michael Davis
4a3b776b78
rust: Highlight function signatures as functions ()
This stanza highlights functions within trait definitions. For example,
in:

    pub trait Widget {
        fn render(self, area: Rect, buf: &mut Buffer);
    }

`render` is currently highlighted as a variable. With this change it's
highlighted as a function.
2022-10-03 23:56:50 +09:00
gavincrawford
1dd1476a9e
Fix highlighting on single-character Rust consts ()
Co-authored-by: Kirawi <67773714+kirawi@users.noreply.github.com>
Co-authored-by: Gavin Crawford <gavincrawford@users.noreply.github.com>
2022-09-21 17:55:28 -05:00
Michael Davis
301f5d7cf7
Fix Rust attribute highlights () 2022-09-07 12:45:51 +09:00
Charles Hall
b3b164f0d5
Highlight SQL in sqlx::{query,query_as}!() in Rust () 2022-09-02 17:26:42 -05:00
Michael Davis
03f0ef93ac Update tree-sitter-rust to latest
There don't appear to be any regressions from the updates.
Also included is a fix which highlights the "#" as in attributes
as punctuation. This was previously unhighlighted.
2022-08-31 17:46:34 +09:00
David
db18206795
Fix rust text objects () 2022-08-28 16:03:39 -05:00
Vince Mutolo
7559b77d53
highlight closure pipes as brackets ()
Co-authored-by: Vince Mutolo <vince@mutolo.org>
2022-08-11 19:00:03 -05:00
ChrHorn
23f4a40a7a
Rust queries: add (function_item) as a local scope () 2022-08-06 05:58:06 -05:00
Michael Davis
9ed9c3faca
Remove let_declaration from Rust locals tracking () 2022-07-28 12:04:50 +09:00
Michael Davis
9753da6ab7
Fix locals tracking in Rust closures ()
The fix comes from the rewriting of the `closure_parameters` stanza:
it was capturing the entire `closure_parameters` node including
paretheses, whitespace, and commas. Capturing the identifiers within
fixes the tracking.

In order to make sure locals definitions from closure parameters don't
leak out of the body of the closure, though, we should also mark the
closure itself as a locals scope.
2022-07-20 11:51:35 +09:00
Michael Davis
78c944ebc3 rust: fix highlight corner-cases
* add punctuation highlights for commas as in function parameters
* remove stray `variable.parameter` highlight
    * I couldn't find any regressions from this and it fixes an
      edge case I ran into (but sadly did not record 😓)
* highlight `fn` as `keyword.function`
    * the theme docs have `fn` as an example so it seems fitting
2022-07-01 11:04:23 +02:00
Michael Davis
9f676dab57 add test textobjects queries for erlang,gleam,go,python,rust 2022-06-21 11:32:03 -05:00
A-Walrus
ad15e7b5e8
Add "<<=" operator to Rust syntax highlighting () 2022-06-18 11:44:21 -05:00
Anton Romanov
7983c71752
Introduce storage_class highlight scope () 2022-06-14 12:35:36 -05:00
Michael Davis
4a27e2d938 capture rust closures as function textobjects
Closures like

    iter.map(|a| a + 1)

Are sort-of functions, so `]f` or `maf` or `mif` can apply to them
as well as named function definitions.
2022-06-07 20:03:31 +09:00
10463fe32c Add parameter.around text object query 2022-05-25 21:26:06 +09:00
62fd1f6999
Include macro attributes to impls, structs, enums, functions etc. textobjects () 2022-05-20 10:19:46 +09:00
Triton171
58758fee61
Indentation rework ()
* WIP: Rework indentation system

* Add ComplexNode for context-aware indentation (including a proof of concept for assignment statements in rust)

* Add switch statements to Go indents.toml (fixes the second half of issue )
Remove commented-out code

* Migrate all existing indentation queries.
Add more options to ComplexNode and use them to improve C/C++ indentation.

* Add comments & replace Option<Vec<_>> with Vec<_>

* Add more detailed documentation for tree-sitter indentation

* Improve code style in indent.rs

* Use tree-sitter queries for indentation instead of TOML config.
Migrate existing indent queries.

* Add documentation for the new indent queries.
Change xtask docgen to look for indents.scm instead of indents.toml

* Improve code style in indent.rs.
Fix an issue with the rust indent query.

* Move indentation test sources to separate files.
Add `#not-kind-eq?`, `#same-line?` and `#not-same-line` custom predicates.
Improve the rust and c indent queries.

* Fix indent test.
Improve rust indent queries.

* Move indentation tests to integration test folder.

* Improve code style in indent.rs.
Reuse tree-sitter cursors for indentation queries.

* Migrate HCL indent query

* Replace custom loading in indent tests with a designated languages.toml

* Update indent query file name for --health command.

* Fix single-space formatting in indent queries.

* Add explanation for unwrapping.

Co-authored-by: Triton171 <triton0171@gmail.com>
2022-03-31 00:08:07 +09:00
Daniel S Poulin
9bfb0caf1b
Add comment textobject for surround selection and navigation () 2022-03-06 10:54:24 +05:30
Michael Davis
a8fd33ac01
add tree-sitter-regex ()
* add tree-sitter-regex

* adapt regex highlights from upstream

* inject regex into elixir sigil_r/2 and sigil_R/2

* generate lang-support docs

* capture interesting nodes in character-ranges

* make $.character_class captures more consistent

* fix fallthrough behavior for character classes

* capture pattern characters as 'string'

* use latest tree-sitter-regex

* set elixir regex injections as combined

* add link to upstream queries

* inject regex in rust into 'Regex::new' raw string literals
2022-01-06 23:00:00 +08:00
Triton171
4da050b4bb
Add basic indentation for languages without treesitter-based indentation rules (always use the indent of the current line for a new line). ()
Fix several bugs in the treesitter indentation calculation.

Co-authored-by: Triton171 <triton0171@gmail.com>
2022-01-03 11:03:57 +09:00
Gokul Soumya
a8618cf111
Add precise rust queries for use, mod, as ()
- Differentiates between `as` keyword as a binary type cast
  operator and import renamer.
- `mod` and `use` are now under `@keyword.control.import`,
  but `mod` is a `@keyword` if used as `mod name;`.
2021-12-23 12:10:24 +09:00
Gokul Soumya
f1c634326b
Improve rust syntax highlighting ()
- Highlight fragment specifiers (expr, tt, in macro
  definitions) with @type.
- Highlight attributes as macros
2021-12-20 11:47:40 +09:00
Michael Davis
e72786df8e
Add tree-sitter-comment ()
* Add tree-sitter-comment

Fix 

* fix precedence in tree-sitter-comment highlights

connects https://github.com/helix-editor/helix/pull/1170

* set injection-regex for comment language

* remove comment filetype

* fix comment injections for neovim-style injections tags

* add comment injections for elixir

* remove f.comment

* fix spacing in .gitmodules

* run 'cargo xtask docgen'

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-12-19 23:56:56 +09:00
Kirawi
ee889aaa85
Updated tree-sitter query scopes ()
* updated theme scopes

variable.property -> variable.field
property -> variable.field

* updated theme scopes

* update book and themes

updated book and themes to reflect scope changes

* wip

* update more queries

* update dark_plus.toml
2021-11-03 12:00:52 +09:00
Gokul Soumya
4ee92cad19
Add treesitter textobjects ()
* Add treesitter textobject queries

Only for Go, Python and Rust for now.

* Add tree-sitter textobjects

Only has functions and class objects as of now.

* Fix tests

* Add docs for tree-sitter textobjects

* Add guide for creating new textobject queries

* Add parameter textobject

Only parameter.inside is implemented now, parameter.around
will probably require custom predicates akin to nvim' `make-range`
since we want to select a trailing comma too (a comma will be
an anonymous node and matching against them doesn't work similar
to named nodes)

* Simplify TextObject cell init
2021-10-23 11:41:19 +09:00
Blaž Hrastnik
4cc562318a Improve docs, fix up a few highlight scopes 2021-09-07 13:03:48 +09:00
Blaž Hrastnik
4ac29434cb syntax: Add go & rust locals, improve tree-sitter error message 2021-09-06 18:13:52 +09:00
Blaž Hrastnik
a6108baec9 Improve grammar definitions 2021-09-06 15:25:46 +09:00
oberblastmeister
098b6b6eed
gruvbox theme changes ()
* changed some gruvbox highlights

* more stuff including cursors

* use property instead

* use variable.property
2021-08-19 01:02:15 +09:00