Commit Graph

4773 Commits (d52b790379ffc5646409a9972e0a4e70bcc8a981)
 

Author SHA1 Message Date
Blaž Hrastnik 53f47bc477
Merge pull request #2507 from Philipp-M/multiple-language-servers
Add support for multiple language servers per language
2 years ago
Philipp Mildenberger 2a512f7c48 Rebase cleanup/fixes and use lsp::CompletionItem in item_to_transaction directly 2 years ago
Philipp Mildenberger f8fa0d8a10 Clarify language-servers documentation for mergeable LSP features (`diagnostics`, `code-action`, `completion`, `document-symbols` and `workspace-symbols`) 2 years ago
Philipp Mildenberger b6d0e26814 Sort language servers table in languages.toml and rename language server 'R' to 'r' 2 years ago
Philipp Mildenberger f45bbf165e Apply all review suggestions (doc_id -> id, error message, unnecessary if)
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
2 years ago
Philipp Mildenberger 656ee24966 Simplify gutter diagnostics rendering by using partition_point instead of binary search
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
2 years ago
Philipp Mildenberger 2b746ea6fa Some minor clarity/cosmetic improvements
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
2 years ago
Philipp Mildenberger 39b9a4bba2 Add function `Editor::language_server_by_id` and refactor/simplify related code, also don't 'crash' in completion menu if language_server somehow disappeared 2 years ago
Philipp Mildenberger 521cdec5a1 Remove TODO comment in helix_lsp::Registry::restart and add doc-comment on top of function instead 2 years ago
Philipp Mildenberger dcb07673f8 Reorder id generation for Clients to stay close to the old behavior 2 years ago
Philipp Mildenberger 56748509bd Reduce boilerplate by 'use lsp::*' in Client::supports_feature, and remove TODO comment 2 years ago
Philipp Mildenberger 3e4bac1d96 Fix lsp_restart across multiple different document scopes (language servers weren't restarted, if not of the same scope id), and fix some smaller rebase issues 2 years ago
Philipp Mildenberger 2a21b939c4 Fix crash with filtered diagnostics in gutter (e.g. when diagnostics aren't visible) 2 years ago
Philipp Mildenberger 93fd79a949 Remove offset_encoding in CodeActionOrCommandItem, as it can be retrieved on demand 2 years ago
Philipp Mildenberger 073000e54d Maintain language servers TOML array order in `doc.language_servers` 2 years ago
Philipp Mildenberger ff26208427 Filter language servers also by capabilities in `doc.language_servers_with_feature`
* Add `helix_lsp::client::Client::supports_feature(&self, LanguageServerFeature)`
* Extend `doc.language_servers_with_feature` to use this method as filter as well
* Add macro `language_server_with_feature!` to reduce boilerplate for non-mergeable language server requests (like goto-definition)
* Refactored most of the `find_map` code to use the either the macro or filter directly via `doc.language_servers_with_feature`
2 years ago
Philipp Mildenberger 9d089c27c7 Fix docgen again 2 years ago
Philipp Mildenberger 451fe528bb Filter out already seen language servers in requests that can be sent to multiple language servers (code-action, completion, symbol pickers) 2 years ago
Philipp Mildenberger 8ee599942a Optimize gutter diagnostics and simplify shown_diagnostics 2 years ago
Philipp Mildenberger 8ab6d7be5e Use let else instead of variable and fix some error messages
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
2 years ago
Philipp Mildenberger 1d5d5dab47 Remove offset_encoding in CompletionItem 2 years ago
Philipp Mildenberger 2eeac10755 Refactor doc language servers to a HashMap, and the config to use a Vec to retain order 2 years ago
Philipp Mildenberger b1199c552b Remove symbol picker is_empty check 2 years ago
Philipp Mildenberger 58c913ce45 Simplify 'lsp_stop' command 2 years ago
Philipp Mildenberger 7d20740b5b Fix docgen and lsp-stop documentation 2 years ago
Philipp Mildenberger 60a6af1fea Remove boilerplate in the goto methods by generically composing functions 2 years ago
Philipp Mildenberger d963050621 Format/fix language docs a bit 2 years ago
Philipp Mildenberger 9639f42766 Refactor doc.shown_diagnostics to avoid an extra HashSet
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
2 years ago
Philipp Mildenberger 1122928c2a Add method doc.supports_language_server for better readability 2 years ago
Philipp Mildenberger ec2f9091a0 Simplify Display implementation for LanguageServerFeature 2 years ago
Philipp Mildenberger 76b5cab524 Refactored doc.language_servers and doc.language_servers_with_feature to return an iterator and refactor LanguageServerFeature handling to a HashMap (language server name maps to features)
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
2 years ago
Philipp Mildenberger 0637691eb1 Use DoubleEndedIterator instead of collect to Vec for reversing
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
2 years ago
Philipp Mildenberger dd2f74794a Fix error messages when no language server is available
Co-authored-by: Skyler Hawthorne <skyler@dead10ck.com>
2 years ago
Philipp Mildenberger 19f88fc577 Simplify Display implementation of LanguageServerFeature
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2 years ago
Philipp Mildenberger f9b08656f4 Fix sorting issues of the editor wide diagnostics and apply diagnostics related review suggestions
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
2 years ago
Philipp Mildenberger 4da6d8ccc7 str instead of String 2 years ago
Philipp Mildenberger b6c60beb2d Remove unnecessary completion support check (likely an artifact) 2 years ago
Philipp Mildenberger 44b2b40190 Fix issue with ltex-ls, filtering params is not what we want here 2 years ago
Philipp Mildenberger 05583f8cc9 Fix hardcoded offset_encoding 2 years ago
Philipp Mildenberger 74e21e1b25 Fix some lints/docgen hints 2 years ago
Philipp Mildenberger 7d4f7eb4bd Fix 'WorkspaceConfiguration' request with empty configuration section strings 2 years ago
Philipp Mildenberger 71551d395b Adds support for multiple language servers per language.
Language Servers are now configured in a separate table in `languages.toml`:

```toml
[langauge-server.mylang-lsp]
command = "mylang-lsp"
args = ["--stdio"]
config = { provideFormatter = true }

[language-server.efm-lsp-prettier]
command = "efm-langserver"

[language-server.efm-lsp-prettier.config]
documentFormatting = true
languages = { typescript = [ { formatCommand ="prettier --stdin-filepath ${INPUT}", formatStdin = true } ] }
```

The language server for a language is configured like this (`typescript-language-server` is configured by default):

```toml
[[language]]
name = "typescript"
language-servers = [ { name = "efm-lsp-prettier", only-features = [ "format" ] }, "typescript-language-server" ]
```

or equivalent:

```toml
[[language]]
name = "typescript"
language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "efm-lsp-prettier" ]
```

Each requested LSP feature is priorized in the order of the `language-servers` array.
For example the first `goto-definition` supported language server (in this case `typescript-language-server`) will be taken for the relevant LSP request (command `goto_definition`).

If no `except-features` or `only-features` is given all features for the language server are enabled, as long as the language server supports these. If it doesn't the next language server which supports the feature is tried.

The list of supported features are:

- `format`
- `goto-definition`
- `goto-declaration`
- `goto-type-definition`
- `goto-reference`
- `goto-implementation`
- `signature-help`
- `hover`
- `document-highlight`
- `completion`
- `code-action`
- `workspace-command`
- `document-symbols`
- `workspace-symbols`
- `diagnostics`
- `rename-symbol`
- `inlay-hints`

Another side-effect/difference that comes with this PR, is that only one language server instance is started if different languages use the same language server.
2 years ago
Michael Davis 7f5940be80 Add 23.05 to the AppData 2 years ago
Michael Davis 59f8f5e6d4 Add changelog notes for the 23.05 release 2 years ago
Michael Davis 04fbf30488 Bump the version to 23.05 2 years ago
Ivan Gulakov 2cccb3f09c
Fix completion on paths containing spaces (#6779)
There was an issue with autocompletion of a path with a space in it.

Before:

:o test\ dir -> <TAB> -> test\ dirfile1

After:

:o test\ dir -> <TAB> -> test\ dir\file1
2 years ago
Pascal Kuthe b0705337be automatically disable TS when parsing takes longer than 500ms 2 years ago
Pascal Kuthe 2f2306475c async picker syntax highlighting 2 years ago
Pascal Kuthe c6f169b1f8 cleanup integration tests 2 years ago
Pascal Kuthe 25d4ebe30d don't move cursor while forward deleting in append mode
Currently, when forward deleting (`delete_char_forward` bound to `del`,
`delete_word_forward`, `kill_to_line_end`) the cursor is moved to the
left in append mode (or generally when the cursor is at the end of the
selection). For example in a document `|abc|def`  (|indicates selection)
if enter append mode the cursor is moved to `c` and the selection
becomes: `|abcd|ef`. When deleting forward (`del`) `d` is deleted. The
expectation would be that the selection doesn't shrink so that `del`
again deletes `e` and then `f`. This would look as follows:

`|abcd|ef`
`|abce|f`
`|abcf|`
`|abc |`

This is inline with how other editors like kakoune work.
However, helix currently moves the selection backwards leading to the
following behavior:

`|abcd|ef`
`|abc|ef`
`|ab|ef`
`ef`

This means that `delete_char_forward` essentially acts like
`delete_char_backward` after deleting the first character in append
mode.

To fix the problem the cursor must be moved to the right while deleting
forward (first fix in this commit). Furthermore, when the EOF char is
reached a newline char must be inserted (just like when entering
appendmode) to prevent the cursor from moving to the right
2 years ago