Commit graph

706 commits

Author SHA1 Message Date
Michael Davis
d8526a752c
Use Popup::ignore_escape_key helper for completion (#6006)
The completion component has a separate branch for handling the
Escape key but it can use the `ignore_escape_key` helper added for
signature-help instead.

This should not cause a behavior change - it's just cleaning up the
completion component.
2023-02-16 10:15:25 +09:00
Matouš Dzivjak
2bebc5042e
feat(ui): deprecated completions (#5932)
* feat(ui): deprecated completions

Mark deprecated completions using strike-through
(CROSSED_OUT modifier). The deprection information
is taken either from the `deprecated` field of the
completion item or from the completion tags.

The field seems to be the older way of passing
the deprecated information and it was already
marked as deprecated for Symbol. In completion
item the field is still valid but it seems that
the LSP is moving in the general direction of using
tags for this kind of information and as such
relying on tags as well seems reasonable and
future-proof.
2023-02-13 11:44:31 +09:00
Gokul Soumya
425315d752 Fix completion doc popup area calculation logic
Earlier the doc popup would draw over the compeltion popup
itself and sometimes over the cursor too.
2023-02-11 16:05:23 +09:00
Gokul Soumya
1562b5ce67 Create popup rect instead of using raw values 2023-02-11 16:05:23 +09:00
Gokul Soumya
0f844ef191 Refactor our Markdown construction in completion doc 2023-02-11 16:05:23 +09:00
Gokul Soumya
937825e8fc Rename completion doc popup area variables 2023-02-11 16:05:23 +09:00
Gokul Soumya
8e9c329952 Use early return in rendering completion doc 2023-02-11 16:05:23 +09:00
Colton Clemmer
ea3293b4da
Split modification indicator from file statusline elements (#4731) 2023-02-10 11:34:18 -06:00
Pascal Kuthe
8a3ec443f1
Fix new clippy lints (#5892) 2023-02-09 16:27:08 -06:00
Blaž Hrastnik
8a602995fa
Address new clippy lints 2023-02-09 11:44:14 +09:00
Pascal Kuthe
e474779c87
bump msrv to 1.63 (#5570)
* bump msrv to 1.63

* resolve new complex type clippy lints
2023-02-09 11:24:31 +09:00
Dylan Bulfin
61e1e6160a
Removing C-j and C-k from completion menu navigation (#5070) 2023-02-02 14:49:17 -05:00
Pascal Kuthe
f0c2e898b4
add substring matching options to picker (#5114) 2023-02-02 14:48:16 -05:00
Pascal Kuthe
2949bb018c
fix position translation at EOF with softwrap (#5786) 2023-02-02 13:04:41 -05:00
Pascal Kuthe
6ed2348078
Hide duplicate symlinks from the picker (#5658)
* hide duplicate symlinks from the picker

* Apply suggestions from code review

Co-authored-by: g-re-g <123515925+g-re-g@users.noreply.github.com>

* minor stylistic fix

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

---------

Co-authored-by: g-re-g <123515925+g-re-g@users.noreply.github.com>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2023-02-02 11:14:02 -06:00
Pascal Kuthe
4dcf1fe66b
rework positioning/rendering and enable softwrap/virtual text (#5420)
* rework positioning/rendering, enables softwrap/virtual text

This commit is a large rework of the core text positioning and
rendering code in helix to remove the assumption that on-screen
columns/lines correspond to text columns/lines.

A generic `DocFormatter` is introduced that positions graphemes on
and is used both for rendering and for movements/scrolling.
Both virtual text support (inline, grapheme overlay and multi-line)
and a capable softwrap implementation is included.

fix picker highlight

cleanup doc formatter, use word bondaries for wrapping

make visual vertical movement a seperate commnad

estimate line gutter width to improve performance

cache cursor position

cleanup and optimize doc formatter

cleanup documentation

fix typos

Co-authored-by: Daniel Hines <d4hines@gmail.com>

update documentation

fix panic in last_visual_line funciton

improve soft-wrap documentation

add extend_visual_line_up/down commands

fix non-visual vertical movement

streamline virtual text highlighting, add softwrap indicator

fix cursor position if softwrap is disabled

improve documentation of text_annotations module

avoid crashes if view anchor is out of bounds

fix: consider horizontal offset when traslation char_idx -> vpos

improve default configuration

fix: mixed up horizontal and vertical offset

reset view position after config reload

apply suggestions from review

disabled softwrap for very small screens to avoid endless spin

fix wrap_indicator setting

fix bar cursor disappearring on the EOF character

add keybinding for linewise vertical movement

fix: inconsistent gutter highlights

improve virtual text API

make scope idx lookup more ergonomic

allow overlapping overlays

correctly track char_pos for virtual text

adjust configuration

deprecate old position fucntions

fix infinite loop in highlight lookup

fix gutter style

fix formatting

document max-line-width interaction with softwrap

change wrap-indicator example to use empty string

fix: rare panic when view is in invalid state (bis)

* Apply suggestions from code review

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

* improve documentation for positoning functions

* simplify tests

* fix documentation of Grapheme::width

* Apply suggestions from code review

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

* add explicit drop invocation

* Add explicit MoveFn type alias

* add docuntation to Editor::cursor_cache

* fix a few typos

* explain use of allow(deprecated)

* make gj and gk extend in select mode

* remove unneded debug and TODO

* mark tab_width_at #[inline]

* add fast-path to move_vertically_visual in case softwrap is disabled

* rename first_line to first_visual_line

* simplify duplicate if/else

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2023-02-01 02:03:19 +09:00
Miguel Madrid-Mencía
d2d3024337
Fix clippy 1.67 warnings (#5697) 2023-01-27 09:43:46 -06:00
Ivan Tham
a20a96abdc
Remove apply_transaction helper (#5598) 2023-01-21 12:13:43 -06:00
Pascal Kuthe
7868e5f2d8
highlight non-bar cursors (#5575) 2023-01-19 00:28:45 +08:00
Gokul Soumya
5c7db7aed5 Replace menu::Item::{row, label} with format() 2023-01-18 14:19:32 +09:00
Gokul Soumya
b2837ff3be Minimize allocation when converting table rows to string 2023-01-18 14:19:32 +09:00
Gokul Soumya
7a76c6cbba Use upstream implementation of table column calculation
Changed in a68e38e59e.
2023-01-18 14:19:32 +09:00
Gokul Soumya
9aafcb2b9a Reuse table in picker 2023-01-18 14:19:32 +09:00
gibbz00
deae13f404
Primary cursor colors by mode (#5130)
* (theme) feat: mode based primary cursor colors

* docs/themes: mode based primary cursor colors
2023-01-18 14:18:49 +09:00
Itay123
d3e0f18c89
Added opening files in the background with A-ret shortcut (#4435) 2023-01-16 16:18:13 +09:00
Pascal Sommer
75dfaff338
Add some function documentations (#5360) 2023-01-10 20:11:43 -06:00
Dylan Bulfin
c4b0eb8356
Fix autocompletion for paths with period (#5175)
* Bug fix

Updated bug fix

* Simplified conditionals

* Switched to use path separator constant
2023-01-09 11:25:19 +09:00
Nick
c9ed42cdec
Add a status line element that shows just the basename of the file (#5318) 2022-12-31 08:18:14 -06:00
jliaoh
df1830ef28
mouse operations respect scrolloff (#5255) 2022-12-22 20:30:33 -06:00
Jonathan LEI
24cd7f6adf Make prompt suggestions greyed out 2022-12-17 13:59:05 -06:00
Alex Kladov
e6a2df8c79
Better sorting in picker in case of ties (#5169) 2022-12-17 13:30:43 -06:00
Michael Davis
35cf972ce4 DynamicPicker: Reset idle timeout on refresh
If the new results shown by the picker select a file that hasn't been
previewed before, the idle timeout would not trigger highlighting on
that file. With this change, we reset the idle timeout and allow that
file to be highlighted on the next idle timeout event.
2022-12-15 17:52:44 +09:00
Michael Davis
a7daa02346 DynamicPicker: Use idle-timeout as debounce
This change uses the idle-timeout event to trigger fetching new results
in the DynamicPicker, so idle-timeout becomes a sort of debounce. This
prevents querying the language server overly aggressively.
2022-12-15 17:52:44 +09:00
Gokul Soumya
914d294499 Add DynamicPicker for updating options on every key 2022-12-15 17:52:44 +09:00
Gokul Soumya
c64debc741 Add force_score() for scoring picker items without optimizations 2022-12-15 17:52:44 +09:00
Pascal Kuthe
70d78123b9
properly handle detachted git worktrees (#5097) 2022-12-11 19:20:34 +09:00
ath3
6798a6651f
Only write newlines in menu selection popup if the lsp returns detail (#4902) 2022-12-08 21:55:15 -06:00
Michael Davis
2077f5e26a
Apply completion edits to all cursors (#4496)
Completion edits - either basic `insert_text` strings or structured
`text_edit`s - are assumed by the LSP spec to apply to the current
cursor (or at least the trigger point). We can use the range (if any)
and text given by the Language Server to create a transaction that
changes all ranges in the current selection though, allowing auto-
complete to affect multiple cursors.
2022-12-06 10:29:40 +09:00
Tshepang Mbambo
a8a54be6bc
Fix nightly clippy lints (#4954) 2022-12-01 10:37:38 -06:00
Pascal Kuthe
5a3ff74221
Show (git) diff signs in gutter (#3890)
* Show (git) diff signs in gutter (#3890)

Avoid string allocation when git diffing

Incrementally diff using changesets

refactor diffs to be provider indepndent and improve git implementation

remove dependency on zlib-ng

switch to asynchronus diffing with similar

Update helix-vcs/Cargo.toml

fix toml formatting

Co-authored-by: Ivan Tham <pickfire@riseup.net>

fix typo in documentation

use ropey reexpors from helix-core

fix crash when creating new file

remove useless use if io::Cursor

fix spelling mistakes

implement suggested improvement to repository loading

improve git test isolation

remove lefover comments

Co-authored-by: univerz <univerz@fu-solution.com>

fixed spelling mistake

minor cosmetic changes

fix: set self.differ to None if decoding the diff_base fails

fixup formatting

Co-authored-by: Ivan Tham <pickfire@riseup.net>

reload diff_base when file is reloaded from disk

switch to imara-diff

Fixup formatting

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

Redraw buffer whenever a diff is updated.

Only store hunks instead of changes for individual lines to easily allow
jumping between them

Update to latest gitoxide version

Change default diff gutter position

Only update gutter after timeout

* update diff gutter synchronously, with a timeout

* Apply suggestions from code review

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* address review comments and ensure lock is always aquired

* remove configuration for redraw timeout

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-12-01 17:35:23 +09:00
Michael Davis
9a9e462183 Call View::apply within Document::append_changes_to_history 2022-11-30 01:15:20 +09:00
Michael Davis
df5457a6e7 Remove eager application of transactions to all views 2022-11-30 01:15:20 +09:00
Michael Davis
4a103db622 Apply inversions to Views on undo/redo
When using undo/redo, the history revision can be decremented. In that
case we should apply the inversions since the given revision in
History::changes_since. This prevents panics with jumplist operations
when a session uses undo/redo to move the jumplist selection outside
of the document.
2022-11-24 10:57:12 +09:00
Michael Davis
42e37a571e
Apply transactions to all views (#4733)
* Add a test case for updating jumplists across windows

* Apply transactions to all views on history changes

This ensures that jumplist selections follow changes in documents, even
when there are multiple views (for example a split where both windows
edit the same document).

* Leave TODOs for cleaning up View::apply

* Use Iterator::reduce to compose history transactions

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

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2022-11-23 12:28:49 +09:00
Michael Davis
9059c65a53
lsp: Check server provider capabilities (#3554)
Language Servers may signal that they do not support a method in
the initialization result (server capabilities). We can check these
when making LSP requests and hint in the status line when a method
is not supported by the server. This can also prevent crashes in
servers which assume that clients do not send requests for methods
which are disabled in the server capabilities.

There is an existing pattern the LSP client module where a method
returns `Option<impl Future<Output = Result<_>>>` with `None` signaling
no support in the server. This change extends this pattern to the rest
of the client functions. And we log an error to the statusline for
manually triggered LSP calls which return `None`.
2022-11-22 11:52:23 +09:00
A-Walrus
2f9ca3840a
Add preview for scratch buffers in buffer picker (#3454) 2022-11-20 19:58:35 -06:00
Blaž Hrastnik
7e99087fa3
minor: render_diagnostics doesn't require &self either 2022-11-19 15:41:55 +09:00
Blaž Hrastnik
a640ab6b1f
Avoid repeatedly loading config 2022-11-19 15:41:03 +09:00
Michael Davis
89efb4f711
lsp: Resolve completion item asynchronously on idle-timeout (#4781)
d7d0d5ffb7 resolves completion items on
the idle-timeout event. The `Completion::resolve_completion_item`
function blocks on the LSP request though, which blocks the compositor
and in turn blocks the event loop. So until the language server returns
the resolved completion item, Helix is unable to respond to keypresses
or other LSP messages.

This is typically ok since the resolution request is fast but for some
language servers this can be problematic, and ideally we shouldn't be
blocking like this anyways.

When receiving a `completionItem/resolve` request, the Volar server
sends a `workspace/configuration` request to Helix and blocks itself
on the response, leading to a deadlock. Eventually the resolve request
times out within Helix but Helix is locked up and unresponsive in that
window.

This change resolves the completion item without blocking the
compositor.
2022-11-19 03:27:46 +09:00
Pascal Kuthe
4b89177e53
sort fuzzy matches with equal score by length in picker (#4698) 2022-11-16 17:28:20 -06:00