Commit graph

624 commits

Author SHA1 Message Date
Lukas Wirth
bb21f0be13
Merge pull request #20912 from A4-Tacks/left-side-in-cond
Fix not complete `let` before expr in condition
2025-10-26 07:19:04 +00:00
A4-Tacks
1607d77a30
Fix not complete let before expr in condition
Example
---
```rust
fn f() {
    if $0foo.bar() {}
}
```

**Before this PR**

"let" not in completion list

**After this PR**

```rust
fn f() {
    if let $1 = $0foo.bar() {}
}
```
2025-10-25 15:24:37 +08:00
Laurențiu Nicola
9fdeb4ebf6 Fix typo 2025-10-24 17:10:23 +03:00
A4-Tacks
943eba5668
minor: fix track_caller for ide-complpetion test utils 2025-10-24 13:34:39 +08:00
A4-Tacks
b96babeef1
Support else completion for more expressions
- Support else completion in ArrayExpr, ReturnExpr and PrefixExpr etc
- Support else completion after MatchArm expression

Before this PR, the else branch could not be completed in most expressions

Example
---
```rust
fn foo() -> [i32; 1] {
    [if true {
        2
    } $0]
}
```
->
```rust
fn foo() -> [i32; 1] {
    [if true {
        2
    } else {
        $0
    }]
}
```

---

```rust
fn foo() -> i32 {
    match () {
        () => if true {
            2
        } $0
    }
}
```
->
```rust
fn foo() -> i32 {
    match () {
        () => if true {
            2
        } else {
            $0
        }
    }
}
```
2025-10-24 10:06:06 +08:00
Chayim Refael Friedman
d2559a7c40
Merge pull request #20889 from A4-Tacks/heuristic-field-expr
Heuristic sensing parenthesis completion of fields
2025-10-23 17:16:53 +00:00
A4-Tacks
3a3c706edd
Fix some typos 2025-10-24 01:06:27 +08:00
A4-Tacks
7333d4cc96
Heuristic sensing parenthesis completion of fields
We have conducted heuristic sensing on method parentheses, but it cannot complete fields

Example
---
```rust
struct Foo { far: i32 }
impl Foo {
    fn foo(&self) {}
}
fn foo() -> (i32, i32) {
    let foo = Foo { far: 4 };
    foo.f$0
    (2, 3)
}
```

**Before this PR**:

```text
me foo()  fn(&self)
...
```

**After this PR**:

```text
fd far          i32
me foo()  fn(&self)
...
```
2025-10-23 14:49:55 +08:00
Chayim Refael Friedman
7a7ab993bb
Revert "internal: Rewrite attribute handling" 2025-10-22 19:19:13 +03:00
Chayim Refael Friedman
08c0dc6234
Merge pull request #20316 from ChayimFriedman2/better-attrs
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
internal: Rewrite attribute handling
2025-10-22 12:46:19 +00:00
Chayim Refael Friedman
455ca02f17 Rewrite attribute handling
Basically, we switch to expanding cfg_attr in AST form, filter irrelevant attributes from the item tree, and move hir-def attributes (non-item-tree) to be flag-based.

The main motivation is memory usage, although this also simplifies the code, and fixes some bugs around handling of `cfg_attr`s.
2025-10-22 11:47:01 +03:00
Chayim Refael Friedman
9d8fa5da8f
Merge pull request #20571 from A4-Tacks/type-kw-comp
Some checks are pending
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
Add type keywords completions
2025-10-22 03:52:52 +00:00
Chayim Refael Friedman
d2c42fc647
Merge pull request #20831 from A4-Tacks/record-expr-shorthand
Add shorthand field completion for record-expr
2025-10-22 03:52:27 +00:00
A4-Tacks
e950c047aa
Add type keywords completions
Example
---
```
kw dyn
kw fn
kw for
kw impl
```
2025-10-22 11:35:09 +08:00
A4-Tacks
9a9f011382
Add shorthand field completion for record-expr
Example
---
```rust
struct Foo { bar: bool, n: i32 }

fn baz() {
    let bar = true;
    let foo: Foo = Fo$0;
}
```

**Before this PR**:

```rust
struct Foo { bar: bool, n: i32 }

fn baz() {
    let bar = true;
    let foo: Foo = Foo { bar: ${1:()}, n: ${2:()} }$0;
}
```

**After this PR**:

