Since locals are handled during parsing instead of highlighting with
tree-house, we need to call `helix_core::syntax::Loader::set_scopes`
before parsing any documents. During `:config-reload` we previously
reloaded the `Loader` and re-parsed documents and _then_ updated the
theme. So documents were parsed before `Loader::set_scopes` was called
on the new loader.
With this change the `refresh_language_config` helper is inlined into
`refresh_config`. Updating the `Editor`'s `ArcSwap` of the loader is
done before updating the theme so that the `load_configured_theme`
helper can call `set_scopes` with on the new loader.
This function was never used and will be superseded by
`RopeSliceExt::is_grapheme_boundary` (which accepts a byte index rather
than a character index) once we transition to Ropey v2. In the meantime
any callers should convert to byte index and use the `RopeSliceExt`
extension rather than form new dependencies on this.
This fixes a regression from the switch to tree-house with one of the
custom predicates in indent queries: `#not-kind-eq?`. This predicate
should be allowed to be written multiple times in a pattern. For example
in the Go indents:
; Switches and selects aren't indented, only their case bodies are.
; Outdent all closing braces except those closing switches or selects.
(
(_ "}" @outdent) @outer
(#not-kind-eq? @outer "select_statement")
(#not-kind-eq? @outer "type_switch_statement")
(#not-kind-eq? @outer "expression_switch_statement")
)
So instead of an `Option<T>` of one we need a `Vec<T>` and we need to
check that all of these predicates are individually satisfied (basically
`iter().all(/* node kind is not expected kind for that capture */)`).
Previously `recv` for new messages from the language server or debug
adapter allocated a fresh Vec for each message. Instead we can reuse
the buffer. This resolves TODO comments.
Co-authored-by: Rolo <roloedits@gmail.com>
With a directory with spaces in the name (for example
`mkdir -p 'Temp/Abc Def'`), completing `Temp/Ab` would create a
completion item `'Temp/AbAbc Def'`. Now it correctly completes
`'Temp/Abc Def'`
This avoids using any custom configuration in a user-defined
`languages.toml` config for the syntax test cases. The test cases should
only use the builtin `languages.toml` config.
Also the xtask crate reimplemented `default_lang_loader` and
`default_lang_config`. These functions are replaced with calls into
`helix_core`.
On Windows for example the behavior of this function typically diverges
from the usual behavior on Unix. Instead of checking that the inserted
string starts with `'\n'` (untrue for for CRLF line endings) we need to
check that the first grapheme cluster in the string is a line ending.
(All line endings are single grapheme clusters.)