Commit graph

848 commits

Author SHA1 Message Date
Aleksey Kladov
b8a6ea5ab5 feat: make join lines behavior configurable
closes #9492
2021-07-05 23:47:20 +03:00
Aleksey Kladov
f34762abb7 internal: better factoring for to_proto::completion
One source completion can produce up to two lsp completions.
Additionally, `preselct` and `sort_text` are global properties of the
whole set of completions, so the right granularity here is to convert
many completions.

As a side-benefit, we no loger allocate intermediate vec.
2021-07-04 14:08:33 +03:00
Aleksey Kladov
3be9ebe2c3 minor: style 2021-07-04 12:48:29 +03:00
Aleksey Kladov
58d2ece88a internal: overhaul code generation
* Keep codegen adjacent to the relevant crates.
* Remove codgen deps from xtask, speeding-up from-source installation.

This regresses the release process a bit, as it now needs to run the
tests (and, by extension, compile the code).
2021-07-03 22:11:03 +03:00
Jonas Schievink
5f13fb9db9 Add "View Crate Graph (Full)" 2021-07-02 00:10:33 +02:00
bors[bot]
37dc2dfada
Merge #9348
9348: output to log file if RA_LOG_FILE is defined in environment r=rezural a=rezural

This adds a check for RA_LOG_FILE, and logs to that if defined. It currently overrides flags.log_file. If this is undesirable, I will add a check.

Co-authored-by: rezural <rezural@protonmail.com>
2021-06-21 21:42:02 +00:00
rezural
ceeee5e3c6 add documentation of RA_LOG_FILE 2021-06-22 07:28:33 +10:00
bors[bot]
25bf451c84
Merge #9264
9264: feat: Make documentation on hover configurable r=Veykril a=Veykril

This also implements deprecation support for config options as this renames `hoverActions_linksInHover` to `hover_linksInHover`.

Fixes #9232

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-21 14:15:49 +00:00
Lukas Wirth
43098d99ae Remove deprecation support in config 2021-06-21 16:15:25 +02:00
bors[bot]
b48aba0090
Merge #9227
9227: Add a config setting to disable the 'test' cfg in specified crates r=matklad a=lf-

If you are opening libcore from rust-lang/rust as opposed to e.g.
goto definition from some other crate which would use the sysroot
instance of libcore, a `#![cfg(not(test))]` would previously have made
all the code excluded from the module tree, breaking the editor
experience.

Core does not need to ever be edited with `#[cfg(test)]` enabled,
as the tests are in another crate.

This PR puts in a slight hack that checks for the crate name "core" and
turns off `#[cfg(test)]` for that crate.

Fixes #9203 
Fixes #9226 

Co-authored-by: Jade <software@lfcode.ca>
2021-06-21 13:41:27 +00:00
rezural
530ee4ff8a
add note about passing cfg(debug_assertions)
add note about passing cfg(debug_assertions) to rustc on build. The server will not spin without this arcane hack
2021-06-20 11:23:20 +10:00
Jade
8b77e2692c Implement a config override for the default #[cfg(test)] in cargo crates
Fixes crates which vanish when the 'test' cfg atom is set.

Fix #7243.
Fix #9203.
Fix #7225.
2021-06-19 01:09:19 -07:00
Lukas Wirth
2ee090faaf Allow to disable import insertion on single path glob imports 2021-06-18 23:11:56 +02:00
bors[bot]
2980fd430d
Merge #9267 #9279
9267: fix: Code: update the LSP server without asking r=matklad a=lnicola

Most LSP extensions seem to do the same thing, and this is causing some
confusion for users who don't notice the update prompt before Code hides
it.

9279: minor: Document installation via Homebrew r=matklad a=Svetlitski

