22866 Commits

Author SHA1 Message Date
sgasho
8ab683759e fix: Implement default member to resolve IdentPat 2025-08-12 21:53:50 +09:00
Chayim Refael Friedman
d307bc614e
Merge pull request #20418 from A4-Tacks/fix-extract-expr-from-fmtstr-on-write
Fix extract_expressions_from_format_string on write!
2025-08-10 07:10:10 +00:00
A4-Tacks
62508aaca1
Fix extract_expressions_from_format_string on write!
**Input**:

```rust
fn main() {
    write!(f, "{2+3}$0")
}
```

**Old output**:

```rust
fn main() {
    write!("{}"$0, 2+3)
}
```

**This PR output**:

```rust
fn main() {
    write!(f, "{}"$0, 2+3)
}
```
2025-08-10 14:45:54 +08:00
Nathaniel McCallum
943b42f743 parser: fix parsing of trait bound polarity and for-binders
The rustc AST allows both `for<>` binders and `?` polarity
modifiers in trait bounds, but they are parsed in a specific
order and validated for correctness:

  1. `for<>` binder is parsed first.
  2. Polarity modifiers (`?`, `!`) are parsed second.
  3. The parser validates that binders and polarity modifiers
     do not conflict:

```rust
if let Some(binder_span) = binder_span {
    match modifiers.polarity {
        BoundPolarity::Maybe(polarity_span) => {
            // Error: "for<...> binder not allowed with ? polarity"
        }
    }
}
```

This implies:

- `for<> ?Sized` → Valid syntax. Invalid semantics.
- `?for<> Sized` → Invalid syntax.

However, rust-analyzer incorrectly had special-case logic that
allowed `?for<>` as valid syntax. This fix removes that incorrect
special case, making rust-analyzer reject `?for<> Sized` as a
syntax error, matching rustc behavior.

This has caused confusion in other crates (such as syn) which
rely on these files to implement correct syntax evaluation.
2025-08-10 02:21:11 -04:00
Chayim Refael Friedman
31db5b5be9
Merge pull request #20409 from A4-Tacks/minicore-write
Add write! and writeln! to minicore
2025-08-10 01:39:58 +00:00
Hmikihiro
cfd41034e2 fix: generate function by indet token 2025-08-09 15:48:10 +09:00
BenjaminBrienen
98322abfd7 remove duplicate field in Debug 2025-08-08 23:46:28 +02:00
A4-Tacks
d5afd99903
Add write! and writeln! to minicore 2025-08-09 00:09:56 +08:00
Lukas Wirth
caef0f46fd
Merge pull request #20400 from rust-lang/veykril/push-ksxzmxqymsto
Disable error log for position clamping, its too noisy due to ease of triggering
2025-08-07 13:25:13 +00:00
Lukas Wirth
5022fb6343 Disable error log for position clamping, its too noisy due to ease of triggering 2025-08-07 15:14:22 +02:00
Hmikihiro
fcd4010b03 In extract_module.rs, generate ast::Module instead of String 2025-08-07 02:29:59 +09:00
Lukas Wirth
23504e1675
Merge pull request #20392 from rust-lang/veykril/push-pxplxplxvvyy
Report the incorrect payload when failing to deserialize lsp messages
2025-08-06 15:42:24 +00:00
Lukas Wirth
ae8b69f33a Report the incorrect payload when failing to deserialize lsp messages 2025-08-06 17:30:18 +02:00
Chayim Refael Friedman
4b49c7bf3d
Merge pull request #20354 from A4-Tacks/clean-lit-stmt-remove-dbg
Add remove literal dbg stmt for remove_dbg
2025-08-06 13:45:51 +00:00
A4-Tacks
75fd004dec
Add remove simple dbg stmt for remove_dbg
Remove only contain literals dbg statement

```rust
fn foo() {
    let n = 2;
    $0dbg!(3);
    dbg!(2.6);
    dbg!(1, 2.5);
    dbg!('x');
    dbg!(&n);
    dbg!(n);
    // needless comment
    dbg!("foo");$0
}
```
->
```rust
fn foo() {
    // needless comment
}
```
Old:
```rust
fn foo() {
    3;
    2.6;
    (1, 2.5);
    'x';
    &n;
    n;
    // needless comment
    "foo";
}
```
2025-08-06 21:33:10 +08:00
Shoyu Vanilla (Flint)
8241ec6b02
Merge pull request #20387 from ChayimFriedman2/rename-macro
fix: Do not remove the original token when descending into derives
2025-08-06 10:17:18 +00:00
Chayim Refael Friedman
75436532df
Merge pull request #20384 from vxpm/fix-external-docs
fix external docs for exported macros
2025-08-05 21:21:24 +00:00
vinícius x
d399beca79 fix external docs for exported macros
add test
2025-08-05 18:09:10 -03:00
Chayim Refael Friedman
bd08e2e480
Merge pull request #20381 from A4-Tacks/fix-assign-sug
Add assignment type analysis for ide-completion
2025-08-05 15:17:49 +00:00
A4-Tacks
bfbeddf32e
Change prev whitespace to prev trivia 2025-08-05 20:54:38 +08:00
Shoyu Vanilla (Flint)
2e283c1106
Merge pull request #20385 from Hmikihiro/migrate_expand_glob_import
Migrate `expand_glob_import` assist to use `SyntaxEditor`
2025-08-05 09:47:09 +00:00
Shoyu Vanilla (Flint)
6600a1a18b
Merge pull request #20383 from Hmikihiro/remove_ted_from_replace_named_generic_with_impl
remove `ted` from replace_named_generic_with_impl.rs
2025-08-05 09:43:32 +00:00
Shoyu Vanilla (Flint)
e968dd17bf
Merge pull request #20380 from Hmikihiro/add_attr_arg
remove `add_attr()` from edit_in_place.rs because it use `ted`.
2025-08-05 09:37:25 +00:00
Lukas Wirth
135f94a02b
Merge pull request #20389 from Veykril/push-ssyssvnrywvy
Slim down compile time artifact progress reports
2025-08-05 08:57:17 +00:00
Lukas Wirth
34ce0b5063 Slim down compile time artifact progress reports 2025-08-05 10:45:54 +02:00
Chayim Refael Friedman
ea140ef0a8 Do not remove the original token when descending into derives
This caused rename to remove both, because it couldn't rename the derive-expanded one.

