Commit graph

710 commits

Author SHA1 Message Date
bors
03f935d4c1 Auto merge of #17188 - szabgab:patch-1, r=Veykril
use the repository field to link to the repository
2024-05-13 10:16:45 +00:00
bors
9e20f4bf0e Auto merge of #17187 - roife:fix-issue-17185, r=Veykril
fix: keep parentheses when the precedence of inner expr is lower than the outer one

fix #17185

Additionally, this PR simplifies some code in `apply_demorgan`.
2024-05-13 10:03:40 +00:00
bors
6a3556b779 Auto merge of #17195 - Veykril:unsafe-attr, r=Veykril
Implement unsafe attribute parsing
2024-05-13 09:50:52 +00:00
Young-Flash
de58ddfd0f test: add test case extract_with_specified_path_attr 2024-05-12 11:48:17 +08:00
Young-Flash
fafcc77855 fix: extract mod to file should respect path attribute 2024-05-12 11:48:17 +08:00
bors
48bcef3a32 Auto merge of #17208 - Wilfred:log_error_from_threads, r=Veykril
fix: Report both IO errors and main_loop errors

If rust-analyzer receives a malformed LSP request, the IO thread terminates with a meaningful error, but then closes the channel.

Once the channel has closed, the main_loop also terminates, but it only has RecvError and can't show a meaningful error. As a result, rust-analyzer would incorrectly claim that the client forgot to shutdown.

```
$ buggy_lsp_client | rust-analyzer
Error: client exited without proper shutdown sequence
```

Instead, include both error messages when the server shuts down.
2024-05-09 11:59:04 +00:00
Wilfred Hughes
a3ed9fe955 fix: Report both IO errors and main_loop errors
If rust-analyzer receives a malformed LSP request, the IO thread
terminates with a meaningful error, but then closes the channel.

Once the channel has closed, the main_loop also terminates, but it
only has RecvError and can't show a meaningful error. As a result,
rust-analyzer would incorrectly claim that the client forgot to
shutdown.

```
$ buggy_lsp_client | rust-analyzer
Error: client exited without proper shutdown sequence
```

Instead, include both error messages when the server shuts down.
2024-05-08 16:53:30 -07:00
Wilfred Hughes
8ca11468fb 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
Tavo Annus
8ef19e777a Make term search fuel configurable 2024-05-08 19:46:33 +03:00
Tavo Annus
f9f1d3140f Use unit of work as fuel instead of time 2024-05-07 22:13:27 +03:00
bors
24ef42aafc Auto merge of #17192 - roife:fix-issue-17179, r=lnicola
Fix source_range for INT_NUMBER in completion

fix #17179.

Previously r-a use `TextRange::empty(self.position.offset)` as `source_range` for `INT_NUMBER`, so the `text_edit` would always be an insertion, which results in #17179.

This PR changed it by using `text_range` of `original_token` (same as `IDENT`).
2024-05-07 07:24:15 +00:00
Tavo Annus
9785dcc317 Add time based fuel to term search 2024-05-06 22:13:09 +03:00
Tavo Annus
1e2738b723 Collapse term search exprs before Cartesian product to avoid OOM 2024-05-06 20:29:34 +03:00
beetrees
3769fddba2
Refactor float Primitives to a separate Float type 2024-05-06 14:56:10 +01:00
Lukas Wirth
58d58afa5f Implement unsafe attribute parsing 2024-05-06 12:11:29 +02:00
roife
88a0df9d82 Fix source_range for INT_NUMBER in completion 2024-05-06 11:50:05 +08:00
dfireBird
4de215ad63
fix lifetime bound var index in dyn trait 2024-05-05 23:40:34 +05:30
roife
723467b264 tests: update test in assist apply_demorgan 2024-05-05 23:44:52 +08:00
Gábor Szabó
26456e6238
use the repository field to link to the repository 2024-05-05 17:59:27 +03:00
roife
85bcced1e9 fix: keep parentheses when the precedence of inner expr is lower than the outer one 2024-05-05 21:39:26 +08:00
Laurențiu Nicola
1f199fe17c Bump peaceiris/actions-gh-pages 2024-05-03 20:23:50 +03:00
hermannm
d09331ce83
Fix Run lens showing when lenses are disabled
The documentation for `lens.run.enable` states that it only applies
when `lens.enable` is set. However, the config setting whether to show
the Run lens did not check `lens.enable`, so the Run lens would show
even though lenses were disabled.
2024-05-02 20:14:41 +02:00
Martin Nordholts
cde0cde151 Change SIGPIPE ui from #[unix_sigpipe = "..."] to -Zon-broken-pipe=...
In the stabilization attempt of `#[unix_sigpipe = "sig_dfl"]`, a concern
was raised related to using a language attribute for the feature: Long
term, we want `fn lang_start()` to be definable by any crate, not just
libstd. Having a special language attribute in that case becomes
awkward.

