Commit Graph

1245 Commits

Author SHA1 Message Date
bors[bot]
e9a797748d
Merge #8866
8866: Update salsa r=matklad a=jonas-schievink

This updates salsa to include https://github.com/salsa-rs/salsa/pull/265, and removes all cancellation-related code from rust-analyzer

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-05-31 12:42:32 +00:00
bors[bot]
3cb3f1d17b
Merge #9025
9025: internal: Display unknown types in `analysis-stats` r=flodiebold a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-05-31 08:20:28 +00: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]
d5f7b2e52a
Merge #9028
9028: only advertise range formatting support if enabled r=Veykril a=euclio

Fixes #9009.

Co-authored-by: Andy Russell <arussell123@gmail.com>
2021-05-28 15:26:20 +00:00
bors[bot]
b5d41ba0e2
Merge #9038
9038: Folding range for return types r=Veykril a=MozarellaMan

For issue #8957 

![return type fold](https://user-images.githubusercontent.com/48062697/119979082-5c62e100-bfb2-11eb-9729-1dea1ce74de1.gif)


Co-authored-by: Ayomide Bamidele <48062697+MozarellaMan@users.noreply.github.com>
2021-05-28 12:16:18 +00:00
Ayomide Bamidele
156d995423 Folding range for return types 2021-05-28 12:39:02 +01:00
Laurențiu Nicola
2dee5930e0 Remove undocumented TextDocumentSyncKind::Full support 2021-05-28 13:01:04 +03:00
Andy Russell
a0cd7fe242
only advertise range formatting support if enabled 2021-05-27 17:36:13 -04:00
Laurențiu Nicola
aabbc84957 Display unknown types in analysis-stats 2021-05-27 19:30:28 +03:00
Jonas Schievink
33debc4065 Update salsa 2021-05-27 15:05:41 +02:00
Lukas Wirth
7ebfc3d410 Document semantic token tags 2021-05-26 15:23:05 +02:00
ammkrn
96ee19851b Check for subdirs in vfs loader exclusions.
The current logic used to transfer global_excludes into vfs exclusions
only transfers global_excludes that are the parent of an item in
dirs.include.
This commit additionally adds an item from global_exclude to the vfs
exclusions if the global_exclude is a child of an included item.
2021-05-25 11:35:39 -05: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
bors[bot]
8b049ec393
Merge #8942
8942: Add `library` semantic token modifier to items from other crates r=arzg a=arzg

Closes #5772.

A lot of code here is pretty repetitive; please let me know if you have any ideas how to improve it, or whether it’s fine as-is.

Side-note: How can I add tests for this? I don’t see a way for the test Rust code in `test_highlighting` to reference other crates to observe the new behaviour.


Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-05-25 02:30:47 +00:00
Laurențiu Nicola
741f47f208 Update test fixtures 2021-05-24 18:18:05 +03:00
Laurențiu Nicola
47afa4a5fc Bump misc deps 2021-05-24 16:31:54 +03:00
Aramis Razzaghipour
e51188cd09
Rename ‘foreign’ semantic token modifier to ‘library’ 2021-05-24 14:54:48 +10:00
Aramis Razzaghipour
4fd5248749
Add highlighting of items from other crates 2021-05-24 14:53:48 +10:00
Kirill Bulatov
b5f524c7ff Don't discover workspaces when detached files are given 2021-05-24 00:09:24 +03:00
Kirill Bulatov
2ca2e24a39 Do not add cargo target for detached files only project 2021-05-23 23:10:05 +03:00
Andy Russell
a90b9a5872
implement range formatting 2021-05-23 15:50:36 -04:00
Kirill Bulatov
de090749d9 Drag detached files towards loading 2021-05-23 22:46:20 +03:00
Kirill Bulatov
695569d978 Draft detached files retrieval 2021-05-23 22:46:20 +03:00
Jonas Schievink
271ec6b990 Add a "Debug ItemTree" LSP request 2021-05-21 23:59:52 +02:00
Lukas Tobias Wirth
6b0ac95df1 Fix code completion not inserting borrow text when client supports InsertAndReplace 2021-05-20 23:22:21 +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
Lukas Tobias Wirth
5fd9f6c7b9 Add ImportGranularity::Guess 2021-05-18 20:21:47 +02:00
Lukas Tobias Wirth
64f7072c25 MergeBehavior -> ImportGranularity 2021-05-18 19:53:20 +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
459b0332d3 internal: use more evocative test folder name 2021-05-17 19:01:54 +03: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
Lukas Wirth
90230e882d Tag Self in impls as a TypeAlias 2021-05-16 15:12:58 +02:00
Aleksey Kladov
ee1c23c78c minor: more useful bench 2021-05-14 20:23:29 +03:00
hi-rustin
b98c119ba6 Apply async semantic token modifier to async/await keywords
Only async semantic token modifier
2021-05-14 10:47:00 +08:00
Jonas Schievink
a272cdfecd Fix build script dependencies 2021-05-12 14:48:26 +02:00
Jonas Schievink
23cd6d0d56 Move dot invocation to rust-analyzer crate 2021-05-12 00:14:59 +02:00
Jonas Schievink
a85a2c4d15 Allow viewing the crate graph in a webview 2021-05-11 16:15:31 +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
John Renner
c3ba1f14fa Allow semantic tokens for strings to be disabled 2021-05-10 13:09:38 -07:00
Lukas Wirth
6a8d47e7f0 Give MergeBehaviour variants better names 2021-05-10 21:14:59 +02:00
Aleksey Kladov
f015429c82 internal: add rust-analyzer version to panic context 2021-05-08 14:14:06 +03:00
John Renner
4059112b4e Use package renaming so source doesn't say tikv 2021-05-07 12:41:07 -07:00
John Renner
d8a9b450a6 Switch from jemalloc to tikv-jemalloc 2021-05-07 12:17:37 -07:00
Aleksey Kladov
189f785749 minor: standard snippet 2021-05-07 21:46:25 +03:00
bors[bot]
c3596371d8
Merge #8674
8674: fix for #8664: Emit folding ranges for multi-line where clauses r=matklad a=m5tfi

#8664 

I added a test that assert folding multi-line where clauses while leaving single lined one. Please, let me know if the code needs further improvements.

Co-authored-by: m5tfi <72708423+m5tfi@users.noreply.github.com>
2021-05-05 21:14:12 +00:00
Aleksey Kladov
a1f42ef8ad internal: env var to toggle slow benches 2021-05-04 18:21:36 +03:00
bors[bot]
a231da9d24
Merge #8720
8720: internal: add integrated completion benchmark r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-05-04 12:14:56 +00:00
Aleksey Kladov
b2f040fc9a internal: add integrated completion benchmark 2021-05-04 15:14:33 +03:00
Aleksey Kladov
41f8ae7daa More searchable name 2021-05-04 10:23:47 +03:00
Kirill Bulatov
734b95a1ac Code review fixes 2021-05-03 23:24:36 +03:00
Kirill Bulatov
90fc329377 Index retrieval fix 2021-05-03 19:35:44 +03:00
Kirill Bulatov
b1d600a1ec Less panics in the assist resolution 2021-05-03 18:18:45 +03:00
Kirill Bulatov
28293d370f Add docs and use better naming 2021-05-03 18:16:35 +03:00
Kirill Bulatov
1679a376f3 Resolve single assist only 2021-05-03 18:03:28 +03:00
Kirill Bulatov
e5cdcb8b12 Add a way to resolve certain assists 2021-05-03 17:14:49 +03:00
Aleksey Kladov
cd69307aee fix: don't duplicate Progerss::Finised for cache priming 2021-05-02 21:45:00 +03:00
Boris-Chengbiao Zhou
ce8c6c4762 Ensure that only one cache priming task can run at a time
Fixes #8632.
2021-04-30 16:48:11 +02:00
m5tfi
5778ab1e41 add folding for where clauses 2021-04-30 10:18:36 +02: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
bors[bot]
86b5084917
Merge #8679
8679: fix: don't show error message for a valid notification r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-27 13:10:22 +00:00
Aleksey Kladov
f45c1ffc5b fix: don't show error message for a valid notification
Closes #6782, #6772
2021-04-27 16:09:59 +03:00
Jeremy Kolb
36c20dc23d Return ServerNotInitialized according to the spec
According to the spec we should return ServerNotInitialized if the server is waiting for an initialize request and something else comes in.
Upgrading to lsp-server 0.5.1 will do this and retry until the initialize request comes in.

Fixes #8581
2021-04-27 07:47:06 -04:00
Jorge Mederos Alvarado
c4dba4077f Add config options 2021-04-26 20:29:54 -04:00
Kirill Bulatov
c24bdab97e Use -u instead of --utc date flag 2021-04-26 17:12:13 +03:00
Aleksey Kladov
4f9640ff39 fix: add date to the version string on Mac
It doesn't support `--iso`
2021-04-26 15:20:15 +03:00
Lukas Wirth
050c69c19d Split out merge_imports module from helpers::insert_use 2021-04-24 13:31:43 +02:00
Aleksey Kladov
8d54fd105c fix: correct version string to contain hash, build date and channel 2021-04-24 13:36:45 +03:00
bors[bot]
e529f73355
Merge #8627
8627: Add profiling spans under cargo_to_crate_graph r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-22 18:26:09 +00:00
Laurențiu Nicola
6b187af337 Add profiling spans under cargo_to_crate_graph 2021-04-22 21:25:29 +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
James Leitch
60841f4276 Diagnostic paths attempt to use VSCode's path join behavior before defaulting to Rust's path join behavior. 2021-04-21 15:10:53 -07:00
Aleksey Kladov
21f4588fc8 internal: fix slightly broken test 2021-04-19 18:57:47 +03:00
Adrian Stanciu
1c75d8975c Fix typo: comparision -> comparison 2021-04-19 18:44:38 +03:00
Lukas Wirth
2f62c0117a Check for rust doc code attributes like rustdoc does 2021-04-19 13:32:52 +02:00
Lukas Wirth
8a959497b1 Don't require all doc fences to be valid for identifying rust code 2021-04-19 11:41:45 +02:00
bors[bot]
75bf832899
Merge #8540
8540: Prevent being able to rename items that are not part of the workspace r=Veykril a=Veykril

This change causes renames that happen on items coming from crates outside the workspace to fail. I believe this should be the right approach, but usage of cargo's workspace might not be entirely correct for preventing these kinds of refactoring from touching things they shouldn't. I'm not entirely sure?

cc #6623, this is one of the bigger footguns when it comes to refactoring, especially in combination with import aliases people tend to rename items coming from a crates dependency which this prevents.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-19 07:57:40 +00:00
Lukas Wirth
493aaa1403 Better visualise control flow for change_annotation_support" 2021-04-19 00:14:55 +02:00
Lukas Wirth
c447a795ab Prevent being able to rename items that are not part of the workspace 2021-04-18 12:44:00 +02:00
Chayim Refael Friedman
6c287e1504 Accept E<error_number> notation in doctests
```compile_fail,E0000
```

The code was stolen from rustdoc at 392ba2ba1a/src/librustdoc/html/markdown.rs (L866-L867)
2021-04-18 06:15:40 +03:00
Milo
2fa5086424 change grammar 2021-04-15 19:40:07 +01:00
Jonas Schievink
30aae2cefb Move cursor position when using item movers 2021-04-14 00:03:04 +02:00
bors[bot]
03e0bf7f55
Merge #8354
8354: Distinguishing between different operators in semantic highlighting r=matklad a=chetankhilosiya



Co-authored-by: Chetan Khilosiya <chetan.khilosiya@gmail.com>
2021-04-13 11:46:23 +00:00
Aleksey Kladov
06a633ff42 feat: improve performance by delaying computation of fixes for diagnostics 2021-04-13 12:09:04 +03:00
Aleksey Kladov
04b5fcfdb2 Ensure that listing&resolving code actions use the same set of actions 2021-04-13 11:27:00 +03:00
bors[bot]
fe29a9e837
Merge #8494
8494: internal: unfork code paths for unresolved and resolved assist r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-13 07:59:36 +00:00
Aleksey Kladov
460f0ef669 internal: unfork code paths for unresolved and resolved assist 2021-04-13 10:59:15 +03:00
Laurențiu Nicola
3b964c0c81 Exclude nightly tag from git describe to fix version string 2021-04-13 09:20:17 +03:00
Aleksey Kladov
426d098bd6 internal: prepare for lazy diagnostics 2021-04-12 17:58:01 +03:00
Aleksey Kladov
29d5f29932 fix: don't spam repeated error messages when cargo check fails
Conceptually, using a *message* here is wrong, because this is a
"status", rather than "point in time" thing. But statuses are an LSP
extension, while messages are stable. As a compromise, send message only
for more critical `metadata` failures, and only once per state change.
2021-04-12 16:19:36 +03:00
Aleksey Kladov
186c5c47cb feat: avoid checking the whole project during initial loading 2021-04-12 15:29:31 +03:00
bors[bot]
0fac165052
Merge #8410
8410: Use CompletionTextEdit::InsertAndReplace if supported by the client r=Veykril a=Veykril

Fixes #8404, Fixes #3130

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-10 13:07:46 +00:00
Chetan Khilosiya
1735b3ef6a 8279: Added initial implementation for
Operator semantic highlighting.
2021-04-08 22:58:26 +05:30
kjeremy
3634b2145c Bump lsp-types and syn
This lsp-types now supports a default InsertTextMode for completion and a per-completion item commit_characters
2021-04-08 10:57:47 -04:00
Lukas Wirth
8fa3011908 Use CompletionTextEdit::InsertAndReplace if supported by the client 2021-04-08 15:21:27 +02:00
Lukas Wirth
4b555ab1d9 Emit folding ranges for multiline array literals 2021-04-08 00:12:11 +02:00