]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoFix: prefer the usage of `for` loops over `fold`
Basti Ortiz [Tue, 10 Aug 2021 14:40:04 +0000 (22:40 +0800)]
Fix: prefer the usage of `for` loops over `fold`

2 years agoChore: add comments to explicitly express two-step check
Basti Ortiz [Tue, 10 Aug 2021 14:30:08 +0000 (22:30 +0800)]
Chore: add comments to explicitly express two-step check

See https://github.com/rust-analyzer/rust-analyzer/pull/9836#discussion_r685953381

2 years agoFix: revert complex conditional in `Directories::contains_file`
Basti Ortiz [Tue, 10 Aug 2021 14:25:43 +0000 (22:25 +0800)]
Fix: revert complex conditional in `Directories::contains_file`

This reverts commit 6d0336b2e41703254b31f5d9a1358eb7e15cee3f.

2 years agoRefactor: use iterator methods over `for` loops
Basti Ortiz [Tue, 10 Aug 2021 09:51:11 +0000 (17:51 +0800)]
Refactor: use iterator methods over `for` loops

2 years agoRefactor: simplify logic for `Directories::contains_file`
Basti Ortiz [Tue, 10 Aug 2021 08:32:00 +0000 (16:32 +0800)]
Refactor: simplify logic for `Directories::contains_file`

The logic was simply inverted to accomodate for the short-circuiting `&&` operator.

2 years agoRefactor: use `filter_map` when iterating over stored IDs and
Basti Ortiz [Tue, 10 Aug 2021 07:56:16 +0000 (15:56 +0800)]
Refactor: use `filter_map` when iterating over stored IDs and

2 years agoChore: use short-circuiting for file ID getter
Basti Ortiz [Tue, 10 Aug 2021 07:43:51 +0000 (15:43 +0800)]
Chore: use short-circuiting for file ID getter

2 years agoMerge #9804
bors[bot] [Mon, 9 Aug 2021 17:09:13 +0000 (17:09 +0000)]
Merge #9804

9804: Generate method from call r=matklad a=mahdi-frms

Needs a bit of refactoring. Tests also should be added.

Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2 years agoMerge #9825
bors[bot] [Mon, 9 Aug 2021 16:59:10 +0000 (16:59 +0000)]
Merge #9825

9825: Generate default impl when converting #[derive(Default)] to manual impl r=Veykril a=yoshuawuyts

Similar to https://github.com/rust-analyzer/rust-analyzer/pull/9814, but for `#[derive(Default)]`. Thanks!

## Follow-up steps
I've added the tests inside `handlers/replace_derive_with_manual_impl.rs` again, but I'm planning a follow-up PR to extract these to `utils/` so we can share them between assists - and maybe even add another assist just for the purpose of testing these impls (e.g. `generate_default_trait_body`).

The step after _that_ is likely to fill out the remaining traits, so we can make it so whenever RA auto-completes a trait which also can be derived, we provide a default function body.

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2 years agorefactor method generation assist
mahdi-frms [Mon, 9 Aug 2021 16:07:07 +0000 (20:37 +0430)]
refactor method generation assist

2 years agomethod gen assist usable in all of expression
mahdi-frms [Mon, 9 Aug 2021 14:51:15 +0000 (19:21 +0430)]
method gen assist usable in all of expression

2 years agoadd test for method generation assist
mahdi-frms [Mon, 9 Aug 2021 14:25:10 +0000 (18:55 +0430)]
add test for method generation assist

2 years agoOne assist for function and method generation
mahdi-frms [Sun, 8 Aug 2021 13:14:05 +0000 (17:44 +0430)]
One assist for function and method generation

2 years agomethod generation assist: store owned ast nodes
mahdi-frms [Sun, 8 Aug 2021 12:51:34 +0000 (17:21 +0430)]
method generation assist: store owned ast nodes

2 years agogenerate method adds pub keyword
mahdi-frms [Sat, 7 Aug 2021 09:29:33 +0000 (13:59 +0430)]
generate method adds pub keyword

2 years agogenerate method assist uses existing impl blocks
mahdi-frms [Sat, 7 Aug 2021 06:59:49 +0000 (11:29 +0430)]
generate method assist uses existing impl blocks

2 years agorefactor: use single next space
mahdi-frms [Thu, 5 Aug 2021 12:18:51 +0000 (16:48 +0430)]
refactor: use single next space

2 years agorefactor: use single fn_args
mahdi-frms [Thu, 5 Aug 2021 12:07:00 +0000 (16:37 +0430)]
refactor: use single fn_args

