* auto save after delay
* configable
* clearer names
* init
* working with some odd behaviour
* working with greater consistency
* Apply reviewer suggestions
- Remove unneccessary field
- Remove blocking save
* Improve auto-save configuration
Auto save can be configured to trigger on focus loss:
```toml
auto-save.focus-lost = true|false
```
and after a time delay (in milli seconds) since last keypress:
```toml
auto-save.after-delay.enable = true|false
auto-save.after-delay.timeout = [0, u64::MAX] # default: 3000
```
* Remove boilerplate and unnecessary types
* Remove more useless types
* Update docs for auto-save.after-delay
* Fix wording of (doc) comments relating to auto-save
* book: Move auto-save descriptions to separate section
---------
Co-authored-by: Miguel Perez <miguelvojito@gmail.com>
Co-authored-by: Miguel Perez <perezoji@cs.fsu.edu>
* Remove special-casing of line ending characters in selection replacement
* Refactor line ending handling and integration test to address code review comments
This is useful for resetting multiple changes at once. For example you
might use 'maf' or even '%' to select a larger region and reset all
changes within.
The original behavior of resetting the change on the current line is
retained when the primary selection is 1-width since we look for chunks
in the line range of each selection.
It can be convenient to define project specific debugger templates, some of
which might not necessitate prompting the user to define completion.
This commit makes completion optional for debugger templates and starts the
dap immediately if undefined or empty.
some LSPs does update the active signature and some not. To make both
worlds happy, make the active signature more intelligent.
1. SignatureHelp store now the suggested lsp_signature
2. if the lsp_signature changes then use it
3. otherwise use the last signature from the old popup
4. in case the old signature doesn't exist anymore, show the last signature
Signed-off-by: Ben Fekih, Hichem <hichem.f@live.de>
Trunctation should always be handled by the parent. Returning None is
only supposed to indicate a missing implementation
Co-authored-by: Ben Fekih, Hichem" <hichem.f@live.de>
While moving completion resolve to the event system in #9668 we introduced what
is essentially a "DOS attack" on slow LSPs. Completion resolve requests were
made in the render loop and debounced with a timeout. Once the timeout expired
the resolve request was made. The problem is the next frame would immediately
request a new completion resolve request (and mark the old one as obsolete but
because LSP has no notion of cancelation the server would still process it). So
we were in essence sending one completion request to the server every 150ms and
only stopped if the server managed to respond before we rendered a new frame.
This caused overload on slower machines/with slower LS.
In this PR I revamped the resolve handler so that a request is only ever
resolved once. Both by checking if a request is already in-flight and by marking
failed resolve requests as resolved.
Make the popup positions more consistent.
Improvements:
1. if the signature popup content is bigger than the available space,
then the popup is always shown under the cursor, even if there more
space above the cursor than below
2. There is no mutation anymore inside required_size. Maybe in the future
we can update all widgets to have no mutations and change the trait
Signed-off-by: Ben Fekih, Hichem <hichem.f@live.de>
Currently the editor mode has no effect on the behavior of `search` and
`rsearch`. We can pass in the right movement for the editor mode to make
the behavior or `search` and `rsearch` match `search_next` and
`search_prev` in select mode.
implement handle_event to cycle through the function signatures.
To change the signature press alt+p/n .
Signed-off-by: Ben Fekih, Hichem <hichem.f@live.de>
when the available height for the popup is low/small, then it is not
possible to scroll until the end
Signed-off-by: Ben Fekih, Hichem <hichem.f@live.de>
Previously unnecessary/deprecated diagnostic tags replaced the highlight
for the severity of a diagnostic. This could cause either the severity
or unnecessary/deprecated scopes to disappear when diagnostic ranges
overlapped though. Plus the severity highlight can be interesting in
addition to the unnecessary/deprecated highlight.
So this change separates the unnecessary and deprecated highlights from
the severity highlights, so each is merged separately and when they
overlap, the highlights are combined.
Prior to this change, every integration test which wanted its line
endings to be handled transparently across platforms, i.e. test with
the same input that has its platform's line feed characters, converting
the line endings was up to each individual test by calling the
`platform_line` helper function. This significantly increases the amount
of boilerplate one has to copy between all the tests.
However, there are some test cases that need to exert strict control
over the exact input text without being manipulated behind the scenes by
the test framework.
So, with this change, the line feed conversions are factored into
the `TestCase` struct. By default, line endings of the input text
are converted to the platform's native line feed ending, but one can
explicitly specify in their test case when the input text should be left
alone and tested as is.
This reverts commit 0dc67ff885.
See the post-merge discussion in #9828. The old behavior was less
surprising and we have other ways to abort from a prompt, so let's
revert the behavior change.
This uses the new TreeCursor type from the parent commit to reimplement
the tree-sitter motions (`A-p/o/i/n`). Other tree-sitter related
features like textobjects are not touched with this change and will
need a different, unrelated approach to solve.
The refactor in bcf7b263 introduced a possible subtraction with overflow
when the statusline is layed out so that the left or right sides are
larger than the padding it would take to align the center area to the
middle.
When the left or right areas are too large, we can evenly space the
elements rather than trying to align the center area to the middle.
This prevents possible underflows and makes sense visually - it's
still easy to tell the areas apart at a glance.
The `shell_impl` and `shell_impl_async` functions no longer return
`success` because it was always `true`. If the command didn't succeed
both functions would return an `Err`.
This was also the reason, why `shell_keep_pipe` didn't work. It relied
upon the value of `success` and aborted in case of an `Err`.
It now removes any selection for which `shell_impl` returns `Err`.
If the command always fails, the selections are preserved and an error
message is displayed in the status bar.
In the `reload-all` command, we should not stop reloading the documents
if one error is found. Instead, we should report the error and continue
trying to reload the current open documents. This is useful in cases
where a backing file does not exist temporarily (e.g. when editing a git
patch in the outstanding chain that doesn't have a file just yet).
This change also remove the error messages in the cases where the
backing is `None`, like in new docs or `tutor`.
* feat: add 'file-abs-path' to statusline (#4434)
* cleanup implementation
* rename to be non-abbreviated names
---------
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* implement another selection modifying command
* Selection feels more ergonomic in case of swapping the direction. This also fixes a problem when starting at an empty line.
* rename select_line_up/down to select_line_above/below
* apply clippy suggestion of using cmp instead of if-chain
* revert `Extent` implementing `Clone/Copy`
* move select_line functions below extend_line implementations
* implement help add function, which saturates at the number of text lines
---------
Co-authored-by: Emi <emanuel.boehm@gmail.com>
Test Document
-------------
```
{{
}
}
```
Steps To Reproduce
------------------
1. 2j # move_visual_line_down
1. C # copy_selection_on_next_line
1. mdm # surround_delete
Debug
-----
`assertion failed: last <= from', transaction.rs:597:13`
Release
-------
`called `Result::unwrap()` on an `Err` value: Char range out of bounds:
char range 18446744073709551614..18446744073709551615,
Rope/RopeSlice char length 7', ropey-1.6.1/src/rope.rs:546:37`
Description
-----------
Processing the surrounding pairs in order violates the assertion the
ranges are ordered. To handle nested surrounds all positions have to
be sorted. Also surround_replace has to track the proper replacement
character for each position.
1. Create a document containing `{A}`
1. C-w v # vsplit
1. gl # goto_line_end
1. b # move_prev_word_start
1. ` # switch_to_lowercase
1. mrm( # surround replace
1. C-w v # vsplit
In the debug build surround_replace/delete will immedately assert with
`assertion failed: last <= from', transaction.rs:597:13`. The splits and
lowercase conversion are not needed to trigger the bug.
In the release build the surround becomes `)a(` and the last vsplit
causes the transaction to panic.
`internal error: entered unreachable code:
(Some(Retain(18446744073709551573)))', transaction.rs:185:46`
Since the selection direction is backwards get_surround_pos returns the
pairs reversed but the downstream code assumes they are in the forward
direction.
Joining lines with Alt-J does not properly select the inserted spaces
when the selection contains blank lines. In the worst case it panics
with an out of bounds index.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value:
Char index out of bounds: char index 11, Rope/RopeSlice char length 10'
Steps to reproduce:
* Create a new document
```
a
b
c
d
e
```
* % (Select all)
* Alt-J (join and select the spaces)
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.
* 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
* 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>