Commit graph

973 commits

Author SHA1 Message Date
Benjamin Bouvier
4a6e602c94 Allow automatically detect the rustc-src directory (fixes #3517).
If the configured rustcSource is set to "discover", try to automatically
detect a source from the sysroot rustc directory.
2021-02-13 18:20:46 +01:00
Lukas Wirth
d644728d82 Refactor reference searching to work with the ast 2021-02-12 18:58:28 +01:00
Florian Diebold
a7387cae2c Fix slow tests sometimes failing
In some situations we reloaded the workspace in the tests after having reported
to be ready. There's two fixes here:
1. Add a version to the VFS config and include that version in progress reports,
so that we don't think we're done prematurely;
2. Delay status transitions until after changes are applied. Otherwise the last
change during loading can potentially trigger a workspace reload, if it contains
interesting changes.
2021-02-12 16:31:16 +01:00
Peter Wischer
f18fc5a0ae fix nightly warning legacy_derive_helpers
see https://github.com/rust-lang/rust/issues/79202
2021-02-12 13:57:38 +01:00
Jonas Schievink
70f388cedb Pin Rust to 1.49.0 on CI 2021-02-12 13:05:56 +01:00
Vincent Esche
8f461ffe8f Consolidate fn load_cargo(…) parameters into struct LoadCargoConfig { … } 2021-02-08 11:30:16 +01:00
Vincent Esche
6d9c13c710 Add config: &CargoConfig parameter to fn load_cargo(…) 2021-02-08 11:00:55 +01:00
petr-tik
f4e3eceb6f Add a semantic token type for char literals
The LSP spec doesn't recognise character literals, so
had to extend the suported types to our own custom type
2021-02-05 23:46:39 +00:00
Jonas Schievink
5d99ba1d9a Make ModPath's representation private 2021-02-04 20:49:24 +01:00
Edwin Cheng
4adf13e2ef Only allow one proc-macro process 2021-02-02 04:55:17 +08:00
Christopher Serr
b072bbed2a Update Test Data 2021-02-01 17:36:51 +01:00
Christopher Serr
2e8c1d13ad Don't filter code suggestions on Applicability
I've noticed that there are various suggestions that rust-analyzer seems
to filter out, even if they make sense.

Here's an example of where it seems like there should be a suggestion,
but there isn't:

![https://i.imgur.com/wsjM6iz.png](https://i.imgur.com/wsjM6iz.png)

It turns out that this specific suggestion is not considered
`MachineApplicable`, which are the only suggestions that rust-analyzer
accepts. However if you read the documentation for `MachineApplicable`,

b3897e3d13/compiler/rustc_lint_defs/src/lib.rs (L27-L29)

then you realize that these are specifically only those suggestions that
rust-analyzer could even automatically apply (in some distant future,
behind some setting or so). Other suggestions that may have some
semantic impact do not use `MachineApplicable`. So all other suggestions
are still intended to be suggested to the user, just not automatically
applied without the user being consulted.

b3897e3d13/compiler/rustc_lint_defs/src/lib.rs (L22-L24)

So with that in mind, rust-analyzer should almost definitely not filter
out `MaybeIncorrect` (which honestly is named horribly, it just means
that it's a semantic change, not just a syntactical one).

Then there's `HasPlaceholders` which basically is just another semantic
one, but with placeholders. The user will have to make some adjustments,
but the suggestion still is perfectly valid. rust-analyzer could
probably detect those placeholders and put proper "tab through" markers
there for the IDE, but that's not necessary for now.

Then the last one is `Unspecified` which is so unknown that I don't even
know how to judge it, meaning that the suggestion should probably also
just be suggested to the user and then they can decide.

So with all that in mind, I'm proposing to get rid of the check for
Applicability entirely.
2021-02-01 16:57:04 +01:00
Laurențiu Nicola
89b86839c7 Add --print-config-schema to help 2021-01-29 20:31:12 +02:00
Edwin Cheng
dd47f8bac6 bug fix 2021-01-29 01:19:09 +08:00
Edwin Cheng
9358eecc04 Async Loading outdir and proc-macro 2021-01-29 01:04:14 +08:00
Aleksey Kladov
30b8468c7e Simplify heavy tests
Progress notifications are edge triggered, while status is level
triggered. This makes it a hared to misuse signal for the readiness of
the server.
2021-01-28 19:15:49 +03:00
Aleksey Kladov
4b59c3a538 Make logger-based debugging more pleasant 2021-01-28 17:07:53 +03:00
Aleksey Kladov
a44f6c18fb Use RA_LOG in tests 2021-01-28 16:49:07 +03:00
Aleksey Kladov
a58fa29dc2 Easier to debug timeouts in tests 2021-01-28 16:00:33 +03:00
bors[bot]
0ebf548ab7
Merge #7451
7451: rust-analyzer.files.excludeDirs r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-27 15:48:35 +00:00
Aleksey Kladov
5101f85da0 Squelch a warning 2021-01-27 12:40:15 +03:00
bors[bot]
fc08fdaf5a
Merge #7457
7457: Add no-buffering file logging and wait for a debugger option. r=vsrs a=vsrs

Adds two command line flags: `--no-buffering` and `--wait-dbg`. 

Not  sure if someone else needs this, but personally I found both flags extremely useful trying to figure out why RA does not work with Visual Studio. Or better to say why Visual Studio does not work with RA.

Co-authored-by: vsrs <vit@conrlab.com>
2021-01-26 22:37:11 +00:00
vsrs
5f1eb544da Apply suggestions. 2021-01-27 01:16:39 +03:00
vsrs
0269071283 cargo fmt 2021-01-27 00:33:27 +03:00
vsrs
ad603c3867 Add debug only guard for the --wait-dbg flag 2021-01-27 00:09:15 +03:00
Aleksey Kladov
d35bda6429 Make always-assert crate reusable 2021-01-26 22:13:42 +03:00
Aleksey Kladov
2870e70163 Add config option to ignore directories 2021-01-26 16:45:54 +03:00
Aleksey Kladov
a733f65126 Allow non-absolute paths to rust source 2021-01-26 16:40:08 +03:00
Aleksey Kladov
c04b561e7e Remove the need to manually sync config in package.json 2021-01-26 16:22:24 +03:00
vsrs
185cd736a6 Add RA_WAIT_DBG and docs 2021-01-25 17:46:03 +03:00
vsrs
8c843d1dac Add the ability to wait for a debugger. 2021-01-25 17:46:03 +03:00
vsrs
98d7512e93 Add stderr flush 2021-01-25 17:46:03 +03:00
vsrs
43fabfbe36 Add --no-buffering flag for the file logging. 2021-01-25 17:46:03 +03:00
vsrs
3618c4e0d3 Add References code lens.
For Struct, Enum, Union and Trait symbols.
2021-01-23 16:56:20 +03:00
Aleksey Kladov
02a17cdffc Make assertion failures more annoying for maintainers 2021-01-22 19:13:21 +03:00
bors[bot]
0c37b3a0fc
Merge #7353
7353: Add LifetimeParam and ConstParam to CompletionItemKind r=matklad a=Veykril

Adds `LifetimeParam` and `ConstParam` to `CompletionItemKind` and maps them both to `TypeParam` in the protocol conversion as there are no equivalents, so nothing really changes there.
`ConstParam` could be mapped to `Const` I guess but I'm split on whether that would be better?

Additions were solely inspired by (the single) test output for const params.

Also sorts the variants of `CompletionItemKind` and its to_proto match.



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-22 15:31:47 +00:00
Aleksey Kladov
e5c5c0a040 Include countme crate to count important data structures. 2021-01-21 19:30:52 +03:00
Laurențiu Nicola
c067ca505a chdir to file before rustfmt 2021-01-21 15:58:17 +02:00
Lukas Wirth
f2cb7dbcb7 Partially unify SymbolKind and CompletionItemKind 2021-01-20 18:39:46 +01:00
Lukas Wirth
563a175fdb Move SymbolKind to ide_db 2021-01-20 15:25:34 +01:00
Lukas Wirth
83e49200d8 Add LifetimeParam and ConstParam to CompletionItemKind 2021-01-19 20:25:29 +01:00
kjeremy
db0aaeca33 Update pico-args
Should maintains existing behavior
2021-01-19 11:56:45 -05:00
bors[bot]
342bf41022
Merge #7297 #7338
7297: Propose trait associated items and autoimport traits on completion r=matklad a=SomeoneToIgnore

![trait_imports](https://user-images.githubusercontent.com/2690773/104819998-6faeb480-583a-11eb-8b45-b7351b51b90e.gif)

Closes #7248

7338: Parse `impl const Trait` r=Veykril a=Veykril

Closes #7313

bors r+

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 19:40:11 +00:00
Lukas Wirth
21a6384ce6 Remove obsolete RangeInfo usage in rename 2021-01-18 20:28:20 +01:00
Jonas Schievink
9b5fa1c61a Add back jemalloc support 2021-01-18 19:39:46 +01:00
Aleksey Kladov
add87f5424 Avoid blocking the main loop when editing Cargo.toml
I've noticed a bunch of "main loop too long" warnings in console when
typing in Cargo.toml. Profiling showed that the culprit is `rustc
--print cfg` call.

I moved it to the background project loading phase, where it belongs.
This highlighted a problem: we generally use single `cfg`, while it
really should be per crate.
2021-01-18 14:52:12 +03:00
Aleksey Kladov
e13065b8ac Add profile call 2021-01-18 13:30:12 +03:00
Kirill Bulatov
db335a1bbf Add flyimport completion for trait assoc items 2021-01-16 20:44:12 +02:00
Kirill Bulatov
6742f38e49 Share import_assets and related entities 2021-01-16 19:33:36 +02:00
Jonas Schievink
36500fe496 Don't duplicate rustc diagnostics fixes 2021-01-15 18:11:54 +01:00