]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agointernal: add implicit `Sized` bounds to type parameters.
Dawer [Sun, 6 Jun 2021 18:41:15 +0000 (23:41 +0500)]
internal: add implicit `Sized` bounds to type parameters.

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 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

2 years agoMerge #9765
bors[bot] [Tue, 3 Aug 2021 15:32:51 +0000 (15:32 +0000)]
Merge #9765

9765: internal: Introduce TypeInfo r=Veykril a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoGive TypeInfo fields and methods more appropriate names
Lukas Wirth [Tue, 3 Aug 2021 15:28:51 +0000 (17:28 +0200)]
Give TypeInfo fields and methods more appropriate names

2 years agoRevise TypeInfo::ty usage
Lukas Wirth [Tue, 3 Aug 2021 15:24:43 +0000 (17:24 +0200)]
Revise TypeInfo::ty usage

2 years agoIntroduce TypeInfo
Lukas Wirth [Mon, 2 Aug 2021 18:42:25 +0000 (20:42 +0200)]
Introduce TypeInfo

2 years agoMerge #9772
bors[bot] [Tue, 3 Aug 2021 14:37:25 +0000 (14:37 +0000)]
Merge #9772

9772: feat: filter out duplicate macro completions r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agofeat: filter out duplicate macro completions
Aleksey Kladov [Tue, 3 Aug 2021 14:36:06 +0000 (17:36 +0300)]
feat: filter out duplicate macro completions

closes #9303

2 years agoMerge #9771
bors[bot] [Tue, 3 Aug 2021 12:13:05 +0000 (12:13 +0000)]
Merge #9771

9771: Give better error message when the rust-analyzer binary path was set in the user's config but the binary is invalid r=matklad a=rylev

`@yoshuawuyts` and I ran into an issue where my rust-analyzer binary path was set in my extension config (which I didn't realize), but the path set in the config was invalid (it simply wasn't on my path). Having an error message that hinted that the binary's path was explicitly set in the config would have considerably shortened the debug time.

Thanks!

Co-authored-by: Ryan Levick <me@ryanlevick.com>
2 years agoMerge #9770
bors[bot] [Tue, 3 Aug 2021 12:04:13 +0000 (12:04 +0000)]
Merge #9770

9770: Downgrade notify and use `RecommendedWatcher` r=lnicola a=lnicola

Closes #9769

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoGive better error message when the rust-analyzer binar path was set in the user's...
Ryan Levick [Tue, 3 Aug 2021 12:03:49 +0000 (14:03 +0200)]
Give better error message when the rust-analyzer binar path was set in the user's config but the binary is invalid

2 years agoDowngrade notify and use RecommendedWatcher
Laurențiu Nicola [Tue, 3 Aug 2021 11:32:28 +0000 (14:32 +0300)]
Downgrade notify and use RecommendedWatcher

2 years agoMerge #9764
bors[bot] [Mon, 2 Aug 2021 18:43:02 +0000 (18:43 +0000)]
Merge #9764

9764: fix: Don't use the module as the candidate node in fuzzy path flyimport r=Veykril a=Veykril

The problem was that the candidate node is whats being used for the scope, so using an inline module will yield the surrounding scope of the module instead of the scope of the module itself.
Also seems to fix the problem in this comment https://github.com/rust-analyzer/rust-analyzer/issues/9760#issuecomment-891125674, though I could not recreate that in a test for some reason.

Fixes #9760

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoDon't use the module as the candidate node in fuzzy path flyimport
Lukas Wirth [Mon, 2 Aug 2021 17:56:32 +0000 (19:56 +0200)]
Don't use the module as the candidate node in fuzzy path flyimport

2 years agoMerge #9762
bors[bot] [Mon, 2 Aug 2021 16:17:15 +0000 (16:17 +0000)]
Merge #9762

9762: fix: Fix ranged hover result range r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoFix ranged hover result range
Lukas Wirth [Mon, 2 Aug 2021 16:15:55 +0000 (18:15 +0200)]
Fix ranged hover result range

2 years agoMerge #9761
bors[bot] [Mon, 2 Aug 2021 15:44:43 +0000 (15:44 +0000)]
Merge #9761