```rust
struct Foo { bar: bool, n: i32 }

fn baz() {
    let bar = true;
    let foo: Foo = Foo { bar$1, n: ${2:()} }$0;
}
```
2025-10-22 11:31:43 +08:00
Chayim Refael Friedman
c585e67400
Merge pull request #20670 from A4-Tacks/heuristic-newline-in-block-expr
Add heuristic sensing `is_in_block`
2025-10-22 03:24:24 +00:00
A4-Tacks
4c14c52615
Add heuristic sensing is_in_block
Example
---
```rust
fn foo() -> [i32; 2] {
    l$0
    [0, n]
}
```

**Before this PR**:

```text
loop~
line!(…)~ macro_rules! line
```

**After this PR**:

```text
let~
loop~
letm~
line!(…)~ macro_rules! line
```
2025-10-22 11:14:31 +08:00
Chayim Refael Friedman
07fa633747
Merge pull request #20755 from A4-Tacks/doc-include
Add `doc = include_str!("…")` completion
2025-10-22 03:01:22 +00:00
Chayim Refael Friedman
81e621af0b Improve fixture support
Support more features beside highlighting, and support items from minicore.
2025-10-16 22:06:16 +03:00
A4-Tacks
9eb11f9220
Add break value completion support
```rust
fn foo() -> i32 {
    loop {
        $0
    }
}
```

**Before this PR**:

```rust
fn foo() -> i32 {
    loop {
        break;
    }
}
```

**After this PR**:

```rust
fn foo() -> i32 {
    loop {
        break $0;
    }
}
```
2025-10-14 16:37:32 +08:00
Shoyu Vanilla (Flint)
b93180b4f2
Merge pull request #20526 from A4-Tacks/postfix-let-in-let-chain
Some checks failed
metrics / build_metrics (push) Has been cancelled
rustdoc / rustdoc (push) Has been cancelled
metrics / other_metrics (ripgrep-13.0.0) (push) Has been cancelled
metrics / other_metrics (diesel-1.4.8) (push) Has been cancelled
metrics / other_metrics (hyper-0.14.18) (push) Has been cancelled
metrics / other_metrics (self) (push) Has been cancelled
metrics / other_metrics (webrender-2022) (push) Has been cancelled
metrics / generate_final_metrics (push) Has been cancelled
Fix .let completion not work for let-chain
2025-10-10 10:07:31 +00:00
A4-Tacks
2fdac92e1e
Fix empty closure completion analysis
Example
---
```rust
fn foo() {
    bar(|| $0);
}
fn bar(f: impl FnOnce() -> u32) {}
```

**Before this PR**:

```
ty: impl FnOnce() -> u32, name: ?
```

**After this PR**:

```
ty: u32, name: ?
```
2025-10-10 12:53:32 +08:00
A4-Tacks
bd2f70105b
Add self param completions for trait assoc fn
Example
---
```rust
trait A {
    fn foo(file_id: usize) {}
    fn new($0) {}
}
```

**Before this PR**:

```text
bn file_id: usize
kw mut
kw ref
```

**After this PR**:

```text
bn &mut self
bn &self
bn file_id: usize
bn mut self
bn self
kw mut
kw ref
```
2025-10-08 16:20:10 +08:00
David Barsky
7e9be347cc
Merge pull request #20796 from ChayimFriedman2/bump-salsa
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
internal: Bump Salsa
2025-10-06 16:23:20 +00:00
A4-Tacks
224e89e382
minor: Remove FIXME for test_tuple_field_inference
This seems to have been fixed
2025-10-05 15:35:30 +08:00
Chayim Refael Friedman
c6ef51e550 Switch to home-made db attaching infrastructure
Instead of using Salsa's, as we can no longer can a `dyn HirDatabase` from the `dyn salsa::Database` Salsa provides.
2025-10-05 09:55:50 +03:00
itsjunetime
3a6e472975
Fix two small things clippy was complaining about 2025-10-01 22:41:01 -05:00
Chayim Refael Friedman
d1288f6353 Migrate inference to next solver 2025-09-30 13:10:59 +03:00
A4-Tacks
6bb1b88677
Add all any and not attribute completions
Example
---
`#[cfg($0)]` -> `#[cfg(any($0))]`
2025-09-28 08:42:18 +08:00
A4-Tacks
b9faa7f271
Add doc = include_str!("…") completion 2025-09-27 12:47:02 +08:00
A4-Tacks
38fed171d9
Fix .let completion not work for let-chain
Example
---
```rust
fn main() {
    let bar = Some(true);
    if true && bar.$0
}
```

**Before this PR**:

Cannot complete `.let`

**After this PR**:

