]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agocleanup
Jeroen Vannevel [Tue, 15 Feb 2022 14:47:23 +0000 (14:47 +0000)]
cleanup

2 years agorough, but appears to work
Jeroen Vannevel [Tue, 15 Feb 2022 14:39:22 +0000 (14:39 +0000)]
rough, but appears to work

2 years agoMerge #11475
bors[bot] [Tue, 15 Feb 2022 09:36:22 +0000 (09:36 +0000)]
Merge #11475

11475: Impr mbe: remove unecessary temporary vec r=bellau a=bellau

It's a micro optimization. I don't know if it's really necessary (less alloc is always better).

Co-authored-by: bellau <laurent.belmonte@gmail.com>
2 years agoMerge #11480
bors[bot] [Tue, 15 Feb 2022 09:29:28 +0000 (09:29 +0000)]
Merge #11480

11480: fix: keyword hover works on non-keyword tokens if expanded to keyword r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoImpr mbe: remove unecessary temporary vec
bellau [Mon, 14 Feb 2022 20:06:13 +0000 (21:06 +0100)]
Impr mbe: remove unecessary temporary vec

2 years agofix: keyword hover works on non-keyword tokens if expanded to keyword
Lukas Wirth [Tue, 15 Feb 2022 09:09:19 +0000 (10:09 +0100)]
fix: keyword hover works on non-keyword tokens if expanded to keyword

2 years agoMerge #11477
bors[bot] [Tue, 15 Feb 2022 01:50:25 +0000 (01:50 +0000)]
Merge #11477

11477: fix: Fix cases where `Merge Imports` would drop imports. r=DropDemBits a=DropDemBits

Fixes #11466

Co-authored-by: DropDemBits <r3usrlnd@gmail.com>
2 years agoApply review fixes
DropDemBits [Tue, 15 Feb 2022 01:41:01 +0000 (20:41 -0500)]
Apply review fixes

2 years agofix: Don't drop glob with nested self
DropDemBits [Tue, 15 Feb 2022 00:41:49 +0000 (19:41 -0500)]
fix: Don't drop glob with nested self

2 years agofix: Don't drop tree when the other has `self`
DropDemBits [Mon, 14 Feb 2022 23:46:16 +0000 (18:46 -0500)]
fix: Don't drop tree when the other has `self`

2 years agoMerge #11369
bors[bot] [Mon, 14 Feb 2022 21:07:41 +0000 (21:07 +0000)]
Merge #11369

11369: feat: Add type hint for keyword expression hovers r=Veykril a=danii

