Commit graph

361 commits

Author SHA1 Message Date
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
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
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
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
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
Aleksey Kladov 0ce591d33d minor: fix ugly line wrapping in the rendered manual 2021-04-20 10:44:06 +03: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
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
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
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
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
Aleksey Kladov 469b739c28 Enable proc-macros by default 2021-03-15 18:19:08 +03:00
Lukas Wirth ebf4448f78 Fix remaining references to cargo xtask codegen 2021-03-12 15:10:33 +01: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
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
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
Aleksey Kladov 3d80e0a154 Migrate to user-centric config name for cargo check stuff 2021-03-04 15:38:53 +03:00
boxdot 9b78a6f6d2
Fix typo. 2021-02-24 11:56:48 +01: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