Commit Graph

19108 Commits

Author SHA1 Message Date
bors[bot]
1dc4d1ce29
Merge #10185
10185: minor: include `ImplLoc` in panic context r=jonas-schievink a=jonas-schievink

cc https://github.com/rust-analyzer/rust-analyzer/issues/10084

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-09 00:23:00 +00:00
Jonas Schievink
85993171e5 minor: include ImplLoc in panic context 2021-09-09 02:20:55 +02:00
bors[bot]
22162aa363
Merge #10093
10093: fix: Remove incorrectly filtering VS Code cargo task execution resolution by scope r=oeed a=oeed

This fixes #9093 ​introduced by #8995.

A filter was present on the function that adds the execution definition to Cargo tasks. This would mean Cargo tasks defined in workspaces (i.e. `.code-workspace` files) would not be given an execution, leading to a `There is no task provider registered for tasks of type "cargo".` error as descibed in #9093. I have made a minimum reproduction setup [here](https://github.com/oeed/ra-workspace).

This PR essentially removes that check. The `if (scope) { ... }` is to handle the case where `task.scope === undefined` using a deprecated constructor. I'm not sure if that is ever likely to occur and can remove if not needed.

There is some discussion about whether it's necessary to filter the tasks before building them. From my understanding, it shouldn't be needed as we should provide an execution for all `cargo` tasks; but I'm not overly familiar with VS Code internals so I could be wrong. For more info please see [the discussion](https://github.com/rust-analyzer/rust-analyzer/pull/8995#issuecomment-908920395) on #8995

Co-authored-by: Oliver Cooper <oliver.cooper@me.com>
2021-09-08 22:34:59 +00:00
Oliver Cooper
d246a5f58b
Undefined scope comment 2021-09-09 08:50:24 +12:00
bors[bot]
6a8062092b
Merge #10174
10174: fix: path display error when start with `crate` r=flodiebold a=dzvon

Fixes  #10172

Co-authored-by: Dezhi Wu <wu543065657@163.com>
2021-09-08 14:40:54 +00:00
bors[bot]
108b0809e0
Merge #10180
10180: Fix resolution for inherent array methods r=flodiebold a=yotamofek

My second attempt at fixing #9992 , previous attempt was here: #10017 , but the logic was broken.

