Commit Graph

1135 Commits

Author SHA1 Message Date
Aleksey Kladov
37b7b56821 Make code less surprising
Theres no reason to have literal `\n\n` in the source code
2021-03-09 14:47:42 +03:00
Joshua Nelson
c7b0914b3f Add more documentation for rustc_private 2021-03-08 16:56:42 -05:00
bors[bot]
d57c9f7980
Merge #7891
7891: Improve handling of rustc_private r=matklad a=DJMcNab

This PR changes how `rust-analyzer` handles `rustc_private`. In particular, packages now must opt-in to using `rustc_private` in `Cargo.toml`, by adding:
```toml
[package.metadata.rust-analyzer]
rustc_private=true
```

This means that depending on crates which also use `rustc_private` will be significantly improved, since their dependencies on the `rustc_private` crates will be resolved properly.

A similar approach could be used in #6714 to allow annotating that your package uses the `test` crate, although I have not yet handled that in this PR.

Additionally, we now only index the crates which are transitive dependencies of `rustc_driver` in the `rustcSource` directory. This should not cause any change in behaviour when using `rustcSource: "discover"`, as the source used then will only be a partial clone. However, if `rustcSource` pointing at a local checkout of rustc, this should significantly improve the memory usage and lower indexing time. This is because we avoids indexing all crates in `src/tools/`, which includes `rust-analyzer` itself.

Furthermore, we also prefer named dependencies over dependencies from `rustcSource`. This ensures that feature resolution for crates which are depended on by both `rustc` and your crate uses the correct set for analysing your crate.

See also [introductory zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Fixed.20crate.20graphs.20and.20optional.20builtin.20crates/near/229086673)

