Commit Graph

137 Commits (3256b013889eee5f9bc66f58b59386214bc49cf2)

Author SHA1 Message Date
trivernis 3256b01388
Merge remote-tracking branch 'origin/master' 1 year ago
Alex Kladov e6a2df8c79
Better sorting in picker in case of ties (#5169) 1 year ago
Gokul Soumya 914d294499 Add DynamicPicker for updating options on every key 1 year ago
Pascal Kuthe 70d78123b9
properly handle detachted git worktrees (#5097) 1 year ago
Tshepang Mbambo a8a54be6bc
Fix nightly clippy lints (#4954) 1 year ago
trivernis e20886dd60
Merge branch 'master' 1 year ago
A-Walrus 2f9ca3840a
Add preview for scratch buffers in buffer picker (#3454) 2 years ago
Matthias Deiml dee5b2a983
Add LSP workspace command picker (#3140)
* Add workspace command picker

* Make command typable

* Add optional argument to lsp-workspace-command
2 years ago
trivernis 46b135bdc5
Merge branch 'master' 2 years ago
Skyler Hawthorne 8c667ef8de factor editor event handling into function 2 years ago
trivernis 1ad06ee586
Merge branch 'master' 2 years ago
trivernis 8b789b6b86
Merge branch 'seperate_code_action' 2 years ago
Pascal Kuthe 7af599e0af Treat space as a seperator instead of a character in fuzzy picker 2 years ago
A-Walrus f3958aa1fd
Cycled to end/beginning + no more matches msgs (#3176)
* Show status msg when next/prev cycles around

* Add msg when there is no wraparound

* Cleanup code

* Change msg to "Wrapped around document"
2 years ago
A-Walrus 57dc5fbe3a
Show "Invalid regex" message on enter (Validate) (#3049)
* Show "Invalid regex" message on enter (Validate)

* Reset selection on invalid regex

* Add popup for invalid regex

* Replace set_position with position

* Make popup auto close
2 years ago
trivernis 2da81760f5
Merge branch 'master' of github.com:helix-editor/helix 2 years ago
A-Walrus cc47d3fb9d Add `text` to language completer 2 years ago
trivernis c24c30584b
Merge branch 'master' of github.com:helix-editor/helix 2 years ago
Frojdholm 4c9f144dac
fix: Recalculate completion when going through prompt history (#3193)
* fix: Recalculate completion when going through prompt history

* Update completion when the prompt line is changed

It should not be possible to update the line without also updating the
completion since the completion holds an index into the line.

* Fix Prompt::with_line recalculate completion

with_line was the last function where recalculate completion had to be
done manually. This function now also recalculates the completion so
that it's impossible to forget.

* Exit selection when recalculating completion

Keeping the selection index when the completion has been recalculated
doesn't make sense. This clears the selection automatically, removing
most needs to manually clear it.

* Remove &mut on save_filter

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
Blaž Hrastnik 8a4fbf6daf
completion: remove_follow links on filename_impl
We don't need to follow links since we're only scanning the current
directory level (non-recursive).
2 years ago
trivernis 151ac52741
Merge branch 'master' of github.com:helix-editor/helix 2 years ago
ChrHorn a7ff39fe3e
remove duplicate entries from theme picker (#3439) 2 years ago
A-Walrus 6b84344e20
Add completion for nested settings (#3183)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2 years ago
trivernis a6e16df9a3
Merge branch 'master' of github.com:helix-editor/helix 2 years ago
trivernis 7cb8330751
Merge remote-tracking branch 'pr-tree/tree_explore'
Signed-off-by: trivernis <trivernis@protonmail.com>
2 years ago
Gokul Soumya 791bf7e50a
Add lsp signature help (#1755)
* Add lsp signature help

* Do not move signature help popup on multiple triggers

* Highlight current parameter in signature help

* Auto close signature help

* Position signature help above to not block completion

* Update signature help on backspace/insert mode delete

* Add lsp.auto-signature-help config option

* Add serde default annotation for LspConfig

* Show LSP inactive message only if signature help is invoked manually

* Do not assume valid signature help response from LSP

Malformed LSP responses are common, and these should not crash the
editor.

* Check signature help capability before sending request

* Reuse Open enum for PositionBias in popup

* Close signature popup and exit insert mode on escape

* Add config to control signature help docs display

* Use new Margin api in signature help

* Invoke signature help on changing to insert mode
2 years ago
Bob e5c7aaed91
support prefilling prompt (#2459)
* support prefilling prompt

* introduce with_line builder method in Prompt

* extract show_prompt

* use textobject_word as fallback input
2 years ago
Mr. E dbf68e0370
Customizable/configurable status line (#2434)
* feat(statusline): add the file type (language id) to the status line

* refactor(statusline): move the statusline implementation into an own struct

* refactor(statusline): split the statusline implementation into different functions

* refactor(statusline): Append elements using a consistent API

This is a preparation for the configurability which is about to be
implemented.

* refactor(statusline): implement render_diagnostics()

This avoid cluttering the render() function and will simplify
configurability.

* feat(statusline): make the status line configurable

* refactor(statusline): make clippy happy

* refactor(statusline): avoid intermediate StatusLineObject

Use a more functional approach to obtain render functions and write to
the buffers, and avoid an intermediate StatusLineElement object.

* fix(statusline): avoid rendering the left elements twice

* refactor(statusline): make clippy happy again

* refactor(statusline): rename `buffer` into `parts`

* refactor(statusline): ensure the match is exhaustive

* fix(statusline): avoid an overflow when calculating the maximal center width

* chore(statusline): Describe the statusline configurability in the book

* chore(statusline): Correct and add documentation

* refactor(statusline): refactor some code following the code review

Avoid very small helper functions for the diagnositcs and inline them
instead.
Rename the config field `status_line` to `statusline` to remain
consistent with `bufferline`.

* chore(statusline): adjust documentation following the config field refactoring

* revert(statusline): revert regression introduced by c0a1870

* chore(statusline): slight adjustment in the configuration documentation

* feat(statusline): integrate changes from #2676 after rebasing

* refactor(statusline): remove the StatusLine struct

Because none of the functions need `Self` and all of them are in an own
file, there is no explicit need for the struct.

* fix(statusline): restore the configurability of color modes

The configuration was ignored after reintegrating the changes of #2676
in 8d28f95.

* fix(statusline): remove the spinner padding

* refactor(statusline): remove unnecessary format!()
2 years ago
Joe b26e7e2e8f
Add live preview to theme picker (#1798)
* Add theme picker with live preview

* Add live theme preview to :theme command

* cargo fmt

* Fix clippy warnings

* Remove picker variant

* Remove unused import

* Cleanup

* Change current_theme to last_theme

* Fix accidental comment flash deletion

* Typo

* Remove theme cache

* Add some comments

* Refactor some theme handling

TIL flatmap on Option is called  and_then

* Remove unnecessary renames

* Constrain last_theme theme preview lifecycle

* Switch to bitflag implementation

* Better handling of last_theme

* Sort theme names

* Better memory juggling

* Missed a branch

* Remove name from theme, switch bitand to &

* cargo fmt

* Update helix-view/src/editor.rs

* Switch boolean to enum

* Remove bitflag impl

* cargo fmt

* Remove un-needed type arg

* cargo fmt
2 years ago
Gokul Soumya 6e2aaed5c2
Reuse menu::Item trait in picker (#2814)
* Refactor menu::Item to accomodate external state

Will be useful for storing editor state when reused by pickers.

* Add some type aliases for readability

* Reuse menu::Item trait in picker

This opens the way for merging the menu and picker code in the
future, since a picker is essentially a menu + prompt. More
excitingly, this change will also allow aligning items in the
picker, which would be useful (for example) in the command palette
for aligning the descriptions to the left and the keybinds to
the right in two separate columns.

The item formatting of each picker has been kept as is, even though
there is room for improvement now that we can format the data into
columns, since that is better tackled in a separate PR.

* Rename menu::Item::EditorData to Data

* Call and inline filter_text() in sort_text() completion

* Rename diagnostic picker's Item::Data
2 years ago
Michael Jones d8abd1eaf3
Sort themes, language & files by score & then name (#2675)
* Sort themes by score & then name

Previously the themes were appearing unordered after typing ':theme '.
This sorts them first by fuzzy score and then by name so that they
generally appear in a more ordered fashion in the initial list.

The sort by name does not really pay off when there is a score so an
alternative approach would be to sort by name if there is string to
fuzzy match against and otherwise sort by score.

I've lowercased the names as that avoids lower case & upper case letters
being sorted into separate groups. There might be a preferable approach
to that though.

* Sort language & files by score then name

And change to use sort_unstable_by instead of sort_unstable_by_key as it
allows us to avoid some allocations.

I don't fully understand the flow of the 'filename_impl' function but
this seems to deliver the desired results.

* Remove unnecessary reference

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

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2 years ago
Falco Hirschenberger ed89f8897e
Add workspace and document diagnostics picker (#2013)
* Add workspace and document diagnostics picker

fixes #1891

* Fix some of @archseer's annotations

* Add From<&Spans> impl for String

* More descriptive parameter names.

* Adding From<Cow<str>> impls for Span and Spans

* Add new keymap entries to docs

* Avoid some clones

* Fix api change

* Update helix-term/src/application.rs

Co-authored-by: Bjorn Ove Hay Andersen <bjrnove@gmail.com>

* Fix a clippy hint

* Sort diagnostics first by URL and then by severity.

* Sort diagnostics first by URL and then by severity.

* Ignore missing lsp severity entries

* Add truncated filepath

* Typo

* Strip cwd from paths and use url-path without schema

* Make tests a doctest

* Better variable names

Co-authored-by: Falco Hirschenberger <falco.hirschenberger@itwm.fraunhofer.de>
Co-authored-by: Bjorn Ove Hay Andersen <bjrnove@gmail.com>
2 years ago
Blaž Hrastnik 23b5b1e25a Remove a couple more unwraps 2 years ago
cossonleo 21d4bf859b tree helper and file explorer 2 years ago
Skyler Hawthorne ed950fcc56 Add more context; Editor::open doesn't need to own path 2 years ago
Roland Kovacs c2cc2037b5
Better handling of symlinks (#2718)
- Add file-picker.follow-symlinks configuration option (default is true), this
  also controls if filename and directory completers follow symlinks.

- Update FilePicker to set editor error if opening a file fails, instead of
  panicing.

Fix #1548
Fix #2246
2 years ago
Blaž Hrastnik b14c258a2c
prompt: If submitting empty prompt, use default (last used) 2 years ago
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
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
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
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 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
Blaž Hrastnik 78fba8683b
Picker performance improvements 2 years ago
Philipp Mildenberger 49c5bc5934
Add jumplist support for the search (closes #1625) (#1718) 2 years ago
Daniel S Poulin bdbf423876
Minor cleanup of file picker file gathering logic (#1683)
* Refactor file picker filetype filter logic to remove panic, make clearer

An unwrap was unneccesarily present due to a prior contribution of mine
which was before I had any understanding of error handling in Rust. I've
also swapped a match for an if let, as was originally suggested in the
original pull request adding filetype filtering, but was merged before I
could address.

* Add some comments to the file picker code for clarity

* Switch to expect instead of ignoring type def error
2 years ago
Daniel S Poulin 700058f433
Always ignore the .git directory in file picker (#1604)
Some users (including myself) want to turn off filtering of files
prefixed with `.`, as they are often useful to edit. For example, `.env`
files, configuration for linters `.eslint.json` and the like.
2 years ago
Blaž Hrastnik c06155ace4 Extract a helper function for lsp::Location 2 years ago
Blaž Hrastnik 24f90ba8d8 Manually recalculate initial completion where it matters 2 years ago
Blaž Hrastnik af21e2a5b4 Pass through Editor instead of Context 2 years ago