9761: feat: Show coerced types on type hover r=Veykril a=Veykril

This applies to both the ranged hover request as well as the normal hover type fallback.
![image](https://user-images.githubusercontent.com/3757771/127883884-2935b624-a3e5-4f35-861a-7d6d3266d187.png)
![image](https://user-images.githubusercontent.com/3757771/127883951-4ff96b6b-7576-4886-887b-1198c1121841.png)

We unfortunately have to leave out syntax highlighting here as otherwise the `Type` and `Coerced` words in the hover will get colored.

Note that this does not show all the coercions yet(and almost no pattern coercions) as not all coercion adjustments are implemented yet.

Closes https://github.com/rust-analyzer/rust-analyzer/issues/2677

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoAlso search for pattern nodes in ranged hover
Lukas Wirth [Mon, 2 Aug 2021 15:26:22 +0000 (17:26 +0200)]
Also search for pattern nodes in ranged hover

2 years agoShow coerced types on type hover
Lukas Wirth [Mon, 2 Aug 2021 15:10:36 +0000 (17:10 +0200)]
Show coerced types on type hover

2 years agoMerge #9751
bors[bot] [Mon, 2 Aug 2021 14:12:37 +0000 (14:12 +0000)]
Merge #9751

9751: Make `LoadCargoConfig`, `fn load_workspace_at` & `fn load_workspace` public again r=matklad a=regexident

This [commit](https://github.com/rust-analyzer/rust-analyzer/commit/b24f816c0d8aaa37fbc0b33f90dd67afbf28adaa) which restricted the visibility of `LoadCargoConfig`, `fn load_workspace_at` & `fn load_workspace` unfortunately effectively rendered every crate/tool that uses rust-analyzer as a library dead in the water.

On of such tools is [cargo-modules](https://github.com/regexident/cargo-modules), a tool for generating tree/graph visualizations of one's Rust project and is powered by rust-analyzer as a library.

For more context see the PRs that introduced those types/functions and made them `pub`:

- https://github.com/rust-analyzer/rust-analyzer/pull/7595
- https://github.com/rust-analyzer/rust-analyzer/pull/7690

If kept as is rust-analyzer would effectively no longer be usable as a library.

cc `@SomeoneToIgnore`

Co-authored-by: Vincent Esche <regexident@gmail.com>
2 years agoMerge #9759
bors[bot] [Mon, 2 Aug 2021 13:28:21 +0000 (13:28 +0000)]
Merge #9759

9759: internal: Simplify inline_local_variable assist r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify inline_local_variable assist
Lukas Wirth [Mon, 2 Aug 2021 13:27:10 +0000 (15:27 +0200)]
Simplify inline_local_variable assist

2 years agoMerge #9752
bors[bot] [Mon, 2 Aug 2021 13:14:22 +0000 (13:14 +0000)]
Merge #9752

9752: feature: Declare proc-macro dependent crates in `rust-project.json` r=matklad a=tobywf

This adds the `is_proc_macro` flag in `rust-project.json`. By default, this is `false` and not required, so existing projects won't break/have the same behavior as before this change. If the flag is true, a dependency to the `proc_macro` sysroot crate is added (if it exists), so that rust-analyzer can resolve those imports.

This fixes #9726 .

I've also added some tests in the second commit. The first is a smoke test for a basic, minimal `rust-project.json` file. The second is a more targeted test for the flag. Both tests depend on the fake sysroot (a bunch of directories in the correct layout with empty `lib.rs` files), and also on `env!("CARGO_MANIFEST_DIR")` being an absolute path. I'm not sure if the later assumption is valid on all platforms. I wanted to at least try and add tests, but I'm happy to rework them or remove them if you don't think that's the way to go.

(You can license/relicense my contribution in any way you wish without contacting me.)

Co-authored-by: Toby Fleming <sourcecode@tobywf.com>
2 years agoMerge #9758
bors[bot] [Mon, 2 Aug 2021 13:00:07 +0000 (13:00 +0000)]
Merge #9758

9758: internal: explain that we don't `ref` in style.md r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: explain that we don't `ref` in style.md
Aleksey Kladov [Mon, 2 Aug 2021 12:59:28 +0000 (15:59 +0300)]
internal: explain that we don't `ref` in style.md

2 years agoMerge #9757
bors[bot] [Mon, 2 Aug 2021 12:41:15 +0000 (12:41 +0000)]
Merge #9757

9757: intenral: completion cleanups r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agoMerge #9756
bors[bot] [Mon, 2 Aug 2021 12:34:59 +0000 (12:34 +0000)]
Merge #9756

9756: internal: `resolve_doc_path` is able to resolve to macros r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoresolve_doc_path is able to resolve to macros
Lukas Wirth [Mon, 2 Aug 2021 12:33:09 +0000 (14:33 +0200)]
resolve_doc_path is able to resolve to macros

2 years agominor: encode usage convention into API
Aleksey Kladov [Mon, 2 Aug 2021 12:27:47 +0000 (15:27 +0300)]
minor: encode usage convention into API

2 years agosimplify
Aleksey Kladov [Mon, 2 Aug 2021 11:26:37 +0000 (14:26 +0300)]
simplify

2 years agofailing test
Aleksey Kladov [Mon, 2 Aug 2021 11:24:34 +0000 (14:24 +0300)]
failing test

2 years agoRust project project model smoke tests
Toby Fleming [Sun, 1 Aug 2021 05:47:21 +0000 (22:47 -0700)]
Rust project project model smoke tests

2 years agoRust project supports proc-macro dependent crates
Toby Fleming [Sat, 31 Jul 2021 22:26:59 +0000 (15:26 -0700)]
Rust project supports proc-macro dependent crates

2 years agoMake `LoadCargoConfig`, `fn load_workspace_at` & `fn load_workspace` public again
Vincent Esche [Sun, 1 Aug 2021 14:34:51 +0000 (16:34 +0200)]
Make `LoadCargoConfig`, `fn load_workspace_at` & `fn load_workspace` public again

2 years agoMerge #9750
bors[bot] [Sun, 1 Aug 2021 14:40:44 +0000 (14:40 +0000)]
Merge #9750

9750: Link â€śDST” to its definition r=lnicola a=gthb

Being new to Rust I wasn't familiar with this acronym and found it hard to guess (the context of syntax trees biased me to reading it as a D-something Syntax Tree and trying to guess what the D was), hard to google (in retrospect googling "rust dst" does the job, but I thought it was an abstract structure thing, not Rust-specific), and hard to Github-search, because `dst` is commonly short for â€śdestination” in code.

Alternatively `<abbr title="dynamically sized type">DST</abbr>` would be about as helpful.

Co-authored-by: Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
2 years agoLink “DST” to its definition
Gunnlaugur Thor Briem [Sun, 1 Aug 2021 14:37:16 +0000 (14:37 +0000)]
Link â€śDST” to its definition

Being new to Rust I wasn't familiar with this acronym and found it hard to guess (the context of syntax trees biased me to reading it as a D-something Syntax Tree and trying to guess what the D was), hard to google (in retrospect googling "rust dst" does the job, but I thought it was an abstract structure thing, not Rust-specific), and hard to Github-search, because `dst` is commonly short for â€śdestination” in code.

Alternatively `<abbr title="dynamically sized type">DST</abbr>` would be about as helpful.

2 years agoMerge #9749
bors[bot] [Sun, 1 Aug 2021 10:11:07 +0000 (10:11 +0000)]
Merge #9749

9749: Exclude `rust-analyzer.server.path` from VS Code's sync feature r=lnicola a=brainplot

By changing the scope of this configuration to `machine-overridible`, this setting becomes fully local for the VS Code instance the user is running.

Having this setting excluded from syncing should help avoid inconveniences for users who have VS Code installed on two different operating systems, where the paths to the language server binary would very likely mismatch.

Co-authored-by: Gianluca Recchia <gianluca.recchia@protonmail.com>
2 years agoExclude `rust-analyzer.server.path` from VS Code's sync feature
Gianluca Recchia [Sun, 1 Aug 2021 10:00:41 +0000 (12:00 +0200)]
Exclude `rust-analyzer.server.path` from VS Code's sync feature

By changing the scope of this configuration to `machine-overridible`,
this setting becomes fully local for the VS Code instance the user is
running.

Having this setting excluded from syncing should help avoid
inconveniences for users who have VS Code installed on two different
operating systems, where the paths to the language server binary would
very likely mismatch.

2 years agoMerge #9747
bors[bot] [Sat, 31 Jul 2021 18:27:41 +0000 (18:27 +0000)]
Merge #9747

9747: fix: Wrap inner tail expressions in MissingOkOrSomeInTailExpr r=Veykril a=Veykril

Fixes #8512

Also fixes a bug in for_each_tail_expr not visiting `else if` chains

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoWrap inner tail expressions in MissingOkOrSomeInTailExpr
Lukas Wirth [Sat, 31 Jul 2021 18:00:09 +0000 (20:00 +0200)]
Wrap inner tail expressions in MissingOkOrSomeInTailExpr

2 years agoMerge #9746
bors[bot] [Sat, 31 Jul 2021 15:27:11 +0000 (15:27 +0000)]
Merge #9746

9746: internal: add API to check what are the max limits in practice r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: add API to check what are the max limits in practice
Aleksey Kladov [Sat, 31 Jul 2021 15:25:45 +0000 (18:25 +0300)]
internal: add API to check what are the max limits in practice

2 years agoMerge #9739
bors[bot] [Sat, 31 Jul 2021 15:08:29 +0000 (15:08 +0000)]
Merge #9739

9739: generate function assist favors deref cmpt types r=matklad a=mahdi-frms

Fixes #9713

Although that's still not relying on sematic info.

Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2 years agoMerge #9744
bors[bot] [Sat, 31 Jul 2021 13:41:04 +0000 (13:41 +0000)]
Merge #9744

9744: fix: Annotate type hints for pattern name ranges instead of the pattern itself r=Veykril a=Veykril

The current type hints do not go well with `bindings_after_at` which is likely to land with 1.56(https://github.com/rust-lang/rust/pull/85305 đźŽ‰very excited for this), hence annotate the names of ident patterns instead of the entire pattern.

This changes where the typehints go for ident patterns that use @ bindings, some example comparisons:

Before:
![Code_82ILMppkve](https://user-images.githubusercontent.com/3757771/127741276-e1dd173b-2964-4df0-abae-860283b2e1be.png)
After:
![Code_tPttN2rJpw](https://user-images.githubusercontent.com/3757771/127741277-e7fc2836-4f31-4c45-a3a9-69cbff3d52d9.png)

This change has no visible effect on patterns without ``@`` bindings.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoAnnotate type hints for pattern name ranges instead of the pattern itself
Lukas Wirth [Sat, 31 Jul 2021 13:24:21 +0000 (15:24 +0200)]
Annotate type hints for pattern name ranges instead of the pattern itself

2 years agoMerge #9743
bors[bot] [Sat, 31 Jul 2021 13:23:00 +0000 (13:23 +0000)]
Merge #9743

9743: internal: a bit of completion profiling r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: make non-zero times stand out in profile
Aleksey Kladov [Sat, 31 Jul 2021 13:22:03 +0000 (16:22 +0300)]
internal: make non-zero times stand out in profile

2 years agointernal: document query implication of completion rendering
Aleksey Kladov [Sat, 31 Jul 2021 13:13:15 +0000 (16:13 +0300)]
internal: document query implication of completion rendering

2 years agominor: follow code style
Aleksey Kladov [Sat, 31 Jul 2021 12:46:03 +0000 (15:46 +0300)]
minor: follow code style

2 years agoMerge #9742
bors[bot] [Sat, 31 Jul 2021 13:00:09 +0000 (13:00 +0000)]
Merge #9742

9742: fix: Fix hover range for derive inputs r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoFix hover range for derive inputs
Lukas Wirth [Sat, 31 Jul 2021 12:47:44 +0000 (14:47 +0200)]
Fix hover range for derive inputs

2 years agoMerge #9741
bors[bot] [Sat, 31 Jul 2021 12:30:09 +0000 (12:30 +0000)]
Merge #9741

9741: minor: Replace useless types r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoReplace useless types
Lukas Wirth [Sat, 31 Jul 2021 12:29:15 +0000 (14:29 +0200)]
Replace useless types

2 years agoMerge #9740
bors[bot] [Sat, 31 Jul 2021 12:05:41 +0000 (12:05 +0000)]
Merge #9740

9740: feat: `add_explicit_type` is applicable for closure parameters r=Veykril a=Veykril

Closes https://github.com/rust-analyzer/rust-analyzer/issues/8886
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoadd_explicit_type is applicable for closure parameters
Lukas Wirth [Sat, 31 Jul 2021 12:04:34 +0000 (14:04 +0200)]
add_explicit_type is applicable for closure parameters

2 years agogenerate function assist favors deref cmpt types
mahdi-frms [Sat, 31 Jul 2021 11:13:22 +0000 (15:43 +0430)]
generate function assist favors deref cmpt types

2 years agoMerge #9737
bors[bot] [Sat, 31 Jul 2021 09:05:06 +0000 (09:05 +0000)]
Merge #9737

9737: minor: Bump deps r=lnicola a=lnicola

Upgrade `rowan` and avoid the duplicate `object` dependency.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoBump deps
Laurențiu Nicola [Sat, 31 Jul 2021 08:25:03 +0000 (11:25 +0300)]
Bump deps

2 years agoMerge #9736
bors[bot] [Sat, 31 Jul 2021 07:25:34 +0000 (07:25 +0000)]
Merge #9736

9736: :arrow_up: crates r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years ago:arrow_up: crates
Aleksey Kladov [Sat, 31 Jul 2021 07:25:13 +0000 (10:25 +0300)]
:arrow_up: crates

2 years agoMerge #9733
bors[bot] [Fri, 30 Jul 2021 16:51:16 +0000 (16:51 +0000)]
Merge #9733

9733: internal: cleanup lsp-extensions docs r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: cleanup lsp-extensions docs
Aleksey Kladov [Fri, 30 Jul 2021 16:50:39 +0000 (19:50 +0300)]
internal: cleanup lsp-extensions docs

2 years agoMerge #9732
bors[bot] [Fri, 30 Jul 2021 16:27:10 +0000 (16:27 +0000)]
Merge #9732

9732: feat: gate custom clint-side commands behind capabilities r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agofeat: gate custom clint-side commands behind capabilities
Aleksey Kladov [Fri, 30 Jul 2021 16:16:33 +0000 (19:16 +0300)]
feat: gate custom clint-side commands behind capabilities

Some features of rust-analyzer requires support for custom commands on
the client side. Specifically, hover & code lens need this.

Stock LSP doesn't have a way for the server to know which client-side
commands are available. For that reason, we historically were just
sending the commands, not worrying whether the client supports then or
not.

That's not really great though, so in this PR we add infrastructure for
the client to explicitly opt-into custom commands, via `extensions`
field of the ClientCapabilities.

To preserve backwards compatability, if the client doesn't set the
field, we assume that it does support all custom commands. In the
future, we'll start treating that case as if the client doesn't support
commands.

So, if you maintain a rust-analyzer client and implement
`rust-analyzer/runSingle` and such, please also advertise this via a
capability.

2 years agoMerge #9727
bors[bot] [Fri, 30 Jul 2021 14:56:50 +0000 (14:56 +0000)]
Merge #9727

9727: internal: Simplify extract_function assist r=Veykril a=Veykril

also fixes #7839(blocked on #9728)

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoAdd trailing comma when extracting match arm expressions into functions
Lukas Wirth [Thu, 29 Jul 2021 20:27:54 +0000 (22:27 +0200)]
Add trailing comma when extracting match arm expressions into functions

2 years agoMerge #9731
bors[bot] [Fri, 30 Jul 2021 14:47:38 +0000 (14:47 +0000)]
Merge #9731

9731: feat: Add `replace_char_with_string` assist r=Veykril a=Veykril

Adds the counterpart for the `replace_string_with_char` assist and fixes the assist not escaping the `'` in the string `"'"` when transforming that to a char.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoAdd replace_char_with_string assist
Lukas Wirth [Fri, 30 Jul 2021 14:46:06 +0000 (16:46 +0200)]
Add replace_char_with_string assist

2 years agoMerge #9728
bors[bot] [Fri, 30 Jul 2021 14:11:37 +0000 (14:11 +0000)]
Merge #9728

9728: fix: Attach comma token to MATCH_ARM instead of MATCH_ARM_LIST r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoFix assists assuming comma belonging to MATCH_ARM_LIST
Lukas Wirth [Fri, 30 Jul 2021 13:51:07 +0000 (15:51 +0200)]
Fix assists assuming comma belonging to MATCH_ARM_LIST

2 years agoMerge #9730
bors[bot] [Fri, 30 Jul 2021 13:38:38 +0000 (13:38 +0000)]
Merge #9730

9730: minor: drop impl-specific stuff from lsp docs r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agominor: drop impl-specific stuff from lsp docs
Aleksey Kladov [Fri, 30 Jul 2021 13:30:04 +0000 (16:30 +0300)]
minor: drop impl-specific stuff from lsp docs

The lc. prefix is a copy-paste from our typescript code, it doesn't make
sense in the impl-agnostic docs.

2 years agoSimplify
Lukas Wirth [Fri, 30 Jul 2021 11:12:52 +0000 (13:12 +0200)]
Simplify

2 years agoFix move_item test fixture indentations
Lukas Wirth [Fri, 30 Jul 2021 11:03:28 +0000 (13:03 +0200)]
Fix move_item test fixture indentations

2 years agoAttach comma token to MATCH_ARM instead of MATCH_ARM_LIST
Lukas Wirth [Thu, 29 Jul 2021 20:32:24 +0000 (22:32 +0200)]
Attach comma token to MATCH_ARM instead of MATCH_ARM_LIST

2 years agoReorder definitions in extract_function
Lukas Wirth [Thu, 29 Jul 2021 20:10:40 +0000 (22:10 +0200)]
Reorder definitions in extract_function

2 years agoSimplify extract_function assist
Lukas Wirth [Thu, 29 Jul 2021 20:01:24 +0000 (22:01 +0200)]
Simplify extract_function assist

2 years agoMerge #9706
bors[bot] [Thu, 29 Jul 2021 16:14:10 +0000 (16:14 +0000)]
Merge #9706

9706: minor: perf and grammar fixes r=lnicola a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoMerge #9724
bors[bot] [Thu, 29 Jul 2021 15:27:03 +0000 (15:27 +0000)]
Merge #9724

9724: internal: Use more strictly typed syntax nodes for analysis in extract_function assist r=Veykril a=Veykril

This also prevents it from looking into local items unnecessarily(which might even cause problems in some cases)
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoUse more strictly typed syntax nodes for analysis in extract_function assist
Lukas Wirth [Thu, 29 Jul 2021 15:17:45 +0000 (17:17 +0200)]
Use more strictly typed syntax nodes for analysis in extract_function assist

2 years agoMerge #9722
bors[bot] [Thu, 29 Jul 2021 13:45:28 +0000 (13:45 +0000)]
Merge #9722

9722: fix: Refine extraction targets of extract_function assist r=Veykril a=Veykril

Closes https://github.com/rust-analyzer/rust-analyzer/issues/7748
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoRefine extraction targets of extract_function assist
Lukas Wirth [Thu, 29 Jul 2021 13:43:44 +0000 (15:43 +0200)]
Refine extraction targets of extract_function assist

2 years agoMerge #9719
bors[bot] [Wed, 28 Jul 2021 17:31:17 +0000 (17:31 +0000)]
Merge #9719

9719: feat: Make flyimport respect `#[doc(hidden)]` r=jonas-schievink a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7718 (we still don't respect `#[doc(hidden)]` on reexports, but that is tracked by https://github.com/rust-analyzer/rust-analyzer/issues/9197)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoMake flyimport respect `#[doc(hidden)]`
Jonas Schievink [Wed, 28 Jul 2021 17:22:59 +0000 (19:22 +0200)]
Make flyimport respect `#[doc(hidden)]`

2 years agoMerge #9718
bors[bot] [Wed, 28 Jul 2021 17:22:40 +0000 (17:22 +0000)]
Merge #9718

9718: Bump notify to 5.0.0-pre.11 r=lnicola a=deontologician

It looks like the `INotifyWatcher::new` method was removed sometime after `5.0.0-pre.3` and then added back in `5.0.0-pre.11`. Without the `=`, cargo can resolve some version from `5.0.0-pre.4` -> `5.0.0-pre.10` which will not compile.

Co-authored-by: Josh Kuhn <deontologician@gmail.com>
2 years agoBump notify to 5.0.0-pre.11
Josh Kuhn [Wed, 28 Jul 2021 17:09:58 +0000 (10:09 -0700)]
Bump notify to 5.0.0-pre.11

2 years agoMerge #9716
bors[bot] [Wed, 28 Jul 2021 15:39:57 +0000 (15:39 +0000)]
Merge #9716

9716: internal: Stop reexporting `hir_def`'s `ItemInNs` from HIR r=jonas-schievink a=jonas-schievink

Resolves a FIXME and simplifies downstream code

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoStop reexporting `hir_def`'s `ItemInNs` from HIR
Jonas Schievink [Wed, 28 Jul 2021 15:39:04 +0000 (17:39 +0200)]
Stop reexporting `hir_def`'s `ItemInNs` from HIR

2 years agoMerge #9715
bors[bot] [Wed, 28 Jul 2021 14:00:33 +0000 (14:00 +0000)]
Merge #9715

9715: feat: Make most completions respect `#[doc(hidden)]` r=jonas-schievink a=jonas-schievink

Closes https://github.com/rust-analyzer/rust-analyzer/issues/2003

This continues https://github.com/rust-analyzer/rust-analyzer/pull/9681 and makes most other completion sources respect `#[doc(hidden)]`. After this, only flyimport is missing support for this.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoMake most completions respect `#[doc(hidden)]`
Jonas Schievink [Wed, 28 Jul 2021 13:59:02 +0000 (15:59 +0200)]
Make most completions respect `#[doc(hidden)]`

2 years agoMerge #9700
bors[bot] [Wed, 28 Jul 2021 12:07:25 +0000 (12:07 +0000)]
Merge #9700

9700: fix: Remove the legacy macro scoping hack r=matklad a=jonas-schievink

This stops prepending `self::` to single-ident macro paths, resolving even legacy-scoped macros using the fixed-point algorithm. This is not correct, but a lot easier than fixing this properly (which involves pushing a new scope for every macro definition and invocation).

This allows resolution of macros from the prelude, fixing https://github.com/rust-analyzer/rust-analyzer/issues/9687.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoMerge #9693
bors[bot] [Wed, 28 Jul 2021 11:21:33 +0000 (11:21 +0000)]
Merge #9693

9693: feat: Add the Hover Range capability which enables showing the type of an expression r=matklad a=alexfertel

Closes https://github.com/rust-analyzer/rust-analyzer/issues/389

This PR extends the `textDocument/hover` method to allow getting the type of an expression. It looks like this:

![type_of_expression](https://user-images.githubusercontent.com/22298999/126914293-0ce49a92-545d-4005-a59e-9294fa2330d6.gif)

Edit: One thing I noticed is that when hovering a selection that includes a macro it doesn't work, so maybe this would need a follow-up issue discussing what problem that may have.

(PS: What a great project! I am learning a lot! đźš€)

Co-authored-by: Alexander Gonzalez <alexfertel97@gmail.com>
Co-authored-by: Alexander González <alexfertel97@gmail.com>
2 years agofix: Revert removing [] from the hover gif
Alexander González [Wed, 28 Jul 2021 10:58:19 +0000 (06:58 -0400)]
fix: Revert removing [] from the hover gif

2 years agoSmall grammar fix
Laurențiu Nicola [Tue, 27 Jul 2021 09:33:58 +0000 (12:33 +0300)]
Small grammar fix

2 years agoMerge #9712
bors[bot] [Wed, 28 Jul 2021 09:36:01 +0000 (09:36 +0000)]
Merge #9712

9712: minor: simplify r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>