Commit graph

31 commits

Author SHA1 Message Date
Emil Lauridsen
4ec5f6e258 Change error output to make a bit more sense 2020-01-29 13:51:20 +01:00
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
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
Emil Lauridsen
fdc04ef920 Don't do check progress update for fresh crates 2020-01-28 14:33:52 +01:00
Laurențiu Nicola
c34571c19e Buffer reads from cargo check's stdout 2020-01-28 01:27:43 +02:00
Jeremy Kolb
6967472703 Move snaps to new naming scheme 2020-01-26 13:29:01 -05:00
Jeremy Kolb
b89991daed Update crates 2020-01-26 10:46:45 -05:00
Emil Lauridsen
05aa5b854b Remove RWLock from check watcher.
@matklad mentioned this might be a good idea.

So the general idea is that we don't really need the lock, as we can
just clone the check watcher state when creating a snapshot. We can then
use `Arc::get_mut` to get mutable access to the state from `WorldState`
when needed.

Running with this it seems to improve responsiveness a bit while cargo
is running, but I have no hard numbers to prove it. In any case, a
serialization point less is always better when we're trying to be
responsive.
2020-01-23 09:26:08 +01:00
kjeremy
ee7dd4b9ae Update crates 2020-01-22 15:40:35 -05:00
Emil Lauridsen
ade657cb66 Tweak naming slightly 2020-01-15 15:53:08 +01:00
Emil Lauridsen
478ba65f8d Manage check state updates in main_loop to reduce lock contention 2020-01-15 15:50:49 +01:00
Jeremy Kolb
e1688be1bb lsp-types 0.69.0
Stabilizes most proposed features
2020-01-15 08:05:42 -05:00
Emil Lauridsen
daca5a3711 Defer cargo check until after workspace load 2020-01-13 17:12:14 +01:00
Emil Lauridsen
480c44918c Disable cargo checking in workspaces with no cargo projects 2020-01-11 21:32:40 +01:00
Edwin Cheng
ff5883637c Fix unused import for windows in cargo_watch test 2020-01-04 01:18:46 +08:00
Jeremy Kolb
35d72e40e2 Update dependencies 2020-01-01 17:51:48 -05:00
Emil Lauridsen
167cbb7c4d Disable cargo_watch snapshot tests on windows 2020-01-01 23:21:35 +01:00
bors[bot]
be37c3369b
Merge #2681
2681: cargo-watcher: Resolve macro call site in more cases r=matklad a=kiljacken

This resolves the actual macro call site in a few more cases, f.x. when a macro invokes `compile_error!` (I'm looking at you `ra_hir_def::path::__path`).

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-29 21:40:42 +00:00
Emil Lauridsen
bca8524fa2 Add related information with original error site 2019-12-29 20:10:20 +01:00
Emil Lauridsen
96156b95b5 Resolve macro call site in more cases 2019-12-29 19:14:18 +01:00
Emil Lauridsen
0d69d23d2f Lowercase drive letters when getting paths from cargo check 2019-12-29 18:27:14 +01:00
Aleksey Kladov
e1d040a6a4 Reduce visibility 2019-12-29 15:07:53 +01:00
Emil Lauridsen
899dbebd02 Fix busy-waiting issue in main cargo watch thread 2019-12-27 17:29:02 +01:00
Emil Lauridsen
c732f215cb Don't finish main cargo watch thread when subprocess finishes. 2019-12-27 12:43:14 +01:00
Emil Lauridsen
ed84c85aef Fix shutdown behavoir of main cargo-watch thread.
Even though this didn't error, it became clear to me that it was closing
the wrong channel, resulting in the child thread never finishing.
2019-12-27 12:42:18 +01:00
Emil Lauridsen
59837c75f4 Add doc comment to module 2019-12-27 11:57:00 +01:00
Emil Lauridsen
4d33835a34 Cargo fmt run 2019-12-27 11:47:09 +01:00
Emil Lauridsen
02ce5bbf6b Shutdown/cancelation story for main cargo watch thread 2019-12-27 11:43:05 +01:00
Emil Lauridsen
a2d10694cc Consistent, hopefully robust, shutdown/cancelation story for cargo check subprocess 2019-12-27 11:32:05 +01:00
Emil Lauridsen
428a6ff5b8 Move cargo watch functionality to separate crate 2019-12-27 11:10:07 +01:00