I know that this is not an ideal solution.... that would require, IIUC, a pretty big overhaul of the const generics handling in `rust-analyzer`. But, given that some of the array methods were/are being stabilized (e.g. https://github.com/rust-lang/rust/pull/87174 ), I think it'll be very beneficial to `rust-analyzer` users to have some preliminary support for them. (I know it's something I've been running into quite a lot lately :) )

As far as my limited understanding of this project's architecture goes, I think this isn't the worst hack in the world, and shouldn't be too much of a hassle to undo if/when const generics become better supported. If the maintainers deem this approach viable, I'll want to add some comments, emphasizing the purpose of this code, and that it should be removed at some point in the future.

Co-authored-by: Yotam Ofek <yotam.ofek@gmail.com>
2021-09-08 12:46:34 +00:00
Yotam Ofek
ebb891246c Split and document array method resolution logic. 2021-09-08 13:15:40 +03:00
Yotam Ofek
9593fe684d Fix resolution of inherent array methods. 2021-09-08 11:49:05 +03:00
Yotam Ofek
1785493cae Add (failing) test for inherent array method resolution. 2021-09-08 11:00:55 +03:00
Oliver Cooper
001608914b Removed deprecated Task constructor 2021-09-08 10:46:31 +12:00
Jonas Schievink
e241015a75 Rename is_member to is_local 2021-09-07 17:29:58 +02:00
Jonas Schievink
8a4c35a068 Treat path dependencies like workspace members 2021-09-07 17:26:21 +02:00
Dezhi Wu
87436a08fa fix super path wrong display 2021-09-07 17:49:46 +08:00
Dezhi Wu
880af425d4 fix path wrong display 2021-09-07 16:54:02 +08:00
Dezhi Wu
6d2154e409 cargo fmt 2021-09-07 14:50:33 +08:00
Dezhi Wu
82ae228d98 fix: path display error when start with crate 2021-09-07 14:44:30 +08:00
bors[bot]
3dae94bf2b
Merge #10169
10169: internal: parser cleanup r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-06 15:55:34 +00:00
Aleksey Kladov
682fbbbd5a minor: modernize 2021-09-06 18:54:16 +03:00
bors[bot]
0b4bff93fa
Merge #10168
10168: internal: make name consistent with usage r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-06 15:35:16 +00:00
Aleksey Kladov
104cd0ce88 internal: make name consistent with usage 2021-09-06 18:34:03 +03:00
bors[bot]
7d9eb4fd73
Merge #10167
10167: minor: Avoid extra allocation in completion rendering r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-09-06 15:15:10 +00:00
Laurențiu Nicola
d27ed8c243 Avoid extra allocation in completion rendering 2021-09-06 17:55:07 +03:00
bors[bot]
702f9881a0
Merge #10165
10165: update to tracing-tree 0.1.10, which does not pull in syn r=matklad a=davidbarsky

I've updated tracing-tree to 0.1.10, which does not pull in syn and proc-macro2 (thanks for [the PR](https://github.com/davidbarsky/tracing-tree/pull/32), `@matklad!).`

It took a little bit more work than I expected to land https://github.com/davidbarsky/tracing-tree/issues/33, but I should get that done this week. However, I didn't want to keep y'all waiting, so here's _some_ of the changes that should hopefully improve your compile times.

Co-authored-by: David Barsky <me@davidbarsky.com>
2021-09-06 14:37:32 +00:00
David Barsky
184fbf24f0 update to tracing-tree 0.1.10, which does not pull in syn. 2021-09-06 10:33:08 -04:00
bors[bot]
86ebc36fa3
Merge #10164
10164: docs: fix unknown configuration setting r=lnicola a=dzvon

Currently, the correct configuration of sysroot is `rust-analyzer.cargo.noSysroot (default: false)`.

Co-authored-by: Dezhi Wu <wu543065657@163.com>
2021-09-06 11:59:21 +00:00
Dezhi Wu
eb8508ae80
docs: fix unknown configuration setting 2021-09-06 19:57:17 +08:00
bors[bot]
cbc13ae6bd
Merge #10152
10152: feat: Add completion for raw identifiers r=matklad a=nabakin

![rust_analyzer_pr](https://user-images.githubusercontent.com/894305/132110362-c21b713d-acaf-4a6d-9749-ff812172cbce.gif)
Adds support for valid Rust completion of raw identifiers.

Previously, code completion of fields made via raw identifiers would not re-insert those raw identifiers, resulting in invalid Rust code. Now, code completion of fields made via raw identifiers do re-insert those raw identifiers, resulting in valid Rust code.

The same is true for all code completion instances for fields and compatible Rust identifiers.

Co-authored-by: Blake Wyatt <894305+nabakin@users.noreply.github.com>
2021-09-06 10:54:18 +00:00
bors[bot]
f0b15e2cc6
Merge #10157
10157: Add section on configuring compilation errors when using `rust-project.json` r=matklad a=dozzman

When using `rust-project.json` to specify the project workspace, flychecks are disabled. It is not mentioned that they can be re-enabled by specifying a custom checking command using the `checkOnSave.overrideCommand` configuration. This additional section makes it clear that using `rust-project.json` disables flychecks and how to enable them either using `cargo check` (as an example) or (more likely) a custom command which emits json error messages.

Further information can be found at this forum thread:

https://users.rust-lang.org/t/rust-analyzer-doesnt-show-cargo-check-compilation-errors-warnings-when-using-rust-project-json/64412

Co-authored-by: Dorian Peake <dozzman@hotmail.co.uk>
2021-09-06 10:46:06 +00:00
bors[bot]
0bc8e2acb8
Merge #10154
10154: feat: Complete `#![recursion_limit = "N"]` instead of `#![recursion_limit = N]` r=lnicola a=hkmatsumoto

Currently ra emits `#![recursion_limit = 128]`, but this should rather be `#![recursion_limit = "128"]`

Co-authored-by: Hirochika Matsumoto <git@hkmatsumoto.com>
2021-09-06 10:38:41 +00:00
bors[bot]
ca62493118
Merge #10162
10162: feat: enable completions inside macros after `.` r=jonas-schievink a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8158
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10039

This issue was not caused by us not being able to expand the macro (we can do that just fine). Instead, body lowering deliberately aborted lowering of a statement macro expansion when the expansion causes errors, citing some hygiene-related issue with recovery (`@edwin0cheng` if you remember what exactly the issue was I'd be happy to take a look).

Simply removing that code path doesn't cause any tests to fail, and makes completions in macros work better ("completion after `.`" is not the only thing that now works better, we also get better highlighting in incomplete macro calls).

Just to be sure, lets merge this after tomorrow's release.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-06 09:20:29 +00:00
Jonas Schievink
8e736da456 Recover from statement macro expansion errors 2021-09-06 00:16:12 +02:00
bors[bot]
b73b321478
Merge #10161
10161: Don't dump `DefMap`s to build the panic context r=matklad a=matklad

internal: remove accidental code re-use
FragmentKind played two roles:

* entry point to the parser
* syntactic category of a macro call

These are different use-cases, and warrant different types. For example,
macro can't expand to visibility, but we have such fragment today.

This PR introduces `ExpandsTo` enum to separate this two use-cases.

I suspect we might further split `FragmentKind` into `$x:specifier` enum
specific to MBE, and a general parser entry point, but that's for
another PR!

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-05 19:37:17 +00:00
Aleksey Kladov
dbb702cfc1 internal: remove accidental code re-use
FragmentKind played two roles:

* entry point to the parser
* syntactic category of a macro call

These are different use-cases, and warrant different types. For example,
macro can't expand to visibility, but we have such fragment today.

This PR introduces `ExpandsTo` enum to separate this two use-cases.

I suspect we might further split `FragmentKind` into `$x:specifier` enum
specific to MBE, and a general parser entry point, but that's for
another PR!
2021-09-05 22:36:36 +03:00
bors[bot]
847d0faf92
Merge #10160
10160: minor: Don't dump `DefMap`s to build the panic context r=jonas-schievink a=jonas-schievink

Fixes perf after https://github.com/rust-analyzer/rust-analyzer/pull/10159

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-05 18:43:25 +00:00
Jonas Schievink
d6a12b491f Don't dump DefMaps to build the panic context 2021-09-05 20:42:22 +02:00
bors[bot]
4235a4a131
Merge #10159
10159: Add panic info for `impl_trait`/`trait_data` r=jonas-schievink a=jonas-schievink

To debug https://github.com/rust-analyzer/rust-analyzer/issues/10084 further

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-05 17:20:54 +00:00
Jonas Schievink
7d67c71c34 Add panic info for impl_trait/trait_data 2021-09-05 19:19:34 +02:00
bors[bot]
487078feb5
Merge #10155
10155: Minor: replace old name `CrateDefMap` in comments r=jonas-schievink a=toyboot4e

This PR replaces the old name `CrateDefMap` in comments with the new name `DefMap`. The renaming was done in [57a82fb0](https://github.com/rust-analyzer/rust-analyzer/commit/57a82fb0) (Jan 2021).

I didn't touch the working code ([CrateDefMapQueryQuery][QQ]). Thank you.

[QQ]: https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_db/src/apply_change.rs#L126


Co-authored-by: toyboot4e <toyboot4e@gmail.com>
2021-09-05 16:57:46 +00:00
bors[bot]
ab8e3c0a6a
Merge #10158
10158: Add crate name to nameres panic context r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-05 16:49:22 +00:00
Jonas Schievink
65bb5d7511 Add crate name to nameres panic context 2021-09-05 18:48:34 +02:00
Dorian Peake
a2bc57c28f
Update manual.adoc 2021-09-05 16:59:38 +01:00
Dorian Peake
aae1e97590
Add rust-project.json + cargo check info to docs
Add information about how to configure compilation errors/checks when using rust-project.json.
2021-09-05 16:32:05 +01:00
toyboot4e
89e46b40c3 Minor: replace old name CrateDefMap 2021-09-05 19:22:34 +09:00
Hirochika Matsumoto
1f238b3bb5 Complete #![recursion_limit = "N"] over #![recursion_limit = N] 2021-09-05 18:05:06 +09:00
Blake Wyatt
6c51ecad5b Add completion for raw identifiers 2021-09-04 19:28:59 -04:00
bors[bot]
c16e6474f9
Merge #10148
10148: docs: make dev docs more discoverable r=matklad a=matklad

I *think* people might try to debug ra by using only the troubleshooting
section. Might make sense to point them to dev docs then!

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-04 17:35:12 +00:00
Aleksey Kladov
cff88a819f no need to reed the docs, feel free to charge ahead!
But knowing where the docs are is useful ;)
2021-09-04 20:34:17 +03:00
Aleksey Kladov
b535804e1b docs: make dev docs more discoverable
I *think* people might try to debug ra by using only the troubleshooting
section. Might make sense to point them to dev docs then!
2021-09-04 20:17:28 +03:00
bors[bot]
fd30bd179c
Merge #10146
10146: fix: use placeholder as default type in `Generate function` and `Extract into function`. r=matklad a=iDawer

Closes #10123 

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-04 14:04:30 +00:00
bors[bot]
5fb2eb2314
Merge #10147
10147: fix: don't panic if the client sends invalid request r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-04 13:56:47 +00:00