aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp/src
Commit message (Collapse)AuthorAge
...
* allow empty placeholdersPascal Kuthe2023-03-16
|
* revamped snippet text element parsingPascal Kuthe2023-03-16
| | | | | | | | | | | | | | Snippet text elements can contain escape sequences that must be treated properly. Furthermore snippets must always escape certain characters (like `}` or `\`). The function has been updated to account for that. `text` is now also included with `anything` to match the grammar and can also match empty text. To avoid infinite loops the `non-empty` combinator has been added which is automatically used in the `one_or_more` and `zero_or more` combinator where the problemn would occur.
* always parse the entire snippetPascal Kuthe2023-03-16
| | | | | | Previously any remaining text of the snippet that could not be parsed was ignored. This commit adds the `parse_all` function which reports an error if any text was not consumed by the parser
* set WorkspaceEditCapabilities correctlyPascal Kuthe2023-03-16
|
* discard outdated diagnostics recived by the LSPascal Kuthe2023-03-16
|
* Check language server symbol renaming support before prompting (#6257)misiasty32023-03-13
| | | Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com>
* LSP: No-op client/registerCapability requests (#6258)Michael Davis2023-03-13
|
* indent snippets to line indent instead of completion start (#6263)Pascal Kuthe2023-03-11
|
* 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
* treat replace/insertmode consistently, default to insertPascal Kuthe2023-03-10
|
* fix snippet bugs and multicursor completion edgecasesPascal Kuthe2023-03-10
| | | | | | | | | | | | | | | | Multicursor completions may overlap and therefore overlapping completions must be dropped to avoid crashes. Furthermore, multicursor edits might simply be out of range if the word before/after the cursor is shorter. This currently leads to crashes, instead these selections are now also removed for completions. This commit also significantly refactors snippet transaction generation so that tabstops behave correctly with the above rules. Furthermore, snippet tabstops need to be carefully mapped to ensure their position is correct and consistent with our selection semantics. Finally, we now keep a partially updated Rope while creating snippet transactions so that we can fill information into snippets that depends on the position in the document.
* avoid allocations during snippet renderingPascal Kuthe2023-03-10
|
* 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>
* Handle snippets for LSPs not providing offsets for completionAndrii Grynenko2023-03-08
|
* Add nested placeholder parsing for LSP snippetsAndrii Grynenko2023-03-08
| | | | | And fix `text` over-parsing, inspired by https://github.com/neovim/neovim/blob/d18f8d5c2d82b209093b2feaa8921a4792b71d59/runtime/lua/vim/lsp/_snippet.lua
* Render every LSP snippets for every cursorAndrii Grynenko2023-03-08
| | | | | | | This refactors the snippet logic to be largely unaware of the rest of the document. The completion application logic is moved into generate_transaction_from_snippet which is extended to support dynamically computing replacement text.
* Correctly handle multiple cursors with LSP snippetsUrgau2023-03-08
|
* Delete snippet placeholders when accepting completionPascal Kuthe2023-03-08
| | | | | | | When accepting a snippet completion we automatically delete the placeholders for now as doing so manual is quite cumbersome. In the future we should keep these as a mark + virtual text that is automatically removed once the cursor moves there.
* Implement LSP snippet tabstops sorting and mergingUrgau2023-03-08
|
* LSP: Advertise snippet supportMichael Davis2023-03-08
|
* Apply snippets as transactionsMichael Davis2023-03-08
|
* Optimize LSP snippet parsingUrgau2023-03-08
|
* Add parser for LSP snippetMichael Davis2023-03-08
|
* Allow LSP server to be stopped (#5964)Davide Galassi2023-03-08
|
* LSP: Add request ID to request timeout message (#6010)Michael Davis2023-02-16
| | | | This improves error logging for requests - without the ID it's hard to know which request is the one that timed out.
* feat(ui): deprecated completions (#5932)Matouš Dzivjak2023-02-13
| | | | | | | | | | | | | | | | | | * feat(ui): deprecated completions Mark deprecated completions using strike-through (CROSSED_OUT modifier). The deprection information is taken either from the `deprecated` field of the completion item or from the completion tags. The field seems to be the older way of passing the deprecated information and it was already marked as deprecated for Symbol. In completion item the field is still valid but it seems that the LSP is moving in the general direction of using tags for this kind of information and as such relying on tags as well seems reasonable and future-proof.
* 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.
* Fix new clippy lints (#5892)Pascal Kuthe2023-02-09
|
* properly handle LSP position encoding (#5711)Pascal Kuthe2023-02-09
| | | | | | | | | | | | | * properly handle LSP position encoding * add debug assertion to Transaction::change * Apply suggestions from code review Co-authored-by: Michael Davis <mcarsondavis@gmail.com> --------- Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Support goto-declaration LSP command (#5646)Ole Krüger2023-01-31
|
* jsonrpc: Skip serializing params if params are None (#5471)Michael Davis2023-01-10
| | | | | | | | | | | | | | | | The JSONRPC spec says: > If present, parameters for the rpc call MUST be provided as a > Structured value https://www.jsonrpc.org/specification#parameter_structures (Where a "Structured value" is elsewhere defined as either a map or array.) This change skips the serialization of the `params` field for JSONRPC method calls and notifications if the `params` field is the `None` variant. This fixes compatibility with LSP servers which adhere closely to that part of the spec: `ocamllsp` in the wild.
* allow specifying environment for language servers in language.toml (#4004)TotalKrill2022-12-09
| | | | | Signed-off-by: Stephen Wakely <fungus.humungus@gmail.com> Co-authored-by: Stephen Wakely <fungus.humungus@gmail.com> Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* feat(lsp): pass client_info on initialization (#4904)Matouš Dzivjak2022-12-09
| | | | Pass client name ('helix') and client version (version / git hash) to LSP server on initialization.
* Apply completion edits to all cursors (#4496)Michael Davis2022-12-06
| | | | | | | | Completion edits - either basic `insert_text` strings or structured `text_edit`s - are assumed by the LSP spec to apply to the current cursor (or at least the trigger point). We can use the range (if any) and text given by the Language Server to create a transaction that changes all ranges in the current selection though, allowing auto- complete to affect multiple cursors.
* feat(lsp): add support for lsp Diagnostic{}.data (#4935)sigmaSd2022-12-02
|
* Drain pending requests on language server termination (#4852)Michael Davis2022-11-24
| | | | | | | | | This prevents a freeze while shutting down when using `efm-langserver`. `efm-langserver` exits immediately after seeing a shutdown request, without responding to the request. We block awaiting the reply to the shutdown request which will never come, so we time out. This change responds to any pending requests with `Err` saying that the stream has been closed.
* 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`.
* Handle language server termination (#4797)Michael Davis2022-11-19
| | | | | | | | | | | | | This change handles a language server exiting. This was a UX sore-spot: if a language server crashed, Helix did not recognize the exit and continued to send requests to it. All requests would timeout since they would not receive responses. This would also hold-up Helix closing itself down since it would try to gracefully shutdown the server which is implemented in the LSP spec as a request. We could attempt to automatically restart the language server on crash. I left this for future work since that change will need to be slightly complicated: it will need to cover the case of a language server repeatedly crashing.
* lsp: Resolve completion item asynchronously on idle-timeout (#4781)Michael Davis2022-11-18
| | | | | | | | | | | | | | | | | | | | | d7d0d5ffb79b6f2e09c6ab8af6e112c41e6f73e8 resolves completion items on the idle-timeout event. The `Completion::resolve_completion_item` function blocks on the LSP request though, which blocks the compositor and in turn blocks the event loop. So until the language server returns the resolved completion item, Helix is unable to respond to keypresses or other LSP messages. This is typically ok since the resolution request is fast but for some language servers this can be problematic, and ideally we shouldn't be blocking like this anyways. When receiving a `completionItem/resolve` request, the Volar server sends a `workspace/configuration` request to Helix and blocks itself on the response, leading to a deadlock. Eventually the resolve request times out within Helix but Helix is locked up and unresponsive in that window. This change resolves the completion item without blocking the compositor.
* Add LSP workspace command picker (#3140)Matthias Deiml2022-11-09
| | | | | | | * Add workspace command picker * Make command typable * Add optional argument to lsp-workspace-command
* lsp: Support insertReplaceBlaž Hrastnik2022-11-08
| | | | Fixes #4473
* Resolve a bunch of upcoming clippy lintsBlaž Hrastnik2022-11-04
|
* Find workspace from document path (#3553)ath32022-10-03
|
* [lsp-restart]: call the force_shutdown method for the old_client (#3972)Alexis Kalabura2022-10-03
| | | | | | | * [lsp-restart]: call the shutdown_and_exit method for the old_client * change shutdown_and_exit to force_shutdown * remove extra log
* diff full-doc LSP edits (#4041)Kirawi2022-10-02
| | | Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Split helix_core::find_root and helix_loader::find_local_config_dirs (#3929)Riccardo Binetti2022-09-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Split helix_core::find_root and helix_loader::find_local_config_dirs The documentation of find_root described the following priority for detecting a project root: - Top-most folder containing a root marker in current git repository - Git repository root if no marker detected - Top-most folder containing a root marker if not git repository detected - Current working directory as fallback The commit contained in https://github.com/helix-editor/helix/pull/1249 extracted and changed the implementation of find_root in find_root_impl, actually reversing its result order (since that is the order that made sense for the local configuration merge, from innermost to outermost ancestors). Since the two uses of find_root_impl have different requirements (and it's not a matter of reversing the order of results since, e.g., the top repository dir should be used by find_root only if there's not marker in other dirs), this PR splits the two implementations in two different specialized functions. In doing so, find_root_impl is removed and the implementation is moved back in find_root, moving it closer to the documented behaviour thus making it easier to verify it's actually correct * helix-core: remove Option from find_root return type It always returns some result, so Option is not needed
* add :lsp-restart command (#3435)Filipe Azevedo2022-09-20
|
* diagnostics: Use Vec<Tag> instead of Option<Vec<Tag>>Blaž Hrastnik2022-09-20
|
* Track source and tags in diagnostics (#3898)Luke Cycon2022-09-20
|
* Remove LspNotDefined, instead return an Option<>Blaž Hrastnik2022-09-07
|