]>
git.lizzy.rs Git - rust.git/log
Lukas Wirth [Thu, 23 Jun 2022 18:08:29 +0000 (20:08 +0200)]
internal: Simplify
bors [Mon, 20 Jun 2022 18:42:48 +0000 (18:42 +0000)]
Auto merge of #12599 - flodiebold:no-test-deps, r=flodiebold
fix: Only apply `cfg(test)` for local crates
Don't analyze dependencies with `test`; this should fix various cases where crates use `cfg(not(test))` and so we didn't find things.
"Local" here currently means anything that's not from the registry, so anything inside the workspace, but also path dependencies. So this isn't perfect, and users might still need to use `rust-analyzer.cargo.unsetTest` for these in some cases.
Florian Diebold [Mon, 20 Jun 2022 18:34:08 +0000 (20:34 +0200)]
Fix test
bors [Mon, 20 Jun 2022 18:28:08 +0000 (18:28 +0000)]
Auto merge of #12597 - Veykril:completions, r=Veykril
fix: Fix auto-ref completions inserting into wrong locations
Fixes https://github.com/rust-lang/rust-analyzer/issues/8058
Lukas Wirth [Mon, 20 Jun 2022 18:22:51 +0000 (20:22 +0200)]
Reimplement auto-ref completions for fields
Florian Diebold [Mon, 20 Jun 2022 18:21:30 +0000 (20:21 +0200)]
Refactor a bit
Lukas Wirth [Mon, 20 Jun 2022 18:16:40 +0000 (20:16 +0200)]
Remove pattern rendering hack
Florian Diebold [Mon, 20 Jun 2022 18:10:25 +0000 (20:10 +0200)]
Only apply `cfg(test)` for local crates
Don't analyze dependencies with `test`; this should fix various cases
where crates use `cfg(not(test))` and so we didn't find things.
"Local" here currently means anything that's not from the registry, so
anything inside the workspace, but also path dependencies. So this isn't
perfect, and users might still need to use
`rust-analyzer.cargo.unsetTest` for these in some cases.
Lukas Wirth [Mon, 20 Jun 2022 16:59:57 +0000 (18:59 +0200)]
fix: Fix auto-ref completions inserting into wrong locations
bors [Mon, 20 Jun 2022 16:03:21 +0000 (16:03 +0000)]
Auto merge of #12596 - Veykril:completions, r=Veykril
fix: Don't trigger pattern completions when typing a wildcard pattern
Fixes https://github.com/rust-lang/rust-analyzer/issues/12592
Lukas Wirth [Mon, 20 Jun 2022 16:02:13 +0000 (18:02 +0200)]
fix: Don't trigger pattern completions when typing a wildcard pattern
bors [Mon, 20 Jun 2022 15:42:31 +0000 (15:42 +0000)]
Auto merge of #12594 - Veykril:completions, r=Veykril
internal: Lift out IdentContext from CompletionContext
Makes things a bit messy overall, but with this I can start cleaning up the render functions properly now.
cc https://github.com/rust-lang/rust-analyzer/issues/12571
Lukas Wirth [Mon, 20 Jun 2022 15:41:04 +0000 (17:41 +0200)]
internal: Lift out IdentContext from CompletionContext
Lukas Wirth [Mon, 20 Jun 2022 13:07:48 +0000 (15:07 +0200)]
internal: Remove `previous_token` field from `CompletionContext`
bors [Mon, 20 Jun 2022 12:50:59 +0000 (12:50 +0000)]
Auto merge of #12588 - Veykril:completions, r=Veykril
internal: More completion reorganizing
Lukas Wirth [Mon, 20 Jun 2022 12:47:30 +0000 (14:47 +0200)]
Remove some usages of `Completions::add_resolution`
Lukas Wirth [Mon, 20 Jun 2022 12:23:46 +0000 (14:23 +0200)]
Even more completion context filtering
Lukas Wirth [Mon, 20 Jun 2022 11:29:13 +0000 (13:29 +0200)]
Lift out PathKind variant fields into structs
Lukas Wirth [Mon, 20 Jun 2022 11:17:30 +0000 (13:17 +0200)]
Split remaining completion calls on the context kinds
bors [Sun, 19 Jun 2022 16:00:33 +0000 (16:00 +0000)]
Auto merge of #12581 - lnicola:changelog-number, r=lnicola
internal: Handle fractional release numbers in changelog naming
bors [Sat, 18 Jun 2022 22:38:04 +0000 (22:38 +0000)]
Auto merge of #12584 - Veykril:attr-diag, r=Veykril
fix: attribute macros not being properly diagnosed
Closes https://github.com/rust-lang/rust-analyzer/issues/12582
Lukas Wirth [Sat, 18 Jun 2022 22:37:37 +0000 (00:37 +0200)]
fix: attribute macros not being properly diagnosed
Laurențiu Nicola [Sat, 18 Jun 2022 14:00:28 +0000 (17:00 +0300)]
internal: Handle fractional release numbers in changelog naming
bors [Sat, 18 Jun 2022 09:21:13 +0000 (09:21 +0000)]
Auto merge of #12580 - Veykril:completion, r=Veykril
internal: Move more things out of `CompletionContext::function_def` into more specific parts
Lukas Wirth [Sat, 18 Jun 2022 09:19:36 +0000 (11:19 +0200)]
Consider walking up macro expansions when searching for surrounding entities in completion analysis
Lukas Wirth [Sat, 18 Jun 2022 08:45:53 +0000 (10:45 +0200)]
Move `CompletionContext::impl_def` into corresponding entities
Lukas Wirth [Sat, 18 Jun 2022 08:18:56 +0000 (10:18 +0200)]
Move `CompletionContext::incomplete_let` into `PathKind::Expr`
bors [Sat, 18 Jun 2022 08:10:31 +0000 (08:10 +0000)]
Auto merge of #12576 - harpsword:fold_range_non_block_match_arm, r=Veykril
feat: add fold range for multi line match arm list
fix: #11893
harpsword [Sat, 9 Apr 2022 05:44:41 +0000 (13:44 +0800)]
feat: add fold range for multi line match arm list
Lukas Wirth [Sat, 18 Jun 2022 07:54:03 +0000 (09:54 +0200)]
Move `CompletionContext::function_def` into `PathKind::Expr`
bors [Sat, 18 Jun 2022 06:59:12 +0000 (06:59 +0000)]
Auto merge of #12577 - Veykril:completion, r=Veykril
internal: NameRefKind classification is not optional
Lukas Wirth [Sat, 18 Jun 2022 06:58:47 +0000 (08:58 +0200)]
internal: NameRefKind classification is not optional
bors [Fri, 17 Jun 2022 23:15:37 +0000 (23:15 +0000)]
Auto merge of #12574 - Veykril:completion, r=Veykril
minor: Simplify
Lukas Wirth [Fri, 17 Jun 2022 23:15:08 +0000 (01:15 +0200)]
minor: Simplify
bors [Fri, 17 Jun 2022 22:48:14 +0000 (22:48 +0000)]
Auto merge of #12573 - Veykril:completion, r=Veykril
internal: Split flyimport into its 3 applicable contexts
Lukas Wirth [Fri, 17 Jun 2022 22:47:28 +0000 (00:47 +0200)]
internal: Split flyimport into its 3 applicable contexts
bors [Fri, 17 Jun 2022 22:26:50 +0000 (22:26 +0000)]
Auto merge of #12570 - Veykril:completion, r=Veykril
Only run completion functions if their corresponding context is active
Lukas Wirth [Fri, 17 Jun 2022 21:36:39 +0000 (23:36 +0200)]
Only run completion functions if their corresponding context is active
Lukas Wirth [Fri, 17 Jun 2022 15:49:25 +0000 (17:49 +0200)]
Remove superfluous early returns
bors [Fri, 17 Jun 2022 15:32:32 +0000 (15:32 +0000)]
Auto merge of #12565 - Veykril:completion, r=Veykril
internal: More completion refactors
Lukas Wirth [Fri, 17 Jun 2022 15:27:12 +0000 (17:27 +0200)]
Inline PathQualifierCtx
Lukas Wirth [Fri, 17 Jun 2022 15:15:29 +0000 (17:15 +0200)]
internal: Collapse lift is_infer_qualifier into `Qualified` variant
Lukas Wirth [Fri, 17 Jun 2022 14:56:21 +0000 (16:56 +0200)]
Move existing_derives into PathKind::Derive
bors [Fri, 17 Jun 2022 14:38:44 +0000 (14:38 +0000)]
Auto merge of #12564 - Veykril:completion, r=Veykril
internal: Collapse completion ctx path `qualifier` and `is_absolute_path` into enum
Lukas Wirth [Fri, 17 Jun 2022 14:36:22 +0000 (16:36 +0200)]
internal: Collapse completion ctx path qualifier and is_absolute_path into enum
bors [Fri, 17 Jun 2022 14:28:52 +0000 (14:28 +0000)]
Auto merge of #12563 - Veykril:completion, r=Veykril
internal: Simplify
Lukas Wirth [Fri, 17 Jun 2022 14:22:51 +0000 (16:22 +0200)]
Simplify
bors [Fri, 17 Jun 2022 13:19:45 +0000 (13:19 +0000)]
Auto merge of #12562 - Veykril:completion, r=Veykril
Split completion context module into definitions and analysis parts
Lukas Wirth [Fri, 17 Jun 2022 13:19:09 +0000 (15:19 +0200)]
Split out tests
Lukas Wirth [Fri, 17 Jun 2022 13:16:20 +0000 (15:16 +0200)]
Split completion context module into definitions and analysis parts
bors [Fri, 17 Jun 2022 13:10:05 +0000 (13:10 +0000)]
Auto merge of #12560 - Veykril:completion, r=Veykril
internal: More completions refactoring
This gets rid of the remaining `ImmediateLocation` bits
Lukas Wirth [Fri, 17 Jun 2022 12:18:03 +0000 (14:18 +0200)]
Remove ImmediateLocation in favor of PathKind::Type
Lukas Wirth [Fri, 17 Jun 2022 09:31:36 +0000 (11:31 +0200)]
Move more ImmediateLocation::TypeAnnotation into PathKind::Type
Lukas Wirth [Fri, 17 Jun 2022 08:45:19 +0000 (10:45 +0200)]
Introduce NameRefKind for completions
bors [Thu, 16 Jun 2022 12:48:33 +0000 (12:48 +0000)]
Auto merge of #12554 - XFFXFF:fix_11959, r=Veykril
fix: local items should not be completed in parent signature
fixes #11959
> We get a Bar completion for the following snippet which is wrong as the item is not visible in that position.
> ``` rust
> fn foo() -> $0 {
> struct Bar;
> }
> ```
I investigated the problem and found that the scope of the cursor offset, also `CompletionContext.scope` is the body of the function
XFFXFF [Thu, 16 Jun 2022 08:43:08 +0000 (16:43 +0800)]
the offset used for the completion cursor should always be relative to the original file and not to the marco file
bors [Thu, 16 Jun 2022 09:14:09 +0000 (09:14 +0000)]
Auto merge of #12517 - xuhongxu96:master, r=Veykril
fix methods in pub trait generated by macro cannot be completed
Fix #12483
Check if the container is trait and inherit the visibility to associate items during collection.
XFFXFF [Thu, 16 Jun 2022 08:12:46 +0000 (16:12 +0800)]
the scope of the return type is not the body of the function
Hongxu Xu [Thu, 16 Jun 2022 00:52:57 +0000 (08:52 +0800)]
disable private editable in TEST_CONFIG by default
adjust test_visibility_filter test case
bors [Wed, 15 Jun 2022 20:01:37 +0000 (20:01 +0000)]
Auto merge of #12545 - jeremyBanks:shebangs, r=Veykril
fix: inserted imports must come after a shebang if present
The current `insert_use` logic adds the first `use` item near the beginning of the file, only skipping past comments and whitespace. However, it does not skip leading [shebang lines](https://en.wikipedia.org/wiki/Shebang_\(Unix\)). This can produce a syntax error, as shebangs are only accepted (ignored) on the first line of the file.
### Before Insertion (valid syntax)
```rust
#!/usr/bin/env rust
fn main() {}
```
### After Insertion (invalid syntax)
```rust
use foo::bar::Baz;
#!/usr/bin/env rust
fn main() {}
```
Rust analyzer's grammar is already shebang-aware, so this PR just adds that to the array of SyntaxKinds that are skipped past when looking for an insertion location, and adds a corresponding test case.
Jeremy Banks [Wed, 15 Jun 2022 19:42:16 +0000 (19:42 +0000)]
fix: inserted imports must come after a shebang if present
Jeremy Banks [Wed, 15 Jun 2022 16:25:47 +0000 (16:25 +0000)]
add failing test: inserts_after_shebang
bors [Wed, 15 Jun 2022 16:21:21 +0000 (16:21 +0000)]
Auto merge of #12544 - Veykril:proc-error, r=Veykril
Show proc-macro loading errors in unresolved-proc-macro diagnostics
This should help out people to potentially figure out the problem without having to check the logs
Lukas Wirth [Wed, 15 Jun 2022 16:07:37 +0000 (18:07 +0200)]
Update test outputs
Lukas Wirth [Wed, 15 Jun 2022 16:04:39 +0000 (18:04 +0200)]
Use the correct crates proc-macro loading error message
Lukas Wirth [Wed, 15 Jun 2022 15:34:13 +0000 (17:34 +0200)]
Diagnose unresolved attribute proc-macros
Lukas Wirth [Wed, 15 Jun 2022 15:33:55 +0000 (17:33 +0200)]
Show proc-macro loading errors in unresolved-proc-macro diagnostics
bors [Wed, 15 Jun 2022 12:29:34 +0000 (12:29 +0000)]
Auto merge of #12541 - Veykril:vs-reload, r=Veykril
fix: Clear proc-macro changed flag when reloading workspace
Lukas Wirth [Wed, 15 Jun 2022 12:29:13 +0000 (14:29 +0200)]
fix: Clear proc-macro changed flag when reloading workspace
bors [Wed, 15 Jun 2022 07:37:18 +0000 (07:37 +0000)]
Auto merge of #12537 - kevinushey:bugfix/items-typo, r=Veykril
fix typo in package.json
Fixes a small typo in `package.json`.
Hongxu Xu [Tue, 14 Jun 2022 23:48:34 +0000 (07:48 +0800)]
revert hir-def lib.rs
Hongxu Xu [Tue, 14 Jun 2022 23:47:06 +0000 (07:47 +0800)]
check if the container is trait and inherit the visibility
Kevin Ushey [Tue, 14 Jun 2022 21:44:23 +0000 (14:44 -0700)]
fix typo in package.json
Hongxu Xu [Tue, 14 Jun 2022 15:24:48 +0000 (23:24 +0800)]
remove inherit_visibility test case in item_tree
Hongxu Xu [Tue, 14 Jun 2022 15:23:15 +0000 (23:23 +0800)]
implement inherited_visibility in collector
Hongxu Xu [Tue, 14 Jun 2022 13:44:07 +0000 (21:44 +0800)]
remove inherited_visibility in lower.rs
Hongxu Xu [Tue, 14 Jun 2022 13:41:09 +0000 (21:41 +0800)]
add test cases to complete fn generated by macro in pub trait
bors [Tue, 14 Jun 2022 11:43:31 +0000 (11:43 +0000)]
Auto merge of #12529 - Veykril:vs-reload, r=Veykril
fix: Ask the user to reload the vscode window when changing server settings
These requires a window reload, as they are set before the server is being started
Lukas Wirth [Tue, 14 Jun 2022 09:11:08 +0000 (11:11 +0200)]
fix: Ask the user to reload the vscode window when changing server settings
bors [Tue, 14 Jun 2022 09:00:21 +0000 (09:00 +0000)]
Auto merge of #12528 - Veykril:proc-diag, r=Veykril
fix: Check for the correct proc-macro settings in missing proc-macro diagnostics
Lukas Wirth [Tue, 14 Jun 2022 08:40:57 +0000 (10:40 +0200)]
fix: Check for the correct proc-macro settings in missing proc-macro diagnostics
bors [Mon, 13 Jun 2022 09:58:04 +0000 (09:58 +0000)]
Auto merge of #12519 - Veykril:hover-assoc, r=Veykril
feat: On assoc item name hover, render trait decl docs
Lukas Wirth [Mon, 13 Jun 2022 09:57:33 +0000 (11:57 +0200)]
feat: On assoc item name hover, render trait decl docs
bors [Sun, 12 Jun 2022 17:35:55 +0000 (17:35 +0000)]
Auto merge of #12515 - Veykril:rustc-proc-macros, r=Veykril
fix: Pass the build data to rustc_private crates
With this all proc-macros should resolve in rustc now when setting up the build script running command properly.
Lukas Wirth [Sun, 12 Jun 2022 17:29:45 +0000 (19:29 +0200)]
fix: Pass the build data to rustc_private crates
bors [Sun, 12 Jun 2022 17:27:41 +0000 (17:27 +0000)]
Auto merge of #12514 - Veykril:proc-mac-err, r=Veykril
More precise proc-macro errors
Lukas Wirth [Sun, 12 Jun 2022 16:44:46 +0000 (18:44 +0200)]
More precise proc-macro errors
bors [Sun, 12 Jun 2022 14:08:08 +0000 (14:08 +0000)]
Auto merge of #12513 - Veykril:ty-utils, r=Veykril
internal: Simplify `hir_ty::utils`
Lukas Wirth [Sun, 12 Jun 2022 14:07:08 +0000 (16:07 +0200)]
internal: Simplify `hir_ty::utils`
bors [Sun, 12 Jun 2022 12:40:57 +0000 (12:40 +0000)]
Auto merge of #12509 - Veykril:ty-utils, r=Veykril
internal: Remove `Generics::type_iter` in favor of `Generics::iter`
Lukas Wirth [Sun, 12 Jun 2022 12:40:37 +0000 (14:40 +0200)]
internal: Remove `Generics::type_iter` in favor of `Generics::iter`
bors [Sun, 12 Jun 2022 09:01:00 +0000 (09:01 +0000)]
Auto merge of #12455 - bitgaoshu:fix_12441, r=flodiebold
fix: #12441 False-positive type-mismatch error with generic future
I think the reason is same with #11815.
add ```Sized``` bound for ```AsyncBlockTypeImplTrait```.
bors [Sun, 12 Jun 2022 00:56:52 +0000 (00:56 +0000)]
Auto merge of #12508 - Veykril:req-retry, r=Veykril
fix: Don't respond to cancelled requests when retrying them
Fixes https://github.com/rust-lang/rust-analyzer/issues/12482
Lukas Wirth [Sun, 12 Jun 2022 00:56:19 +0000 (02:56 +0200)]
fix: Don't respond to cancelled requests when retrying them
bors [Sat, 11 Jun 2022 16:57:38 +0000 (16:57 +0000)]
Auto merge of #12506 - cgburgess:master, r=Veykril
minor: Fix typo in style guide
Fix type `Ues` -> `Use` in `style.md`
Chris Burgess [Sat, 11 Jun 2022 16:50:36 +0000 (12:50 -0400)]
fix typo in style.md
bors [Sat, 11 Jun 2022 11:41:26 +0000 (11:41 +0000)]
Auto merge of #12504 - rust-lang:Veykril-patch-1, r=Veykril
fix: Fix config patching for callable snippets
Closes https://github.com/rust-lang/rust-analyzer/issues/12498
Lukas Wirth [Sat, 11 Jun 2022 11:41:06 +0000 (13:41 +0200)]
fix: Fix config patching for callable snippets
bors [Sat, 11 Jun 2022 11:34:08 +0000 (11:34 +0000)]
Auto merge of #12481 - XFFXFF:add_label_to_loop, r=Veykril
assist: add label to loop
closes: #12392
I changed `'loop` to `'l`, as `cargo check` says `'loop` is an invalid label name.
bors [Fri, 10 Jun 2022 23:35:38 +0000 (23:35 +0000)]
Auto merge of #12449 - Veykril:version, r=Veykril
Bring the version command output in line with other rust tools
Inspired by how cargo handles it
Fixes https://github.com/rust-lang/rust-analyzer/issues/12280
![image](https://user-images.githubusercontent.com/
3757771 /
171680176 -
236451ee -2c6c-449f-8aa5-
4a047e8cc907 .png)