Commit Graph

700 Commits

Author SHA1 Message Date
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
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