`rust-analyzer` can be installed via [Homebrew](https://brew.sh) (AKA`brew`) on macOS. I've added instructions on how to do so to the documentation. Additionally, I added a `.gitignore` rule to ignore the HTML documentation produced by  `asciidoctor manual.adoc` so that it is not accidentally checked into `git`.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Kevin Svetlitski <kevin_svetlitski@berkeley.edu>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-15 20:45:54 +00:00
Aleksey Kladov
78668f76a0
Update docs/user/manual.adoc 2021-06-15 23:40:07 +03:00
Laurențiu Nicola
cbf53ba251 Consolidate the privacy notes 2021-06-15 20:07:59 +03:00
Aleksey Kladov
3f4ad44082 internal: document that we don't #[ignore] tests 2021-06-15 11:46:47 +03:00
Kevin Svetlitski
76202234a9 Document installation via Homebrew; Add gitignore entry for asciidoctor output 2021-06-14 16:41:34 -05:00
Lukas Wirth
178b5ffba3 Add configuration deprecation 2021-06-14 15:49:57 +02:00
Lukas Wirth
a93d166f0f Make documentation on hover configurable 2021-06-14 15:25:10 +02:00
Jade
e23cfeac71
Fix typo in env-var quoting 2021-06-14 00:38:28 -07:00
Florian Diebold
0290b61b1b
Further clarification 2021-06-07 14:50:03 +02:00
Florian Diebold
b649376edc
One additional grammar fix 2021-06-07 14:43:58 +02:00
Florian Diebold
fc2d286dae
Clarify label documentation
Also some other cleanups while I'm there.
2021-06-07 14:34:41 +02:00
Lukas Wirth
07394316ff Add function references hover action 2021-06-04 15:54:55 +02:00
Jonas Schievink
9fdb8f9037 Make it opt-in 2021-06-03 18:09:21 +02:00
mjkalyan
508d1230d8
manual.adoc: add Gentoo Linux installation method
Added installation instructions for the binary ebuild of the "latest" `rust-analyzer` in Gentoo's GURU repository.
2021-06-03 00:16:23 -06:00
Lukas Wirth
d304352407 Document that addCallArgumentSnippets requires `addCallParenthesis 2021-06-02 22:10:09 +02:00
Aleksey Kladov
5e577a6373 minor: expand docs a tiny bit 2021-05-31 17:27:27 +03:00
Lukas Wirth
fb7105a580 Add config setting for self-on-the-fly 2021-05-31 15:14:56 +02:00
Lucas Schwiderski
9a057c0ff4
Fix incorrect setting descriptions
Descriptions for diagnostic warning hint and info display were swapped.

Fixes #8485.

Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
2021-05-29 18:08:14 +02:00
Aleksey Kladov
cabb679cbb internal: explain the motivation behind early configuration 2021-05-27 11:16:14 +03:00
bors[bot]
835cf55887
Merge #8767
8767: implement range formatting r=matklad a=euclio

Fixes #7580.

This PR implements the `textDocument/rangeFormatting` request using `rustfmt`'s `--file-lines` option.

Still needs some tests. What I want to know is how I should handle the instability of the `--file-lines` option. It's still unstable in rustfmt, so it's only available on nightly, and needs a special flag to enable. Is there a way for `rust-analyzer` to detect if it's using nightly rustfmt, or for users to opt-in?

Co-authored-by: Andy Russell <arussell123@gmail.com>
2021-05-25 12:15:48 +00:00
Laurențiu Nicola
400cf10299 Update download instructions 2021-05-24 17:57:20 +03:00
Christoph Schmatzler
9f8f7a8053 docs: fix binary installation instructions
issue #8926 removed uncompressed release artifacts. This updates the documentation to update instructions accordingly.
2021-05-24 16:38:33 +02:00
Andy Russell
a90b9a5872
implement range formatting 2021-05-23 15:50:36 -04:00
sim
fe93c114e3
docs(manual): Add rust-tools.nvim to nvim-lsp 2021-05-22 21:17:40 -07:00
Jonas Schievink
3360053312 Update lsp-extensions.md 2021-05-22 00:03:36 +02:00
Lukas Tobias Wirth
066856ab5b Update outdated auto-import documentation 2021-05-20 15:31:33 +02:00
bors[bot]
8bb37737c9
Merge #8873
8873: Implement import-granularity guessing  r=matklad a=Veykril

This renames our `MergeBehavior` to `ImportGranularity` as rustfmt has it as the purpose of them are basically the same. `ImportGranularity::Preserve` currently has no specific purpose for us as we don't have an organize imports assist yet, so it currently acts the same as `ImportGranularity::Item`.

We now try to guess the import style on a per file basis and fall back to the user granularity setting if the file has no specific style yet or where it is ambiguous. This can be turned off by setting `import.enforceGranularity` to `true`.

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

Co-authored-by: Lukas Tobias Wirth <lukastw97@gmail.com>
2021-05-20 08:27:16 +00:00
Lukas Tobias Wirth
b4fe479236 Replace ImportGranularity::Guess with guessing boolean flag 2021-05-19 15:57:10 +02:00
Aleksey Kladov
1fd31f7f4c feat: allow clients to feature detect symbol filtering 2021-05-19 13:28:58 +03:00
alcroito
1f7d2a6c22 Add new LSP extension for workspace symbol lookup
The new extension allows filtering of workspace symbool lookup
results by search scope or search kind.

Filtering can be configured in 3 different ways:

 - The '#' or '*' markers can be added inline with the symbol lookup
   query.

   The '#' marker means symbols should be looked up in the current
   workspace and any dependencies. If not specified, only current
   workspace is considered.

   The '*' marker means all kinds of symbols should be looked up
   (types, functions, etc). If not specified, only type symbols are
   returned.

 - Each LSP request can take an optional search_scope or search_kind
   argument query parameter.

 - Finally there are 2 global config options that can be set for all
   requests served by the active RA instance.

Add support for setting the global config options to the VSCode
extension.
The extension does not use the per-request way, but it's useful for
other IDEs.

The latest version of VSCode filters out the inline markers, so
currently the only reasonable way to use the new functionality is
via the global config.
2021-05-18 00:40:30 +02:00
Aleksey Kladov
41510f437e minor: adjust config name 2021-05-17 18:37:06 +03:00
bors[bot]
f9d4a9eaee
Merge #8795
8795: Allow semantic tokens for strings to be disabled r=matklad a=djrenren

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7111

Pretty straightforward change, but open to any suggestions if there's a more recommended testing strategy than what I went with.

Co-authored-by: John Renner <john@jrenner.net>
2021-05-17 14:41:56 +00:00
Aleksey Kladov
e22b21e1bb minor: and one more recipe for ace 2021-05-17 11:22:59 +03:00
Aleksey Kladov
0650f77dd9 internal: remove one more immutable tree 2021-05-14 16:19:27 +03:00
Aleksey Kladov
ad0648dc95 Cleanup imports 2021-05-13 13:44:47 +03:00
Jonas Schievink
b8d40a02a9 Document viewCrateGraph request 2021-05-11 16:45:51 +02:00
John Renner
7ae3967e57 Formatting and docs 2021-05-10 13:34:09 -07:00
Lukas Wirth
59c2efe4b6 Update docs 2021-05-10 22:10:12 +02:00
Aleksey Kladov
078c8f7488 fix: fix manual rendering
We add `// see the other repo` comments before headers (==). This one isn't a header, but a closing of the example block.
2021-05-10 15:43:01 +03:00
Aleksey Kladov
ca0aef2f3f feat: make troubleshooting a top-level section 2021-05-08 13:48:25 +03:00
Aleksey Kladov
a191b24fec feat: friendlier trouble shooting guide 2021-05-08 13:18:25 +03:00
Méven Car
b39578d816 docs: Add Kate installation section 2021-05-08 07:33:24 +02:00
Aleksey Kladov
0fce38b138 fix: direct people to the right repository 2021-05-08 00:26:29 +03:00
Aleksey Kladov
d4a51241ce internal: explain why sentence-per-line 2021-05-06 17:40:36 +03:00
Aleksey Kladov
3f6980e4e1 simplify macro expansion code
Using `Option` arguments such that you always pass `None` or `Some` at
the call site is a code smell.
2021-05-04 22:41:46 +03:00
bors[bot]
a2349366b5
Merge #8482
8482:  Mention how to customize unsafe operation styles r=matklad a=danielzfranklin

I was confused about how to do this, so I filed #8474. I apologize for initially filing this incorrectly and spamming people.

Co-authored-by: Daniel Franklin <daniel@danielzfranklin.org>
2021-05-03 16:57:51 +00:00
Daniel Franklin
13e9fb73f9
Merge with semantic style section 2021-05-03 17:54:09 +01:00
Aleksey Kladov
5c1a901035 internal: ensure that client and server-side configs are not mixed up
https://github.com/rust-lang/rust/issues/84647 would help big time here.
2021-04-28 13:13:30 +03:00
Jorge Mederos Alvarado
c4dba4077f Add config options 2021-04-26 20:29:54 -04:00
bors[bot]
576f50637c
Merge #8605
8605: internal: Automatically categorize the changelog entries r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-22 17:35:41 +00:00
bors[bot]
d1c9bd134d
Merge #8621
8621: feat: make sure nightly regressions don't break users r=lnicola a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-22 08:29:01 +00:00
Aleksey Kladov
27073f4fc3 feat: make sure nightly regressions don't break users 2021-04-22 11:15:20 +03:00
James Leitch
72718bc2d7 Code review feedback. 2021-04-21 15:10:53 -07:00
James Leitch
9fcad82980 Diagnostic Remap Path Prefixes added. 2021-04-21 15:10:53 -07:00
Laurențiu Nicola
39ce393a9e Automatically categorize the changelog entries 2021-04-20 19:54:58 +03:00
bors[bot]
1834938d6f
Merge #8598
8598: minor: fix ugly line wrapping in the rendered manual r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-20 07:45:04 +00:00
Aleksey Kladov
0ce591d33d minor: fix ugly line wrapping in the rendered manual 2021-04-20 10:44:06 +03:00
bors[bot]
15b34667c5
Merge #8588
8588: internal: Add guidelines for release notes PR descriptions r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-19 18:38:34 +00:00
Laurențiu Nicola
bb4952da04 internal: Add guidelines for release notes PR descriptions 2021-04-19 21:30:44 +03:00
Aleksey Kladov
dcb759b727 Remove confusion around serverStatusNotification 2021-04-19 18:12:25 +03:00
Aleksey Kladov
e5d91e8992 Fix spec bug 2021-04-19 17:55:51 +03:00
Aleksey Kladov
453b9cf6f0 Update docs/dev/README.md
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2021-04-19 16:08:50 +03:00
Aleksey Kladov
ad24310d41 internal: document review requesting etiquette
* don't feel obliged to quickly review every PR assigned to you
* so that other folks can notify you about interesting PRs without
  thinking to much about creating additional work for you
2021-04-19 16:08:49 +03:00
Lukas Wirth
b501b59eda Update lsp-extensions docs 2021-04-18 12:50:44 +02:00
Jonas Schievink
93128efef8 Fix markdown links 2021-04-15 19:45:07 +02:00
bors[bot]
3af303600a
Merge #8510 #8533
8510: Move cursor position when using item movers r=jonas-schievink a=jonas-schievink

This updates the cursor position when moving items around to stay in the same location within the moved node.

I changed the `moveItem` response to `SnippetTextEdit[]`, since that made more sense to me (the file was ignored by the client anyways, since the edits always apply to the current document). It also matches `onEnter`, which seems logical to me, but please let me know if this doesn't make sense.

There's still a bug in the client-side snippet code that will cause the cursor position to be slightly off when moving parameters in the same line (presumably we don't track the column correctly after deleting `$0`). Not really sure how to fix that immediately, but this PR should already be an improvement despite that bug.