I spent some time trying to create a test for this, before giving up. But I checked manually that this works.
2025-08-05 01:04:21 +03:00
Chayim Refael Friedman
47845d6097 Allow renaming when there are multiple definitions (due to macros) even when some cannot rename 2025-08-05 00:10:21 +03:00
Hmikihiro
0e456af6a1 Migrate expand_glob_import assist to use SyntaxEditor 2025-08-05 01:16:57 +09:00
Hmikihiro
d2588a723d remove ted from replace_named_generic_with_impl.rs 2025-08-05 00:51:50 +09:00
Laurențiu Nicola
978393bae8
Merge pull request #20378 from skewb1k/chore/folding_ranges-perms
chore: fix crates/ide/src/folding_ranges.rs file perms
2025-08-04 15:15:27 +00:00
Shoyu Vanilla (Flint)
4c8fb89a36
Merge pull request #20382 from ChayimFriedman2/goto-def-from-macro
fix: Correctly goto `From` impl when on `into()` even when the call is inside a macro
2025-08-04 15:10:06 +00:00
Chayim Refael Friedman
1a6f7c2dcf Correctly goto From impl when on into() even when the call is inside a macro
Descend into macros first.
2025-08-04 17:41:00 +03:00
Hmikihiro
c57a42acf3 remvoe add_attr edit_in_place.rs because it use ted. 2025-08-04 21:52:49 +09:00
skewb1k
865b8802e6 chore: fix crates/ide/src/folding_ranges.rs file perms
755 -> 644
2025-08-04 14:19:31 +03:00
A4-Tacks
22d6136462
Add assignment type analysis for ide-completion 2025-08-04 01:59:03 +08:00
Hmikihiro
1fea875fb1 Remove unused functions from edit_in_place 2025-08-03 19:40:54 +09:00
Lukas Wirth
531a02c824
Merge pull request #20371 from Hmikihiro/migrate_generate_trait_from_impl
Migrate `generate_trait_from_impl` assist to use `SyntaxEditor`
2025-08-03 07:23:07 +00:00
Hmikihiro
24f7f739d7 Migrate generate_trait_from_impl assist to use SyntaxEditor 2025-08-03 16:12:08 +09:00
Lukas Wirth
99526ef6ef
Merge pull request #20368 from Hmikihiro/migrate_delegate_methods
Migrate `generate_delegate_methods` assist to use `SyntaxEditor`
2025-08-03 06:37:22 +00:00
Lukas Wirth
22ec3e51a6
Merge pull request #20364 from Hmikihiro/migrate_convert_from_to_tryfrom
Migrate `convert_from_to_tryfrom` assist to use `SyntaxEditor`
2025-08-03 06:36:15 +00:00
Lukas Wirth
5daac5567b
Merge pull request #20351 from ChayimFriedman2/rename-self1
feat: When renaming a parameter to `self`, change callers to use method call syntax
2025-08-02 18:50:08 +00:00
Chayim Refael Friedman
74ecb1e788 When renaming a parameter to self, change callers to use method call syntax 2025-08-02 21:39:22 +03:00
Hmikihiro
85f7112c0e Migrate generate_delegate_methods assist to use SyntaxEditor 2025-08-03 02:17:56 +09:00
Hmikihiro
c2275c28e1 Migrate convert_from_to_tryfrom assist to use SyntaxEditor 2025-08-02 20:35:09 +09:00
Ifeanyi Orizu
76b2333c1b Update documentation for overrideCommand config options 2025-08-01 10:48:54 -05:00
Shoyu Vanilla (Flint)
68e7ec90bf
Merge pull request #20345 from Hmikihiro/Migrate_add_trait_assoc_items_to_impl
add `SyntaxEditor::delete_all` to migrate utils.rs `add_trait_assoc_items_to_impl`
2025-07-31 15:11:22 +00:00
Lukas Wirth
8ce30264c8 cargo clippy --fix 2025-07-31 10:55:10 +02:00
Lukas Wirth
423c7dd23a
Merge pull request #20342 from Veykril/push-zysqtqskuxvr
Reorganize proc-macro-srv more, add `--format` and `--version` args
2025-07-31 08:21:52 +00:00
Lukas Wirth
87625cc166 Add version command to proc-macro-srv 2025-07-31 10:10:50 +02:00
Lukas Wirth
218e00d0bb Reorganize proc-macro-srv 2025-07-31 09:55:07 +02:00