aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands/lsp.rs
Commit message (Collapse)AuthorAge
* 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>
* 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.
* fix: decode lsp url for workspace_diagnostics_picker (#6016)Erasin2023-02-16
|
* Negotiate LSP Position Encoding (#5894)Pascal Kuthe2023-02-11
| | | | | | | So far LSP always required that `PositionEncoding.characters` is an UTF-16 offset. Now that LSP 3.17 is available in `lsp-types` request the server to send char offsets (UTF-32) or byte offsets (UTF-8) instead. For compatability with old servers, UTF-16 remains as the fallback as required by the standard.
* Support goto-declaration LSP command (#5646)Ole Krüger2023-01-31
|
* Remove apply_transaction helper (#5598)Ivan Tham2023-01-21
|
* Replace menu::Item::{row, label} with format()Gokul Soumya2023-01-18
|
* workspace symbols: Default to empty Vec on NoneMichael Davis2022-12-15
| | | | | | | A language server might send None as the response to workspace symbols. We should treat this as the empty Vec rather than the server sending an error status. This fixes the interaction with gopls which uses None to mean no matching symbols.
* Re-request workspace symbols on keypress in pickerGokul Soumya2022-12-15
| | | | | | | | | | | Most language servers limit the number of workspace symbols that are returned with an empty query even though all symbols are supposed to be returned, according to the spec (for perfomance reasons). This patch adds a workspace symbol picker based on a dynamic picker that allows re-requesting the symbols on every keypress (i.e. when the picker query text changes). The old behavior has been completely replaced, and I have only tested with rust-analyzer so far.
* Fix nightly clippy lints (#4954)Tshepang Mbambo2022-12-01
|
* Call View::apply within Document::append_changes_to_historyMichael Davis2022-11-29
|
* lsp: Check server provider capabilities (#3554)Michael Davis2022-11-22
| | | | | | | | | | | | | | 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`.
* Add preview for scratch buffers in buffer picker (#3454)A-Walrus2022-11-21
|
* Popup scrollbar (#4449)Manos Mertzianis2022-11-15
| | | | | | | | | | | | | | | * init * cargo fmt * optimisation of the scrollbar render both for Menu and Popup. Toggling off scrollbar for Popup<Menu>, since Menu has its own * rendering scroll track * removed unnecessary cast * improve memory allocation * small correction
* Add LSP workspace command picker (#3140)Matthias Deiml2022-11-09
| | | | | | | * Add workspace command picker * Make command typable * Add optional argument to lsp-workspace-command
* Resolve a bunch of upcoming clippy lintsBlaž Hrastnik2022-11-04
|
* fix: Never create automatic doc popups outside of Insert mode (#4456)Poliorcetics2022-10-28
|
* nit: Do less allocations in `ui::menu::Item::label` implementationsAlexis (Poliorcetics) Bourget2022-10-21
| | | | | | This complicates the code a little but it often divides by two the number of allocations done by the functions. LSP labels especially can easily be called dozens of time in a single menu popup, when listing references for example.
* Sort by fixed diagnostics/is_preffered within codeaction categoriesPascal Kuthe2022-10-21
|
* never sort menu items when no fuzzy matching is possiblePascal Kuthe2022-10-21
|
* use permalink to vscode repoPascal Kuthe2022-10-21
|
* use stable sort instead of allocating new vectorsPascal Kuthe2022-10-21
|
* sort codeaction by their kind instead of alphabeticallyPascal Kuthe2022-10-21
|
* Add a helper function for applying transactionsMichael Davis2022-10-11
| | | | | | It is easy to forget to call `Document::apply` and/or `View::apply` in the correct order. This commit introduces a helper function which closes over both calls.
* Apply transactions to ViewsMichael Davis2022-10-11
| | | | | | This change adds View::apply calls for all Document::apply call-sites, ensuring that changes to a document do not leave invalid entries in the View's jumplist.
* Remove border from code actions popup (#3444)A-Walrus2022-09-13
|
* 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.
* 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
* 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.
* 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
| * 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
|/
* 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
|
* 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.
* 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
|
* chore(lsp): check rename capabilities before send rename action (#2203)ttys32022-04-23
|
* 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
* Address clippy lintBlaž Hrastnik2022-03-28
|