Commit graph

47 commits

Author SHA1 Message Date
Lukas Wirth
71a43aff4e fix: Don't panic lsp writer thread on dropped receiver 2024-09-06 09:13:00 +02:00
mo8it
0b541ebbaa Use crossbeam-channel from the workspace 2024-08-09 23:48:03 +02:00
Hamir Mahal
7c34eb3880
style: simplify string interpolation 2024-05-30 16:18:49 -07:00
Wilfred Hughes
84fdb72525 fix: Report all LSP protocol errors with invalid_data
Previously we did not use invalid_data for serde errors, making it
harder to understand errors when the client sends malformed data to
the server.
2024-05-08 16:08:00 -07:00
bors
2074cc28de Auto merge of #16722 - mo8it:allocations, r=Veykril
Avoid some allocations

I went on a small `.clone()` hunting tour :D
2024-03-04 09:17:23 +00:00
Lukas Wirth
83a1ad5bfe Give all threads names 2024-03-01 13:19:55 +01:00
mo8it
06a883e32f Take a reference instead of cloning 2024-02-29 16:05:26 +01:00
Michel Lind
fafb16b052
lsp-server: add license files
The `lsp-server` crate is currently published without license files, which is
needed when packaging in Linux distributions.

Symlink the files from the repository root so they are kept in sync.

Test showing the files get picked up by `cargo package`:
```
michel in rust-analyzer/lib/lsp-server on  add-lsp-server-license [+] is 📦 v0.7.6 via 🐍 v3.12.1 (.venv311) via 🦀 v1.76.0
⬢ [fedora:39] ❯ cargo package --allow-dirty --no-verify
    Updating crates.io index
   Packaging lsp-server v0.7.6 (/home/michel/src/github/rust-lang/rust-analyzer/lib/lsp-server)
    Updating crates.io index
    Packaged 12 files, 59.6KiB (16.3KiB compressed)

michel in rust-analyzer/lib/lsp-server on  add-lsp-server-license [+] is 📦 v0.7.6 via 🐍 v3.12.1 (.venv311) via 🦀 v1.76.0
⬢ [fedora:39] ❯ tar tf ../../target/package/lsp-server-0.7.6.crate | grep LICENSE
lsp-server-0.7.6/LICENSE-APACHE
lsp-server-0.7.6/LICENSE-MIT
```

Signed-off-by: Michel Lind <salimma@fedoraproject.org>
2024-02-15 18:01:36 -06:00
Tetsuharu Ohzeki
bffb8880d5 lsp-server: Fix warnings about clippy str_to_string rule 2024-02-10 01:00:40 +09:00
Lukas Wirth
9e8a0fae0c Lint debug prints and disallowed types with clippy 2024-02-01 17:57:27 +01:00
Young-Flash
db9fd370ee minor: correct typos 2024-01-30 21:43:43 +08:00
Lukas Wirth
8a5829cf28 Re-order mod declarations 2024-01-27 11:02:34 +01:00
Johann Hemmann
fad4fa163c cargo clippy --fix 2024-01-18 13:59:49 +01:00
bors
86e559bf3f Auto merge of #16211 - tetsuharuohzeki:update-lint, r=Veykril
Use Cargo's [workspace.lints.*] to config clippy

This change begin to use [`[workspace.lints.*]`](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table) that is stabilized since [Rust 1.74](https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html).

By this change, we make the configure more readable and simplify `xargo lint` more.
2024-01-02 14:53:22 +00:00
Lukas Wirth
3c8dd9e89e Expose whether a channel has been dropped in lsp-server errors 2024-01-01 14:10:46 +01:00
Tetsuharu Ohzeki
efc87092b3 Use Cargo's [workspace.lints.*] to config clippy 2023-12-29 23:51:32 +09:00
Lukas Wirth
2a5b60b186 internal: Update world symbols request definiton, prefer focus range for macros 2023-12-22 11:42:08 +01:00
Lukas Wirth
a84685a58d Publish lsp-server 0.7.5 2023-12-06 22:00:01 +01:00
Igor Matuszewski
a7224c998d Don't explicitly warn against semicolon_in_expressions_from_macros
This has been warn-by-default for two years now and has already been
added to the future-incompat lints in 1.68.
2023-12-05 11:35:09 +01:00
Marc Schreiber
81c2d3552e Cancelable Initialization
This commit provides additional initialization methods to Connection in
order to support CTRL + C sigterm handling.
2023-11-21 21:29:33 +01:00
Laurențiu Nicola
2bfd6b659d Bump serde_json 2023-11-15 13:17:36 +02:00
Laurențiu Nicola
970a796368 Bump serde 2023-11-15 13:16:07 +02:00
Alex Kladov
343ee8bacf internal: unpin serde
Sered no longer uses blobs as of