2 years agogenerate method assist
mahdi-frms [Thu, 5 Aug 2021 09:30:08 +0000 (14:00 +0430)]
generate method assist

2 years agomove code around
Yoshua Wuyts [Mon, 9 Aug 2021 16:27:01 +0000 (18:27 +0200)]
move code around

2 years agoMerge #9827
bors[bot] [Mon, 9 Aug 2021 16:26:24 +0000 (16:26 +0000)]
Merge #9827

9827: internal: remove client-side support for latest requests r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: remove client-side support for latest requests
Aleksey Kladov [Mon, 9 Aug 2021 16:24:43 +0000 (19:24 +0300)]
internal: remove client-side support for latest requests

Companion for #9826

2 years agoMerge #9826
bors[bot] [Mon, 9 Aug 2021 16:04:03 +0000 (16:04 +0000)]
Merge #9826

9826: internal: drop latest requests tracking r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: drop latest requests tracking
Aleksey Kladov [Mon, 9 Aug 2021 15:56:19 +0000 (18:56 +0300)]
internal: drop latest requests tracking

From the dawn of time, when dinosaurs roamed the and we didn't have
hierarchical profiling, there was the `latest_requests` infra we used to
track the time of ten last requests.

Today, no one is actually using it and, what's more, it itself became
pretty useless -- LSP grew way more chatty, and 10 requests don't really
paint any kind of picture.

Personally, it's been years since I last looked at latest requests in
the status output.

So, let's remove a tiny bit of state from the big ball of complexity
that is `GlobalState` and `main_loop`!

2 years agoAdd gen default for tuple structs
Yoshua Wuyts [Mon, 9 Aug 2021 15:28:06 +0000 (17:28 +0200)]
Add gen default for tuple structs

2 years agoAdd default body when implementing Default by hand
Yoshua Wuyts [Mon, 9 Aug 2021 15:12:18 +0000 (17:12 +0200)]
Add default body when implementing Default by hand

2 years agoMerge #9823
bors[bot] [Mon, 9 Aug 2021 13:16:43 +0000 (13:16 +0000)]
Merge #9823

9823: fix: avoid pathological macro expansions  r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agofix: avoid pathological macro expansions
Aleksey Kladov [Mon, 9 Aug 2021 13:06:49 +0000 (16:06 +0300)]
fix: avoid pathological macro expansions

Today, rust-analyzer (and rustc, and bat, and IntelliJ) fail badly on
some kinds of maliciously constructed code, like a deep sequence of
nested parenthesis.

"Who writes 100k nested parenthesis" you'd ask?

Well, in a language with macros, a run-away macro expansion might do
that (see the added tests)! Such expansion can be broad, rather than
deep, so it bypasses recursion check at the macro-expansion layer, but
triggers deep recursion in parser.

In the ideal world, the parser would just handle deeply nested structs
gracefully. We'll get there some day, but at the moment, let's try to be
simple, and just avoid expanding macros with unbalanced parenthesis in
the first place.

closes #9358

2 years agointernal: remove useless helpers
Aleksey Kladov [Mon, 9 Aug 2021 12:41:19 +0000 (15:41 +0300)]
internal: remove useless helpers

We generally avoid "syntax only" helper wrappers, which don't do much:
they make code easier to write, but harder to read. They also make
investigations harder, as "find_usages" needs to be invoked both for the
wrapped and unwrapped APIs

2 years agoMerge #9821
bors[bot] [Mon, 9 Aug 2021 11:06:58 +0000 (11:06 +0000)]
Merge #9821

9821: minor: Fix typo in reference modifier description r=lnicola a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoFix typo in reference modifier description
Laurențiu Nicola [Mon, 9 Aug 2021 11:06:14 +0000 (14:06 +0300)]
Fix typo in reference modifier description

2 years agoMerge #9735
bors[bot] [Mon, 9 Aug 2021 10:21:14 +0000 (10:21 +0000)]
Merge #9735

9735: Add assist to sort members alphabetically. r=matklad a=vsrs

Supports traits, impls, structs, unions and enums (including inner struct variants). Does not support modules yet.

```rust
en┃um Animal {
  Dog(String, f64),
  Cat { weight: f64, name: String },
}
```
->
```rust
enum Animal {
  Cat { weight: f64, name: String },
  Dog(String, f64),
}
```
---
```rust
enum Animal {
  Dog(String, f64),
  Cat {┃ weight: f64, name: String },
}
```
->
```rust
enum Animal {
  Dog(String, f64),
  Cat { name: String, weight: f64 },
}
```
---
More samples in docs https://github.com/vsrs/rust-analyzer/blob/0b7835619a3ec7fdc5c11e6ab001ad452314a3f2/crates/ide_assists/src/handlers/sort_items.rs#L12-L83.

