aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands
Commit message (Collapse)AuthorAge
* Some minor clarity/cosmetic improvementsPhilipp Mildenberger2023-05-18
| | | | Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
* Add function `Editor::language_server_by_id` and refactor/simplify related ↵Philipp Mildenberger2023-05-18
| | | | code, also don't 'crash' in completion menu if language_server somehow disappeared
* Fix lsp_restart across multiple different document scopes (language servers ↵Philipp Mildenberger2023-05-18
| | | | weren't restarted, if not of the same scope id), and fix some smaller rebase issues
* Remove offset_encoding in CodeActionOrCommandItem, as it can be retrieved on ↵Philipp Mildenberger2023-05-18
| | | | demand
* Filter language servers also by capabilities in ↵Philipp Mildenberger2023-05-18
| | | | | | | | | `doc.language_servers_with_feature` * Add `helix_lsp::client::Client::supports_feature(&self, LanguageServerFeature)` * Extend `doc.language_servers_with_feature` to use this method as filter as well * Add macro `language_server_with_feature!` to reduce boilerplate for non-mergeable language server requests (like goto-definition) * Refactored most of the `find_map` code to use the either the macro or filter directly via `doc.language_servers_with_feature`
* Filter out already seen language servers in requests that can be sent to ↵Philipp Mildenberger2023-05-18
| | | | multiple language servers (code-action, completion, symbol pickers)
* Use let else instead of variable and fix some error messagesPhilipp Mildenberger2023-05-18
| | | | Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
* Remove symbol picker is_empty checkPhilipp Mildenberger2023-05-18
|
* Simplify 'lsp_stop' commandPhilipp Mildenberger2023-05-18
|
* Fix docgen and lsp-stop documentationPhilipp Mildenberger2023-05-18
|
* Remove boilerplate in the goto methods by generically composing functionsPhilipp Mildenberger2023-05-18
|
* Refactored doc.language_servers and doc.language_servers_with_feature to ↵Philipp Mildenberger2023-05-18
| | | | | | return an iterator and refactor LanguageServerFeature handling to a HashMap (language server name maps to features) Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
* Fix error messages when no language server is availablePhilipp Mildenberger2023-05-18
| | | | Co-authored-by: Skyler Hawthorne <skyler@dead10ck.com>
* Fix sorting issues of the editor wide diagnostics and apply diagnostics ↵Philipp Mildenberger2023-05-18
| | | | | | related review suggestions Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
* Adds support for multiple language servers per language.Philipp Mildenberger2023-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Language Servers are now configured in a separate table in `languages.toml`: ```toml [langauge-server.mylang-lsp] command = "mylang-lsp" args = ["--stdio"] config = { provideFormatter = true } [language-server.efm-lsp-prettier] command = "efm-langserver" [language-server.efm-lsp-prettier.config] documentFormatting = true languages = { typescript = [ { formatCommand ="prettier --stdin-filepath ${INPUT}", formatStdin = true } ] } ``` The language server for a language is configured like this (`typescript-language-server` is configured by default): ```toml [[language]] name = "typescript" language-servers = [ { name = "efm-lsp-prettier", only-features = [ "format" ] }, "typescript-language-server" ] ``` or equivalent: ```toml [[language]] name = "typescript" language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "efm-lsp-prettier" ] ``` Each requested LSP feature is priorized in the order of the `language-servers` array. For example the first `goto-definition` supported language server (in this case `typescript-language-server`) will be taken for the relevant LSP request (command `goto_definition`). If no `except-features` or `only-features` is given all features for the language server are enabled, as long as the language server supports these. If it doesn't the next language server which supports the feature is tried. The list of supported features are: - `format` - `goto-definition` - `goto-declaration` - `goto-type-definition` - `goto-reference` - `goto-implementation` - `signature-help` - `hover` - `document-highlight` - `completion` - `code-action` - `workspace-command` - `document-symbols` - `workspace-symbols` - `diagnostics` - `rename-symbol` - `inlay-hints` Another side-effect/difference that comes with this PR, is that only one language server instance is started if different languages use the same language server.
* Fix completion on paths containing spaces (#6779)Ivan Gulakov2023-05-18
| | | | | | | | | | | There was an issue with autocompletion of a path with a space in it. Before: :o test\ dir -> <TAB> -> test\ dirfile1 After: :o test\ dir -> <TAB> -> test\ dir\file1
* Replace DAP vars popup, instead of adding new (#7034)A-Walrus2023-05-13
|
* Add wbc and wbc! commands (#6947)Kitsu2023-05-09
|
* feat(commands): add clear-register typable command (#5695)jorge2023-04-27
| | | Co-authored-by: Jorge <chorcheus@tutanota.com>
* feat: add a config option to exclude declaration from LSP references (#6886)Vitalii Solodilov2023-04-27
| | | | | | | | | * feat: added the config option to exclude declaration from reference query Fixes: #5344 * fix: review * fix: review
* fix panic in inlay hint computation when view anchor is out of bounds (#6883)Pascal Kuthe2023-04-27
|
* make `:u` alias `:update` (#6835)Atticus Sebastiani2023-04-23
| | | | | | | * Gave the command update the alias u * Re added trailing newline * generated docs
* flip symbol range in LSP goto commands (#6794)Pascal Kuthe2023-04-21
|
* make :toggle-option print the new value (#6774)Aleksey Kuznetsov2023-04-16
| | | | Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Fix typos (#6643)Daniel Sedlak2023-04-07
|
* Fix line number display for LSP goto pickers (#6559)Dmitry Ulyanov2023-04-03
| | | | Line numbers are 0-indexed in the LSP spec but 1-indexed for display and jumping purposes in Helix.
* Let..else refactor (#6562)Casper Rogild Storm2023-04-03
|
* add option to enable/disable lsp snippetsPascal Kuthe2023-03-31
|
* Hide signature help if it overlays completion menu (#5523)Pascal Kuthe2023-03-31
|
* add workspace config and manual LSP root managementPascal Kuthe2023-03-29
| | | | | | | | | | fixup documentation Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com> fixup typo Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>
* Run shell commands asynchronously (#6373)sarah2023-03-21
|
* discard outdated workspace edits recived from the LSPascal Kuthe2023-03-16
|
* fix compilationBlaž Hrastnik2023-03-14
|
* Only complete appropriate arguments for typed commands. (#5966)Kyle Smith2023-03-14
|
* LSP: Separate diagnostic picker message and code (#6095)Francesc Elies2023-03-13
|
* Check language server symbol renaming support before prompting (#6257)misiasty32023-03-13
| | | Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com>
* Feat: LSP Type Hints (#5934)Poliorcetics2023-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * misc: missing inline, outdated link * doc: Add new theme keys and config option to book * fix: don't panic in Tree::try_get(view_id) Necessary for later, where we could be receiving an LSP response for a closed window, in which case we don't want to crash while checking for its existence * fix: reset idle timer on all mouse events * refacto: Introduce Overlay::new and InlineAnnotation::new * refacto: extract make_job_callback from Context::callback * feat: add LSP display_inlay_hint option to config * feat: communicate inlay hints support capabilities of helix to LSP server * feat: Add function to request range of inlay hint from LSP * feat: Save inlay hints in document, per view * feat: Update inlay hints on document changes * feat: Compute inlay hints on idle timeout * nit: Add todo's about inlay hints for later * fix: compute text annotations for current view in view.rs, not document.rs * doc: Improve Document::text_annotations() description * nit: getters don't use 'get_' in front * fix: Drop inlay hints annotations on config refresh if necessary * fix: padding theming for LSP inlay hints * fix: tracking of outdated inlay hints should not be dependant on document revision (because of undos and such) * fix: follow LSP spec and don't highlight padding as virtual text * config: add some LSP inlay hint configs
* Generalised to multiple runtime directories with priorities (#5411)paul-scott2023-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Generalised to multiple runtime directories with priorities This is an implementation for #3346. Previously, one of the following runtime directories were used: 1. `$HELIX_RUNTIME` 2. sibling directory to `$CARGO_MANIFEST_DIR` 3. subdirectory of user config directory 4. subdirectory of path to helix executable The first directory provided / found to exist in this order was used as a root for all runtime file searches (grammars, themes, queries). This change lowers the priority of `$HELIX_RUNTIME` so that the user config runtime has higher priority. More significantly, all of these directories are now searched for runtime files, enabling a user to override default or system-level runtime files. If the same file name appears in multiple runtime directories, the following priority is now used: 1. sibling directory to `$CARGO_MANIFEST_DIR` 2. subdirectory of user config directory 3. `$HELIX_RUNTIME` 4. subdirectory of path to helix executable One exception to this rule is that a user can have a `themes` directory directly in the user config directory that has higher piority to `themes` directories in runtime directories. That behaviour has been preserved. As part of implementing this feature `theme::Loader` was simplified and the cycle detection logic of the theme inheritance was improved to cover more cases and to be more explicit. * Removed AsRef usage to avoid binary growth * Health displaying ;-separated runtime dirs * Changed HELIX_RUNTIME build from src instructions * Updated doc for more detail on runtime directories * Improved health symlink printing and theme cycle errors The health display of runtime symlinks now prints both ends of the link. Separate errors are given when theme file is not found and when the only theme file found would form an inheritence cycle. * Satisfied clippy on passing Path * Clarified highest priority runtime directory purpose * Further clarified multiple runtime details in book Also gave markdown headings to subsections. Fixed a error with table indentation not building table that also appears present on master. --------- Co-authored-by: Paul Scott <paul.scott@anu.edu.au> Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* LSP: Support textDocument/prepareRename (#6103)Kyle Smith2023-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * LSP: Support textDocument/prepareRename 'textDocument/prepareRename' can be used by the client to ask the server the range of the symbol under the cursor which would be changed by a subsequent call to 'textDocument/rename' with that position. We can use this information to fill the prompt with an accurate prefill which can improve the UX for renaming symbols when the symbol doesn't align with the "word" textobject. (We currently use the "word" textobject as a default value for the prompt.) Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * clippy fixes * rustfmt * Update helix-term/src/commands/lsp.rs Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update helix-term/src/commands/lsp.rs Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * fix clippy from suggestions * Update helix-term/src/commands/lsp.rs Co-authored-by: Michael Davis <mcarsondavis@gmail.com> --------- Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Softwrapping improvements (#5893)Clément Delafargue2023-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * use max_line_width + 1 during softwrap to account for newline char Helix softwrap implementation always wraps lines so that the newline character doesn't get cut off so he line wraps one chars earlier then in other editors. This is necessary, because newline chars are always selecatble in helix and must never be hidden. However That means that `max_line_width` currently wraps one char earlier than expected. The typical definition of line width does not include the newline character and other helix commands like `:reflow` also don't count the newline character here. This commit makes softwrap use `max_line_width + 1` instead of `max_line_width` to correct the impedance missmatch. * fix typos Co-authored-by: Jonathan Lebon <jonathan@jlebon.com> * Add text-width to config.toml * text-width: update setting documentation * rename leftover config item * remove leftover max-line-length occurrences * Make `text-width` optional in editor config When it was only used for `:reflow` it made sense to have a default value set to `80`, but now that soft-wrapping uses this setting, keeping a default set to `80` would make soft-wrapping behave more aggressively. * Allow softwrapping to ignore `text-width` Softwrapping wraps by default to the viewport width or a configured `text-width` (whichever's smaller). In some cases we only want to set `text-width` to use for hard-wrapping and let longer lines flow if they have enough space. This setting allows that. * Revert "Make `text-width` optional in editor config" This reverts commit b247d526d69adf41434b6fd9c4983369c785aa22. * soft-wrap: allow per-language overrides * Update book/src/configuration.md Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de> * Update book/src/languages.md Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de> * Update book/src/configuration.md Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de> --------- Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de> Co-authored-by: Jonathan Lebon <jonathan@jlebon.com> Co-authored-by: Alex Boehm <alexb@ozrunways.com> Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Do not add intermediate lines to jumplist with :<linenum> command. (#5751)Kyle Smith2023-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Do not add intermediate lines to jumplist with :<linenum> command. * Revert jumplist index changes. * Reduce calculations during update cycle. * Use jumplist for undo, set jumplist before preview. * remove some debug logging * Revert "remove some debug logging" This reverts commit 5772c4327e7121c53ea0726a4d7333ae1c413ffb. * Revert "Use jumplist for undo, set jumplist before preview." This reverts commit f73a1b29824feaf16477b9df547fb28d9db81923. * Add last_selection, update implementation. * @pascalkuthe initial feedback * Ensure ":goto 123" keybinding works as expected. * fix clippies, prefer expect() for expect last_selection state
* Jump to symbol ranges in LSP goto commands (#5986)Michael Davis2023-03-08
| | | | This follows prior changes like 42ad1a9e: we select the range given by the language server rather than the starting point.
* Add command for resetting diff hunks (#5736)Pascal Kuthe2023-03-08
|
* Allow LSP server to be stopped (#5964)Davide Galassi2023-03-08
|
* feat(dap): implement Restart request (#5651)Filip Dutescu2023-03-06
| | | | | | | | | | | | | | | Add a restart debug session command, which would issue a [Restart Request][1], if the debugger supports it and a session is running. It uses the same arguments and requests used to start the initial session, when recreating it. It builds upon #5532, making use of the changes to the termination workflow of a session. [1]: https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Restart Closes: #5594 Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
* fix(dap): validate key and index exist when requesting vars (#5628)Filip Dutescu2023-02-20
| | | | | | | | | | Check if the stack frames contain the thread id and the frame before trying to get the frame id. If case any of the two fails to be found, provide the user with messages to inform them of the issue and gracefully return. Closes: #5625 Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
* feat(dap): send Disconnect if Terminated event received (#5532)Filip Dutescu2023-02-20
| | | | | | | | | | | | | | | | | | | | | | | | | | Send a `Disconnect` DAP request if the `Terminated` event is received. According to the specification, if the debugging session was started by as `launch`, the debuggee should be terminated alongside the session. If instead the session was started as `attach`, it should not be disposed of. This default behaviour can be overriden if the `supportTerminateDebuggee` capability is supported by the adapter, through the `Disconnect` request `terminateDebuggee` argument, as described in [the specification][discon-spec]. This also implies saving the starting command for a debug sessions, in order to decide which behaviour should be used, as well as validating the capabilities of the adapter, in order to decide what the disconnect should do. An additional change made is handling of the `Exited` event, showing a message if the exit code is different than `0`, for the user to be aware off the termination failure. [discon-spec]: https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Disconnect Closes: #4674 Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
* feat: show current language when no argument is provided (#5895)Guillaume2023-02-16
|
* fix: decode lsp url for workspace_diagnostics_picker (#6016)Erasin2023-02-16
|
* Add :toggle-option command (#4085)A-Walrus2023-02-13
| | | This command toggles the value of boolean options