I have tested this in [priroda](https://github.com/oli-obk/priroda/), and it provides a significant improvement to the development experience (once I give `miri` the required data in `Cargo.toml`)

Todo:
- [ ] Documentation

This is ready to review, and I will add documentation if this would be accepted (or if I get time to do so anyway)

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2021-03-08 16:51:20 +00:00
Daniel McNab
20007fd3a8 Document rustc_private in metadata 2021-03-08 16:47:40 +00:00
Daniel McNab
bbecea03fd Revert "Support disabling rustc build scripts"
This reverts commit ddce6bb282.
2021-03-08 16:37:52 +00:00
Aleksey Kladov
c7b5d6be4c Make code completion "just work" in more cases 2021-03-08 14:57:56 +03:00
bors[bot]
13982e4ee4
Merge #7901
7901: Make extension respect http proxy settings r=matklad a=kamyuentse

This patch makes vscode extension respect proxy settings when fetching release metadata and rust-analyzer binary.

Co-authored-by: Kam Y. Tse <kevin.xjy@gmail.com>
2021-03-08 09:41:21 +00:00
Daniel McNab
ddce6bb282 Support disabling rustc build scripts 2021-03-08 09:05:19 +00:00
Kam Y. Tse
77b7c96aea
Make extension respect http proxy settings 2021-03-07 18:21:48 +08:00
asv
96fc01a30b Make group imports configurable 2021-03-07 10:15:17 +02:00
Aleksey Kladov
3d80e0a154 Migrate to user-centric config name for cargo check stuff 2021-03-04 15:38:53 +03:00
cgiguere
3df8df23c6 clean uo rustup link 2021-03-01 15:19:30 -05:00
cgiguere
0b1981baf5 add sponsor links 2021-03-01 15:07:36 -05:00
Charles Giguere
a0de1723bd
Add more information to VSCode extenstion README
A lot of these are duplicated from the documentation or main README. While it's unfortunate to have duplicated information, the current VSCode page is very barebones and doesn't offer much confidence. 

This updated README offers a few more links and follows a structure similar to the official rust extension and other popular vscode extensions. The additions are, as much as possible specific to the vscode extension and not rust-analyzer as a LSP.

The note about not using the official extension is also right there at the top because that's a common issue people have when trying it out. 

I added the sponsor section since it's common in other extensions README, but I'm not sure if it's necessary
2021-03-01 14:47:54 -05:00
Lukas Wirth
91ff47ef6a Update vscode README with a small features list 2021-03-01 11:08:26 +01:00
kjeremy
c3ab200114 Update our vscode npm packages 2021-02-23 11:39:19 -05:00
Laurențiu Nicola
23a8fc5284 Try to detect musl distros in the Code extension 2021-02-20 18:44:28 +02:00
kjeremy
a403be6456 Remove Semantic Tokens flicker workaround
https://github.com/microsoft/vscode-languageserver-node/issues/576 has been closed with
the latest vscode-languageclient release.
2021-02-16 16:27:30 -05:00
kjeremy
13008c4d30 vscode-languageclient 7.1.0-next.2 2021-02-16 16:23:37 -05:00
kjeremy
338c08f13e Use npm 7.x package-lock.json 2021-02-16 15:48:27 -05:00
Jeremy Kolb
8105418b25 Start LSP 3.17 support 2021-02-14 14:51:29 -05:00
bors[bot]
d50a37d3aa
Merge #7643 #7663
7643: Automatically detect the rustc-src directory (fixes #3517) r=matklad a=bnjbvr

If the configured rustcSource was not set, then try to automatically
detect a source for the sysroot rustc directory.

I wasn't sure how to do it in the case of the project.json file, though.

7663: Tolerate spaces in nix binary patching r=matklad a=CertainLach

If path to original file contains space (I.e on code insiders, where
default data directory is ~/Code - Insiders/), then there is syntax
error evaluating src arg.

Instead pass path as str, and coerce to path back in nix expression

Co-authored-by: Benjamin Bouvier <public@benj.me>
Co-authored-by: Yaroslav Bolyukin <iam@lach.pw>
2021-02-14 15:42:07 +00:00
Yaroslav Bolyukin
471795b019
fix: tolerate spaces in nix binary patching
If path to original file contains space (I.e on code insiders, where
default data directory is ~/Code - Insiders/), then there is syntax
error evaluating src arg.

Instead pass path as str, and coerce to path back in nix expression

Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
2021-02-13 23:11:00 +03:00
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
bors[bot]
82a1b91f20
Merge #7625
7625: Add **Copy Run Command Line** command for vscode r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-02-10 11:38:56 +00:00
Aleksey Kladov
97166e2ad9 Add **Copy Run Command Line** command for vscode
This is useful when you want to, e.g., run a specific test in a terminal
with `--release`.
2021-02-10 14:37:27 +03:00
bors[bot]
ff5ef2830c
Merge #7591 #7622
7591: Fix/no floating promises r=matklad a=sahandevs

closes #3515

- added `@typescript-eslint/no-floating-promises: error` rule
- changed `"no-console": ["error"]` to `"no-console": ["error", { allow: ["warn", "error"] }]` (we at least log the error messages of the floating promises)
- fixed lint/compile errors

7622: Resolve TupleStructPat in SourceAnalyzer::resolve_path r=Veykril a=Veykril

Closes #7594
bors r+

Co-authored-by: Sahandevs <sahandevs@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-10 08:44:53 +00:00
Aleksey Kladov
0f324bac6b Fix highlighting of injected attributes 2021-02-09 17:41:12 +03:00
Sahandevs
91dd61b9a6 use await instead 2021-02-09 17:42:46 +03:30
Sahandevs
2f82a84d2a fix errors 2021-02-07 22:06:16 +03:30
Sahandevs
3a0234d60f format 2021-02-07 21:59:06 +03:30
Sahandevs
1bb4e973ff handle Thenable type rejects 2021-02-07 21:52:32 +03:30
Sahandevs
1d0e93b58e handle promise catches 2021-02-07 21:27:21 +03:30
Sahandevs
eb69f67ab7 add no-floating-promises rule 2021-02-07 21:18:15 +03:30
Sahandevs
06c02021a3 remove unnecessary 2021-02-07 21:15:13 +03:30
Lukas Wirth
fb2b1f5ea6 Fix resolveCodeAction trying to edit files before creating them 2021-02-05 21:33:37 +01:00
Edwin Cheng
35310f1032 Update vscode for new status 2021-01-29 01:04:14 +08:00
Aleksey Kladov
2870e70163 Add config option to ignore directories 2021-01-26 16:45:54 +03:00
Aleksey Kladov
c04b561e7e Remove the need to manually sync config in package.json 2021-01-26 16:22:24 +03:00
Laurențiu Nicola
03a1da9d46 Simplify file download code 2021-01-25 19:12:54 +02:00
bors[bot]
83231dd987
Merge #7409 #7421
7409: Add References CodeLens. r=matklad a=vsrs

Closes #5836

7421: Fix RA_LOG example in dev docs r=lnicola a=lnicola

bors r+

Co-authored-by: vsrs <vit@conrlab.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-25 11:18:58 +00:00
Laurențiu Nicola
5bd84716ed Code: reduce progress notification spam 2021-01-25 10:05:38 +02:00
vsrs
3618c4e0d3 Add References code lens.
For Struct, Enum, Union and Trait symbols.
2021-01-23 16:56:20 +03:00
Laurențiu Nicola
a19728604f Download aarch64-unknown-linux-gnu from GitHub 2021-01-17 16:35:57 +02:00
Laurențiu Nicola
1749a78ada Fix server path comparison 2021-01-14 15:38:57 +02:00
bors[bot]
aa9bef0797
Merge #7194
7194: Don't update the server if managed by the user r=matklad a=lnicola

Fixes #7187

CC @figsoda

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-07 14:39:50 +00:00
Laurențiu Nicola
c547ec1cd6 Don't update the server if managed by the user 2021-01-07 16:37:08 +02:00
Aleksey Kladov
037caec62c Use american spelling for config
As per

171c3c08fe/docs/dev/style.md (variable-naming)

Also implement config aliasing, for pain-free settings migrations in the future
2021-01-07 15:07:19 +03:00
Aleksey Kladov
f7a15b5cd1 More maintainable config
Rather than eagerly converting JSON, we losslessly keep it as is, and
change the shape of user-submitted data at the last moment.

This also allows us to remove a bunch of wrong Defaults
2021-01-06 15:39:28 +03:00
Aleksey Kladov
01a5b83562 Rename extension config 2021-01-04 18:41:24 +03:00