8533: Fix typo in style guide r=jonas-schievink a=jonas-schievink

Fixes bold text rendering

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-15 16:42:36 +00:00
Jonas Schievink
6e575d8c73 Fix typo in style guide 2021-04-15 18:38:52 +02:00
Jonas Schievink
30aae2cefb Move cursor position when using item movers 2021-04-14 00:03:04 +02:00
bors[bot]
9beed98f2a
Merge #8432
8432: decl_check: consider outer scopes' allows r=jonas-schievink a=lf-

Fix #8417. Also makes it less noisy about no_mangle annotated stuff the
user can do nothing about.

Note: this still is broken with bitfield! macros. A repro in an ignore
test is included here. I believe this bug is elsewhere, and I don't
think I can work around it here.

I would like help filing the remaining bug, as it does actually affect
users, but I don't know how to describe the behaviour (or even if it
is unintended).

Co-authored-by: Jade <software@lfcode.ca>
2021-04-13 12:02:26 +00:00
Aleksey Kladov
db2a989565 internal: don't use #[should_panic] for tests 2021-04-13 12:21:59 +03:00
Aleksey Kladov
c8f48f50b3 internal: clarify who a rls-2.0 wg 2021-04-12 19:19:16 +03:00
Daniel Franklin
23429a08d5
Mention how to customize unsafe operation styles
I was confused about how to do this, so I filed [an issue][issue].