Relates #6110

Co-authored-by: vsrs <vit@conrlab.com>
2 years agoMerge #9820
bors[bot] [Mon, 9 Aug 2021 10:13:23 +0000 (10:13 +0000)]
Merge #9820

9820: minor: as per code-styple, add invariant comment r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agominor: as per code-styple, add invariant comment
Aleksey Kladov [Mon, 9 Aug 2021 10:13:02 +0000 (13:13 +0300)]
minor: as per code-styple, add invariant comment

2 years agoMerge #9814
bors[bot] [Sun, 8 Aug 2021 22:30:37 +0000 (22:30 +0000)]
Merge #9814

9814: Generate default impl when converting `#[derive(Debug)]` to manual impl r=yoshuawuyts a=yoshuawuyts

This patch makes it so when you convert `#[derive(Debug)]` to a manual impl, a default body is provided that's equivalent to the original output of `#[derive(Debug)]`. This should make it drastically easier to write custom `Debug` impls, especially when all you want to do is quickly omit a single field which is `!Debug`.

This is implemented for enums, record structs, tuple structs, empty structs - and it sets us up to implement variations on this in the future for other traits (like `PartialEq` and `Hash`).

Thanks!

## Codegen diff
This is the difference in codegen for record structs with this patch:
```diff
struct Foo {
    bar: String,
}

impl fmt::Debug for Foo {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        todo!();
+        f.debug_struct("Foo").field("bar", &self.bar).finish()
    }
}
```

Co-authored-by: Irina Shestak <shestak.irina@gmail.com>
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Co-authored-by: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
2 years agoRemove unwraps
Yoshua Wuyts [Sun, 8 Aug 2021 22:29:38 +0000 (00:29 +0200)]
Remove unwraps

2 years agoUpdate crates/test_utils/src/minicore.rs
Yoshua Wuyts [Sun, 8 Aug 2021 22:00:09 +0000 (00:00 +0200)]
Update crates/test_utils/src/minicore.rs

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #9816
bors[bot] [Sun, 8 Aug 2021 18:42:19 +0000 (18:42 +0000)]
Merge #9816

9816: feat: Implement if_to_bool_then assist r=Veykril a=Veykril

One half of https://github.com/rust-analyzer/rust-analyzer/issues/8413

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoUse minicore
Yoshua Wuyts [Sun, 8 Aug 2021 16:58:42 +0000 (18:58 +0200)]
Use minicore

2 years agoexclude files from tidy check
Yoshua Wuyts [Sun, 8 Aug 2021 16:44:54 +0000 (18:44 +0200)]
exclude files from tidy check

2 years agoMerge #9817
bors[bot] [Sun, 8 Aug 2021 16:07:09 +0000 (16:07 +0000)]
Merge #9817

9817: fix: Increase chalk overflow depth r=flodiebold a=lnicola

This makes the experience better for people using `tonic`, see https://github.com/rust-analyzer/rust-analyzer/issues/7817.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoImplement if_to_bool_then assist
Lukas Wirth [Sun, 8 Aug 2021 15:12:08 +0000 (17:12 +0200)]
Implement if_to_bool_then assist

2 years agoIncrease chalk overflow depth
Laurențiu Nicola [Sun, 8 Aug 2021 15:40:28 +0000 (18:40 +0300)]
Increase chalk overflow depth

2 years agouse make::name_ref
Yoshua Wuyts [Sun, 8 Aug 2021 14:31:28 +0000 (16:31 +0200)]
use make::name_ref

2 years agoUpdate replace_derive_with_manual_impl.rs
Yoshua Wuyts [Sun, 8 Aug 2021 14:24:14 +0000 (16:24 +0200)]
Update replace_derive_with_manual_impl.rs

2 years agoImprove naming and add comments
Yoshua Wuyts [Sun, 8 Aug 2021 13:56:26 +0000 (15:56 +0200)]
Improve naming and add comments

2 years agodedup struct debug impl code
Yoshua Wuyts [Sun, 8 Aug 2021 13:41:32 +0000 (15:41 +0200)]
dedup struct debug impl code

2 years agoFix enum debug indent level
Yoshua Wuyts [Sun, 8 Aug 2021 13:32:11 +0000 (15:32 +0200)]
Fix enum debug indent level

