Commit graph

732 commits

Author SHA1 Message Date
Ole Christian Eidheim
06da68303d
Update manual.adoc: added juCi++ section 2021-08-14 12:47:58 +02:00
Aleksey Kladov
629c68e80d internal: document that ascription is preferred to a turbo fish 2021-08-11 14:16:15 +03:00
Aleksey Kladov
fc48def916 minor: reword a bit 2021-08-10 14:56:55 +03:00
Aleksey Kladov
967c088e01 internal: document codebase stance on using functional combinators 2021-08-10 14:34:05 +03:00
Aleksey Kladov
2f9273633b feat: filter out duplicate macro completions
closes #9303
2021-08-03 17:36:06 +03:00
bors[bot]
314e2e75c0
Merge #9752
9752: feature: Declare proc-macro dependent crates in `rust-project.json` r=matklad a=tobywf

This adds the `is_proc_macro` flag in `rust-project.json`. By default, this is `false` and not required, so existing projects won't break/have the same behavior as before this change. If the flag is true, a dependency to the `proc_macro` sysroot crate is added (if it exists), so that rust-analyzer can resolve those imports.

This fixes #9726 .

I've also added some tests in the second commit. The first is a smoke test for a basic, minimal `rust-project.json` file. The second is a more targeted test for the flag. Both tests depend on the fake sysroot (a bunch of directories in the correct layout with empty `lib.rs` files), and also on `env!("CARGO_MANIFEST_DIR")` being an absolute path. I'm not sure if the later assumption is valid on all platforms. I wanted to at least try and add tests, but I'm happy to rework them or remove them if you don't think that's the way to go.

(You can license/relicense my contribution in any way you wish without contacting me.)

Co-authored-by: Toby Fleming <sourcecode@tobywf.com>
2021-08-02 13:14:22 +00:00
Aleksey Kladov
12d7f5b56e internal: explain that we don't ref in style.md 2021-08-02 15:59:28 +03:00
Toby Fleming
cb13e4a2ca
Rust project supports proc-macro dependent crates 2021-08-01 14:43:10 -07:00
Gunnlaugur Thor Briem
4930e5d74d
Link “DST” to its definition
Being new to Rust I wasn't familiar with this acronym and found it hard to guess (the context of syntax trees biased me to reading it as a D-something Syntax Tree and trying to guess what the D was), hard to google (in retrospect googling "rust dst" does the job, but I thought it was an abstract structure thing, not Rust-specific), and hard to Github-search, because `dst` is commonly short for “destination” in code.

Alternatively `<abbr title="dynamically sized type">DST</abbr>` would be about as helpful.
2021-08-01 14:37:16 +00:00
Aleksey Kladov
2229cfcf48 internal: cleanup lsp-extensions docs 2021-07-30 19:50:39 +03: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
Aleksey Kladov
68836c0dbe minor: drop impl-specific stuff from lsp docs
The lc. prefix is a copy-paste from our typescript code, it doesn't make
sense in the impl-agnostic docs.
2021-07-30 16:37:41 +03:00
Alexander Gonzalez
41943f2328 refactor: Apply PR suggestions 2021-07-27 18:31:21 -04:00
Alexander Gonzalez
c6fab1993a test: Update lsp_ext.rs hash 2021-07-27 18:31:21 -04:00
Alexander Gonzalez
ca85185bc6 docs: Update the lsp-extensions.md with the Hover Range capability 2021-07-27 18:31:21 -04:00
bors[bot]
2c638a467e
Merge #9709
9709: fix: add capability for "open cargo.toml" lsp extension r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-27 16:41:02 +00:00
Aleksey Kladov
7d6c4142b2 fix: add capability for "open cargo.toml" lsp extension 2021-07-27 19:40:19 +03:00
Alexander Gonzalez
c865b56744 docs: Fix several typos and grammar mistakes 2021-07-26 18:15:40 -04:00
bors[bot]
bf8a55a2df
Merge #9692
9692: Use same cancelled spelling in doc and code. r=matklad a=mattiasgronlund

Right thing might be to update the spelling in the code to
follow American instead of English spelling, that is
using only canceled. But they should at least be aligned.

Co-authored-by: Mattias Grönlund <mattias@gronlund.se>
2021-07-26 10:29:24 +00:00
Jonas Platte
c0107d2ea6
Fix some grammar / spelling mistakes 2021-07-26 10:12:41 +02:00
Mattias Grönlund
9e99a9b860 Use same cancelled spelling in doc and code.
Right thing might be to update the spelling in the code to
follow American instead of English spelling, that is
using only canceled. But they should at least be aligned.
2021-07-25 23:18:59 +02: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
Aleksey Kladov
efa4a36a50 docs: publish Explaining Rust Analyzer series 2021-07-19 23:41:15 +03:00
Aleksey Kladov
1dc337645a minor: typo 2021-07-19 19:18:39 +03:00
Aleksey Kladov
6a0f7f0852 internal: explain why we avoid serializing everything 2021-07-19 17:47:56 +03: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
Alexander Gonzalez
60be683d5e
fix: Typo in architecture.md 2021-07-18 22:17:45 -04: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
a9d0d1414a internal: remove erroneous default impl 2021-07-12 20:18:07 +03:00
Aleksey Kladov
706bd1c35d minor: one more usless type 2021-07-08 17:18:44 +03:00
Aleksey Kladov
0db4f3f6a4 internal: ensure consistent passing for config params
We pass "context" parametes first, so configs should be on the left.
"Bigger" context wins, so configs goes after db.
2021-07-06 00:00:39 +03:00
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