Commit graph

585 commits

Author SHA1 Message Date
kjeremy
02903c8b60 Update crates
Documentation improvements
2020-05-13 08:44:15 -04:00
kjeremy
735fdebd87 Update crates 2020-05-12 16:49:42 -04:00
Aleksey Kladov
ded460146b ⬆️ ra_vfs
Fix a critical bug where \r\n line endings would accidentally sneak in
after in-memory overlay removal.
2020-05-11 00:52:11 +02:00
bors[bot]
a3dbd272e0
Merge #4406 #4410 #4411 #4417
4406: Update cargo-metadata r=matklad a=edwin0cheng

This PR update `cargo-metadata` to  0.10.0 and it also relax the` serde-derive` deps to 1.0 for tests in `proc-macro-srv`.

cc @robojumper 

r= @matklad  , I think you would have something to say related to https://github.com/serde-rs/json/issues/647#issue-593788429 ?





4410: Improve wording in comment r=matklad a=edwin0cheng



4411: do not remove then block when you unwrap else block #4361 r=matklad a=bnjjj

close #4361 

4417: Omit default types in HirDisplay SourceCode mode r=matklad a=TimoFreiberg

Closes #4390

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-05-10 17:37:07 +00:00
Edwin Cheng
2400d70442 Update cargo-metadata 2020-05-10 06:22:26 +08:00
Aleksey Kladov
ecff5dc141 Cleanup 2020-05-08 14:55:28 +02:00
Aleksey Kladov
6713be0b13 Rename ra_env -> ra_toolchain 2020-05-08 12:25:36 +02:00
bors[bot]
8295a9340c
Merge #4329
4329: Look for `cargo`, `rustc`, and `rustup` in standard installation path r=matklad a=cdisselkoen

Discussed in #3118.  This is approximately a 90% fix for the issue described there.

This PR creates a new crate `ra_env` with a function `get_path_for_executable()`; see docs there.  `get_path_for_executable()` improves and generalizes the function `cargo_binary()` which was previously duplicated in the `ra_project_model` and `ra_flycheck` crates.  (Both of those crates now depend on the new `ra_env` crate.)  The new function checks (e.g.) `$CARGO` and `$PATH`, but also falls back on `~/.cargo/bin` manually before erroring out.  This should allow most users to not have to worry about setting the `$CARGO` or `$PATH` variables for VSCode, which can be difficult e.g. on macOS as discussed in #3118.

I've attempted to replace all calls to `cargo`, `rustc`, and `rustup` in rust-analyzer with appropriate invocations of `get_path_for_executable()`; I don't think I've missed any in Rust code, but there is at least one invocation in TypeScript code which I haven't fixed.  (I'm not sure whether it's affected by the same problem or not.) a4778ddb7a/editors/code/src/cargo.ts (L79)

I'm sure this PR could be improved a bunch, so I'm happy to take feedback/suggestions on how to solve this problem better, or just bikeshedding variable/function/crate names etc.

cc @Veetaha 

Fixes #3118.

Co-authored-by: Craig Disselkoen <craigdissel@gmail.com>
Co-authored-by: veetaha <veetaha2@gmail.com>
2020-05-08 10:11:19 +00:00
kjeremy
88a45a2ee3 Update deps 2020-05-07 16:22:53 -04:00
Craig Disselkoen
3077eae2a6 use home crate instead of dirs 2020-05-07 12:06:44 -07:00
Craig Disselkoen
303b444dbb pull function out into new crate ra_env; use in ra_flycheck as well 2020-05-05 16:12:56 -07:00
Craig Disselkoen
ffaef1b7ae ra_project_model: look for Cargo in more places
See #3118
2020-05-05 16:12:56 -07:00
kjeremy
810c961961 Update crates 2020-05-01 18:26:42 -04:00
Laurențiu Nicola
1e20467c3a Bump deps 2020-05-01 15:29:03 +03:00
Laurențiu Nicola
1a2d4e2921 Add support for incremental text synchronization 2020-04-30 21:26:57 +03:00
kjeremy
61f1c0a990 lsp-types 0.74
* Fixes a bunch of param types to take partial progress into account.
* Will allow us to support insert/replace text in completions
2020-04-26 16:05:22 -04:00
Aleksey Kladov
bd9ede0ec9 Extract messy tree handling out of profiling code 2020-04-25 21:22:40 +02:00
Aleksey Kladov
e873469500 text-size 1.0.0 2020-04-25 12:15:32 +02:00
Aleksey Kladov
b1d5817dd1 Convert code to text-size 2020-04-25 11:59:18 +02:00
Aleksey Kladov
aa9a9d7ac5 ⬆️ crates (to bust the caches) 2020-04-24 02:58:21 +02:00
kjeremy
08e5654076 cargo update 2020-04-22 10:34:53 -04:00
Edwin Cheng
4a303366c8 Improve remove dervie attrs 2020-04-22 01:44:21 +08:00
Florian Diebold
0be68a4825 Update Chalk, and cache Chalk env elaboration through a query
This should fix some of the worst performance problems.
2020-04-20 19:16:01 +02:00
Jeremy Kolb
5c760a96b6 Update regex 2020-04-19 13:17:14 -04:00
Laurențiu Nicola
93fcf1c133 Use mmap for proc macro libs 2020-04-17 12:38:38 +03:00
bors[bot]
10d8cb913c
Merge #3958
3958: Add proc-macro related config and tests r=matklad a=edwin0cheng

This PR do the following things:

1. Add cli argument `proc-macro` for running proc-macro server.
2. Added support for proc-macro in bench and analysis-stats
3. Added typescript config for proc-macros
4. Added an heavy test for proc-macros. 

