Commit Graph

18409 Commits

Author SHA1 Message Date
Aleksey Kladov
891867b1f1 fix: correctly update diagnostics when files are opened and closed
Basically, this tracks the changes to `subscriptions` we use when
issuing a publish_diagnostics.
2021-07-26 21:22:06 +03:00
Jonas Schievink
18b6327a29 Remove the legacy macro scoping hack 2021-07-26 19:58:14 +02:00
Aleksey Kladov
410679285b internal: prepare to track changes to mem_docs 2021-07-26 20:17:10 +03:00
bors[bot]
f0db648cb6
Merge #9558
9558: Do not erase Cargo diagnostics from the closed documents r=matklad a=SomeoneToIgnore

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6850

The LSP specification at https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textDocument_publishDiagnostics states that


> Diagnostics notification are sent from the server to the client to signal results of validation runs.
> 
> Diagnostics are “owned” by the server so it is the server’s responsibility to clear them if necessary. The following rule is used for VS Code servers that generate diagnostics:
> 
>  *  if a language is single file only (for example HTML) then diagnostics are cleared by the server when the file is closed.
>  *  if a language has a project system (for example C#) diagnostics are not cleared when a file closes. When a project is opened all diagnostics for all files are recomputed (or read from a cache).
> 
> When a file changes it is the server’s responsibility to re-compute diagnostics and push them to the client. If the computed set is empty it has to push the empty array to clear former diagnostics. Newly pushed diagnostics always replace previously pushed diagnostics. There is no merging that happens on the client side.


So for projects we should not clear any diagnostics from cargo/json projects.
Our "standalone file" mode is in a way a project too, with sysroot attached and a potential support for dynamic standalone files.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-07-26 14:53:05 +00:00
bors[bot]
cfb7d3ac7b
Merge #9699
9699: fix: Fix generic_arg not parsing opt_generic_arg_list properly in arg lists r=Veykril a=Veykril

Fixes #9697
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-26 13:23:17 +00:00
Lukas Wirth
f43cd562bc Fix generic_arg not parsing opt_generic_arg_list properly in arg lists 2021-07-26 15:21:19 +02:00
bors[bot]
d571ca814e
Merge #9593
9593: fix: Adding remove_unused_param for method and fixing same for assoc func r=matklad a=feniljain

Solves #9571 

Co-authored-by: vi_mi <fenil.jain2018@vitstudent.ac.in>
2021-07-26 10:36:31 +00: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
bors[bot]
35e072ed44
Merge #9696
9696: Fix some grammar / spelling mistakes r=lnicola a=jplatte



Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2021-07-26 08:43:58 +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
bors[bot]
5983d3745a
Merge #9691
9691: fix: Keep catch-all arm in fill_match_arms if it has a non-empty expression r=Veykril a=Veykril

Fixes #4165
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-25 13:52:35 +00:00
Lukas Wirth
0a13259fc6 Kepp catch-all arm in fill_match_arms if it has a non-empty expression 2021-07-25 15:51:47 +02:00
bors[bot]
2fe586a8a7
Merge #9688
9688: feat: Resolve derive attribute input macro paths in ide layer r=Veykril a=Veykril

Enables goto def, syntax highlighting and hover for `Foo` in `#[derive(Foo)]`.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/4413
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-24 18:37:13 +00:00
Lukas Wirth
bfe0fa009e Resolve derive attribute input macro paths in ide layer 2021-07-24 20:35:43 +02:00
bors[bot]
31306bafbf
Merge #9686
9686: Bump deps r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-07-24 08:21:31 +00:00
Laurențiu Nicola
1da21b797a Fix typo 2021-07-24 11:20:40 +03:00
Laurențiu Nicola
d9ec9d95c5 Bump deps 2021-07-24 11:16:32 +03:00
bors[bot]
2e45e47c83
Merge #9685
9685: internal: add tests for tuple struct field completion and resolve a FIXME r=jonas-schievink a=jonas-schievink

This removes the last FIXME related to visibility and thus fixes https://github.com/rust-analyzer/rust-analyzer/issues/824

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-07-23 18:22:09 +00:00
Jonas Schievink
c495a7374f Resolve tuple field visibility FIXME 2021-07-23 20:20:41 +02:00
Jonas Schievink
4267c38db1 Add tests for tuple struct field completion 2021-07-23 20:20:23 +02:00
bors[bot]
661961ca75
Merge #9684
9684: Complete editable private items r=jonas-schievink a=jonas-schievink

This checks if a private item's location is editable (local source root), and completes them anyways if that's the case.

In order to test this, the `new_source_root` fixture command has been changed to take a `local` or `library` value, and to apply to all *following* files instead of the preceding ones (which would be hard to understand).

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-07-23 18:00:35 +00:00
Jonas Schievink
3efdf6861f Complete editable private items 2021-07-23 19:57:16 +02:00
bors[bot]
75d7da196f
Merge #9683
9683: internal: Move out expression based `unqualified_path` completion tests r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-23 15:07:10 +00:00
Lukas Wirth
189440c7b5 Add a Union to the base item completion test fixture 2021-07-23 17:02:39 +02:00
bors[bot]
6494193adb
Merge #9681
9681: Respect `#[doc(hidden)]` in dot-completion r=jonas-schievink a=jonas-schievink

This adds `CompletionContext::is_visible` as a convenience method that checks visibility, presence of `doc(hidden)`, and whether the completed item is in the same crate as the completion site or not. We only complete `doc(hidden)` items from the same crate.

This doesn't yet work for *all* completions: `qualified_path` completions use `Module::scope` and `ScopeDef`, which doesn't work with this.

Part of https://github.com/rust-analyzer/rust-analyzer/issues/7718

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-07-23 14:59:26 +00:00
Jonas Schievink
c8d915e2ea Fix formatting and use Iterator::any 2021-07-23 16:45:14 +02:00
Lukas Wirth
8de3f7ee53 Move out unqualified_path completion tests 2021-07-23 16:37:19 +02:00
Lukas Wirth
ea72a5136c Add functions to base items completion test fixture 2021-07-23 16:12:09 +02:00
bors[bot]
4107106e67
Merge #9678
9678: Add Configuration for Highlight Related Feature r=kdelorey a=kdelorey

# Summary
Adds basic configuration that allows you to control when the highlight related feature is activated. You can control this for references, break points, exit points, and yield points.

Resolves #9618 

![config](https://user-images.githubusercontent.com/2295721/126728849-a38b560c-b687-42c1-9c41-7584ad718469.gif)


Co-authored-by: Kevin DeLorey <kdelorey.dev@gmail.com>
2021-07-23 13:56:57 +00:00
Kevin DeLorey
5b9f173254 Removed all dead config accessors. 2021-07-23 07:50:37 -06:00
Kevin DeLorey
d8f0213316 removed dead code 2021-07-23 07:41:55 -06:00
Jonas Schievink
b0f7aac72f Respect #[doc(hidden)] in dot-completion 2021-07-23 15:36:43 +02:00
Kevin DeLorey
7797c59f18 Updated docs. 2021-07-22 19:35:47 -06:00
Kevin DeLorey
efb6587664 Added tests to ensure config behavior. 2021-07-22 19:35:47 -06:00
Kevin DeLorey
b75e0e7bb1 Initial commit of highlight related configuration w/ implementation. 2021-07-22 19:35:47 -06:00
bors[bot]
1dd1814100
Merge #9677
9677: fix: Correctly classify Rename Names r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-23 00:15:43 +00:00
Lukas Wirth
ef6fed052c Correctly classify Rename Names 2021-07-23 02:14:59 +02:00
bors[bot]
b744e3369d
Merge #9676
9676: minor: Describe the current lifetime/label completion specifics r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-22 18:19:11 +00:00
Lukas Wirth
1f558faa8d Describe the current lifetime/label completion specifics 2021-07-22 20:18:46 +02:00
bors[bot]
096e369698
Merge #9675
9675: internal: Move and clean up record completion tests r=Veykril a=Veykril

Now all that's left are the expression related tests which will take some time to go through
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-22 18:04:09 +00:00
Lukas Wirth
d5947d9d48 Clarify what the outline test module is for 2021-07-22 20:03:29 +02:00
Lukas Wirth
2d696b9c9e Move out record completion tests 2021-07-22 19:38:49 +02:00
bors[bot]
444679f202
Merge #9674
9674: fix: Fix pattern name resolution when name is also occupied in type namespace r=flodiebold a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8694

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-07-22 11:49:18 +00: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
Jonas Schievink
b596c32a41 Resolve tuple variants in value namespace 2021-07-22 13:40:18 +02: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
bors[bot]
0bee7cb716
Merge #9453
9453: Add first-class limits. r=matklad,lnicola a=rbartlensky

Partially fixes #9286.

This introduces a new `Limits` structure which is passed as an input
to `SourceDatabase`. This makes limits accessible almost everywhere in
the code, since most places have a database in scope.

One downside of this approach is that whenever you query limits, you
essentially do an `Arc::clone` which is less than ideal.

Let me know if I missed anything, or would like me to take a different approach!

Co-authored-by: Robert Bartlensky <bartlensky.robert@gmail.com>
2021-07-22 10:33:05 +00:00
bors[bot]
33748a6fce
Merge #9671
9671: minor: Fix a couple of clippy nits r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-07-22 06:04:25 +00:00
Laurențiu Nicola
efcc487dff Fix a couple of clippy nits 2021-07-22 09:03:54 +03:00