aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp/src/lib.rs
Commit message (Collapse)AuthorAge
* normalize LSP workspaces (#6517)Pascal Kuthe2023-04-03
|
* add option to enable/disable lsp snippetsPascal Kuthe2023-03-31
|
* implement proper lsp-workspace supportPascal Kuthe2023-03-29
| | | | | | fix typo Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>
* 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>
* 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
|
* 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.
* Handle snippets for LSPs not providing offsets for completionAndrii Grynenko2023-03-08
|
* 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.
* 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.
* 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.
* 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>
* 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>
* 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
|
* 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.
* 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>
* 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
|
* lsp: Don't log "LSP not defined" errors in the logfileBlaž Hrastnik2022-09-03
|
* Change default formatter for any language (#2942)PiergiorgioZagaria2022-08-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change default formatter for any language * Fix clippy error * Close stdin for Stdio formatters * Better indentation and pattern matching * Return Result<Option<...>> for fn format instead of Option * Remove unwrap for stdin * Handle FormatterErrors instead of Result<Option<...>> * Use Transaction instead of LspFormatting * Use Transaction directly in Document::format * Perform stdin type formatting asynchronously * Rename formatter.type values to kebab-case * Debug format for displaying io::ErrorKind (msrv fix) * Solve conflict? * Use only stdio type formatters * Remove FormatterType enum * Remove old comment * Check if the formatter exited correctly * Add formatter configuration to the book * Avoid allocations when writing to stdin and formatting errors * Remove unused import Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
* Suport diagnostic code (#3096)Erasin2022-07-26
| | | | | | | * add code for diagnostic. This PR provides a solution to resolve #2994. missing Code Actions for lsp * remote unused import
* embed jsonrpc types from jsonrpc-core crate (#2801)Michael Davis2022-06-18
| | | | | | | | | | | | | | We should not depend on jsonrpc-core anymore: * The project just announced it's no longer actively maintained[^1], preferring their new implementation in `jsonrpsee`. * The types are too strict: we would benefit from removing some `#[serde(deny_unknown_fields)]` annotations to allow language servers that disrespect the spec[^2]. * We don't use much of the project. Just the types out of core. These are easy to embed directly into the `helix-lsp` crate. [^1]: https://github.com/paritytech/jsonrpc/pull/674 [^2]: https://github.com/helix-editor/helix/issues/2786
* fix: lsp: Sort edits by start range, Omnisharp sends them in reverseBlaž Hrastnik2022-06-02
|
* Don't panic on LSP parsing errorsBlaž Hrastnik2022-05-11
| | | | | | This made sense initially when the implementation was still new (so we got user reports more frequently), but a parsing error now generally signifies a language server isn't properly implementing the spec.
* configurable lsp request timeout (#2405)EmmChriss2022-05-11
|
* fix typos (#2304)chunghha2022-04-27
|
* prevent panic when receiving malformed LSP PublishDiagnostic (#2160)Michael Davis2022-04-18
| | | | | | | | | | | Instead of panicing we can discard the malformed diagnostic. This `.parse()` fails commonly when a non-conformant language server gives a diagnostic with a location that breaks the spec: { "character": 0, "line": -1 } can currently be returned by ElixirLS and the python LS. Other messages in this block are discarded but this one feels special enough to log.
* 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
* lsp: Implement support for workspace_folders (currently just one)Blaž Hrastnik2022-04-01
| | | | Refs #1898
* Implement LSP `workspace/configuration` and ↵Triton1712022-02-28
| | | | | | | | | | | | | `workspace/didChangeConfiguration` (#1684) * Implement LSP `workspace/configuration` request * Implement LSP `workspace/didChangeConfiguration` notification. * Simplify retrieval of LSP configuration * Implement suggestions from PR discussion Co-authored-by: Triton171 <triton0171@gmail.com>
* Optimize lsp_pos_to_pos (#1423)Kirawi2022-01-03
| | | lines().count() is slow compared to len_lines()
* Detect workspace root using language markers (#1370)Alexis Mousset2021-12-31
| | | | | | | | | | | | | | | | * Detect workspace root using language markers * Avoid allocating root_markers * Update helix-core/src/lib.rs Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> * Update helix-core/src/lib.rs Co-authored-by: Kirawi <67773714+kirawi@users.noreply.github.com> Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> Co-authored-by: Kirawi <67773714+kirawi@users.noreply.github.com>
* LSP code action commands (#1304)Matouš Dzivjak2021-12-21
| | | | | | | | | * feat(lsp): codeAction commands * Don't block on command call * Fix lifetime of command execution * Fix lint issues
* lsp: Don't panic if init failsBlaž Hrastnik2021-12-03
| | | | | | We correctly filter out the language server inside Document to ignore it if the capabilities are missing, so this way it'll simply ignore the errored out LSP rather than panicking.
* Allow `language.config` (in languages.toml) to be passed in as a toml object ↵Midnight Exigent2021-10-08
| | | | | | | | | | | | | (#807) * allow language.config (in languages.toml) to be passed in as a toml object * Change config field for languages from json string to toml object * remove indents on languages.toml config * fix: remove patch version from serde_json import in helix-core * Use same tree-sitter-zig as upstream/master
* log errors produced when trying to initialize the LSP (#746)Kirawi2021-09-15
|
* lsp: Don't send notifications until initialize completesBlaž Hrastnik2021-09-06
| | | | Then send open events for all documents with the LSP attached.
* lsp: Outdated commentBlaž Hrastnik2021-09-06
|
* lsp: Delay requests & notifications until initialization is completeBlaž Hrastnik2021-09-06
|
* lsp: Refactor capabilities as an async OnceCellBlaž Hrastnik2021-09-06
| | | | First step in making LSP init asynchronous
* Added option to provide a custom config file to the lsp. (#460)Cor Peters2021-07-18
| | | | | | | | | | | | | | | | | * Added option to provide a custom config file to the lsp. * Simplified lsp loading routine with anyhow * Moved config to language.toml * Fixed test case * Cargo fmt * Revert now-useless changes * Renamed custom_config to config Co-authored-by: Cor <prive@corpeters.nl>
* Make formatting happen asynchronously.Joe Neeman2021-06-30
|