With this change textobjects work even within injection layers, so you
can use `]f` to jump to a function definition in a JavaScript `<script>`
tag within HTML for example.
This requires `Syntax::query_iter` - a utility function for running a
query from `HighlightConfiguration` across injection layers - which
comes from the rainbow brackets branch (merged into my driver).
We need to relocate the textobject query from the `LanguageConfiguration`
to the `HighlightConfiguration` in order to access it
per-injection-layer, like we do for the rainbow brackets query. With
that, the only necessary change is to port the contents of
`TextObjectQuery::capture_nodes_any` to a new function that uses
`query_iter` and update callers.
The callers end up being a bit cleaner: they only need to take `Syntax`
now and not `LanguageConfiguration` and the root layer's root
`tree_sitter::Node`.
It's easy to mistakenly use-after-free the cursor and captures iterator
here because of the transmute. Ideally this could be fixed upstream in
tree-sitter by introducing an API with lifetimes/types that reflect the
lifetimes of the underlying data.
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
The code in the `sort_layers` function was fully duplicated between
the HighlightIter and the QueryIter. This change adds a common
`sort_layers` function that accepts a layer Vec from both.
This is brings the fix from d5f17d3 to the QueryIter layers. A trait
for getting the cursor and sort-key from each layer helps cut down on
code duplicated between these iterators.
This can be used to calculate rainbow highlights (see the child commit)
or indents or textobjects and be accurate to the injected content
rather than just the root layer. This is useful for languages which
use injections heavily like Vue or JavaScript within HTML but are also
useful in common scenarios like within codeblocks in Markdown.
This iterator shares some code with the HighlightIter and
HighlightIterLayer but that iterator emits HighlightEvents, so it cares
about the beginnings and ends of highlight events rather than captures.
URIs need to be normalized to be comparable. For example a language
server could send a URI for a path containing '+' as '%2B' but we might
encode this in something like 'Document::url' as just '+'. We can
normalize the URI straight into a PathBuf though since this is the only
value we compare these diagnostics URIs against. This also covers
edge-cases like windows drive letter capitalization.
* Use next and avoid a redundant prefix strip
* Avoid allocations
Especially when `expand_tilde` is claled on a path
that doesn't contain a tilde.
* Add a test
* Use Into<Cow<…>>
* Put the expand_tilde test at the end of the file
* Remove unused importsw
Previously we used the IdleTimeout event to trigger LSP
`completion/resolveItem` requests. We can now refactor this to use an
event system hook instead and lower the timeout.
The Gradle build tool provides two DSLs for configuring builds. On is
based on Groovy and Gradle build files written in Gradle Groovy DSL use
*.gradle file ending.
This change adds `gradle` to the supported file types of the groovy
language configuration.
* Add Groovy grammar
* Rewrite Neovim captures into Helix for Groovy
* Simplify Groovy injections
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Remove Neovim's spell from Groovy highlights
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Apply suggestions to languages.toml
* Escape backslash in groovy highlights.scm
---------
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* languages: add docker-compose language
it uses docker-compose-langserver as lsp
And yaml for syntax highlighting, indents and injections
* languages: add luajit as a shebang of lua
This helps to provide syntax highlighting and
other lua goodies when writing luajit
* book(update): run cargo xtask docgen
* since #8006 full filenames uses glob
* neovim like scroll function
* clear line annotations outside of move_vertically/_visual
* add nvim scroll function to commands
* assign nvim-scroll to C-d and C-u (half page scrolls)
* dont remove backspace and space mapping
* move non-softwrap logic to seperate function, call this in nvim-scroll fn
* Revert "move non-softwrap logic to seperate function, call this in nvim-scroll fn"
This reverts commit e4905729c3.
* Revert "clear line annotations outside of move_vertically/_visual"
This reverts commit 1df3fefe55.
* add TODO for when inline diagnostics gets merged
* move nvim-scroll logic into scroll(), dont respect scrolloff
* run cargo fmt
* run cargo clippy
* update documenation for Ctrl-d and Ctrl-u remap
* Add conf as a bash file type
Tmux and tmux.conf is used widely in software developer circles.
Having the tmux.conf file not have any syntax highlighting by default is (IMO) not ideal for an editor that otherwise "just works".
* Use tmux.conf glob instead of simply conf for tmux
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
---------
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Make sonokai palette perfectfully faithful
* Amend theme to better match original sonokai
Changes based on the following references:
(1) https://www.sainnhe.dev/post/contributing-guide/#sonokai
(2) https://github.com/sainnhe/sonokai/blob/master/colors/sonokai.vim
* Make constants white (1)
* Make builtin variables purple (1)
* Make members orange (1)
* Make labels red (2)
* Make operators red (1)
* Make all punctuation grey (2)
* Make builtin functions and macros green (2)
* Make diff delta blue (2)
* Make cursor match bg4 (2)
* Make visible whitespace bg4 (2)
* Make Sonokai special punctuation yellow
* Make sure pending key list is empty when count handling
This will allow using numbers as second key event.
* count handling; add an exception for 'g'
* Lookup the key event before considering a number as count
* Avoid the allocation of another vec for the pending keys
---------
Co-authored-by: x <x@torrent>
`syn_loader` was replaced rather than interior value being replace,
old value was still being referenced and not updated after `:config-refresh`.
By using `ArcSwap` like for `config`, each `.load()` call will return the most
updated value.
Co-authored-by: kyfan <kyfan@email>
* theme: add horizon-dark
* fix whitespace color and gutter selected
* taplo fmt
* markup and color tweaks
markup colors
diff colors
better comment and menu colors
* horizon-dark: fix constructor color
makes Some and None to look better and more like the vscode theme
Before there was no document about what the `diff` gutter is displaying
or what the colors mean.
These docs clarify it's a `git` diff and makes it easier to
cross-reference the theme if you aren't sure what the colors mean or
want to change them.
`build.zig.zon` is what 0.11.0 uses for external dependencies. The syntax is a subset of zig and can be highlighted and formatted like normal zig code.