[issue]: rust-analyzer/rust-analyzer#8474
2021-04-12 16:18:04 +01:00
Aleksey Kladov
186c5c47cb feat: avoid checking the whole project during initial loading 2021-04-12 15:29:31 +03:00
Jade
4529f1be81 decl_check: consider outer scopes' allows
Fix #8417. Also makes it less noisy about no_mangle annotated stuff the
user can do nothing about.

Note: this still is broken with bitfield! macros. A repro in an ignore
test is included here. I believe this bug is elsewhere, and I don't
think I can work around it here.
2021-04-08 14:43:19 -07:00
Laurențiu Nicola
7221188b0d Remove extra bracket in architecture docs 2021-04-08 17:51:19 +03:00
Kirill Bulatov
e785672f15 Adjust fixture docs a bit 2021-04-06 21:42:27 +03:00
Kirill Bulatov
b5f3815aee Small grammar fixes 2021-04-06 21:42:27 +03:00
Kirill Bulatov
d5bedf8d6d Update Zulip link and macro privacy statement 2021-04-06 21:42:27 +03:00
Aleksey Kladov
658776d4ed internal: document broken windows 2021-04-06 20:11:42 +03:00
Aleksey Kladov
8fe20b19d4 More robust status notifications 2021-04-06 15:45:31 +03:00
Aleksey Kladov
a01fd1af19 internal: explain "extract if condition" refactoring 2021-04-05 13:02:47 +03:00
sim
d542a2b463
docs: Fix moveItem method name 2021-04-04 11:49:32 -07:00
Aleksey Kladov
636c3c49d2 internal: document style for helper functions and variables 2021-04-02 14:52:00 +03:00
Aleksey Kladov
27b779d1fd internal: document Cargo.lock maintenance process 2021-04-02 13:59:36 +03:00
Aleksey Kladov
ff8142d47e internal: touch up dev readme 2021-03-30 13:30:38 +03:00
PSeitz
14a1f0ce46
remove enumeration 2021-03-29 22:09:04 +02:00
PSeitz
3153a80261
update vim ycm installation instruction 2021-03-29 21:31:29 +02:00
Aleksey Kladov
b352b90c86 internal: make --log-file more discoverable 2021-03-29 15:11:31 +03:00
Laurențiu Nicola
ea8159893a Mention the rustup version in the manual 2021-03-27 12:39:16 +02:00
Thiébaud Weksteen
1c68954a7d Fix manual description for rust_project.json 2021-03-25 10:02:16 +01:00
Kirill Bulatov
5e83a56dfb Bump the default hint length 2021-03-23 19:43:55 +02:00
Kirill Bulatov
f1e1a2c0a7 Limit the hints size by default 2021-03-23 19:04:48 +02:00
bors[bot]
d4fa6721af
Merge #8054
8054: Item movers r=matklad a=ivan770

