Commit Graph

194 Commits (a97ebc2ed06ba17aab7479da517b794c30247988)

Author SHA1 Message Date
Nikita Revenco a97ebc2ed0 style: format 2025-02-18 14:17:31 +00:00
Nikita Revenco 4fabd7927d refactor: remove unneeded macro 2025-02-18 14:08:16 +00:00
Nikita Revenco 24bd14863b feat: restore cursor when performing file operations 2025-02-18 14:04:10 +00:00
Nikita Revenco 9227267aa3 chore: remove TODO comment 2025-02-18 13:52:09 +00:00
Nikita Revenco 8eac1c2721 feat: refresh picker when directory operations are performed 2025-02-18 13:11:37 +00:00
Nikita Revenco fac6c7c1a6 chore: appease clippy 2025-02-18 12:38:27 +00:00
Nikita Revenco b6bbd4f18a fix: delete path, not confirmation e.g. `y` 2025-02-18 12:38:11 +00:00
Nikita Revenco 6a558be7b3 feat: better initial prompts when using file picker commands 2025-02-18 12:36:54 +00:00
Nikita Revenco 0e6e3e8aeb refactor: rename variable 2025-02-18 12:24:45 +00:00
Nikita Revenco cd6584f0ab chore: appease clippy 2025-02-18 12:20:37 +00:00
Nikita Revenco 382803c803 feat: add confirmation prompt when overwriting 2025-02-18 12:15:35 +00:00
Nikita Revenco e177c48208 refactor: use Option<Result> to indicate if a status message should not be changed 2025-02-18 11:42:03 +00:00
Nikita Revenco a099ae1dbe style: formatting 2025-02-18 11:33:01 +00:00
Nikita Revenco eafd8ace18 style: formatting 2025-02-18 11:28:30 +00:00
Nikita Revenco eecabdbeb5 feat: pass context to all callbacks in file operations 2025-02-18 11:16:15 +00:00
Nikita Revenco 7fd7b7274a feat: implement copy path of selected item 2025-02-18 11:11:02 +00:00
Nikita Revenco b3d0f16276 feat: use display method on paths 2025-02-18 10:48:38 +00:00
Nikita Revenco 835cda11f1 refactor: variable renaming 2025-02-18 10:27:58 +00:00
Nikita Revenco a96841dac1 feat: implement copying 2025-02-17 23:54:37 +00:00
Nikita Revenco 469115e5ee feat: implement delete files 2025-02-17 23:46:04 +00:00
Nikita Revenco f59c5966f6 feat: implement creating new files and directory 2025-02-17 23:37:58 +00:00
Nikita Revenco 2eef82e4df feat: implement basic callback functions for prompt operarions 2025-02-17 23:08:17 +00:00
Nikita Revenco 7dc631de9a chore: allow macro to destructure 2025-02-17 22:24:13 +00:00
Nikita Revenco 43f40d318f chore: add TODO comments 2025-02-17 22:08:31 +00:00
Nikita Revenco d5fb7b2999 refactor: improve the declare_key_handlers macro 2025-02-17 21:54:45 +00:00
Nikita Revenco 5d29a175f3 refactor: utility macro to declare multiple handlers with ease 2025-02-17 21:41:23 +00:00
Nikita Revenco 9a28d4fa42 feat: create operations for create, delete, copy, rename in file explorer 2025-02-17 21:22:51 +00:00
Nikita Revenco f4e5c26112 feat: figure out how to pass custom callback function set by keymap to picker 2025-02-17 21:09:04 +00:00
Michael Davis 369f2bb93d
ui: Expose the 'prompt' module
The prompt Completion type alias is otherwise private. This will be
used in <https://redirect.github.com/helix-editor/helix/pull/12527>
to refactor some functions to return prompt completions.
2025-02-01 21:12:20 -05:00
Nikita Revenco a63a2ad281
feat: specify custom lang server(s) for `:lsp-stop` and `:lsp-restart` (#12578)
Co-authored-by: Nikita Revenco <154856872+NikitaRevenco@users.noreply.github.com>
2025-01-23 18:14:35 -06:00
Michael Davis d4ade40983
Rename "file browser" => "file explorer"
Connects #11285
2025-01-23 18:17:56 -05:00
Denys Rybalka 6b044aeb29
Add file browser (#11285) 2025-01-23 16:28:18 -06:00
Rolo c1d382a532 fix(lints): clippy 1.84 2025-01-23 15:18:16 -05:00
Nikita Revenco 91a5d407da
Allow theming directory prompt completions (#12205) 2024-12-17 21:13:42 -06:00
Philipp Mildenberger dc941d6d24
Add support for path completion (#2608)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Co-authored-by: Pascal Kuthe <pascalkuthe@pm.me>
2024-11-21 21:12:36 -06:00
Ingrid 1d0a3d49d3
Consistently maintain view position (#10559)
* replicate t-monaghan's changes

* remove View.offset in favour of Document.view_data.view_position

* improve access patterns for Document.view_data

* better borrow checker wrangling with doc_mut!()

* reintroduce ensure_cursor_in_view in handle_config_events

since we sorted out the borrow checker issues using partial borrows,
there's nothing stopping us from going back to the simpler implementation

* introduce helper functions on Document .view_offset, set_view_offset

* fix rebase breakage
2024-07-23 19:54:00 +02:00
Pascal Kuthe 2c0506aa96
streamline text decoration API
This commit brings the text decoration API inline with the
LineAnnotation API (so they are consistent) resulting in a single
streamlined API instead of multiple ADHOK callbacks.
2024-07-15 16:35:26 +02:00
Michael Davis a7777b3c11
Accept 'IntoIterator<Item = Column<T, D>>' for picker columns
This allows us to replace any `vec![..]`s of columns where all columns
are static with static slices `[..]`.
2024-07-15 09:31:33 -04:00
Michael Davis 8555248b01
Accept 'IntoIterator<Item = T>' for Picker::new options
`Picker::new` loops through the input options to inject each of them, so
there's no need to collect into an intermediary Vec. This removes some
unnecessary collections. Also, pickers that start with no initial
options can now pass an empty slice instead of an empty Vec.

Co-authored-by: Luis Useche <useche@gmail.com>
2024-07-15 09:31:33 -04:00
Michael Davis 3906f6605f
Avoid allocations in Picker file preview callback
The `FileLocation` and `PathOrId` types can borrow paths rather than
requiring them to be owned. This takes a refactor of the preview
functions and preview internals within `Picker`. With this change we
avoid an unnecessary `PathBuf` clone per render for any picker with a
file preview function (i.e. most pickers).

This refactor is not fully complete. The `PathOrId` is _sometimes_ an
owned `PathBuf`. This is for pragmatic reasons rather than technical
ones. We need a further refactor to introduce more core types like
`Location` in order to eliminate the Cow and only use `&Path`s within
`PathOrId`. This is left for future work as it will be a larger refactor
almost entirely fitting into the LSP commands module and helix-core -
i.e. mostly unrelated to refactoring the `Picker` code itself.

Co-authored-by: Pascal Kuthe <pascalkuthe@pm.me>
2024-07-15 09:31:33 -04:00
Michael Davis 9e31ba5475
Consolidate DynamicPicker into Picker
DynamicPicker is a thin wrapper over Picker that holds some additional
state, similar to the old FilePicker type. Like with FilePicker, we want
to fold the two types together, having Picker optionally hold that
extra state.

The DynamicPicker is a little more complicated than FilePicker was
though - it holds a query callback and current query string in state and
provides some debounce for queries using the IdleTimeout event.
We can move all of that state and debounce logic into an AsyncHook
implementation, introduced here as `DynamicQueryHandler`. The hook
receives updates to the primary query and debounces those events so
that once a query has been idle for a short time (275ms) we re-run
the query.

A standard Picker created through `new` for example can be promoted into
a Dynamic picker by chaining the new `with_dynamic_query` function, very
similar to FilePicker's replacement `with_preview`.

The workspace symbol picker has been migrated to the new way of writing
dynamic pickers as an example. The child commit will promote global
search into a dynamic Picker as well.
2024-07-15 09:31:32 -04:00
Michael Davis 385b398808
Add column configurations for existing pickers
This removes the menu::Item implementations for picker item types and
adds `Vec<Column<T, D>>` configurations.
2024-07-15 09:31:32 -04:00
Michael Davis f40fca88e0
Refactor Picker in terms of columns
`menu::Item` is replaced with column configurations for each picker
which control how a column is displayed and whether it is passed to
nucleo for filtering. (This is used for dynamic pickers so that we can
filter those items with the dynamic picker callback rather than nucleo.)

The picker has a new lucene-like syntax that can be used to filter the
picker only on certain criteria. If a filter is not specified, the text
in the prompt applies to the picker's configured "primary" column.

Adding column configurations for each picker is left for the child
commit.
2024-07-15 09:31:31 -04:00
Schmiddiii 06d8fee048
Allow multiple language server with lsp-workspace-command (#10176)
This fix allows for multiple language servers at once which support
workspace commands. This was previously broken as just the first
language server supporting workspace commands was queried when listing
allowed worspace commands.

The fix is in two parts. Firstly, querying all workspace commands from
all language servers available and using them when actually running the
command in `lsp_workspace_command`. Secondly, doing the same in
`completers::lsp_workspace_command` such that completion still works as
expected.

The fix has one remaining issue, which I am unsure how to handle in the
best way possible, but which I also don't think should happen often:
Multiple language servers may register commands with the same name. This
will lead to that command being listed in the popup menu and in the
completion list multiple times, which can be possibly confusing. One
could disambigue them in the popover menu, but I am not sure the same
can be done for completion. When running `lsp-workspace-command` with
parameters, this behavior is "fixed" by displaying an error in that
case. I am unsure if this is the best fix for this issue in that case,
but could not find a better one.
2024-07-06 10:34:33 -05:00
TiredTumblrina 94a9c81eb0
Prevent improper files (like /dev/random) from being used as file arguments (#10733)
* Implement check before adding path to files

* fix problem where directories were removed from args.files

* Revert "Implement check before adding path to files"

This reverts commit c123944d9b.

* Dissallow opening of irregular non-symlink files

* Fixed issue with creating new file from command line

* Fixed linting error.

* Optimized regularity check as suggested in review

* Created DocumentOpenError Sum Type to switch on in Application

* Forgot cargo fmt

* Update helix-term/src/application.rs

Accept suggestion in review.

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

* Moved thiserror version configuration to the workspace instead of the individual packages.

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2024-06-18 18:14:17 +02:00
Ben Fekih, Hichem af4ff80524 Improve popup position
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>
2024-04-20 08:39:12 -04:00
Kirawi d9de809a57
add register completion (#9936) 2024-03-19 17:26:32 +01:00
Pascal Kuthe cd02976fa3
switch to regex-cursor (#9422) 2024-02-26 16:45:20 +09:00
Mo 6db666fce1
Optimization of tilde expansion (#9709)
* 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
2024-02-24 16:59:11 +01:00
kyfanc fe869e5dc7
fix lsp config reload (#9415)
`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>
2024-02-13 11:58:53 +01:00