Commit Graph

176 Commits

Author SHA1 Message Date
Kirill Bulatov
bacb2a266a
Add more data into LSP header parsing error contexts (#7282)
Follow-up of https://github.com/zed-industries/zed/pull/6929 

Release Notes:

- N/A
2024-02-02 18:04:23 +02:00
Rashid Almheiri
998f6cf80d
Add OCaml support (#6929)
This pull request implements support for the [OCaml
Language](https://ocaml.org/).

### Additions
- [x]
[tree-sitter-ocaml](https://github.com/tree-sitter/tree-sitter-ocaml)
grammar
- [x] Highlight, Indents, Outline queries
- [x] A new file icon for .ml(i) files. Based on
[ocaml/ocaml-logo](https://github.com/ocaml/ocaml-logo/blob/master/Colour/SVG/colour-transparent-icon.svg)
- [x] LSP Integration with
[ocaml-language-server](https://github.com/ocaml/ocaml-lsp)
- [x] Completion Labels
- [x] Symbol Labels

### Bug Fixes
- [x] Improper parsing of LSP headers. 

### Missing [will file a separate issue]
- Documentation on completionItem, requires: `completionItem/resolve`
with support for `documentation` as a provider.

### Screenshots

<details><summary>Zed</summary>
<img width="1800" alt="Screenshot 2024-02-01 at 03 33 20"
src="https://github.com/zed-industries/zed/assets/69181766/e17c184e-203e-40c3-a08f-4de46226b79c">
</details>

Release Notes:
- Added OCaml Support
([#5316](https://github.com/zed-industries/zed/issues/5316)).

> [!NOTE]
> Partially completes #5316 
> To complete #5316:
> 1. addition of a reason tree-sitter grammar.
> 2. opam/esy integration, however it may be better as it's own plugin.
2024-02-02 16:58:07 +02:00
Thorsten Ball
3107ed847a
lsp: if language server closes stdout/stderr, break loop (#7229)
Previously we would run these loops indefinitely when a language server
closed its stdout/stderr and the `read_until` returned `0` bytes read.

Easy to reproduce: start Zed with LSP attached, `kill -9` the LSP, see
logs accumulate.

Release Notes:

- Fix high CPU usage when a language server crashes (or closes its
stdout/stderr on purpose).

Co-authored-by: Julia <julia@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-02-01 17:49:53 +01:00
Kirill Bulatov
944a1f8fb0
Send lsp_types::InitializeParams with Zed version (#7216)
Based on the great work in
https://github.com/zed-industries/zed/pull/7130 , now sends this data

```
[crates/lsp/src/lsp.rs:588] ClientInfo { name: name.to_string(), version: Some(version.to_string()) } = ClientInfo {
    name: "Zed Dev",
    version: Some(
        "0.122.0",
    ),
}
```

with every LSP server initialization.

Release Notes:

- Added Zed name and version to LSP InitializeParams requests
2024-02-01 18:39:28 +02:00
Marshall Bowers
e338f34097
Sort dependencies in Cargo.toml files (#7126)
This PR sorts the dependency lists in our `Cargo.toml` files so that
they are in alphabetical order.

This should make them easier to visually scan when looking for a
dependency.

Apologies in advance for any merge conflicts 🙈 

Release Notes:

- N/A
2024-01-30 21:41:29 -05:00
Marshall Bowers
0cb8b0e451
Clean up Cargo.toml files (#7044)
This PR cleans up some inconsistencies in the `Cargo.toml` files that
were driving me crazy.

Release Notes:

- N/A
2024-01-29 23:47:20 -05:00
Kirill Bulatov
7767062c09
Add missing workspace edit capabilities (#6950)
Closes https://github.com/zed-industries/zed/issues/6916

Specification:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspaceEdit
Adds a safe minimum of the capabilities that Zed supports already,
allowing rust-analyzer to send file edits on rename.

Release Notes:

- Fixed rust module rename from editor not renaming the FS entries
([6916](https://github.com/zed-industries/zed/issues/6916))
2024-01-28 23:46:10 +02:00
Piotr Osiewicz
0a0a866dd5
Licenses: change license fields in Cargo.toml to AGPL-3.0-or-later. (#5535)
Release Notes:
- N/A
2024-01-27 13:51:16 +01:00
Piotr Osiewicz
f2ff7fa4d5
chore: Change AGPL-licensed crates to GPL (except for collab) (#4231)
- [x] Fill in GPL license text.
- [x] live_kit_client depends on live_kit_server as non-dev dependency,
even though it seems to only be used for tests. Is that an issue?

Release Notes:
- N/A
2024-01-24 00:26:58 +01:00
Piotr Osiewicz
21e6b09361
Remove license-file from Cargo.toml as it is apparently redundant (#4218)
Release Notes:

- N/A
2024-01-23 17:40:30 +01:00
Piotr Osiewicz
678bdddd7d
chore: Add crate licenses. (#4158)
- GPUI and all dependencies: Apache 2
- Everything else: AGPL

Here's a script that I've generated for it:
https://gist.github.com/osiewicz/6afdd6626e517da24a2092807e6f0b6e

Release Notes:
- N/A

---------

Co-authored-by: David <david@zed.dev>
2024-01-23 16:56:22 +01:00
Piotr Osiewicz
6c82380232 chore: Fix clippy::needless_borrow up to an editor 2024-01-21 15:03:24 +01:00
Thorsten Ball
1a6cd73334 Cancel language server requests if request is dropped
Before this change, we would send requests to language servers without
canceling them even if we never wait for their response.

Example: when doing document highlights, we'd send a request (modulo
debouncing) whenever a change was made, ignoring previously sent
requests that might still be in-flight.

With this change, we now send a Cancel request (from the LSP spec) to
the language server in case no one listens to the response anymore
(which is what happens when the `Future` returned by `request_internal`)
is dropped.
2024-01-19 16:28:27 +01:00
Thorsten Ball
5e6d1a47b2 Refactor LanguageSever::fake into FakeLanguageServer::new
This is just moving code around and doesn't change behaviour, but it's
something Julia and I bumped into yesterday while writing docs.
2024-01-18 10:59:32 +01:00
Mikayla Maki
aa7351041d
Add typo detection to CI (#4107)
Adding the typos crate to our CI will take some doing, as we have
several tests which rely on typos in various ways (e.g. checking state
as the user types), but I thought I'd take a first stab at fixing what
it finds.

Release Notes:

- N/A
2024-01-17 17:13:47 -08:00
Marshall Bowers
9521f49160
Clean up references in doc comments in lsp crate (#4109)
This PR cleans up a handful of references in doc comments in the `lsp`
crate so that `rustdoc` will link and display them correctly.

Release Notes:

- N/A
2024-01-17 19:06:19 -05:00
Mikayla Maki
0711476fd5
Merge branch 'main' into fix-typos 2024-01-17 14:36:03 -08:00
Mikayla
57400e9687
Fix typos detected by crate-ci/typos 2024-01-17 14:31:21 -08:00
Julia
d7503a7d47 Document LSP crate
Co-Authored-By: Thorsten Ball <thorsten@zed.dev>
2024-01-17 13:39:37 -05:00
Max Brunsfeld
f5ba22659b Remove 2 suffix from gpui
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 12:59:39 -08:00
Max Brunsfeld
9f99e58834 Remove 2 suffix for lsp, language, fuzzy
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 11:58:02 -08:00
Kirill Bulatov
14993e0876 Declare more supported client capabilities 2023-11-30 12:22:23 +02:00
Julia
170ebd8221 Capture language server stderr during startup/init and log if failure 2023-10-26 12:29:22 +02:00
Julia
77ba25328c Most of getting completion documentation resolved & cached MD parsing 2023-10-06 13:26:38 -04:00
Mikayla Maki
591ec02cea
Add support for the experimental Next LS for Elixir (#3024)
This is a PR I built for a friend of a friend at StrangeLoop, who is
making a much better LSP for elixir that elixir folks want to experiment
with. This PR also improves the our debug log viewer to handle LSP
restarts.

TODO:
- [ ] Make sure NextLS binary loading works.

Release Notes:

- Added support for the experimental Next LS for Elxir, to enable it add
the following field to your settings to enable:

```json
"elixir": {
    "next": "on"
}
```
2023-09-25 12:52:56 -05:00
Kirill Bulatov
d61565d227 Do not resubscribe for Copilot logs events
Copilot sends multiple events about its LSP server readiness, not necessarily recreating the server from scratch (e.g. due to re-sign in action).
Avoid re-adding same log subscriptions on the same LSP server, which
causes panics.
2023-09-22 13:40:20 +03:00
Mikayla
02a85b1252
Add local next LSP adapter 2023-09-21 18:09:02 -07:00
Kirill Bulatov
ddc6214216
Tailwind autocomplete (#2920)
Release Notes:
- Added basic Tailwind CSS autocomplete support
([#746](https://github.com/zed-industries/community/issues/746)).
2023-08-31 16:55:46 +03:00
Kirill Bulatov
18efc0d5e5 Fix the tests, by not requiring stderr for fake servers 2023-08-31 11:07:37 +03:00
Julia
ff3865a4ad Merge branch 'main' into multi-server-completions-tailwind 2023-08-30 22:58:37 -04:00
Kirill Bulatov
54e7e2f59d Capture language servers' stderr into server logs 2023-08-31 01:14:37 +03:00
Kirill Bulatov
7e5735c8f1 Reap overly long LSP requests with a 2m timeout
Co-authored-by: Julia Risley <julia@zed.dev>
2023-08-30 18:41:41 +03:00
Kirill Bulatov
3bfe78b1df Use proper property names for inlay hint resolve capabilities 2023-08-28 00:27:59 +03:00
Max Brunsfeld
f798be6e27 Fix rust 1.72 warnings about shadowed glob re-exports 2023-08-25 10:25:21 -07:00
Julia
c842e87079 Use updated lsp-types fork branch 2023-08-18 11:57:19 -04:00
Julia
a979e32127 Utilize LSP completion itemDefaults a bit
Tailwind likes to throw a lot of completion data at us, this gets it to
send less. Previously it would respond to a completion with 2.5 MB JSON
blob, now it is more like 0.8 MB.

Relies on a local copy of lsp-types with the `itemDefaults` field added.
I don't have write perms to push to our fork of the crate atm, sorry :)
2023-08-17 21:57:39 -04:00
Julia
e54f16f372 Register initial request handlers before launching server 2023-08-16 21:25:17 -04:00
Kirill Bulatov
27bf01c3a8 Strip off inlay hints data that should be resolved 2023-08-14 22:50:55 +03:00
Piotr Osiewicz
dc557e1647 Add scaffolding of php language server 2023-07-17 11:43:32 +02:00
Kirill Bulatov
b146762f68 Remove a flacky test, fix the failing one 2023-06-29 22:45:04 +03:00
Kirill Bulatov
31f0f9f7b1 Forbid extra inlay updates 2023-06-29 22:25:49 +03:00
Kirill Bulatov
f83cfda9bc React on message-less LSP requests properly
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-29 22:25:48 +03:00
Kirill Bulatov
79b97f9e75 Stub initial hint requests 2023-06-29 22:25:48 +03:00
Kirill Bulatov
8a3b515f56 Initial protocol check commit 2023-06-29 22:25:48 +03:00
Julia
48bed2ee03
Merge branch 'main' into fix-broken-lsp-installations 2023-06-28 16:46:06 -04:00
Julia
7caa096bd0 Remove installation test binary from language server instance 2023-06-23 13:24:50 -04:00
Julia
0abda54d3c Remove individual location's request error handling 2023-06-22 11:43:26 -04:00
Julia
e1cd6cebb9 Revert "Route language server requests through wrapper object"
This reverts commit 9b63d6f832.
2023-06-22 10:45:08 -04:00
Julia
9b63d6f832 Route language server requests through wrapper object 2023-06-21 23:05:37 -04:00
Kirill Bulatov
bd97767c72 Run LSP response deserialization outside of main thread
Improves latency when big inlay hints LSP responses for ~8k line files

Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-21 13:20:42 +03:00