```rust
fn main() {
    let bar = Some(true);
    if true && let Some($0) = bar
}
```
2025-09-26 21:20:04 +08:00
Shoyu Vanilla (Flint)
084c1e537d
Merge pull request #20604 from A4-Tacks/cfg-attr-comp
Add cfg_attr predicate completion
2025-09-26 08:10:25 +00:00
Shoyu Vanilla (Flint)
a55e2b578c
Merge pull request #20729 from A4-Tacks/const-param-kwd
Add const parameter keyword completion
2025-09-26 07:00:52 +00:00
jackh726
6a458880fd Remove non-ns version of impl_self_ty and impl_trait 2025-09-24 05:45:12 +00:00
Jack Huey
cc7c061e34 Use lower_nextsolver::callable_item_signature instead of lower::callable_item_signature 2025-09-23 16:26:46 -04:00
A4-Tacks
b39c7a892f
Add const parameter keyword completion
Example
---
```rust
fn foo<c$0>() {}
```
->
```rust
fn foo<const $1: $0>() {}
```
2025-09-23 11:26:52 +08:00
Jack Huey
34f773f596 Use ParamEnv in TraitEnvironment 2025-09-23 00:04:57 +00:00
jackh726
7b9ad945ec Make Field::ty return TypeNs 2025-09-23 00:04:56 +00:00
Shoyu Vanilla (Flint)
c1499a2381
Merge pull request #20679 from A4-Tacks/no-comp-ty-in-nested-pat
Fix complete type in nested pattern
2025-09-22 15:37:39 +00:00
A4-Tacks
07f33e2b81
Fix IfExpr then branch suggest
- And add logic operation suggest

Example
---
In the old implementation, it always suggested conditions,
this is a lot of noise, e.g `contract_checks()~(use std::intrinsics::contract_checks) const fn() -> bool`

```rust
fn foo() {
    if true {
        c$0
    }
}
```
2025-09-20 20:56:27 +08:00
Shoyu Vanilla (Flint)
a943034d68
Merge pull request #20702 from A4-Tacks/else-not-before-else
Fix `else` completion before else keyword
2025-09-20 11:57:07 +00:00
A4-Tacks
c976f9900d
Fix else completion before else keyword
Example
---
```rust
fn foo() {
    let x = if true {
        1
    } el$0 else {
        2
    };
}
```

**Before this PR**:

```text
else~    k [LS]
else if~ k [LS]
```

**After this PR**:

```text
else if~ k [LS]
```
2025-09-19 19:59:47 +08:00
Chayim Refael Friedman
cd31e11f94
Merge pull request #20664 from ChayimFriedman2/coerce-ns
Some checks are pending
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
fix: Port a bunch of stuff from rustc and fix a bunch of type mismatches/diagnostics
2025-09-18 00:19:30 +00:00
A4-Tacks
408b8bcc4a
Fix complete type in nested pattern
Example
---
```rust
struct Foo { num: u32 }
struct Bar(Foo);
fn foo(Bar($0)) {}
```

**Before this PR**:

```rust
struct Foo { num: u32 }
struct Bar(Foo);
fn foo(Bar(Foo { num$1 }: Foo$0)) {}
```

**After this PR**:

```rust
struct Foo { num: u32 }
struct Bar(Foo);
fn foo(Bar(Foo { num$1 }$0)) {}
```
2025-09-17 15:11:22 +08:00
Lukas Wirth
aecb756876
Merge pull request #20517 from Veykril/veykril/push-wrurmtqppzus
fix: Only compute unstable paths on nightly toolchains for IDE features
2025-09-16 07:28:47 +00:00
Lukas Wirth
685f156fa6 fix: Only compute unstable paths on nightly toolchains for IDE features 2025-09-16 09:17:16 +02:00
Chayim Refael Friedman
7d1860807e Port a bunch of stuff from rustc and fix a bunch of type mismatches/diagnostics
This started from porting coercion, but ended with porting much more.
2025-09-15 18:56:17 +03:00
A4-Tacks
d42c81e8d1
Fix extra semicolon before else in let-stmt
Example
---
```rust
fn main() {
    let x = if true {
        ()
    } $0 else {};
}
```

**Before this PR**:

```rust
fn main() {
    let x = if true {
        ()
    } else if $1 {
        $0
    }; else {};
}
```

**After this PR**:

```rust
fn main() {
    let x = if true {
        ()
    } else if $1 {
        $0
    } else {};
}
```
2025-09-12 20:56:59 +08:00
Shoyu Vanilla
4a8bc8db38 Fix failing tests and fill-in missing details 2025-09-10 01:43:22 +09:00
Laurențiu Nicola
a91fb2b9a1
Merge pull request #20620 from A4-Tacks/let-else-completion
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
fix: add `else` keyword completion after `let` statements
2025-09-08 06:03:00 +00:00