To test it out: 

1. run `cargo xtask install --proc-macro`
2. add `"rust-analyzer.cargo.loadOutDirsFromCheck": true"` and `"rust-analyzer.procMacro.enabled": true"` in vs code config.

[Edit] Change to use `rust-analyzer proc-macro` for running proc-macro standalone process.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-16 20:21:59 +00:00
Edwin Cheng
177becea98 Add proc-macro cli command for rust-analyzer 2020-04-16 21:13:57 +08:00
kjeremy
45b0826499 cargo update 2020-04-16 09:13:44 -04:00
Florian Diebold
e8d0d79a0c Update Chalk 2020-04-16 12:39:00 +02:00
bors[bot]
d61909f904
Merge #3964 #3965 #3967
3964: Nicer Chalk debug logs r=matklad a=flodiebold

I'm looking at a lot of Chalk debug logs at the moment, so here's a few changes to make them slightly nicer...

3965: Implement inline associated type bounds r=matklad a=flodiebold

Like `Iterator<Item: SomeTrait>`.

This is an unstable feature, but it's used in the standard library e.g. in the definition of Flatten, so we can't get away with not implementing it :)

(This is cherry-picked from my recursive solver branch, where it works better, but I did manage to write a test that works with the current Chalk solver as well...)

3967: Handle `Self::Type` in trait definitions when referring to own associated type r=matklad a=flodiebold

It was implemented for other generic parameters for the trait, but not for `Self`.

(Last one off my recursive solver branch 😄 )

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-15 09:19:46 +00:00
bors[bot]
9726401eae
Merge #3963
3963: Upgrade Chalk r=matklad a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-15 09:08:39 +00:00
kjeremy
eedab116ab insta 0.16 2020-04-14 13:57:02 -04:00
Florian Diebold
c216a93da7 Upgrade Chalk 2020-04-13 16:18:25 +02:00
Florian Diebold
2e7b88b525 Nicer display of projections in Chalk logs 2020-04-13 14:46:03 +02:00
bors[bot]
0ecdba20df
Merge #3920
3920: Implement expand_task and list_macros in proc_macro_srv r=matklad a=edwin0cheng

This PR finish up the remain `proc_macro_srv` implementation :

1. Added dylib loading code for proc-macro crate dylib. Note that we have to add some special flags for unix loading because of a bug in old version of glibc, see https://github.com/fedochet/rust-proc-macro-panic-inside-panic-expample/issues/1 and https://github.com/rust-lang/rust/issues/60593 for details.

2. Added tests for proc-macro expansion: We use a trick here by adding `serde_derive` to dev-dependencies and calling `cargo-metadata` for searching its dylib path, and expand it in our tests. 

[EDIT]
Note that this PR **DO NOT** implement the final glue code with rust-analzyer and proc-macro-srv yet.
 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-11 11:49:07 +00:00
kjeremy
51b1750cfa cargo update 2020-04-10 13:48:25 -04:00
Florian Diebold
a0a80a4103 Implement Chalk's debug methods using TLS
Chalk now panics if we don't implement these methods and run with CHALK_DEBUG,
so I thought I'd try to implement them 'properly'. Sadly, it seems impossible to
do without transmuting lifetimes somewhere. The problem is that we need a `&dyn
HirDatabase` to get names etc., which we can't just put into TLS. I thought I
could just use `scoped-tls`, but that doesn't support references to unsized
types. So I put the `&dyn` into another struct and put the reference to *that*
into the TLS, but I have to transmute the lifetime to 'static for that to work.
2020-04-10 15:04:06 +02:00
Edwin Cheng
460ddde176 Add tests 2020-04-10 02:05:54 +08:00
Edwin Cheng
f7f121d60d Add dylib loading code 2020-04-10 01:18:47 +08:00
Edwin Cheng
6af1015f74 Add rustc_server (ra_tt rustc bridge) 2020-04-09 12:22:45 +08:00
Josh Mcguigan
8c378af721 missing match arms diagnostic 2020-04-07 05:12:08 -07:00
Edwin Cheng
40616fdb49 Refactor deps 2020-04-06 23:07:48 +08:00
bors[bot]
972816b6d4
Merge #3843
3843: Remove rustc_lexer dependency in favour of rustc-ap-rustc_lexer r=est31 a=est31

The latter is auto-published on a regular schedule (Right now weekly).

See also https://github.com/alexcrichton/rustc-auto-publish

Co-authored-by: est31 <MTest31@outlook.com>
2020-04-06 08:42:52 +00:00
est31
2f6914824a Remove rustc_lexer dependency in favour of rustc-ap-rustc_lexer
The latter is auto-published on a regular schedule (Right now weekly).
2020-04-06 10:08:51 +02:00
bors[bot]
a93a04fc9e
Merge #3744
3744: Upgrade Chalk r=matklad a=flodiebold



Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-06 07:49:09 +00:00
kjeremy
66c20495e7 Update serde_json 2020-04-05 16:03:21 -04:00
Florian Diebold
952714685a Upgrade Chalk again
The big change here is counting binders, not
variables (https://github.com/rust-lang/chalk/pull/360). We have to adapt to the
same scheme for our `Ty::Bound`. It's mostly fine though, even makes some things
more clear.
2020-04-05 19:23:18 +02:00
Florian Diebold
3659502816 Upgrade Chalk 2020-04-05 19:23:18 +02:00
kjeremy
e37e8d52f1 Cargo update 2020-04-04 17:47:19 -04:00
est31
dc142152e6 Remove unused dependencies 2020-04-04 19:22:14 +02:00