Commit Graph

7473 Commits

Author SHA1 Message Date
Emil Lauridsen
8ffbe86dfd Parse cargo output a line at a time.
We previously used serde's stream deserializer to read json blobs from
the cargo output. It has an issue though: If the deserializer encounters
invalid input, it gets stuck reporting the same error again and again
because it is unable to foward over the input until it reaches a new
valid object.

Reading a line at a time and manually deserializing fixes this issue,
because cargo makes sure to only outpu one json blob per line, so should
we encounter invalid input, we can just skip a line and continue.

The main reason this would happen is stray printf-debugging in
procedural macros, so we still report that an error occured, but we
handle it gracefully now.

Fixes #2935
2020-01-29 13:40:27 +01:00
Aleksey Kladov
9f68f7acf2 Tweak readme 2020-01-29 13:25:32 +01:00
Aleksey Kladov
5643c0730a
Merge pull request #2936 from matklad/better-release
Make sure release uses the release branch, and not master
2020-01-29 12:24:09 +00:00
Aleksey Kladov
f4fd91a7fe Make sure release uses the release branch, and not master 2020-01-29 13:19:51 +01:00
bors[bot]
6fd29651b4
Merge #2931
2931: Added documentation to test_utils r=matklad a=Veetaha

Added some doc comments to test_utils functions while studying this crate. They should be all stable enough to document them.
Also some minor code relocation in `parse_fixture()` closer to its usage according to the advice of @matklad.

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-01-29 11:06:18 +00:00
bors[bot]
7a2b87db73
Merge #2934
2934: Complain loudly if the main loop is blocked r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-29 10:24:08 +00:00
Aleksey Kladov
9753eb98cc Complain loudly if the main loop is blocked 2020-01-29 11:21:49 +01:00
Aleksey Kladov
aaa4861a0b More uniform naming 2020-01-29 11:15:08 +01:00
bors[bot]
3ea8940d94
Merge #2933
2933: Don't compute diagnostics on the main thread r=matklad a=matklad

closes #2909

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-29 10:14:12 +00:00
Aleksey Kladov
2d2585e03f Don't compute diagnostics on the main thread
closes #2909
2020-01-29 11:03:59 +01:00
Veetaha
5e1ae1d7aa test_utils: move flush!() to its usage as per conversation with @matklad 2020-01-29 03:53:15 +02:00
Veetaha
d3472e8ae4 test_utils: updated documentation and some typos 2020-01-29 03:52:13 +02:00
bors[bot]
3bdf2e0972
Merge #2917
2917: Prefer imports starting with std r=matklad a=SomeoneToIgnore

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

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-01-28 16:22:18 +00:00
Kirill Bulatov
713870ee0c Add the tests 2020-01-28 18:03:24 +02:00
bors[bot]
50b6a989d2
Merge #2928
2928: Provide better diagnostics if the server is not in path r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-28 16:00:34 +00:00
Aleksey Kladov
94784cc546 Provide better diagnostics if the server is not in path 2020-01-28 17:00:00 +01:00
bors[bot]
3f70236965
Merge #2927
2927: Publicize debug printing of CrateDefMap r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-28 15:30:19 +00:00
Aleksey Kladov
4b9e5d5dd9 Publicize debug printing of CrateDefMap 2020-01-28 16:29:31 +01:00
Kirill Bulatov
07b505b633 Revert accidental package-lock.json change 2020-01-28 17:21:40 +02:00
Kirill Bulatov
762d293581 Apply the proposed refactoring 2020-01-28 17:19:41 +02:00
bors[bot]
2ddfc4ed5b
Merge #2926
2926: Standard formatting for array types r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-28 14:33:11 +00:00
Aleksey Kladov
6ca19b2188 Standard formatting for array types 2020-01-28 15:32:20 +01:00
bors[bot]
82ffe597ca
Merge #2925
2925: ⬆️ node r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-28 14:12:15 +00:00
Aleksey Kladov
c378133185 ⬆️ node 2020-01-28 15:11:44 +01:00
bors[bot]
76e17fe7d8
Merge #2924
2924: Modify ordering of drops in check watcher to only ever have one cargo r=matklad a=kiljacken

Due to the way drops are ordered when assigning to a mutable variable we
were launching a new cargo sub-process before letting the old one quite.

By explicitly replacing the original watcher with a dummy first, we
ensure it is dropped and the process is completed, before we start the
new process.

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2020-01-28 13:54:29 +00:00
Emil Lauridsen
35025f0975 Modify ordering of drops in check watcher to only ever have one cargo
Due to the way drops are ordered when assigning to a mutable variable we
were launching a new cargo sub-process before letting the old one quite.

By explicitly replacing the original watcher with a dummy first, we
ensure it is dropped and the process is completed, before we start the
new process.
2020-01-28 14:48:50 +01:00
bors[bot]
e8f990a3d1
Merge #2923
2923: Don't do check progress update for fresh crates r=matklad a=kiljacken

Skip sending progress updates for crates that aren't getting checked.

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2020-01-28 13:40:14 +00:00
Emil Lauridsen
fdc04ef920 Don't do check progress update for fresh crates 2020-01-28 14:33:52 +01:00
Edwin Cheng
c32be4bfe8 Ignore illform node id from metadata 2020-01-28 17:08:17 +08:00
bors[bot]
912776fd95
Merge #2916
2916: Buffer reads from cargo check's stdout r=matklad a=lnicola