So as a first step towards towards the next stabilization attempt, this
PR changes the `#[unix_sigpipe = "..."]` attribute to a compiler flag
`-Zon-broken-pipe=...` to remove that concern, since now the language
is not "contaminated" by this feature.

Another point was also raised, namely that the ui should not leak
**how** it does things, but rather what the **end effect** is. The new
flag uses the proposed naming. This is of course something that can be
iterated on further before stabilization.
2024-05-02 19:48:29 +02:00
bors
b05f906a50 Auto merge of #17176 - Veykril:fix-implicit-ty-args, r=Veykril
Fix impl trait params not being counted properly

Fixes the other thing in https://github.com/rust-lang/rust-analyzer/issues/17173, this just rolls back a change from https://github.com/rust-lang/rust-analyzer/pull/17175 and adds a comment as to what it does
2024-05-02 12:05:25 +00:00
Lukas Wirth
fdf757e057 Fix impl trait params not being counted properly 2024-05-02 13:56:10 +02:00
bors
c5eaf59e43 Auto merge of #17175 - Veykril:fix-implicit-ty-args, r=Veykril
fix: Fix implicit ty args being lowered where they shouldn't

Fixes https://github.com/rust-lang/rust-analyzer/issues/17173
2024-05-02 10:04:13 +00:00
Lukas Wirth
f190ce61b7 fix: Fix implicit ty args being lowered where they shouldn't 2024-05-02 11:53:53 +02:00
Lukas Wirth
f4b4a12b02 fix: Correctly handle no_core/no_std for preludes 2024-05-02 10:50:28 +02:00
Kenny Kerr
60cac54e83 Update rust-analyzer to use windows-sys crate 2024-05-01 09:04:13 -05:00
bors
d70c8765f8 Auto merge of #17148 - Wilfred:span_names, r=Veykril
fix: Tracing span names should match function names

When viewing traces, it's slightly confusing when the span name doesn't match the function name. Ensure the names are consistent.

