Commit Graph

445 Commits

Author SHA1 Message Date
Aleksey Kladov
b535804e1b docs: make dev docs more discoverable
I *think* people might try to debug ra by using only the troubleshooting
section. Might make sense to point them to dev docs then!
2021-09-04 20:17:28 +03:00
unexge
3a9ba0e506 feat: join lines merges assignments 2021-08-22 21:28:39 +03:00
Ole Christian Eidheim
06da68303d
Update manual.adoc: added juCi++ section 2021-08-14 12:47:58 +02:00
Toby Fleming
cb13e4a2ca
Rust project supports proc-macro dependent crates 2021-08-01 14:43:10 -07:00
Aleksey Kladov
be84f85c1d feat: gate custom clint-side commands behind capabilities
Some features of rust-analyzer requires support for custom commands on
the client side. Specifically, hover & code lens need this.

Stock LSP doesn't have a way for the server to know which client-side
commands are available. For that reason, we historically were just
sending the commands, not worrying whether the client supports then or
not.

That's not really great though, so in this PR we add infrastructure for
the client to explicitly opt-into custom commands, via `extensions`
field of the ClientCapabilities.

To preserve backwards compatability, if the client doesn't set the
field, we assume that it does support all custom commands. In the
future, we'll start treating that case as if the client doesn't support
commands.

So, if you maintain a rust-analyzer client and implement
`rust-analyzer/runSingle` and such, please also advertise this via a
capability.
2021-07-30 19:16:33 +03:00
Kevin DeLorey
7797c59f18 Updated docs. 2021-07-22 19:35:47 -06:00
bors[bot]
2fbecccc71
Merge #9634
9634: minor update to excludeDirs doc r=lnicola a=dae

I saw reference to globs in #7755, but it doesn't look like they're
actually supported, and I had to dig through the source to discover
that the folders are relative to the workspace root. Further digging
was required to get VS Code from hanging for long periods trying to
watch giant Bazel folders that had already been excluded from Rust
Analyzer. Hopefully this tweak will save others the confusion :-)

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2021-07-22 11:43:05 +00:00
Damien Elmes
d22b830ed1 mention files.watcherExclude
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2021-07-22 21:25:23 +10:00
Jesse Jackson
a9f4527fd3
docs: fix typo
tree -> three
2021-07-21 04:06:19 -05:00
Damien Elmes
106ea7ad85 minor update to excludeDirs doc
I saw reference to globs in #7755, but it doesn't look like they're
actually supported, and I had to dig through the source to discover
that the folders are relative to the workspace root. Further digging
was required to get VS Code from hanging for long periods trying to
watch giant Bazel folders that had already been excluded from Rust
Analyzer. Hopefully this tweak will save others the confusion :-)
2021-07-19 23:30:00 +10:00
Daniel Hofstetter
8470c020bc
Remove outdated "(not yet released)" hint
Neovim 0.5 has been released recently (see http://neovim.io/news/2021/07), hence the "(not yet released)" hint is no longer needed.
2021-07-17 16:56:26 +02:00
Aleksey Kladov
b8a6ea5ab5 feat: make join lines behavior configurable
closes #9492
2021-07-05 23:47:20 +03: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
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
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
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
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
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
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
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
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
Laurențiu Nicola
84c324b3dd Improve nvim-lsp setup instructions 2021-02-01 20:20:15 +02: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
vsrs
3618c4e0d3 Add References code lens.
For Struct, Enum, Union and Trait symbols.
2021-01-23 16:56:20 +03:00
bors[bot]
b821264f86
Merge #7195
7195: Update remaining serverPath references r=lnicola a=lnicola

Fixes https://github.com/rust-analyzer/rust-analyzer/pull/7156#issuecomment-755487667

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-07 15:30:23 +00:00
Laurențiu Nicola
56497ce925 Update remaining serverPath references 2021-01-07 17:06:11 +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
d7741d1610 Allow #anchor linking of config options 2021-01-05 13:09:06 +03:00
bors[bot]
5b86ff3e91
Merge #7113
7113: Manual updates r=matklad a=tekul

Add some details on how to build the manual and some clarification on how to deal with "proc macro2 warnings.

For context, this arose from [this question](https://users.rust-lang.org/t/how-to-disable-rust-analyzer-proc-macro-warnings-in-neovim/53150) on users.rust-lang.org.

Co-authored-by: Luke Taylor <tekul.hs@gmail.com>
2021-01-03 18:22:07 +00:00
Mara Bos
4833972067 Add support for Rust 2021. 2021-01-01 17:22:23 +01:00