`Stdio::piped()` is unbuffered, which caused RA to read the output of `cargo check` one byte at a time (out of 114KB in my test).

This isn't obviously faster on my system, but making fewer syscalls sounds like a good idea.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-01-27 23:33:06 +00:00
Laurențiu Nicola
c34571c19e Buffer reads from cargo check's stdout 2020-01-28 01:27:43 +02:00
Kirill Bulatov
7a2e449424 Prefer imports starting with std 2020-01-28 01:02:06 +02:00
bors[bot]
5dd8f8e26f
Merge #2810
2810: Improves reference search by StructLiteral r=mikhail-m1 a=mikhail-m1

Hey, I've made some changes to improve search for struct literals, now it works for `struct Foo<|> {`, `struct Foo <|>{`, `struct Foo<|>(`. Unfortunately tuple creation is represented as a call expression, so for tuples it works only is search is started in a tuple declaration.  It leads to incorrect classification of function calls during search phase, but from user perspective it's not visible and works as expected. May be it worth to add a comment or rename it to remove this misleading classification. Issue #2549.

Co-authored-by: Mikhail Modin <mikhailm1@gmail.com>
2020-01-27 21:58:35 +00:00
Mikhail Modin
fbc3ffcee6 Improves reference search by StructLiteral 2020-01-27 21:34:19 +00:00
bors[bot]
5cfaf87627
Merge #2872
2872: Upgrade Chalk r=matklad a=flodiebold

This is just keeping track of the changes required to upgrade Chalk; currently we can't really merge it since it breaks opaque types.

Now also makes use of the newly introduced `solve_limited` to implement fuel.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-01-27 21:24:24 +00:00
Florian Diebold
339a11c33c Tweak Chalk settings 2020-01-27 21:52:35 +01:00
Florian Diebold
d3a3e5abdf Ignore failing impl Trait tests 2020-01-27 21:38:10 +01:00
Florian Diebold
96ddf2962c Upgrade Chalk 2020-01-27 21:25:33 +01:00
bors[bot]
1916a78c6a
Merge #2914
2914: vscode-languageclient 6.1.0 r=matklad a=kjeremy

Adds client side support for proposed semantic highlighting extension

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-01-27 16:24:36 +00:00
kjeremy
1266810e55 vscode-languageclient 6.1.0
Adds support for proposed semantic highlighting extension
2020-01-27 10:25:22 -05:00
bors[bot]
e48adcb035
Merge #2913
2913: Update insta r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-01-27 14:55:09 +00:00
kjeremy
bcef1ddf63 Update insta 2020-01-27 09:52:34 -05:00
bors[bot]
87e1baf242
Merge #2910
2910: Use package script r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-01-27 13:50:04 +00:00
Jeremy Kolb
1b5b30f2ac
Update docs/user/README.md
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-01-27 08:49:34 -05:00
bors[bot]
1d729033eb
Merge #2883
2883: Implement Syntax Highlight inside macro call r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-27 13:36:26 +00:00
bors[bot]
4f9506416c
Merge #2887
2887: Initial auto import action implementation r=matklad a=SomeoneToIgnore

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

Adds an auto import action implementation.

This implementation is not ideal and has a few limitations:

* The import search functionality should be moved into a separate crate accessible from ra_assists.
This requires a lot of changes and a preliminary design. 
Currently the functionality is provided as a trait impl, more on that here: https://github.com/rust-analyzer/rust-analyzer/issues/2180#issuecomment-575690942

* Due to the design desicion from the previous item, no doctests are run for the new aciton (look for a new FIXME in the PR)

* For the same reason, I have to create the mock trait implementaion to test the assist

* Ideally, I think we should have this feature as a diagnostics (that detects an absense of an import) that has a corresponding quickfix action that gets evaluated on demand.
Curretly we perform the import search every time we resolve the import which looks suboptimal.
This requires `classify_name_ref` to be moved from ra_ide, so not done currently.

A few improvements to the imports mechanism to be considered later:

* Constants like `ra_syntax::SyntaxKind::NAME` are not imported, because they are not present in the database

* Method usages are not imported, they are found in the database, but `find_use_path` does not return any import paths for them

* Some import paths returned by the `find_use_path` method end up in `core::` or `alloc::` instead of `std:`, for example: `core::fmt::Debug` instead of `std::fmt::Debug`.
This is not an error techically, but still looks weird.

* No detection of cases where a trait should be imported in order to be able to call a method

* Improve `auto_import_text_edit` functionality: refactor it and move away from the place it is now, add better logic for merging the new import with already existing imports

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-01-27 13:04:53 +00:00
Kirill Bulatov
9be1ab7ff9 Code review fixes 2020-01-27 14:42:45 +02:00
bors[bot]
a108f22d83
Merge #2908
2908: Update crates r=matklad a=kjeremy

Updates insta to 0.13 and bumps everything else.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-01-27 11:21:54 +00:00
Kirill Bulatov
9a6b5c6183 Enforce alphabetical import sorting 2020-01-27 01:53:59 +02:00
Kirill Bulatov
1a78991df6 Adjust the tests 2020-01-27 00:57:24 +02:00