Commit Graph

1215 Commits

Author SHA1 Message Date
Aleksey Kladov
f521e41853 internal: introduce minicore -- a subset of libcore for testing 2021-06-15 21:03:08 +03:00
Laurențiu Nicola
41949748a6 Use objects instead of bools for markers in package.json 2021-06-15 09:40:43 +03:00
bors[bot]
5a8ddb4b2d
Merge #9260
9260: tree-wide: make rustdoc links spiky so they are clickable r=matklad a=lf-

Rustdoc was complaining about these while I was running with --document-private-items and I figure they should be fixed.

Co-authored-by: Jade <software@lfcode.ca>
2021-06-14 07:16:48 +00:00
Jade
20b325c7d5 tree-wide: make rustdoc links spiky so they are clickable 2021-06-13 21:58:05 -07:00
Aleksey Kladov
500c909c76 internal: diagnostic code is mandatory 2021-06-13 22:17:36 +03:00
Maan2003
c50b4579ec
clippy::useless_return 2021-06-13 09:35:29 +05:30
Maan2003
75370312fb
clippy::redundant_closure 2021-06-13 09:29:36 +05:30
Maan2003
c9b4ac5be4
clippy::redudant_borrow 2021-06-13 09:24:16 +05:30
Kirill Bulatov
339448157c Only prefill caches in the completion benchmark 2021-06-11 09:27:25 +03:00
Kirill Bulatov
b24f816c0d Fix visibility issues 2021-06-11 02:00:05 +03:00
Kirill Bulatov
ba65d259de Prime caches on workspace load 2021-06-11 02:00:03 +03:00
Lukas Wirth
88bc4f17fd Fix incorrect config usage in hover references 2021-06-07 12:32:25 +02:00
Laurențiu Nicola
18484365e6 Enable proc macros and build scripts by default in CLI 2021-06-05 15:20:41 +03:00
Florian Diebold
d174b919dc Enable attribute macro expansion in analysis-stats
Before:
```
> $ rust-analyzer -q analysis-stats --with-proc-macro --load-output-dirs .
Database loaded:     19.08s, 277minstr
  crates: 34, mods: 688, decls: 13202, fns: 10412
Item Collection:     16.21s, 76ginstr
  exprs: 290580, ??ty: 2508 (0%), ?ty: 1814 (0%), !ty: 947
Inference:           27.46s, 108ginstr
Total:               43.67s, 184ginstr
```
After:
```
> $ ./target/release/rust-analyzer -q analysis-stats --with-proc-macro --load-output-dirs .
Database loaded:     1.09s, 277minstr
  crates: 34, mods: 688, decls: 14790, fns: 11006
Item Collection:     18.20s, 78ginstr
  exprs: 297826, ??ty: 493 (0%), ?ty: 558 (0%), !ty: 342
Inference:           28.34s, 111ginstr
Total:               46.54s, 190ginstr
```
2021-06-05 11:29:24 +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
Matthias Krüger
9452dfaac7 NFC: remove redundant clones (clippy::perf) 2021-06-03 15:32:46 +02:00
Lukas Wirth
d304352407 Document that addCallArgumentSnippets requires `addCallParenthesis 2021-06-02 22:10:09 +02:00
bors[bot]
e6ec860363
Merge #9039
9039: feat: Complete fields and methods with `self.` prefixed when inside methods r=matklad a=Veykril


![w65NbjkZiG](https://user-images.githubusercontent.com/3757771/119984385-a0111700-bfc1-11eb-9dbf-52fdaa4d72b5.gif)
Closes #7173

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-31 13:21:31 +00:00
Lukas Wirth
fb7105a580 Add config setting for self-on-the-fly 2021-05-31 15:14:56 +02:00
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