Commit Graph

22096 Commits

Author SHA1 Message Date
feniljain
25f3e7a33c fix: float display impl 2022-05-31 10:13:03 +05:30
bors
a5d7ab54f9 Auto merge of #12418 - Veykril:completions, r=Veykril
internal: More precise completion filtering with existing item qualifiers

Now we are approaching the more complex cases for filtering completions
2022-05-30 14:05:37 +00:00
Lukas Wirth
0327df224b More precise completion filtering 2022-05-30 16:01:17 +02:00
bors
c551d1a6af Auto merge of #12417 - jonas-schievink:pr-msg-style, r=jonas-schievink
minor: Update commit/PR style guide

What matters for the changelog is having PR title/description from the user's perspective, while commits can be internal.
2022-05-30 13:56:54 +00:00
Jonas Schievink
592bc5106c Update commit/PR style 2022-05-30 15:55:40 +02:00
Lukas Wirth
ea594c4c44 Use char for trigger character 2022-05-30 14:17:58 +02:00
bors
edb2e571fe Auto merge of #12416 - Veykril:inlay-hints, r=Veykril
Add implicit static lifetime hints
2022-05-30 12:00:54 +00:00
Lukas Wirth
aced76d0ff Add implicit static lifetime hints 2022-05-30 13:59:58 +02:00
bors
9ceaff91d3 Auto merge of #12406 - harpsword:fix-add-inlayHints-closures-without-block, r=Veykril
fix: add an option to show inlay hint for return type of closures wit…

fix #12321
2022-05-30 11:36:55 +00:00
bors
bd0c2344f2 Auto merge of #12387 - 00nktk:fix-mod-rename, r=Veykril
fix(ide-db): correct single-file module rename

Fixes a bug where rust-analyzer would emit `WorkspaceEdit`s with paths to dirs instead of files for the following project layout.

lib.rs
```rust
mod foo;
```

foo.rs
```rust
mod bar {
    struct Bar;
}
```
Also fixes emitted paths for modules with mod.rs.
The bug resulted in panic in helix editor when attempting to rename a module.
2022-05-30 11:29:55 +00:00
bors
e4ead8a7c6 Auto merge of #12412 - yue4u:fix/visibility-completion, r=Veykril
fix: Retrigger visibility completion after parentheses

close #12390

This PR add `(` to trigger_characters as discussed in original issue.

Some questions:

1. Is lsp's `ctx.trigger_character` from `params.context` is the same as `ctx.original_token` inside actually completions?
    1. If not what's the difference?
    2. if they are the same, it's unnecessary to pass it down from handler at all.
    3.  if they are the same, maybe we could parse it from fixture directly instead of using the `check_with_trigger_character` I added.
