Commit Graph

64 Commits (8694d60ab3558a4b65cf8b45c5f38580a01097dd)

Author SHA1 Message Date
Blaž Hrastnik 8694d60ab3
Simplify LSP formatting, feature gate lsp in helix-view 2022-05-01 11:41:13 +09:00
chunghha 3a398eec56
fix typos (#2304) 2022-04-27 14:21:20 -05:00
Michael Davis 449d1dfdfb
prevent panic when receiving malformed LSP PublishDiagnostic (#2160)
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.
2022-04-18 23:11:28 +08:00
Robin Jadoul 33b7483db5
Send active diagnostics to LSP when requesting code actions. (#2005)
* 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
2022-04-17 12:05:23 +09:00
Blaž Hrastnik 8adf0c1b3a
lsp: Implement support for workspace_folders (currently just one)
Refs #1898
2022-04-01 11:20:41 +09:00
Triton171 f044059a2a
Implement LSP `workspace/configuration` and `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>
2022-02-28 17:57:22 +09:00
Kirawi ea095ca5fb
Optimize lsp_pos_to_pos (#1423)
lines().count() is slow compared to len_lines()
2022-01-03 11:26:17 +09:00
Alexis Mousset 8a019b423f
Detect workspace root using language markers (#1370)
* 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>
2021-12-31 17:06:54 +09:00
Matouš Dzivjak 75a8b789d2
LSP code action commands (#1304)
* feat(lsp): codeAction commands

* Don't block on command call

* Fix lifetime of command execution

* Fix lint issues
2021-12-21 18:21:45 +09:00
Blaž Hrastnik d31bef7fea lsp: Don't panic if init fails
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.
2021-12-03 10:05:27 +09:00
Midnight Exigent eedcea7e6b
Allow `language.config` (in languages.toml) to be passed in as a toml object (#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
2021-10-08 11:14:12 +09:00
Kirawi ef532e0c0d
log errors produced when trying to initialize the LSP (#746) 2021-09-15 14:58:06 +09:00
Blaž Hrastnik 46f3c69f06 lsp: Don't send notifications until initialize completes
Then send open events for all documents with the LSP attached.
2021-09-06 15:25:46 +09:00
Blaž Hrastnik 48fd4843fc lsp: Outdated comment 2021-09-06 15:25:46 +09:00
Blaž Hrastnik 5a558e0d8e lsp: Delay requests & notifications until initialization is complete 2021-09-06 15:25:46 +09:00
Blaž Hrastnik c3a58cdadd lsp: Refactor capabilities as an async OnceCell
First step in making LSP init asynchronous
2021-09-06 15:25:46 +09:00
Cor Peters 0aa43902ca
Added option to provide a custom config file to the lsp. (#460)
* 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>
2021-07-18 16:56:25 +09:00
Joe Neeman c9be480bf8 Make formatting happen asynchronously. 2021-06-30 17:08:50 +09:00
Blaž Hrastnik cad14c6b46 Address nightly clippy warnings 2021-06-27 13:27:47 +09:00
wojciechkepka cc357d5096 Add progress spinners to status line 2021-06-21 12:59:06 +09:00
wojciechkepka c2aad859b1 Handle language server shutdown with timeout 2021-06-19 13:02:56 +09:00
wojciechkepka 38cb934d8f Add unique id to each lsp client/server pair 2021-06-18 17:42:38 +09:00
wojciechkepka 52fb90b81e Add `MethodCall`, `ProgressStatus`, `LspProgressMap` 2021-06-18 17:42:38 +09:00
Robin 9baf1ecc90
add symbol picker (#230)
* add symbol picker

use the lsp document_symbol request

* fix errors from merging in master

* add docs for symbol picker
2021-06-12 21:45:21 +09:00
Wojciech Kępka c754df12b3
lsp: Check bounds when converting lsp positions (#204)
* lsp: Make position conversion funcs return `Option`

* Add tests

* Fixes

* Revert pos_to_lsp_pos to panic
2021-06-12 16:04:30 +09:00
Wojciech Kępka 098806ce2a
lsp: Display LSP progress messages (#216) 2021-06-11 12:42:16 +09:00
Ivan Tham 7cc13fefe9 Derive debug without feature
Note that this also removed those `finish_non_exhaustive()`.
2021-06-10 22:00:08 +09:00
notoria 1a3a924634 Implement Debug for data structure as a feature 2021-06-10 22:00:08 +09:00
Egor Karavaev ea6667070f helix-lsp cleanup 2021-06-08 10:56:46 +09:00
Egor Karavaev 960bc9f134 Don't panic on LSP not starting 2021-06-08 10:02:41 +09:00
Egor Karavaev d55419604c Remove select_all implementation 2021-06-04 09:25:30 +09:00
Blaž Hrastnik e4ff75b4d4 Add :fmt (formats the whole file). 2021-05-12 17:24:55 +09:00
Blaž Hrastnik 6c705f09e8 Lint 2021-05-09 17:13:59 +09:00
Blaž Hrastnik caf4349925 Remove some of the panics, just log instead. 2021-05-08 18:17:13 +09:00
Blaž Hrastnik ba97005495 Work around the rest of the blocking issues. 2021-05-06 17:15:49 +09:00
Blaž Hrastnik 355ad3cb82 Tokio migration. 2021-05-06 13:56:34 +09:00
Blaž Hrastnik 3b90317060 Add window/showMessage / logMessage stubs so gopls fully starts. 2021-04-15 17:34:38 +09:00
Blaž Hrastnik 3e5f24a9d5 lsp: support both utf-8 and utf-16 offsets.
Still need to implement the clangd encoding negotiation, but it's
a start. Should also manually override to utf8 for pyls.
2021-04-14 15:39:31 +09:00
Blaž Hrastnik 5aed1f3c00 lsp: Gracefully fail if binary doesn't exist. 2021-04-07 13:38:24 +09:00
Blaž Hrastnik 2a3910c1d9 wip: Async async. Delay response handling with a callback. 2021-03-26 17:12:45 +09:00
Blaž Hrastnik e3c4edae32 Add the machinery to load syntax config from TOML.
It's embedded into the binary at build time for now, but it's progress.
2021-03-25 15:26:25 +09:00
Blaž Hrastnik e9bd9e72c3 Pos conversions always operate on whole documents. 2021-03-18 15:23:42 +09:00
Blaž Hrastnik 5237084d98 Don't publicly re-export once_cell in lsp. 2021-03-18 14:29:38 +09:00
Blaž Hrastnik 59e6024186 Remove State from a few more signatures. 2021-03-18 14:17:32 +09:00
Blaž Hrastnik 8eaf9a432d Make Transaction::change only rely on the rope. 2021-03-18 13:39:56 +09:00
Blaž Hrastnik 87e3cd3df2 ui: Render diagnostic errors in sideline. 2021-03-15 16:19:31 +09:00
Blaž Hrastnik bb87b08fc9 Configure language servers via LanguageConfiguration. 2021-03-14 17:14:34 +09:00
Blaž Hrastnik 1ae7c43391 commands: = as range formatting (via lsp) 2021-02-26 15:52:43 +09:00
Blaž Hrastnik c9dd1c930e treewide: &RopeSlice -> RopeSlice. It's Copy so no reason to pass by ref 2021-02-18 18:34:22 +09:00
Blaž Hrastnik 05c7fb98df Refactoring: move language_servers into Editor, proper load for doc. 2021-01-21 16:55:46 +09:00