(It might be worth moving most of these to use `#[tracing::instrument]` so the name can never go stale. `@davidbarsky` suggested that is marginally slower, so I've just done the simple change here.)
2024-04-30 18:33:17 +00:00
Wilfred Hughes
65b201adb4 fix: Tracing span names should match function names
When viewing traces, it's slightly confusing when the span name doesn't
match the function name. Ensure the names are consistent.

(It might be worth moving most of these to use #[tracing::instrument]
so the name can never go stale. @davidbarsky suggested that is marginally
slower, so I've just done the simple change here.)
2024-04-30 11:22:47 -07:00
Wilfred Hughes
76fd22e8c4 docs: Fix typo in VS Code setting description 2024-04-30 11:17:57 -07:00
Harry Sarson
dd16cbcb4e
braces around {self} in UseTree are not unnecessary
Before this commit `UseTree::remove_unnecessary_braces` removed the braces
around `{self}` in `use x::y::{self};` but `use x::y::self;` is not valid
rust.
2024-04-30 18:17:32 +01:00
bors
b5a0f7e9ea Auto merge of #17160 - dfireBird:fix_impl_trait, r=Veykril
Implement creating generics for impl traits in associated types

Hopefully fix #17017
2024-04-30 12:23:23 +00:00
Lukas Wirth
b1ed49208e
Use RefCell::take 2024-04-30 14:19:56 +02:00
bors
4ce1c6cb97 Auto merge of #17138 - Kohei316:generate-function-assist-for-new, r=Veykril
feature: Make generate function assist generate a function as a constructor if the generated function has the name "new" and is an asscociated function.

close #17050
This PR makes `generate function assist` generate a function as a constructor if the generated function has the name "new" and is an asscociated function.
If the asscociate type is a record struct, it generates the constructor like this.
```rust
impl Foo {
    fn new() -> Self {
        Self { field_1: todo!(), field_2: todo!() }
    }
}
```
If the asscociate type is a tuple struct, it generates the constructor like this.
```rust
impl Foo {
    fn new() -> Self {
        Self(todo!(), todo!())
    }
}
```
If the asscociate type is a unit struct, it generates the constructor like this.
```rust
impl Foo {
    fn new() -> Self {
        Self
    }
}
```
If the asscociate type is another adt, it generates the constructor like this.
```rust
impl Foo {
    fn new() -> Self {
        todo!()
    }
}
```
2024-04-30 12:09:34 +00:00
morine0122
39a653f632 Fix coercion of async block 2024-04-30 18:31:10 +09:00
morine0122
e2b1c55255 Make generate function assist generate a function as a constructor if the name of function is new 2024-04-30 17:02:48 +09:00
Yu Zeng
8f3eecc369 discard when the path is invalid utf8 symbol. 2024-04-30 15:39:05 +08:00
dfireBird
14ef6363df
implement creating generics for impl traits in associated types 2024-04-29 23:55:02 +05:30
bors
f7de09415c Auto merge of #17144 - cbiffle:patch-1, r=Veykril
manual: remove suggestion of rust-project.json example

The manual has been linking to the repo

https://github.com/rust-analyzer/rust-project.json-example/tree/master

This repo does not contain a rust-project.json, does not appear to have _ever_ contained a rust-project.json, and my bug report about this has gone untouched: https://github.com/rust-analyzer/rust-project.json-example/issues/4

Since I can't figure out an example, this commit removes the link pending better documentation.
2024-04-29 08:16:11 +00:00
bors
3e3faf00fc Auto merge of #17157 - Veykril:retry, r=Veykril
fix: Don't retry position relient requests and version resolve data

Fixes https://github.com/rust-lang/rust-analyzer/issues/15907
Fixes https://github.com/rust-lang/rust-analyzer/issues/14839
Fixes https://github.com/rust-lang/rust-analyzer/issues/16536
2024-04-29 08:02:08 +00:00
Lukas Wirth
495afd15d2 Retry inlay hint requests 2024-04-29 09:53:12 +02:00
Lukas Wirth
e379766311 Work around completion retrying not fixing up offsets 2024-04-28 17:25:20 +02:00
Lukas Wirth
001c387150 Don't retry position relient requests and version resolve data 2024-04-28 17:02:38 +02:00
bors
960598b514 Auto merge of #17153 - Veykril:doc-comment-desugaring, r=Veykril
fix: Fix doc comment desugaring for proc-macros

Fixes https://github.com/rust-lang/rust-analyzer/issues/16259
2024-04-27 11:32:40 +00:00
Lukas Wirth
efb390bb94 fix: Fix doc comment desugaring for proc-macros 2024-04-27 13:30:51 +02:00
bors
b81f1f66c8 Auto merge of #17151 - Veykril:fix-cfg-trait-params, r=Veykril
fix: Fix attributes on generic parameters colliding in item tree

Fixes https://github.com/rust-lang/rust-analyzer/issues/16141
2024-04-27 11:17:14 +00:00
Lukas Wirth
d37c4b70d2 fix: Fix attributes on generic parameters colliding in item tree 2024-04-27 13:15:36 +02:00
bors
94c5034ee9 Auto merge of #17150 - RalfJung:josh-pull, r=lnicola
internal: add no-new-root check to josh pull

We probably don't want a second root to show up...

Also clear the rust-version file while we are at it.
2024-04-27 07:10:12 +00:00