2. Some completion fixtures written as `($0)` ( https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-completion/src/tests/fn_param.rs#L105 as an example), If I understand correctly they are not invoked outside tests at all?
    1. using `ctx.original_token` directly would break these tests as well as parsing trigger_character from fixture for now.
    2. I think it make sense to allow `(` triggering these cases?
3. I hope this line up with #12144
2022-05-30 11:22:10 +00:00
yue4u
1b5f0462ed fix: visibility completion 2022-05-30 00:06:48 +09:00
bors
f94fa62d69 Auto merge of #12409 - lowr:fix/usize-overflow, r=Veykril
fix overflow during type inference for tuple struct patterns

The following code causes integer overflow during type inference for (malformed) tuple struct patterns.

```rust
struct S(usize);
let S(.., a, b) = S(1);
```

It has been panicking only in debug builds, and working in a way in release builds but it was inconsistent with type inference for tuple patterns:

```rust
struct S(usize);
let S(.., a, b) = S(1); // a -> unknown, b -> usize
let (.., a, b) = (1,);  // a -> usize, b -> unknown
```

With this PR, the overflow no longer happens by utilizing `saturating_sub()` like in other places and type inference for tuple struct patterns is in line with that for tuple patterns.
2022-05-29 08:45:15 +00:00
Ryo Yoshida
be2fa2b31b
fix overflow during tuple struct type inference 2022-05-29 16:22:33 +09:00
harpsword
55509548e8 fix: add an option to show inlay hint for return type of closures without block 2022-05-28 22:12:30 +08:00
Nikita Podoliako
d98c04aac1 fix(ide-db): correct single-file module rename 2022-05-28 15:07:22 +03:00
bors
6c9fc4fec2 Auto merge of #12402 - Veykril:feat-docs, r=Veykril
minor: Freshen up goto feature docs

Fixes https://github.com/rust-lang/rust-analyzer/issues/2541
2022-05-27 13:47:56 +00:00
Lukas Wirth
86576072ab minor: Freshen up goto feature docs 2022-05-27 15:47:31 +02:00
bors
bd06902f90 Auto merge of #12395 - feniljain:fix_bugs, r=Veykril
fix: f32 and f64 representation during lowering

should fix #12380
2022-05-27 12:44:08 +00:00
bors
145bad473d Auto merge of #12341 - vemoo:exclude_dirs, r=Veykril
make `files.excludeDirs` work

There's a small issue because if all projects are excluded, this: 01d412f4d7/crates/rust-analyzer/src/main_loop.rs (L114) will be shown.
I thought about not showing it if `files.excludeDirs` is set, but that is not necessarily correct.

Fixes #7755
2022-05-27 12:35:48 +00:00
bors
732eb9a167 Auto merge of #12399 - Joehoel:patch-1, r=lnicola
typo: missing comma
2022-05-26 18:15:54 +00:00
Joël Kuijper
f872b61c56
typo: missing comma 2022-05-26 20:12:43 +02:00
bors
c567771605 Auto merge of #12397 - Hofer-Julian:patch-1, r=lnicola
Fix typo
2022-05-26 17:14:55 +00:00
Hofer-Julian
2916cd2a86
Fix typo 2022-05-26 19:12:49 +02:00
feniljain
1f4870ff1c fix: f32 and f64 representation during lowering 2022-05-26 20:03:05 +05:30
bors
37c7f3c4cf Auto merge of #12393 - Veykril:hir-def, r=Veykril
internal: Remove `Interned` usage from nameres collector
2022-05-26 11:01:08 +00:00
Lukas Wirth
7913ae69b9 internal: Remove Interned usage from nameres collector 2022-05-26 12:59:57 +02:00
bors
92f363059a Auto merge of #12388 - Veykril:statusitem, r=Veykril
internal: Make use of the statusBarItem colors in VSCode

Fixes https://github.com/rust-lang/rust-analyzer/issues/7736
2022-05-26 10:31:23 +00:00
Lukas Wirth
02c2377229 internal: Use statusBarItem colors for status item in VSCode 2022-05-26 12:31:07 +02:00
bors
5b69a34fb5 Auto merge of #12386 - fasterthanlime:gh-12372-test, r=Veykril
Add test for #12372 (generate enum variant in different file)

The test currently fails but I'm not sure why.

The "Right" output seems to contain only the contents of `foo.rs`, without the magic comments:

<img width="967" alt="image" src="https://user-images.githubusercontent.com/7998310/170310707-e69b21eb-d4f8-46c1-8a0a-9b4071289e26.png">

cc `@Veykril`
2022-05-25 16:42:29 +00:00
Amos Wenger
c06c4f9682 Make test pass 2022-05-25 18:31:08 +02:00
Amos Wenger
05563805b1 Add test for #12372 (generate enum variant in different file) 2022-05-25 18:18:08 +02:00
bors
0468d84564 Auto merge of #12384 - fasterthanlime:gh-12372, r=Veykril
Generate variant: insert code in file with enum definition

Closes #12372
2022-05-25 14:49:51 +00:00
Amos Wenger
89e27ed0b9 Generate variant: insert code in file with enum definition
Closes #12372
2022-05-25 16:43:15 +02:00
bors
c13f04dcaa Auto merge of #12383 - Veykril:diag, r=Veykril
fix: Clear native diagnostics for files when they are deleted

Fixes https://github.com/rust-lang/rust-analyzer/issues/7004
2022-05-25 13:48:14 +00:00
Lukas Wirth
5410ace1fe fix: Clear native diagnostics for files when they are deleted 2022-05-25 15:47:41 +02:00
bors
3fe137a5b5 Auto merge of #12382 - Veykril:ontype, r=lnicola
internal: Make autoclosing angle brackets configurable, disabled by default

cc https://github.com/rust-lang/rust-analyzer/issues/12379
2022-05-25 11:29:50 +00:00
Lukas Wirth
f02c915eb5 internal: Make autoclosing angle brackets configurable, disabled by default 2022-05-25 12:42:07 +02:00
bors
d7c147406e Auto merge of #12377 - Veykril:logs, r=Veykril
minor: log build script invocations
2022-05-24 21:10:32 +00:00
bors
161ab76008 Auto merge of #12376 - Veykril:completion, r=Veykril
fix: Insert whitespace into trait-impl completions when coming from macros

Fixes https://github.com/rust-lang/rust-analyzer/issues/12278
2022-05-24 20:57:05 +00:00
Lukas Wirth
7274a48657 minor: log build script invocations 2022-05-24 22:56:49 +02:00
Lukas Wirth
86d1d9067e fix: Insert whitespace into trait-impl completions when coming from macros 2022-05-24 22:56:33 +02:00
Lukas Wirth
6f006b7524 Simplify 2022-05-24 21:58:47 +02:00
bors
4ca47b3432 Auto merge of #12373 - Veykril:completion, r=Veykril
internal: Refactor our record pat/expr handling in completion context
2022-05-24 11:26:04 +00:00
Lukas Wirth
6a8b8a6039 internal: Refactor our record pat/expr handling in completion context 2022-05-24 13:24:36 +02:00
bors
7a4994d948 Auto merge of #12361 - Veykril:completion, r=Veykril
internal: Simplify DotAccess representation in completions

`@bors` r+
2022-05-24 09:55:13 +00:00
Lukas Wirth
697ade6f8d internal: Simplify DotAccess representation in completions 2022-05-24 11:54:50 +02:00
bors
d5965aa871 Auto merge of #12370 - andylizi:macro-expand-underscore, r=lnicola
ide: insert whitespaces surrounding `_` in macro expansion

#### Before

```rust
for_in 0..10 {
  foo();
}
```

#### After

```rust
for _ in 0..10 {
  foo();
}
```
2022-05-24 06:52:00 +00:00
andylizi
e34ae760f0
add test for macro expand formatting 2022-05-24 12:45:58 +08:00
bors
cc8140a7c7 Auto merge of #12371 - jhgg:fix/extra-env-non-string-value-handling, r=lnicola
vscode: fix extraEnv handling numeric values

fixes #12363 by bringing the types more inline with the reality, and making `Env` not a lie.
2022-05-24 04:11:19 +00:00