2 years agogenerate Debug for enums
Yoshua Wuyts [Sun, 8 Aug 2021 13:24:04 +0000 (15:24 +0200)]
generate Debug for enums

2 years agorename variables
Yoshua Wuyts [Sun, 8 Aug 2021 12:11:47 +0000 (14:11 +0200)]
rename variables

According to https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/style.md#variable-naming

2 years agofinish debug_struct impls
Yoshua Wuyts [Sun, 8 Aug 2021 12:08:02 +0000 (14:08 +0200)]
finish debug_struct impls

2 years agodebug for record field structs
Yoshua Wuyts [Sun, 8 Aug 2021 11:50:49 +0000 (13:50 +0200)]
debug for record field structs

2 years agowip
Yoshua Wuyts [Sun, 8 Aug 2021 11:09:50 +0000 (13:09 +0200)]
wip

2 years agoimpl Debug def from trait
Irina Shestak [Sun, 1 Aug 2021 18:46:23 +0000 (20:46 +0200)]
impl Debug def from trait

2 years agoMerge #9812
bors[bot] [Sun, 8 Aug 2021 12:53:53 +0000 (12:53 +0000)]
Merge #9812

9812: fix: add `!` to macro completions with existing arg r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agofix: add `!` to macro completions with existing arg
Aleksey Kladov [Sun, 8 Aug 2021 12:49:00 +0000 (15:49 +0300)]
fix: add `!` to macro completions with existing arg

2 years agoMerge #9808
bors[bot] [Sun, 8 Aug 2021 10:41:45 +0000 (10:41 +0000)]
Merge #9808

9808: fix: Look for enum variants and trait assoc functions when looking for lang items r=matklad a=Veykril

Examples for lang enum variants are the `Option` variants.
Assoc trait functions aren't being seen since they aren't declared in the direct module scope.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #9810
bors[bot] [Sun, 8 Aug 2021 10:35:00 +0000 (10:35 +0000)]
Merge #9810

9810: Add reference here r=matklad a=ivan770

Superseds #6853

Co-authored-by: ivan770 <ivan@ivan770.me>
2 years agoAdd reference here diagnostic
ivan770 [Sun, 8 Aug 2021 08:12:40 +0000 (10:12 +0200)]
Add reference here diagnostic

2 years agoLook for enum variants and trait assoc functions when looking for lang items
Lukas Wirth [Sat, 7 Aug 2021 19:56:42 +0000 (21:56 +0200)]
Look for enum variants and trait assoc functions when looking for lang items

2 years agoMerge #9809
bors[bot] [Sat, 7 Aug 2021 20:16:58 +0000 (20:16 +0000)]
Merge #9809

9809: internal: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Sat, 7 Aug 2021 20:16:15 +0000 (22:16 +0200)]
Simplify

2 years agoMerge #9806
bors[bot] [Sat, 7 Aug 2021 15:42:26 +0000 (15:42 +0000)]
Merge #9806

9806: Add proc_macro crate for the 1.56 ABI r=lnicola a=alexjg

I've copied the latest proc macro source from Rust nightly and modified it to compile on `stable`. This fixes #9795 . Almost everything here is uninteresting copy and paste, the interesting stuff is in `crates/proc_macro_srv/src/abis/mod.rs`. I've left the 1.55 ABI implementation in for now. We did discuss only supporting one nightly ABI so we may want to remove 1.55. That will break code which is pinned to older nightly releases but that seems acceptable to me, what do people think?

Co-authored-by: Alex Good <alex@memoryandthought.me>
2 years agoCopy the proc_macro crate for the 1.56 ABI
Alex Good [Sat, 7 Aug 2021 15:21:53 +0000 (16:21 +0100)]
Copy the proc_macro crate for the 1.56 ABI

2 years agoMerge #9805
bors[bot] [Sat, 7 Aug 2021 11:32:08 +0000 (11:32 +0000)]
Merge #9805

9805: internal: Upgrade Chalk r=flodiebold a=flodiebold

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoUpgrade Chalk
Florian Diebold [Sat, 7 Aug 2021 11:11:58 +0000 (13:11 +0200)]
Upgrade Chalk

2 years agoMerge #9801
bors[bot] [Fri, 6 Aug 2021 14:16:24 +0000 (14:16 +0000)]
Merge #9801

