ath3
7c9809eeb2
Find workspace from document path ( #3553 )
2022-10-04 00:02:49 +09:00
Riccardo Binetti
888f4fef6f
Split helix_core::find_root and helix_loader::find_local_config_dirs ( #3929 )
...
* 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
2022-09-23 17:04:07 +09:00
Michael Davis
672ea98b05
Advertise WorkspaceSymbolClientCapabilities support ( #3361 )
2022-08-09 11:51:10 +09:00
Gokul Soumya
791bf7e50a
Add lsp signature help ( #1755 )
...
* 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
2022-07-19 11:28:24 +09:00
Gokul Soumya
21b66ba068
lsp: Add workspace/applyEdit to client capabilites ( #3012 )
...
The functionality already existed, but the capability wasn't being
reported correctly to the server:
230ba264bf/helix-term/src/application.rs (L716-L728)
2022-07-09 07:31:15 +09:00
lazytanuki
096abdd19b
feat: highlight / select symbol under cursor using LSP textDocument/documentHighlight ( #2738 )
...
* feat: highlight symbol under cursor using LSP textDocument/documentHighlight
* fix: please clippy
* fix: shorter description and code style
2022-06-27 20:19:56 +09:00
Blaž Hrastnik
24f03097e3
Remove some more unwraps
2022-06-27 17:27:44 +09:00
Michael Davis
45ce1ebdb6
embed jsonrpc types from jsonrpc-core crate ( #2801 )
...
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
2022-06-18 12:59:57 +09:00
farwyler
f92a25a856
Passing extra formatting options to LSPs ( #2635 )
...
* allows passing extra formatting options to LSPs
- adds optional field 'format' to [[language]] sections in 'languages.toml'
- passes specified options the LSPs via FormattingOptions
* cleaner conversion of formatting properties
* move formatting options inside lsp::Client
* cleans up formatting properties merge
2022-06-05 19:50:57 +09:00
EmmChriss
807cdc60bf
configurable lsp request timeout ( #2405 )
2022-05-11 09:54:35 +09:00
matt rice
db47761154
register publish_diagnostics client capability ( #2241 )
2022-04-25 11:14:46 +09:00
ttys3
19d042dde6
chore(lsp): check rename capabilities before send rename action ( #2203 )
2022-04-23 17:09:16 +09: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
dc8fef5dd3
Fixes #1991 LSP Auto-import ( #2088 )
2022-04-16 10:43:54 +09:00
Blaž Hrastnik
8adf0c1b3a
lsp: Implement support for workspace_folders (currently just one)
...
Refs #1898
2022-04-01 11:20:41 +09:00
Blaž Hrastnik
84e799f0e4
fix: Some LSPs still want rootPath, so provide it
...
Refs #1898
2022-03-31 17:45:51 +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
Blaž Hrastnik
9712bbb23b
Use which to resolve lsp/dap binaries
...
This resolves the following issue: https://github.com/helix-editor/helix/discussions/962#discussioncomment-1580046
2022-02-24 11:38:40 +09:00
Blaž Hrastnik
f88c077f99
Replace tendril with smartstring
...
Slightly smaller API surface, less dependencies.
2022-02-10 11:12:47 +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
Gabriel Berto
5d7b5db8ab
Resolve completion item ( #1315 )
...
Co-authored-by: Gabriel Berto <gabriel.berto@pottencial.com.br>
2021-12-25 19:00:57 +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
CossonLeo
29e6849413
Add LSP rename_symbol (space-r) ( #1011 )
...
improve apply_workspace_edit
2021-11-09 00:17:54 +09:00
Ivan Tham
49f6c2623f
Bump lsp-types to 0.91.0 ( #932 )
2021-10-29 12:00:18 +09:00
Blaž Hrastnik
bb47a9a0b8
fix: Fix regression where formatting would fail on null response
2021-09-09 11:49:45 +09:00
Blaž Hrastnik
37606bad47
lsp: doc.language_server() is None until initialize completes
2021-09-06 15:25:46 +09:00
Blaž Hrastnik
2793ff3832
lsp: SyncKind::Full: we need to send the whole document on each change
2021-09-06 15:25:46 +09:00
Blaž Hrastnik
800d79b584
ls: Refactor textDocument/didSave in a similar vein
2021-09-06 15:25:46 +09:00
Blaž Hrastnik
184637c55a
lsp: refactor format so we stop cloning the language_server
2021-09-06 15:25:46 +09:00
Blaž Hrastnik
8744f367bd
wip
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
Blaž Hrastnik
fe17b99ab3
fix: lsp: Don't consume \n\n as a single newline
2021-09-06 15:25:08 +09:00
Blaž Hrastnik
57ed5180e0
lsp: Improve line ending handling when generating TextEdit
2021-09-06 11:00:33 +09:00
Grzegorz Baranski
48e344a2a8
feat: code actions - document edits ( #478 )
...
* wip: Code actions
* fix(term): use current macro instead Context::context
* feat(lsp): set code_action capabilities
* feat(term): set SPC-a to code_action
* feat(term): wip on applying code actions
* deps: `cargo update`
* feat(term): applying code actions edits
* fix(term): cleanup of apply_edit
* fix(term): applying edits as a whole thing instead one by one
* refactor(term): move apply_edits below
* fix(term): improve unimplemented messages for further investigation
* fix(term): change code action command comment
Co-authored-by: Ivan Tham <pickfire@riseup.net>
* fix(term): add matching `}`
* fix(term): cleanup, todo!() on workspace edit
* fix(term): remove unrelated workspace_symbol_picker
* fix(term): apply cargo-clippy suggestions
* fix(term): replace todo!'s with editor.set_error
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-07-24 10:26:43 +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
Nathan Vegdahl
4efd6713c5
Work on moving code over to LineEnding instead of assuming '\n'.
...
Also some general cleanup and some minor fixes along the way.
2021-06-20 15:33:02 -07:00
wojciechkepka
c2aad859b1
Handle language server shutdown with timeout
2021-06-19 13:02:56 +09:00
wojciechkepka
d095ec15d4
Reenable work_done_progress
capability
2021-06-18 17:42:38 +09:00
wojciechkepka
38cb934d8f
Add unique id to each lsp client/server pair
2021-06-18 17:42:38 +09:00
wojciechkepka
80b4a69053
Update client::reply
to be non async
2021-06-18 17:42:38 +09:00
wojciechkepka
a6d39585d8
Add work_done_token
as parameter to lsp methods
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
Blaž Hrastnik
a8a5bcd13d
Temporarily disable workDone
...
Blows up on gopls because we don't handle receiving window/workDoneProgress/create method calls
2021-06-11 13:30:21 +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
Blaž Hrastnik
8d6fad4cac
lsp: Provide workspace root on client.initialize()
2021-06-07 21:32:01 +09:00
Blaž Hrastnik
fd4fd12fa3
clippy lint
2021-05-06 17:20:00 +09:00
Blaž Hrastnik
ba97005495
Work around the rest of the blocking issues.
2021-05-06 17:15:49 +09:00
Blaž Hrastnik
d00414f81a
Start moving more LSP calls into callbacks/futures without capturing self
2021-05-06 15:08:59 +09:00
Blaž Hrastnik
355ad3cb82
Tokio migration.
2021-05-06 13:56:34 +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
0e9ecccfc1
clippy: Drop or-patterns for now because they're not on stable rust yet
2021-04-06 19:51:15 +09:00
Blaž Hrastnik
ceea5eacd8
clippy lint
2021-03-31 23:42:16 +09:00
Blaž Hrastnik
2a3910c1d9
wip: Async async. Delay response handling with a callback.
2021-03-26 17:12:45 +09:00
Blaž Hrastnik
9a36d2c2a8
wip: Hooks & trigger characters for completion/signature_help.
2021-03-24 18:17:00 +09:00
Blaž Hrastnik
e9bd9e72c3
Pos conversions always operate on whole documents.
2021-03-18 15:23:42 +09:00
Blaž Hrastnik
15f142bc4b
lsp: Use into_iter->map->collect instead of manual loop.
2021-03-16 23:03:29 +09:00
Blaž Hrastnik
4240f757c0
lsp: Fix compilation errors.
2021-03-16 23:03:10 +09:00
Jan Hrastnik
a5f9080a9c
goto_request wip
2021-03-16 23:03:10 +09:00
Jan Hrastnik
b738ae1bc7
more goto lsp functions
2021-03-16 23:03:10 +09:00
Jan Hrastnik
0322c28e6b
gd now works for singular definition
2021-03-16 23:03:10 +09:00
Jan Hrastnik
8a68a04340
gotodefiniton now runs but doesnt return anything
2021-03-16 23:03:10 +09:00
Jan Hrastnik
d3ddc8dea6
wip
2021-03-16 23:03:10 +09:00
Blaž Hrastnik
eca2a73ad0
lsp: Pass through language_id on didOpenTextDocument.
2021-03-16 16:13:41 +09:00
Blaž Hrastnik
143cfe13e0
minor: TODO comment cleanup
2021-03-16 15:41:42 +09:00
Blaž Hrastnik
6cbfb050e2
lsp: Emit didSave notifications.
2021-03-12 16:25:12 +09:00
Blaž Hrastnik
4102992c46
Bump deps.
2021-03-01 14:33:02 +09:00
Blaž Hrastnik
1ae7c43391
commands: = as range formatting (via lsp)
2021-02-26 15:52:43 +09:00
Blaž Hrastnik
7162632eb7
lsp: Hover documentation draft.
2021-02-25 18:07:47 +09:00
Blaž Hrastnik
87a6d4e736
minor: Simplify some code.
2021-02-24 16:07:39 +09:00
Blaž Hrastnik
61ce2c9cfe
lsp: Disable snippet_support until we implement it.
2021-02-22 14:42:12 +09:00
Blaž Hrastnik
004a4f37a7
lsp: Handle responses being returned after request timed out.
2021-02-22 12:44:36 +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
d5f9622e2e
lsp: edit events change ranges need to affect each other.
2021-02-17 17:28:55 +09:00
Blaž Hrastnik
b7da7f83c3
lsp: Test changeset_to_changes.
2021-02-16 15:45:46 +09:00
Blaž Hrastnik
0541fbb85f
Adjust LSP changeset generation too: insert now always preceedes delete.
2021-02-16 11:08:06 +09:00
Blaž Hrastnik
777a80917d
Address clippy lints.
2021-01-08 16:37:36 +09:00
Blaž Hrastnik
941c34a7fc
lsp: Move timeouts into client.request
2021-01-06 17:48:14 +09:00
Blaž Hrastnik
3cbab20908
lsp: Fix pos_to_lsp_pos calculation.
2020-12-25 17:42:50 +09:00
Blaž Hrastnik
2ab069bb3f
lsp: Work on syncing the state with the language server.
2020-12-25 17:20:09 +09:00
Blaž Hrastnik
56f2193811
Retrieve completion options on ctrl-x.
2020-12-23 16:20:49 +09:00
Blaž Hrastnik
955cb81687
Init lsp through the registry.
2020-12-23 15:50:16 +09:00
Blaž Hrastnik
39bf1ca825
Update deps.
2020-12-03 13:12:07 +09:00
Blaž Hrastnik
ae8a9e5bac
lsp: Make base request methods take &self instead of &mut self.
2020-12-03 13:10:35 +09:00
Blaž Hrastnik
cc6bdf8f66
Text change generation, RPC call handling.
2020-12-03 13:10:35 +09:00
Blaž Hrastnik
b39849dde1
Refactor: Document type as a wrapper around barebones State.
2020-12-03 13:10:35 +09:00
Blaž Hrastnik
81ccca0c6a
Improve error typing.
2020-12-03 13:10:35 +09:00