Adds the return type of keywords to tool-tips where it makes sense. This applies to: `if`, `else`, `match`, `loop`, `unsafe` and `await`. Thanks to `@Veykril` for sharing the idea of putting return type highlighting on other keywords!
![image](https://user-images.githubusercontent.com/39541871/151611737-12325c23-a1f9-4fca-ae48-279b374bdcdf.png)

Closes #11359

Co-authored-by: Daniel Conley <himself@danii.dev>
2 years agoHide Keyword Expression Hover For Units `()`
Daniel Conley [Mon, 14 Feb 2022 20:26:40 +0000 (15:26 -0500)]
Hide Keyword Expression Hover For Units `()`

Cleaned up the code for keyword expression hovers.

Added a check to hide units `()` in keyword expression hovers.

2 years agoMerge #11458
bors[bot] [Mon, 14 Feb 2022 17:35:12 +0000 (17:35 +0000)]
Merge #11458

11458: Fix  Immovable generator syntax (static ||) not recognized #11448 r=Veykril a=bellau

Co-authored-by: bellau <laurent.belmonte@gmail.com>
2 years agoMerge #11470
bors[bot] [Mon, 14 Feb 2022 12:05:21 +0000 (12:05 +0000)]
Merge #11470

11470: correct the description of Struct GlobalState r=lnicola a=doki23

Fixes #11469

The description of GlobalState should be 'more than one impl'

Co-authored-by: doki <11144133+doki23@users.noreply.github.com>
2 years agocorrect the description of Struct GlobalState
doki [Mon, 14 Feb 2022 11:30:21 +0000 (19:30 +0800)]
correct the description of Struct GlobalState

2 years agoFix style
bellau [Mon, 14 Feb 2022 06:41:50 +0000 (07:41 +0100)]
Fix style

2 years agoMerge #11464
bors[bot] [Sun, 13 Feb 2022 16:15:37 +0000 (16:15 +0000)]
Merge #11464

11464: minor: Bump deps r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoBump deps
Laurențiu Nicola [Sat, 12 Feb 2022 07:25:26 +0000 (09:25 +0200)]
Bump deps

2 years agoMerge #11442 #11460
bors[bot] [Sun, 13 Feb 2022 12:43:16 +0000 (12:43 +0000)]
Merge #11442 #11460

11442: fix(rename): Use text range of a mod name after macro expansion r=Veykril a=tysg

Fixes #11417.

11460: fix: documentation of SsrParams r=Veykril a=nemethf

Fix #11429 by extending the documentation of SsrParms with the
mandatory field 'selections'.  Copy its description from lsp_ext.rs.

Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
Co-authored-by: Felicián Németh <felician.nemeth@gmail.com>
2 years agoMerge #11459
bors[bot] [Sun, 13 Feb 2022 12:35:11 +0000 (12:35 +0000)]
Merge #11459

11459: fix: add missing experimental capabilities r=Veykril a=nemethf

Fix #11389 by extending server_capabilities.experimental with
matchingBrace, externalDocs, moveItems.  Also, sort entries
alphabetically.

Co-authored-by: Felicián Németh <felician.nemeth@gmail.com>
2 years agoAddress PR comments
Tianyi Song [Sun, 13 Feb 2022 10:14:39 +0000 (18:14 +0800)]
Address PR comments

2 years agooops, remove println
bellau [Sun, 13 Feb 2022 08:11:35 +0000 (09:11 +0100)]
oops, remove println

2 years agofix handle static async and static async move
bellau [Sun, 13 Feb 2022 08:09:44 +0000 (09:09 +0100)]
fix handle static async and static async move

2 years agoExtract struct from enum variant filters generics
Jonas Goronczy [Sat, 12 Feb 2022 22:21:41 +0000 (23:21 +0100)]
Extract struct from enum variant filters generics

Extracting a struct from an enum variant now filters out only the
generic parameters necessary for the new struct.
Bounds will be copied to the new struct, but unneeded ones are not
filtered out.
Extracting bounds in a where clause are still not implemented.

2 years agoFix style
bellau [Sat, 12 Feb 2022 16:31:17 +0000 (17:31 +0100)]
Fix style

2 years agosupport static move too
bellau [Sat, 12 Feb 2022 15:07:58 +0000 (16:07 +0100)]
support static move too

2 years agofix: documentation of SsrParams
Felicián Németh [Sat, 12 Feb 2022 14:47:54 +0000 (15:47 +0100)]
fix: documentation of SsrParams

Fix #11429 by extending the documentation of SsrParms with the
mandatory field 'selections'.  Copy its description from lsp_ext.rs.

2 years agofix: add missing experimental capabilities
Felicián Németh [Sat, 12 Feb 2022 14:32:43 +0000 (15:32 +0100)]
fix: add missing experimental capabilities

Fix #11389 by extending server_capabilities.experimental with
matchingBrace, externalDocs, moveItems.  Also, sort entries
alphabetically.

2 years agoFix styles
bellau [Sat, 12 Feb 2022 14:35:06 +0000 (15:35 +0100)]
Fix styles

2 years agoFix Immovable generator syntax (static ||) not recognized #11448
bellau [Sat, 12 Feb 2022 14:17:10 +0000 (15:17 +0100)]
Fix  Immovable generator syntax (static ||) not recognized #11448

2 years agoMerge #11444
bors[bot] [Sat, 12 Feb 2022 12:48:46 +0000 (12:48 +0000)]
Merge #11444

11444: feat: Fix up syntax errors in attribute macro inputs to make completion work more often r=flodiebold a=flodiebold

This implements the "fix up syntax nodes" workaround mentioned in #11014. It isn't much more than a proof of concept; I have only implemented a few cases, but it already helps quite a bit.

Some notes:
 - I'm not super happy about how much the fixup procedure needs to interact with the syntax node -> token tree conversion code (e.g. needing to share the token map). This could maybe be simplified with some refactoring of that code.
 - It would maybe be nice to have the fixup procedure reuse or share information with the parser, though I'm not really sure how much that would actually help.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoMerge #11453
bors[bot] [Fri, 11 Feb 2022 21:21:57 +0000 (21:21 +0000)]
Merge #11453

11453: internal: Make `ascend_call_token` iterative instead of recursive r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Make `ascend_call_token` iterative instead of recursive
Lukas Wirth [Fri, 11 Feb 2022 21:12:16 +0000 (22:12 +0100)]
internal: Make `ascend_call_token` iterative instead of recursive

2 years agoHandle proc-macro functions as the proc-macro they resolve to
Lukas Wirth [Fri, 11 Feb 2022 21:06:03 +0000 (22:06 +0100)]
Handle proc-macro functions as the proc-macro they resolve to

2 years agoUse text range of name after macro expansion
Tianyi Song [Fri, 28 Jan 2022 08:15:23 +0000 (16:15 +0800)]
Use text range of name after macro expansion

2 years agoFormat again
Florian Diebold [Wed, 9 Feb 2022 16:52:15 +0000 (17:52 +0100)]
Format again

2 years agoReduce visibility
Florian Diebold [Wed, 9 Feb 2022 16:43:37 +0000 (17:43 +0100)]
Reduce visibility

2 years agoAdd back an assertion
Florian Diebold [Wed, 9 Feb 2022 15:36:06 +0000 (16:36 +0100)]
Add back an assertion

2 years agoVarious fixes
Florian Diebold [Wed, 9 Feb 2022 15:30:10 +0000 (16:30 +0100)]
Various fixes

2 years agoRename syntax_node_to_token_tree_censored
Florian Diebold [Wed, 9 Feb 2022 11:00:03 +0000 (12:00 +0100)]
Rename syntax_node_to_token_tree_censored

2 years agoReplace expressions with errors in them
Florian Diebold [Wed, 9 Feb 2022 10:58:52 +0000 (11:58 +0100)]
Replace expressions with errors in them

2 years agoMerge #11441
bors[bot] [Wed, 9 Feb 2022 07:24:33 +0000 (07:24 +0000)]
Merge #11441

11441: minor: Bump deps r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoBump lsp-types
Laurențiu Nicola [Wed, 9 Feb 2022 07:22:25 +0000 (09:22 +0200)]
Bump lsp-types

2 years agoRevert "Revert "Bump dashmap""
Laurențiu Nicola [Wed, 9 Feb 2022 07:19:57 +0000 (09:19 +0200)]
Revert "Revert "Bump dashmap""

This reverts commit 39674cd35054f4905691bb0c3d1eca7b97063aa7.

2 years agoBump deps
Laurențiu Nicola [Wed, 9 Feb 2022 07:14:55 +0000 (09:14 +0200)]
Bump deps

2 years agoMerge #11437
bors[bot] [Tue, 8 Feb 2022 23:30:50 +0000 (23:30 +0000)]
Merge #11437

11437: [ide_completion] render if a function is async/const/unsafe in completion details r=Veykril a=jhgg

this change renders in the autocomplete detail, whether a function is async/const/unsafe.

i found myself wanting to know this information at a glance, so now it renders here:

![image](https://user-images.githubusercontent.com/5489149/153089518-5419afe4-b2c6-4be8-80f7-585f5c514ff2.png)

Co-authored-by: Jake Heinz <jh@discordapp.com>
2 years agoMerge #11436
bors[bot] [Tue, 8 Feb 2022 23:19:07 +0000 (23:19 +0000)]
Merge #11436

11436: fix: renaming modules does not change references by super r=Veykril a=TheDoctor314

Fixes #11289.

Co-authored-by: TheDoctor314 <64731940+TheDoctor314@users.noreply.github.com>
2 years ago[ide_completion] render if a function is async/const/unsafe in completion details
Jake Heinz [Tue, 8 Feb 2022 22:48:34 +0000 (22:48 +0000)]
[ide_completion] render if a function is async/const/unsafe in completion details

2 years agoFix test
Florian Diebold [Tue, 8 Feb 2022 19:44:46 +0000 (20:44 +0100)]
Fix test

2 years agoTrack synthetic tokens, to be able to remove them again later
Florian Diebold [Tue, 8 Feb 2022 17:13:18 +0000 (18:13 +0100)]
Track synthetic tokens, to be able to remove them again later

2 years agoFix renaming super keyword
TheDoctor314 [Tue, 8 Feb 2022 15:58:32 +0000 (21:28 +0530)]
Fix renaming super keyword

2 years agoAdd test
TheDoctor314 [Tue, 8 Feb 2022 15:49:14 +0000 (21:19 +0530)]
Add test

The rename function should not change any path segments that refer to a
module by super.

2 years agoActually check in fixup.rs
Florian Diebold [Mon, 7 Feb 2022 19:30:28 +0000 (20:30 +0100)]
Actually check in fixup.rs

2 years agoReverse fixups
Florian Diebold [Mon, 7 Feb 2022 18:53:31 +0000 (19:53 +0100)]
Reverse fixups

2 years agoSimplify
Florian Diebold [Mon, 7 Feb 2022 17:21:31 +0000 (18:21 +0100)]
Simplify

2 years agoAdd a check
Florian Diebold [Mon, 7 Feb 2022 17:19:00 +0000 (18:19 +0100)]
Add a check

2 years agoSimplify a bit
Florian Diebold [Mon, 7 Feb 2022 17:17:28 +0000 (18:17 +0100)]
Simplify a bit

2 years agoWIP: Actually fix up syntax errors in attribute macro input
Florian Diebold [Mon, 7 Feb 2022 17:08:31 +0000 (18:08 +0100)]
WIP: Actually fix up syntax errors in attribute macro input

2 years agoAdd test for giving attribute proc macros valid syntax
Florian Diebold [Mon, 7 Feb 2022 11:54:08 +0000 (12:54 +0100)]
Add test for giving attribute proc macros valid syntax

2 years agoMerge #11427
bors[bot] [Mon, 7 Feb 2022 07:51:13 +0000 (07:51 +0000)]
Merge #11427

11427: add missing snake case attribute, update hash r=lnicola a=HansAuger

Fix for #11414

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2 years agoadd missing snake case attribute, update hash
Moritz Vetter [Mon, 7 Feb 2022 03:57:20 +0000 (04:57 +0100)]
add missing snake case attribute, update hash

2 years agoPass required features to cargo when using run action
Maybe Waffle [Sun, 6 Feb 2022 15:56:25 +0000 (18:56 +0300)]
Pass required features to cargo when using run action

When using `F1`->`Rust Analyzer: Run` action on an `example`, pass its
`required-features` to `cargo run`. This allows to run examples that
were otherwise impossible to run with RA.

2 years agoMerge #11416
bors[bot] [Sun, 6 Feb 2022 14:42:01 +0000 (14:42 +0000)]
Merge #11416

11416: Fix eslint language server not working r=Veykril a=jackos

Allows the language server for eslint to work inside VS Code.

Before change:
![image](https://user-images.githubusercontent.com/77730378/152661637-c5d90678-39dc-4018-b884-fc4b6135368e.png)

After change:
![image](https://user-images.githubusercontent.com/77730378/152661647-164c0655-aa6a-4c50-b49d-49cda112d149.png)

Co-authored-by: Jack Clayton <jackclayto@gmail.com>
2 years agoMerge #11420
bors[bot] [Sun, 6 Feb 2022 14:28:27 +0000 (14:28 +0000)]
Merge #11420

11420: fix two vulneabilities (moderate: 1, high: 1) by running npm audit r=lnicola a=HansAuger

Again me getting familiar with the code base :D

I noticed npm warning about two vulnerabilities
```
markdown-it  <12.3.2
Severity: moderate
Uncontrolled Resource Consumption in markdown-it - https://github.com/advisories/GHSA-6vfc-qv3f-vr6c
fix available via `npm audit fix`
node_modules/markdown-it
  vsce  1.26.0 - 2.6.3
  Depends on vulnerable versions of markdown-it
  node_modules/vsce

simple-get  3.0.0 - 3.1.0
Severity: high
Exposure of Sensitive Information in simple-get - https://github.com/advisories/GHSA-wpg7-2c88-r8xv
fix available via `npm audit fix`
node_modules/simple-get
```

So I thought why not run `npm audit fix`

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2 years agofix two vulneabilities (moderate: 1, high: 1) by running npm audit
Moritz Vetter [Sun, 6 Feb 2022 14:23:48 +0000 (15:23 +0100)]
fix two vulneabilities (moderate: 1, high: 1) by running npm audit

2 years agoMerge #11418
bors[bot] [Sun, 6 Feb 2022 08:54:34 +0000 (08:54 +0000)]
Merge #11418

11418: fix: Update dependency, fix Markdown references r=Veykril a=HansAuger

Stumbled across this accidentally while familiarizing myself with the code base.

Update `pulldown-cmark-to-cmark` Fix for #11008

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2 years agoBump pulldown-cmark-to-cmark, adjust usages and fix test
Moritz Vetter [Sun, 6 Feb 2022 08:04:06 +0000 (09:04 +0100)]
Bump pulldown-cmark-to-cmark, adjust usages and fix test

2 years agoFix eslint errors
Jack Clayton [Sat, 5 Feb 2022 22:52:51 +0000 (06:52 +0800)]
Fix eslint errors

2 years agoMerge #11415
bors[bot] [Sat, 5 Feb 2022 14:21:40 +0000 (14:21 +0000)]
Merge #11415

11415: Downgrade `dashmap` and bump `thread_local` r=lnicola a=lnicola

Closes #11341

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoBump thread_local
Laurențiu Nicola [Sat, 5 Feb 2022 14:19:08 +0000 (16:19 +0200)]
Bump thread_local

2 years agoUpdate lockfile
Laurențiu Nicola [Sat, 5 Feb 2022 14:17:12 +0000 (16:17 +0200)]
Update lockfile

2 years agoRevert "Bump dashmap"
Laurențiu Nicola [Sat, 5 Feb 2022 14:15:56 +0000 (16:15 +0200)]
Revert "Bump dashmap"

This reverts commit 485f318b70bdc40bd71fa46748cc7053a5b8fd8a.

2 years agoMerge #11412
bors[bot] [Sat, 5 Feb 2022 11:54:07 +0000 (11:54 +0000)]
Merge #11412

11412: fix: Include `fn`/`type`/`const` keyword in trait impl completion item source ranges r=Veykril a=The0x539

Fixes #11301

If the user has typed, say, `fn de` while implementing `Default`, or `type Ta` when implementing `Deref`, then the resulting completion suggestion will replace the entire "line", which, on its own, is fine.
However, the use of `ctx.source_range()` in this code was meant that `source_range` field of the `CompletionItem` covers only the identifier and not the preceding keyword.

Over in `rust_analyzer::to_proto::completion_item`, this caused the LSP completion response to be broken up into a text edit that replaces `de` with `fn default() -> Self {` and then an entry in `additional_text_edits` to remove the extra `fn`.
I'm pretty sure that using the field like that is (slightly) out of [spec](https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#completionItem):
> Edits must not overlap [...] with the main edit
> Additional text edits should be used to change text **unrelated to the current cursor position**

VS Code supports `additionalTextEdits` in such a way that this doesn't seem like a problem, so has gone largely unnoticed.
The various LSP clients I've tried, however, do not, and as a result this bug has been haunting me for ages.

Co-authored-by: The0x539 <the0x539@gmail.com>
2 years agoFix trait impl completion ranges
The0x539 [Sat, 5 Feb 2022 01:55:55 +0000 (19:55 -0600)]
Fix trait impl completion ranges

2 years agoMerge #11411
bors[bot] [Fri, 4 Feb 2022 13:36:34 +0000 (13:36 +0000)]
Merge #11411

11411: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Fri, 4 Feb 2022 01:50:33 +0000 (02:50 +0100)]
Simplify

2 years agoMerge #11406
bors[bot] [Thu, 3 Feb 2022 20:11:18 +0000 (20:11 +0000)]
Merge #11406

11406: Update install notes for bundled servers r=stanciuadrian a=lnicola

r? `@stanciuadrian`

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoUpdate install notes
Laurențiu Nicola [Thu, 3 Feb 2022 19:54:23 +0000 (21:54 +0200)]
Update install notes

2 years agoMerge #11403
bors[bot] [Thu, 3 Feb 2022 16:30:01 +0000 (16:30 +0000)]
Merge #11403

11403: internal: Shrink `mbe::ExpandError` and `mbe::ParseError` r=Veykril a=Veykril

Also fixes https://github.com/rust-analyzer/rust-analyzer/issues/10051, as we no longer emit an empty diagnostic in some expansion cases which seems to trip up vscode for some reason. Using `compile_error!("")` will still trigger the vscode bug.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoShrink `mbe::ExpandError` and `mbe::ParseError`
Lukas Wirth [Thu, 3 Feb 2022 16:25:24 +0000 (17:25 +0100)]
Shrink `mbe::ExpandError` and `mbe::ParseError`

2 years agoMerge #11402
bors[bot] [Thu, 3 Feb 2022 16:02:51 +0000 (16:02 +0000)]
Merge #11402

11402: fix: Fix vis restriction path completions always using the parent module r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix vis restriction path completions always using the parent module
Lukas Wirth [Thu, 3 Feb 2022 16:02:12 +0000 (17:02 +0100)]
fix: Fix vis restriction path completions always using the parent module

2 years agoMerge #11401
bors[bot] [Thu, 3 Feb 2022 15:38:45 +0000 (15:38 +0000)]
Merge #11401

11401: Sort completion calls lexicographically r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoAdd abi string completions
Lukas Wirth [Thu, 3 Feb 2022 15:29:23 +0000 (16:29 +0100)]
Add abi string completions

2 years agoSort completion calls lexicographically
Lukas Wirth [Thu, 3 Feb 2022 15:05:21 +0000 (16:05 +0100)]
Sort completion calls lexicographically

2 years agoMerge #11397
bors[bot] [Thu, 3 Feb 2022 15:01:08 +0000 (15:01 +0000)]
Merge #11397

11397: internal: Refactor completion module split r=Veykril a=Veykril

Currently our completion infra is split into several modules, each trying to do completions for something specific. This "something" is rather unstructured as it stands now, we have a module for `flyimporting path` completions, `unqualified` and `qualified path` completions, modules for `pattern position` completions that only try to complete extra things for patterns that aren't done in the path modules, `attribute` completions that again only try to add builtin attribute completions without adding the normal path completions and a bunch of other special "entity" completions like lifetimes, method call/field access, function param cloning, ... which serve a more specific purpose than the previous listed ones.

As is evident, the former mentioned ones have some decent overlap which requires extra filtering in them so that they don't collide with each other duplicating a bunch of completions(which we had happen in the past at times).

Now this overlap mostly happens with path completions(and keyword completions as well in some sense) which gives me the feeling that having `qualified` and `unqualified` path completions be separate from the rest gives us more troubles than benefits in the long run.
So this is an attempt at changing this structure to instead still go by rough entity for special cases, but when it comes to paths we instead do the module split on the "path kinds"/"locations"(think pattern, type, expr position etc) that exist. This goes hand in hand with the test refactoring I have done that moved tests to "location oriented" modules as well as the `CompletionContext` refactoring that actually already started splitting the context up for path kinds.

This PR moves some path completions out of the `qualified` and `unqualified` path modules namely attribute, visibility, use and pattern paths.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Wed, 2 Feb 2022 17:18:08 +0000 (18:18 +0100)]
Simplify

2 years agoMove path completions for patterns into pattern module
Lukas Wirth [Wed, 2 Feb 2022 17:09:30 +0000 (18:09 +0100)]
Move path completions for patterns into pattern module

2 years agoCleanup PathCompletionContext qualifier handling
Lukas Wirth [Wed, 2 Feb 2022 15:01:46 +0000 (16:01 +0100)]
Cleanup PathCompletionContext qualifier handling

2 years agoAdd missing test for use completions
Lukas Wirth [Wed, 2 Feb 2022 14:28:23 +0000 (15:28 +0100)]
Add missing test for use completions

2 years agoAdd completion module tailored towards visibility modifiers
Lukas Wirth [Wed, 2 Feb 2022 14:14:43 +0000 (15:14 +0100)]
Add completion module tailored towards visibility modifiers

2 years agoAdd completion module tailored towards use trees
Lukas Wirth [Wed, 2 Feb 2022 14:03:46 +0000 (15:03 +0100)]
Add completion module tailored towards use trees

2 years agoMove attribute path completions into attribute completion module
Lukas Wirth [Wed, 2 Feb 2022 12:35:46 +0000 (13:35 +0100)]
Move attribute path completions into attribute completion module

2 years agoMerge #11399
bors[bot] [Thu, 3 Feb 2022 12:21:18 +0000 (12:21 +0000)]
Merge #11399

11399: Fix assoc type shorthand from method bounds r=flodiebold a=flodiebold

In code like this:
```rust
impl<T> Option<T> {
    fn as_deref(&self) -> T::Target where T: Deref {}
}
```

when trying to resolve the associated type `T::Target`, we were only
looking at the bounds on the impl (where the type parameter is defined),
but the method can add additional bounds that can also be used to refer
to associated types. Hence, when resolving such an associated type, it's
not enough to just know the type parameter T, we also need to know
exactly where we are currently.

This fixes #11364 (beta apparently switched some bounds around).

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoFix assoc type shorthand from method bounds
Florian Diebold [Thu, 3 Feb 2022 11:43:15 +0000 (12:43 +0100)]
Fix assoc type shorthand from method bounds

In code like this:
```rust
impl<T> Option<T> {
    fn as_deref(&self) -> T::Target where T: Deref {}
}
```

when trying to resolve the associated type `T::Target`, we were only
looking at the bounds on the impl (where the type parameter is defined),
but the method can add additional bounds that can also be used to refer
to associated types. Hence, when resolving such an associated type, it's
not enough to just know the type parameter T, we also need to know
exactly where we are currently.

This fixes #11364 (beta apparently switched some bounds around).

2 years agoMerge #11394
bors[bot] [Wed, 2 Feb 2022 11:42:40 +0000 (11:42 +0000)]
Merge #11394

11394: feat: Deprioritize completions of private but editable definitions r=Veykril a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoFix test fixture
Lukas Wirth [Wed, 2 Feb 2022 11:42:13 +0000 (12:42 +0100)]
Fix test fixture

2 years agoMerge #11395
bors[bot] [Wed, 2 Feb 2022 11:20:38 +0000 (11:20 +0000)]
Merge #11395

11395: fix: Fix and re-enable format string completions r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix and re-enable format string completions
Lukas Wirth [Wed, 2 Feb 2022 11:20:10 +0000 (12:20 +0100)]
fix: Fix and re-enable format string completions

2 years agoCleanup `Completions` api a bit
Lukas Wirth [Wed, 2 Feb 2022 11:05:21 +0000 (12:05 +0100)]
Cleanup `Completions` api a bit