https://github.com/serde-rs/serde/pull/2590

As such, there's no longer need for us to pin it.

Note that this doesn't upgrade serde version we use: I am fairly
confident that the blobs are already there are fine, and now I am fairly
confident that all future versions of serde will be fine as well.
2023-08-21 14:29:18 +01:00
Alex Kladov
6c46b98a95 fix: avoid problematic serde release
serde 1.0.172 and up rely on opaque non-reproducible binary blobs to
function, explicitly not providing a library-level opt-out.

This is problematic for two reasons:

- directly, unauditable binary blobs are a security issue.
- indirectly, it becomes much harder to predict future behaviors of the
  crate.

As such, I am willing to go on a limb here and forbid building
rust-analyzer with those versions of serde. Normally, my philosophy is
to defer the choice to the end user, but it's also a design constraint
of rust-analyzer that we don't run random binaries downloaded from the
internet without explicit user's concent.

Concretely, this upper-bounds serde for both rust-analyzer workspace, as
well as the lsp-server lib.

See https://github.com/serde-rs/serde/issues/2538 for wider context.
2023-08-19 14:14:23 +01:00
Charles
02d5c0ac56
chore: convert unwrap to except and add a debug log 2023-08-08 14:55:56 +02:00
Lukas Wirth
9031f385e0 Enable derive feature for serde in lsp-server 2023-07-11 13:45:27 +02:00
Sebastian Sturm
872cd30325 [lsp-server] Ignore 'Content-Length' case 2023-07-10 22:36:52 +02:00
Lukas Wirth
e5c65071bc Disconnect library crate dependencies from workspace dependencies 2023-06-22 11:50:52 +02:00
David Lattimore
fb3e54ef05 Release lsp-server 0.7.1 2023-06-20 13:53:39 +10:00
KatKlo
1db2a2536c Fix bug with notifications during initialization 2023-04-15 19:31:02 +02:00
Lukas Wirth
39e86e78c3 Bump Cargo.lock 2023-03-25 15:12:39 +01:00
Lukas Wirth
38144fd914 Bump lsp-types 2023-02-14 14:59:50 +01:00
Maybe Waffle
41fda76152 simplify is_exit check 2023-01-31 11:01:01 +00:00
Lukas Wirth
9eb50d3cde Make it clearer when the server expects an initialized notification 2023-01-09 17:03:36 +01:00
Daniel Eades
77051679d7 use inline format args 2023-01-02 14:52:32 +00:00
Yuri Astrakhan
e16c76e3c3 Inline all format arguments where possible
This makes code more readale and concise,
moving all format arguments like `format!("{}", foo)`
into the more compact `format!("{foo}")` form.

The change was automatically created with, so there are far less change
of an accidental typo.

```
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2022-12-24 14:36:10 -05:00
Laurențiu Nicola
e93a2bff67 Pin lsp-types 2022-10-25 15:03:35 +03:00
Laurențiu Nicola
956b96a19d Switch to upstream positionEncoding 2022-10-25 14:43:26 +03:00
Laurențiu Nicola
cbce0cda08 Bump anyhow, arbitrary, itertools, semver, serde 2022-10-15 12:52:34 +03:00
Lukas Wirth
1a6c1595fe Don't retry requests that have already been cancelled 2022-09-27 17:39:15 +02:00
Alan Zimmerman
fb0ce25d59 Add RequestFailed error code, as per spec 3.17
See https://github.com/microsoft/language-server-protocol/issues/1341
2022-09-23 09:49:44 +01:00
wuaoxiang
2c0d2e719d internal: remove unnecessary stream writer try_clone in lsp-server 2022-08-22 11:25:21 +08:00
Amos Wenger
23d25a3094 Enable extra warnings required by rust-lang/rust 2022-07-20 15:00:17 +02:00
Jonas Schievink
6c6ae965ba Update remaining GitHub URLs 2022-07-08 15:44:49 +02:00
Laurențiu Nicola
212f84ab46 Bump crossbeam-channel 2022-07-03 09:56:58 +03:00
Lukas Wirth
76ae5434fa internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
Aleksey Kladov
57cb65bb7a internal: vendor lsp-server 2022-05-14 21:15:43 +01:00