Closes #6823

https://user-images.githubusercontent.com/14003886/111331579-b4f43480-8679-11eb-9af0-e4dabacc4923.mp4

Implementation issues:
- [ ] Most of items are non-movable, since _movability_ of any item has to be determined manually. Common ones are movable though
- [x] Cursor should move with the item

Co-authored-by: ivan770 <leshenko.ivan770@gmail.com>
2021-03-22 13:08:45 +00:00
bors[bot]
6f1f91cdcf
Merge #8136 #8146
8136: Introduce QuantifiedWhereClause and DynTy analogous to Chalk r=flodiebold a=flodiebold

This introduces a bunch of new binders in lots of places, which we have to be careful about, but we had to add them at some point. There's a lot of skipping of the binders; once we're done with the Chalk move, we should review the remaining ones.

8146: Document patch policy r=matklad a=matklad

bors r+
🤖

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-22 12:08:25 +00:00
Aleksey Kladov
79b4c89b89
Update docs/dev/README.md
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2021-03-22 15:08:04 +03:00
Aleksey Kladov
aab148f943 Document patch policy 2021-03-22 14:59:56 +03:00
Aleksey Kladov
2469af3017
Apply suggestions from code review
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2021-03-22 13:56:13 +03:00
Aleksey Kladov
2b427fa3dd
Update docs/user/manual.adoc
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-03-22 13:55:16 +03:00
Aleksey Kladov
63e083122c Document our security stance
changelog: feature
2021-03-22 13:53:00 +03:00
Aleksey Kladov
670964d802
Update docs/user/manual.adoc 2021-03-18 18:57:44 +03:00
Mickael Istria
c0425cbdbd Update info about Eclipse Corrosion 2021-03-18 16:22:54 +01:00
ivan770
7d60458495
Item up and down movers 2021-03-18 11:22:27 +02:00
Aleksey Kladov
30dea3a727 Prefer match to if let else 2021-03-16 10:51:05 +03:00
Aleksey Kladov
469b739c28 Enable proc-macros by default 2021-03-15 18:19:08 +03:00
Laurențiu Nicola
dd9974c59d Fix cargo xtask lint references 2021-03-14 15:24:34 +02:00
bors[bot]
7accf6bc37
Merge #7799
7799: Related tests r=matklad a=vsrs

