aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands
Commit message (Collapse)AuthorAge
* fix: Recalculate completion when going through prompt history (#3193)Frojdholm2022-08-31
| | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Derive Document language name from languages.toml name key (#3338)Michael Davis2022-08-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Derive Document language name from `languages.toml` `name` key This changes switches from deriving the language name from the `languages.toml` `scope` key to `name` (`language_id` in the `LanguageConfiguration` type). For the most part it works to derive the language name from scope by chopping off `source.` or `rsplit_once` on `.` but for some languages we have now like html (`text.html.basic`), it doesn't. This also should be a more accurate fallback for the `language_id` method which is used in LSP and currently uses the `rsplit_once` strategy. Here we expose the language's name as `language_name` on `Document` and replace ad-hoc calculations of the language name with the new method. This is most impactful for the `file-type` statusline element which is using `language_id`. * Use `Document::language_name` for the `file-type` statusline element The `file-type` indicator element in the statusline was using `Document::language_id` which is meant to be used to for telling Language Servers what language we're using. That works for languages with `language-server` configurations in `languages.toml` but shows text otherwise. The new `Document::language_name` method from the parent commit is a more accurate way to determine the language.
* Detect indent-style in `:set-language` (#3330)Michael Davis2022-08-05
| | | | | | | Indent style may change when choosing a language with `:set-language`. Line-endings most likely will not change, but `:set-language` should have a similar effect as reloading a file (`:reload`), plus the two are currently grouped in the implementation and line-ending detection is not particularly expensive.
* Avoid copying fragments (#3136)Matthias Deiml2022-08-04
| | | | | | | * Avoid copying fragments * Add slice / slices method * Better documentation for fragment and slice methods
* Add cwd parameter which is not optional anymore (#3240)Danilo Spinella2022-07-31
|
* Fix byte index error in signature help highlightingGokul Soumya2022-07-29
| | | | | | | | | | | | | | | The language server sends a char offset range within the signature help label text to highlight as the current parameter, but helix uses byte offset ranges for rendering highlights. This was brought up in the [review of the original signature help PR][1], but the ranges were being highlighted correctly, and there were no out of bound or indexing panics. Turns out rust-analyzer was [incorrectly sending byte offsets] instead of char offsets and this made it seem like all was well and good with offsets in helix during initial testing. [1]: https://github.com/helix-editor/helix/pull/1755#discussion_r906715371 [2]: https://github.com/rust-lang/rust-analyzer/pull/12272
* Shorten embedded command descriptions (#3070)Gokul Soumya2022-07-26
| | | | | | | | | * Shorten embedded command descriptions - Compact descriptions in command palette and infobox * Shorten typed command descriptions * Fix typo in decrement command description
* add statusline element to display file line endings (#3113)Alexis Kalabura2022-07-21
| | | | | | | | | * add statusline element to display file line endings * run cargo fmt --all * change the word *ending* from plural to singular * support for the unicode-lines feature flag
* Add lsp signature help (#1755)Gokul Soumya2022-07-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* support prefilling prompt (#2459)Bob2022-07-18
| | | | | | | | | * support prefilling prompt * introduce with_line builder method in Prompt * extract show_prompt * use textobject_word as fallback input
* Show file path only in workspace diagnostic pickerGokul Soumya2022-07-06
|
* Display error code only if not noneGokul Soumya2022-07-06
|
* Display diagnostic text before code in pickerGokul Soumya2022-07-06
|
* Remove source from diagnostic picker displayGokul Soumya2022-07-06
| | | | | It is usually the name of the LSP and doesn't add much useful information.
* Add live preview to theme picker (#1798)Joe2022-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Reuse menu::Item trait in picker (#2814)Gokul Soumya2022-07-02
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Add workspace and document diagnostics picker (#2013)Falco Hirschenberger2022-06-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* feat: highlight / select symbol under cursor using LSP ↵lazytanuki2022-06-27
| | | | | | | | | textDocument/documentHighlight (#2738) * feat: highlight symbol under cursor using LSP textDocument/documentHighlight * fix: please clippy * fix: shorter description and code style
* Remove a couple more unwrapsBlaž Hrastnik2022-06-21
|
* Merge pull request #2359 from dead10ck/test-harnessBlaž Hrastnik2022-06-21
|\ | | | | Integration testing harness
| * fix(command): write-quit: do not quit if write failsSkyler Hawthorne2022-06-19
| | | | | | | | | | | | | | | | | | During write-quit, if the file fails to be written for any reason, helix will still quit without saving the changes. This fixes this behavior by introducing fallibility to the asynchronous job queues. This will also benefit all contexts which may depend on these job queues. Fixes #1575
| * Add more context; Editor::open doesn't need to own pathSkyler Hawthorne2022-06-19
| |
* | Refactor Margin for fine grained control (#2727)Gokul Soumya2022-06-21
| |
* | Enable shellwords for Windows (with escaping disabled) (#2767)ath32022-06-21
|/
* views -> buffers in write-all (#2788)Gygaxis Vainhardt2022-06-16
|
* Add docstring for language_server!() macro (#2750)Gokul Soumya2022-06-12
|
* Refactor push_jump so we're not needlessly fetching doc twiceBlaž Hrastnik2022-06-06
|
* Add shell insert commands to typable and config (#2589)Termina942022-06-05
| | | | | | | * Add shell insert commands to typable and config * generate docs Co-authored-by: Dean Revell <revell@gmail.com>
* ensure :quit and :quit! take no arguments (#2654)Michael Davis2022-06-05
|
* Avoid modifying jumplist until jumping to ref (#2670)yzwduck2022-06-05
| | | | | | When a goto command is cancelled, the jumplist should remain unchanged. This commit delays saving the current selection to the jumplist until jumping to a reference.
* append `set_line_ending` to document history (#2649)Kirawi2022-06-02
|
* fix: lsp: be more defensive about URI conversionsBlaž Hrastnik2022-06-02
|
* fix: lsp: be more defensive about URI conversionsBlaž Hrastnik2022-06-02
|
* Improve Readability (#2639)Ryan Russell2022-06-01
|
* Fix panic when reloading a shrunk file (#2506)Leoi Hung Kin2022-05-22
| | | | | | | * fix panic when reloading a shrunk file * linting * use scrolloff
* feat(commands): add log-open command (#2422)amaihoefner2022-05-11
|
* Making the 'set-option' command help more descriptive. (#2365)Ben Lee-Cohen2022-05-04
| | | | | | | | | * Making the 'set-option' command help more descriptive. * Adding the generated docs * Making the message multi-line * Replace newline with break in generated docs
* feat(commands): make it possible to disable format-on-save via the ↵unrelentingtech2022-05-02
| | | | 'auto-format' option (#2321)
* add reflow command (#2128)Vince Mutolo2022-05-02
| | | | | | | | | | | | | | | | | | | | | | | * add reflow command Users need to be able to hard-wrap text for many applications, including comments in code, git commit messages, plaintext documentation, etc. It often falls to the user to manually insert line breaks where appropriate in order to hard-wrap text. This commit introduces the "reflow" command (both in the TUI and core library) to automatically hard-wrap selected text to a given number of characters (defined by Unicode "extended grapheme clusters"). It handles lines with a repeated prefix, such as comments ("//") and indentation. * reflow: consider newlines to be word separators * replace custom reflow impl with textwrap crate * Sync reflow command docs with book * reflow: add default max_line_len language setting Co-authored-by: Vince Mutolo <vince@mutolo.org>
* Add run-shell-command for Commands (#1682)Ryosuke Hayashi2022-05-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add run_shell_command * docgen * fix command name Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> * refactored Info::new * show 'Command failed' if execution fails * TypedCommand takes care of error handling and printing the error to the statusline. * docgen * use Popup instead of autoinfo * remove to_string in format! * Revert chage in info.rs * Show "Command succeed" when success * Fix info.rs Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* fix typos (#2304)chunghha2022-04-27
|
* Fix paste direction for typed paste commands (#2288)Michael Davis2022-04-26
|
* Add :get-option command (#2231)Daniel2022-04-24
|
* chore(lsp): check rename capabilities before send rename action (#2203)ttys32022-04-23
|
* Replace line endings using `set_line_ending` command (#1871)Kirawi2022-04-23
| | | | | | | * set_line_ending: now replace line endings * use ending.len_chars() directly * account for unicode-lines feaure in line-ending doc
* Send active diagnostics to LSP when requesting code actions. (#2005)Robin Jadoul2022-04-17
| | | | | | | | | | | * Send active diagnostics to LSP when requesting code actions. This allows for e.g. clangd to properly send the quickfix code actions corresponding to those diagnostics as options. The LSP spec v3.16.0 introduced an opaque `data` member that would allow the server to persist arbitrary data between the diagnostic and the code actions request, but this is not supported yet by this commit. * Reuse existing range_to_lsp_range functionality
* Pipe typable command (#1972)Thomas2022-04-17
| | | Co-authored-by: DeviousStoat <devious@stoat.com>
* Add `:write!` to create nonexistent subdirectories (#1839)Omnikar2022-04-12
| | | | | | | * Make `:write` create nonexistent subdirectories Prompting as to whether this should take place remains a TODO. * Move subdirectory creation to new `w!` command
* Add runtime language configuration (#1794) (#1866)Roland Kovacs2022-04-05
| | | | | | | | | | | | | | | | | | | | | * 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
* Add typed commands buffer-next and buffer-previous (#1940)Dr. David A. Kunz2022-04-03
|