Commit Graph

1362 Commits (b03421a8c0811b48da0f30f4d4fce41a1f98a547)

Author SHA1 Message Date
Roland Kovacs d962e06e91
Add runtime language configuration (#1794) (#1866)
* Add runtime language configuration (#1794)

* Add set-language typable command to change the language of current buffer.
* Add completer for available language options.

* Update set-language to refresh language server as well

* Add language id based config lookup on `syntax::Loader`.
* Add `Document::set_language3` to set programming language based on language
  id.
* Update `Editor::refresh_language_server` to try language detection only if
  language is not already set.

* Remove language detection from Editor::refresh_language_server

* Move document language detection to where the scratch buffer is saved.
* Rename Document::set_language3 to Document::set_language_by_language_id.

* Remove unnecessary clone in completers::language
2 years ago
Ivan Tham e7beb32fd7
Add paragraph to last motion (#1956)
Fix #1954
2 years ago
Rose Hudson f8c83f9885 clear terminal after switching to alternate screen
when using helix over mosh, the screen doesn't get cleared and
characters get left all over the place until they are overwritten. with
this change, the screen gets properly cleared as soon as helix starts
2 years ago
Dr. David A. Kunz 9782204f73
Add typed commands buffer-next and buffer-previous (#1940) 2 years ago
Ivan Tham 8b91ecde40 Rename _para to _paragraph 2 years ago
Ivan Tham 8350ee9a0e Add paragraph textobject
Change parameter/argument key from p to a since paragraph only have p
but parameter are also called arguments sometimes and a is not used.
2 years ago
Ivan Tham 8b02bf2ea8 Add (prev) paragraph motion
Also improved testing facility.

Fix #1580
2 years ago
Simon H 36d1df71fc
Added checkmarks to health.rs output, Resolves #1894 (#1918)
* Added checkmarks to health.rs output

* replaced found/not found text with checkmarks
2 years ago
jeepee 85c23b31de
Avoid unnecessary clone when formatting error (#1903)
Instead of first cloning the query and then allocating again to format
the error, format the error using a reference to the query.
2 years ago
jeepee 8165febe23
Fix start-position of next search (#1904)
The search implementation would start searching at the next grapheme
boundary after the previous selection. In case the next occurence of the
needle is immediately after the current selection, this occurence would
not be found (without wraparound) because the first grapheme is skipped.

The correct approach is to use the ensure_grapheme_boundary functions instead
of using the functions that skip unconditionally to the next grapheme.
2 years ago
antoyo 47fe739757
Jump to the next number on the line before incrementing (#1778)
* Jump to the next number on the line before incrementing

Partially fix #1645

* Refactor to avoid duplicating find_nth_next
2 years ago
Blaž Hrastnik 8adf0c1b3a
lsp: Implement support for workspace_folders (currently just one)
Refs #1898
2 years ago
Blaž Hrastnik 236c6b7707
fix: copy_selections was broken with selections (not cursors) 2 years ago
Rohan Jain 5d61631507
Resolve conflicts between prompt/picker bindings (#1792)
Currently, the picker's re-using a few bindings which are also present
in the prompt. This causes some editing behaviours to not function on
the picker.

**Ctrl + k** and **Ctrl + j**
This should kill till the end of the line on prompt, but is overridden
by the picker for scrolling. Since there are redundancies (`Ctrl + p`,
`Ctrl + n`), we can remove it from picker.

**Ctrl + f** and **Ctrl + b**
This are used by the prompt for back/forward movement. We could modify
it to be Ctrl + d and Ctrl + u, to match the `vim` behaviour.
2 years ago
Blaž Hrastnik d15c875214
Add a TODO for the future 2 years ago
Blaž Hrastnik ab7885e934
fix: copy_selection needs to account for to() being exclusive
Fixes #1367
Fixes #1590
2 years ago
Triton171 58758fee61
Indentation rework (#1562)
* 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 #1523)
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>
2 years ago
Nirmal Patel 8702aaaefc
Handle BrokenPipe when piping hx --health through head (#1876)
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
2 years ago
Marcin Puc f2dd3d4469
Avoid using the format ident Rust feature (#1881) 2 years ago
Blaž Hrastnik 6c276d7868
Revert "Resize is not necessary inside SIGCONT, handled by render()"
Fixes #1877

This reverts commit 85264a861a.
2 years ago
Blaž Hrastnik a516f5881b
Address clippy lint 2 years ago
Blaž Hrastnik 4940db3e2d
Make truncate_start a builder method instead 2 years ago
Blaž Hrastnik 20cf75dfa1
Strip some more params 2 years ago
Blaž Hrastnik 1849ad1fde
Clean up global search 2 years ago
Blaž Hrastnik 92bb312f0f
Make line a private property 2 years ago
Blaž Hrastnik 96a4eb8483
Remove more push_layer calls 2 years ago
Blaž Hrastnik 5c162ef995
Make regex_prompt directly call cx.push_layer 2 years ago
Blaž Hrastnik 83b3272166
This doesn't need to be mut 2 years ago
Blaž Hrastnik 9a6ee88e66
Split off dap event handlers into helix-view to allow reuse 2 years ago
Blaž Hrastnik 85264a861a
Resize is not necessary inside SIGCONT, handled by render() 2 years ago
Gokul Soumya 7b3a3d562c
Move top level lsp config to editor.lsp (#1868)
* Move top level lsp config to editor.lsp

This is mainly done to accomodate the new lsp.signature-help config
option that will be introduced in https://github.com/helix-editor/helix/pull/1755
which will have to be accessed by commands. The top level config
struct is split and moved to different places, making the relocation
necessary

* Revert rebase slipup
2 years ago
Joe bee05dd32a
Add refresh-config and open-config command (#1803)
* Add refresh-config and open-config command

* clippy

* Use dynamic dispatch for editor config

* Refactor Result::Ok to Ok

* Remove unused import

* cargo fmt

* Modify config error handling

* cargo xtask docgen

* impl display for ConfigLoadError

* cargo fmt

* Put keymaps behind dyn access, refactor config.load()

* Update command names

* Update helix-term/src/application.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* Switch to unbounded_channel

* Remove --edit-config command

* Update configuration docs

* Revert "Put keymaps behind dyn access", too hard

This reverts commit 06bad8cf492b9331d0a2d1e9242f3ad4e2c1cf79.

* Add refresh for keys

* Refactor default_keymaps, fix config default, add test

* swap -> store, remove unneeded clone

* cargo fmt

* Rename default_keymaps to default

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
Blaž Hrastnik 919ac7ba15
Handle RPC returning an invalid call 2 years ago
Blaž Hrastnik a7ee9f74f7
No need for KeymapResult anymore since we can query .sticky() 2 years ago
Blaž Hrastnik 7909d6f05e
keymap: Store pending/sticky on the root level 2 years ago
Blaž Hrastnik f67e1ee172
Put esoteric line endings behind a feature flag 2 years ago
Blaž Hrastnik 59f05088b9
Optimize rendering by using Ropey::byte_slice
This avoids costly conversions via byte_to_char (which are then
reversed back into bytes internally in Ropey).

Reduces time spent in slice/byte_to_char from ~24% to ~5%.
2 years ago
Gokul Soumya 2b0835b295
Refactor :set to parse by deserializing values (#1799)
* Refactor :set to parse by deserializing values

* Implement serialize for idle_timeout config
2 years ago
Joe c0dbd6dc3f
Add horizontal and vertical split scratch buffers (#1763)
Make subcommand name more descriptive

Fix vsplit completer

Run cargo xtask docgen
2 years ago
Rohan Jain 1ac576f2b3
Handle panic on move within empty picker (#1786)
When the picker results output is empty, movement actions result in a panic:
```
thread 'main' panicked at 'attempt to calculate the remainder with a divisor of zero', helix-term/src/ui/picker.rs:420:31
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

This could be a no-op instead when the matches length is zero.
2 years ago
Ivan Tham 29d6a5a9b6
Perform extend line on every selection (#1804)
Currently `x` only affect the current selection, but this will make it
affect every selection so `x` can be more useful with multi-cursors.
2 years ago
Ivan Tham 3d76fa0b81
Match in visual use head not anchor (#1805)
Currently match is finding the match based on the anchor rather than the
head (cursor) so this behavior is rather unexpected when user is doing
a match but a different item was matched instead when the selection is
more than one character.
2 years ago
Blaž Hrastnik c94c0d9f1c
minor: occurance -> occurrence 2 years ago
Narazaki Shuji 05161aa85e
Fix: insert_register (#1751)
- set register name correctly
 - use autoinfo to display register contents
 - call `paste` with `Paste::Cursor`
2 years ago
nibon7 43997f1936
Use `^` and `$` to match the beginning and end of a line when searching (#1790)
Fixes #1737

Signed-off-by: nibon7 <nibon7@163.com>
2 years ago
Michael Davis 37fed4de80
fix '--grammar' flag in help text (#1784) 2 years ago
Michael Davis 7044d7d804 rename '--fetch/build-grammars' flags into '--grammar fetch/build'
The old flags were a bit long. --grammar is also aliased to -g to make
it even easier.
2 years ago
Michael Davis 4fc991fdec migrate grammar fetching/building code into helix-loader crate
This is a rather large refactor that moves most of the code for
loading, fetching, and building grammars into a new helix-loader
module. This works well with the [[grammars]] syntax for
languages.toml defined earlier: we only have to depend on the types
for GrammarConfiguration in helix-loader and can leave all the
[[language]] entries for helix-core.
2 years ago
Michael Davis 08ee949dcb add 'use-grammars' to languages.toml
The vision with 'use-grammars' is to allow the long-requested feature
of being able to declare your own set of grammars that you would like.
A simple schema with only/except grammar names controls the list
of grammars that is fetched and built. It does not (yet) control which
grammars may be loaded at runtime if they already exist.
2 years ago
Michael Davis 00b2d616eb implement build_grammars and fetch_grammars
build_grammars adapts the functionality that previously came from
helix-syntax to be used at runtime from the command line flags.

fetch_grammars wraps command-line git to perform the same actions
previously done in the scripts in #1560.
2 years ago