![tests](https://user-images.githubusercontent.com/62505555/109397453-a9013680-7947-11eb-8b11-ac03079f7645.gif)
This adds an ability to look for tests for the item under the cursor: function, constant, data type, etc

The LSP part is bound to change. But the feature itself already works and I'm looking for a feedback :)



Co-authored-by: vsrs <vit@conrlab.com>
2021-03-13 13:50:35 +00:00
Lukas Wirth
ebf4448f78 Fix remaining references to cargo xtask codegen 2021-03-12 15:10:33 +01:00
vsrs
49cdb2452a Fix LSP extensions documentation 2021-03-11 17:59:27 +03:00
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
bors[bot]
844b7f7411
Merge #7927
7927: Add more documentation for rustc_private r=matklad a=jyn514



Co-authored-by: Joshua Nelson <jyn514@gmail.com>
2021-03-09 11:22:37 +00:00
Aleksey Kladov
5b2b310827 Clarify that all caps are experimental 2021-03-09 12:02:20 +03:00
Joshua Nelson
c7b0914b3f Add more documentation for rustc_private 2021-03-08 16:56:42 -05:00
Laurențiu Nicola
fc9eed4836 Use upstream cov-mark 2021-03-08 22:19:44 +02:00
Aleksey Kladov
9faf8dd69a Hygiene is an internal implementation detail of the compiler 2021-03-08 22:14:52 +03:00
Aleksey Kladov
1eb61203b7 Make code generation just work
Contributors don't need to learn about `cargo xtask codegen` if `cargo
test` just does the right thing.
2021-03-08 21:45:37 +03: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
Daniel McNab
ddce6bb282 Support disabling rustc build scripts 2021-03-08 09:05:19 +00:00
bors[bot]
d54e1157b6
Merge #7889
7889: Make group imports configurable r=lnicola a=asv1



Co-authored-by: asv <asv7c2@gmail.com>
2021-03-07 08:24:02 +00:00
asv
96fc01a30b Make group imports configurable 2021-03-07 10:15:17 +02:00
Florian Diebold
d6094c70fb Add a line about code action commands to the CoC section of the docs 2021-03-06 11:35:04 +01:00
bors[bot]
16a76aa158
Merge #7868
7868: Migrate to user-centric config name for `cargo check` stuff r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-04 12:39:36 +00:00
Aleksey Kladov
3d80e0a154 Migrate to user-centric config name for cargo check stuff 2021-03-04 15:38:53 +03:00
Aleksey Kladov
e15621482c Clarify comparison rule 2021-03-03 11:23:05 +03:00
Aleksey Kladov
979c26e1ae Axe pre-commit 2021-03-01 21:30:21 +03:00
Vincent Esche
c4e2f32d73 Fixed remaining references to AnalysisChange (now: Change)
(The type was renamed/moved in 8716c4cec3)
2021-02-28 12:57:41 +01:00
vsrs
5e88436517 Update lsp-extensions.md 2021-02-27 21:07:58 +03:00
boxdot
9b78a6f6d2
Fix typo. 2021-02-24 11:56:48 +01:00
azzamsa
ae50b18503 Fix typos 2021-02-20 17:53:19 +07:00
Aleksey Kladov
3f09e3fba6 document offsets 2021-02-16 19:22:09 +03: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
ivan770
13e9d9809a
Remove CodeLensResolveData mention from lsp-extensions.md 2021-02-13 19:36:29 +02: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
ivan770
185da286d2
Moved CodeLens to ide crate 2021-02-13 13:07:47 +02:00
Laurențiu Nicola
8814d1368d Include a commit log summary in the changelog 2021-02-12 19:53:58 +02:00
bors[bot]
777d936c17
Merge #7653
7653: Document config pattern r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-02-12 15:10:50 +00:00
Aleksey Kladov
799810eaaa Document config pattern 2021-02-12 18:10:16 +03: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
Aleksey Kladov
d932812134 Use track caller in test documentation 2021-02-10 11:26:48 +03:00
Aleksey Kladov
4b1279d0b1 Infra for "unit" benchmarking 2021-02-09 20:25:39 +03:00
Aleksey Kladov
ad7b0f670a Add emacs guide 2021-02-08 19:08:02 +03:00
bors[bot]
433ad23988
Merge #7592
7592: [Doc] Note about Eclipse IDE support r=lnicola a=mickaelistria



Co-authored-by: Mickael Istria <mistria@redhat.com>
2021-02-08 09:16:01 +00:00
Mickael Istria
7e0854ec57 [Doc] Note about Eclipse IDE support 2021-02-08 09:52:46 +01:00
Ilya Bobyr
9ffe4ca26c Vim docs: vim-lsp with initial configuration.
`vim-lsp` is another popular LSP client for Vim.  And, as there is no
`rust-analyzer` specific UI, it is non-trivial to figure out how the
initial configuration is performed.
2021-02-07 20:24:56 -08:00
Ilya Bobyr
6781692732 Explain how initial configuration is sent over LSP. 2021-02-07 20:24:56 -08:00
Aleksey Kladov
cbebb70313 Add a section on entry points 2021-02-07 10:58:59 +03:00
Erick Tovar
a423a5196c Fixing architecture image on dark theme 2021-02-07 10:57:39 +03:00
Edwin Cheng
a0475f10d8 Remove redunacny 2021-02-07 12:53:54 +08:00
Edwin Cheng
542e35e397 More information for mbe 2021-02-07 12:51:30 +08:00
Edwin Cheng
504a54b222 Update architecture.md for mbe and proc-macro 2021-02-07 12:31:33 +08:00
Adam Tuck
c2064e8bcf
Update architecture.md
Typo
2021-02-06 14:40:23 -08:00
kjeremy
8ff69055b9 Do not overwrite lock file
Use `npm ci` instead of `npm install`. `npm install` will overwrite
the lock file if you have a newer npm version than the one that
generated the package-lock.json
2021-02-05 10:57:36 -05:00
Aleksey Kladov
648d99537c Add howtos 2021-02-05 17:45:14 +03:00
Aleksey Kladov
06aa34cd10 More architecture.md 2021-02-04 13:27:34 +03:00
Kushagra Gupta
b75e85998d
typo fixes 2021-02-03 21:30:42 +05:30
Kushagra Gupta
ed35e516b1
Grammar fixes
I think line 235 is still wrong, but I am not sure.

Is the `crated/tt` in line 252 supposed to be `crates/tt`?
2021-02-03 21:05:21 +05:30
Lukas Wirth
f82ce500a9 Fix spelling mistakes in docs/dev 2021-02-03 13:46:51 +01:00
Aleksey Kladov
1008aaae58 Make architecture more informative
Call out boundaries and invariants
2021-02-03 14:26:23 +03:00
Aleksey Kladov
283c3b0133 add useless types to the styleguide 2021-02-02 15:41:57 +03:00
Laurențiu Nicola
84c324b3dd Improve nvim-lsp setup instructions 2021-02-01 20:20:15 +02:00
Laurențiu Nicola
5e61d62fdc Explain what to do if a release fails 2021-02-01 16:46:23 +02:00
Edwin Cheng
d069ef60b6 Update lsp-extension.md hash 2021-01-29 01:32:31 +08:00
Edwin Cheng
edcafe7865 Update doc 2021-01-29 01:04:14 +08: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
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
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
c04b561e7e Remove the need to manually sync config in package.json 2021-01-26 16:22:24 +03:00
Aleksey Kladov
2be55703d1 Document design label 2021-01-26 14:18:28 +03:00
vsrs
185cd736a6 Add RA_WAIT_DBG and docs 2021-01-25 17:46:03 +03:00
Laurențiu Nicola
f0cffb66b3 Fix typo in style guide 2021-01-25 14:14:43 +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
83fd639829 Fix RA_LOG example in dev docs 2021-01-25 13:18:24 +02:00
vsrs
3618c4e0d3 Add References code lens.
For Struct, Enum, Union and Trait symbols.
2021-01-23 16:56:20 +03:00
Aleksey Kladov
e54a398bfb Promote marks 2021-01-22 17:58:00 +03:00
Aleksey Kladov
4c92ef03ac Style: use the right string 2021-01-22 15:29:31 +03:00
Aleksey Kladov
e5c5c0a040 Include countme crate to count important data structures. 2021-01-21 19:30:52 +03:00
Aleksey Kladov
74f8201586 Avoid intermediate collections 2021-01-20 14:49:29 +03:00
Aleksey Kladov
724059569b Don't show runnable suggestions for other files
It't be actually great to have these once we have run anything dialog,
but for run the thing at point it makes sense to show a limited set.
2021-01-20 14:30:50 +03:00
Aleksey Kladov
8dc68ecdfc Introduce more appropriate assertion mechanism
rust-analyzer is a long-running program, so we *should* handle assertion
failures.

See also https://www.sqlite.org/assert.html.
2021-01-14 18:25:19 +03:00
Aleksey Kladov
2d0464a6f3 Encourage gifs 2021-01-11 16:29:29 +03:00
Laurențiu Nicola
a7db8abab7 Use T! for bool keywords 2021-01-10 17:47:12 +02:00
Aleksey Kladov
8f994dda68 typo 2021-01-07 20:27:22 +03:00
Aleksey Kladov
5aed769afe Styleguide readability 2021-01-07 20:11:55 +03:00
Aleksey Kladov
eb710a63ca Document std::ops style 2021-01-07 19:27:47 +03:00