9801: fix: Don't publish diagnostics in crates.io or sysroot files r=jonas-schievink a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9766

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoDon't publish diagnostics in library source roots
Jonas Schievink [Fri, 6 Aug 2021 14:14:54 +0000 (16:14 +0200)]
Don't publish diagnostics in library source roots

2 years agoMerge #9800
bors[bot] [Fri, 6 Aug 2021 14:00:29 +0000 (14:00 +0000)]
Merge #9800

9800: feat: Include suggested replacement in diagnostics r=jonas-schievink a=jonas-schievink

rustc renders the diagnostic text for suggestions by including the suggested replacement at the end (`` help: a function with a similar name exists: `boo` ``), but the emitted JSON diagnostic does not include this in the message. This causes our diagnostics to lack some useful info, so this PR fixes that by appending any suggested replacements to the message.

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9797

Before:
![screenshot-2021-08-06-15:54:19](https://user-images.githubusercontent.com/1786438/128521003-105a43a3-e386-4afc-9d5c-7806631f53d7.png)

After:
![screenshot-2021-08-06-15:53:16](https://user-images.githubusercontent.com/1786438/128521022-c16e0967-6cc6-410d-917d-5db5cfbb96be.png)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoBless tests
Jonas Schievink [Fri, 6 Aug 2021 13:59:58 +0000 (15:59 +0200)]
Bless tests

2 years agoDon't include empty suggestions
Jonas Schievink [Fri, 6 Aug 2021 13:58:55 +0000 (15:58 +0200)]
Don't include empty suggestions

2 years agoInclude suggested replacement in diagnostics
Jonas Schievink [Fri, 6 Aug 2021 13:52:47 +0000 (15:52 +0200)]
Include suggested replacement in diagnostics

2 years agoMerge #9794
bors[bot] [Thu, 5 Aug 2021 20:45:49 +0000 (20:45 +0000)]
Merge #9794

9794: Fix binders with bare dyn trait r=flodiebold a=flodiebold

Fixes #9639.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoFix binders with bare dyn trait
Florian Diebold [Thu, 5 Aug 2021 20:44:38 +0000 (22:44 +0200)]
Fix binders with bare dyn trait

Fixes #9639.

2 years agoMerge #9793
bors[bot] [Thu, 5 Aug 2021 17:56:19 +0000 (17:56 +0000)]
Merge #9793

9793: Remove unused structs in ide_db r=matklad a=michalmuskala

Co-authored-by: Michał Muskała <michal@muskala.eu>
2 years agoMerge #9785
bors[bot] [Thu, 5 Aug 2021 16:17:38 +0000 (16:17 +0000)]
Merge #9785

9785: feature: Add completion for struct literals in which all fields are visible. r=Veykril a=Afourcat

This PR adds a new completion for struct literal.

It Implements the feature discussed in the issue #9610.

![RAExample3](https://user-images.githubusercontent.com/35599359/128211142-116361e9-7a69-425f-83ea-473c6ea47b26.gif)

This PR introduce a repetition in the source files `crates/ide_completion/render/pattern.rs` and `crates/ide_completion/render/struct_literal.rs` that may be fix in another PR.

Co-authored-by: Alexandre Fourcat <afourcat@gmail.com>
2 years agoRemove unused structs in ide_db
Michał Muskała [Thu, 5 Aug 2021 11:02:52 +0000 (12:02 +0100)]
Remove unused structs in ide_db

2 years agoMerge #9790
bors[bot] [Thu, 5 Aug 2021 00:54:49 +0000 (00:54 +0000)]
Merge #9790

9790: fix: extract_type_alias extracts generics correctly r=Veykril a=Veykril

Fixes #8335
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoextract_type_alias extracts generics correctly
Lukas Wirth [Thu, 5 Aug 2021 00:54:06 +0000 (02:54 +0200)]
extract_type_alias extracts generics correctly

2 years agoMerge #9780
bors[bot] [Wed, 4 Aug 2021 18:12:37 +0000 (18:12 +0000)]
Merge #9780

9780: Support exclusive_range_pattern r=matklad a=lf-

Fix #9779

Co-authored-by: Jade <software@lfcode.ca>
2 years agoMerge #9788
bors[bot] [Wed, 4 Aug 2021 18:03:41 +0000 (18:03 +0000)]
Merge #9788

9788: fix: extract_function does not move locals defined outside of loops r=Veykril a=Veykril

Fixes #8234

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoextract_function does not move locals defined outside of loops
Lukas Wirth [Wed, 4 Aug 2021 18:00:45 +0000 (20:00 +0200)]
extract_function does not move locals defined outside of loops

2 years agoDocument reference highlighting mod
Lukas Wirth [Wed, 4 Aug 2021 12:17:56 +0000 (14:17 +0200)]
Document reference highlighting mod

2 years agoAdd completion for struct literal in which all fields are visible.
Alexandre Fourcat [Tue, 3 Aug 2021 22:46:50 +0000 (00:46 +0200)]
Add completion for struct literal in which all fields are visible.

Fix ide_completion tests.

Move 'complete_record_literal' call to the main completion function.

Fix a rendering bug when snippet not available.

Checks if an expression is expected before adding completion for struct literal.

Move 'completion struct literal with private field' test to 'expressions.rs' test file.

Update 'expect' tests with new check in 'complete record literal'.

2 years agoMerge #9786
bors[bot] [Wed, 4 Aug 2021 16:04:35 +0000 (16:04 +0000)]
Merge #9786

9786: fix: Fix detection of macro file in inactive-code diag r=jonas-schievink a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9753

`HirFileId::expansion_info` can return `None` for builtin macros or if there's an error in the macro call or definition, so add a `HirFileId::is_macro` method that checks the right thing.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoFix detection of macro file in inactive-code diag
Jonas Schievink [Wed, 4 Aug 2021 16:02:45 +0000 (18:02 +0200)]
Fix detection of macro file in inactive-code diag

2 years agoSplit the test
Jade [Wed, 4 Aug 2021 10:01:27 +0000 (03:01 -0700)]
Split the test

2 years agoMerge #9734
bors[bot] [Wed, 4 Aug 2021 09:37:30 +0000 (09:37 +0000)]
Merge #9734

9734: semantic highlighting: add reference hlmod r=matklad a=jhgg

This PR adds the "reference" highlight modifier!

I basically went around and looked for `HlMod::Mutable` to find the callsites to add a reference. I think these all make sense!

Co-authored-by: Jake Heinz <jh@discordapp.com>
Co-authored-by: Jake <jh@discordapp.com>
2 years agomatch style
Jake Heinz [Wed, 4 Aug 2021 06:14:58 +0000 (06:14 +0000)]
match style

2 years agofix + update expects
Jake Heinz [Wed, 4 Aug 2021 06:12:41 +0000 (06:12 +0000)]
fix + update expects

2 years agoApply suggestions from code review
Jake [Wed, 4 Aug 2021 06:07:46 +0000 (23:07 -0700)]
Apply suggestions from code review

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSupport exclusive_range_pattern
Jade [Wed, 4 Aug 2021 04:31:57 +0000 (21:31 -0700)]
Support exclusive_range_pattern

Fix #9779

2 years agotree-wide: fix rustdoc warnings, add some links
Jade [Wed, 4 Aug 2021 03:57:31 +0000 (20:57 -0700)]
tree-wide: fix rustdoc warnings, add some links

2 years agoMerge #9775
bors[bot] [Tue, 3 Aug 2021 18:48:43 +0000 (18:48 +0000)]
Merge #9775

9775: internal: extract_assist is aware of the expression owner r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years ago`extract_assist` is aware of the expression owner
Lukas Wirth [Tue, 3 Aug 2021 18:47:51 +0000 (20:47 +0200)]
`extract_assist` is aware of the expression owner

2 years agoUpdate crates/ide/src/syntax_highlighting/highlight.rs
Jake [Tue, 3 Aug 2021 16:54:27 +0000 (09:54 -0700)]
Update crates/ide/src/syntax_highlighting/highlight.rs

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agoMerge #9773
bors[bot] [Tue, 3 Aug 2021 16:53:12 +0000 (16:53 +0000)]
Merge #9773

9773: internal: Improve `extract_function` assist r=Veykril a=Veykril

- fix: It doesn't try to overwrite parts of selected comments any longer
- fix: It doesn't wrap tail expressions and return types in a result or option unnecessarily
- feat?: It now adds a `const` modifier to the created function if extract somethings from a const context

Fixes #7840

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoextract_function is `const` aware
Lukas Wirth [Tue, 3 Aug 2021 16:43:28 +0000 (18:43 +0200)]
extract_function is `const` aware

2 years agoReorganize functions in extract_function assist
Lukas Wirth [Tue, 3 Aug 2021 16:24:33 +0000 (18:24 +0200)]
Reorganize functions in extract_function assist

2 years agoDo no tear comments apart in extract_function assist
Lukas Wirth [Tue, 3 Aug 2021 15:39:49 +0000 (17:39 +0200)]
Do no tear comments apart in extract_function assist