]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMerge #5989
bors[bot] [Wed, 16 Sep 2020 20:03:41 +0000 (20:03 +0000)]
Merge #5989

5989: Rewrite import merging r=jonas-schievink a=Veykril

Rewrites how import merging is being handled. It is now a recursive function to properly handle merging of intermediate levels in the import trees. With this ordering the imports is also now possible tho it doesn't quite order it the same way as `rustfmt` does yet, namely it orders lowercase identifiers after uppercase identifiers as that is the standard character order that rust uses. This also fixes a few weird behaviors that were visible in some of the `replace_qualified_name_with_use.rs` tests.

This really took longer than I was hoping for, fighting with import trees is quite the exhausting task 😅

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoAdd make::glob_use_tree function to create star-only UseTree
Lukas Wirth [Wed, 16 Sep 2020 18:33:08 +0000 (20:33 +0200)]
Add make::glob_use_tree function to create star-only UseTree

3 years agoMerge #6013
bors[bot] [Wed, 16 Sep 2020 18:04:29 +0000 (18:04 +0000)]
Merge #6013

6013: Add support for custom flycheck commands with JSON project workspaces r=jonas-schievink a=woody77

Enable flychecks with JSON project workspaces if an override command was provided as part
of the client configuration:

```
    "rust-analyzer.checkOnSave.enable": true,
    "rust-analyzer.checkOnSave.overrideCommand": ["custom_tool", "arg1", "arg2"],
```

Co-authored-by: Aaron Wood <aaronwood@google.com>
3 years agoMerge #5993
bors[bot] [Wed, 16 Sep 2020 17:07:05 +0000 (17:07 +0000)]
Merge #5993

5993: Update chalk to 0.27 and add support for extern opaque types. r=crlf0710 a=crlf0710

Co-authored-by: Charles Lew <crlf0710@gmail.com>
3 years agoUse Ty::apply instead of simple and fix method resolution.
Charles Lew [Wed, 16 Sep 2020 16:50:24 +0000 (00:50 +0800)]
Use Ty::apply instead of simple and fix method resolution.

3 years agoAdd a test.
Charles Lew [Wed, 16 Sep 2020 16:21:34 +0000 (00:21 +0800)]
Add a test.

3 years agoLower extern type alias as foreign opaque type.
Charles Lew [Wed, 16 Sep 2020 12:57:14 +0000 (20:57 +0800)]
Lower extern type alias as foreign opaque type.

3 years agoMerge #6011
bors[bot] [Wed, 16 Sep 2020 09:20:36 +0000 (09:20 +0000)]
Merge #6011

6011: Document "consuming" semantic tokens modifier r=jonas-schievink a=Veetaha

cc https://github.com/rust-analyzer/rust-analyzer/pull/5957/files

Co-authored-by: Veetaha <veetaha2@gmail.com>
3 years agoAdd support for custom flycheck commands with JSON project workspaces
Aaron Wood [Wed, 16 Sep 2020 01:51:57 +0000 (18:51 -0700)]
Add support for custom flycheck commands with JSON project workspaces

Enable flychecks with JSON project workspaces if an override command was provided as part
of the client configuration.

3 years agoDocument "consuming" semantic tokens modifier
Veetaha [Tue, 15 Sep 2020 21:53:37 +0000 (00:53 +0300)]
Document "consuming" semantic tokens modifier

3 years agoMerge #6010
bors[bot] [Tue, 15 Sep 2020 20:15:04 +0000 (20:15 +0000)]
Merge #6010

6010: Avoid checking all ancestors and fix mis-completion r=jonas-schievink a=oxalica

Refactor the logic of `completion_match` to check deterministic number of ancestors instead of `token.ancestors().find_map()`.
This should fix wrong completions (https://github.com/rust-analyzer/rust-analyzer/pull/5976#issuecomment-692332191) and hopefully make completion to be faster (#6004).

More play and test? @jonas-schievink @hammypants

If this patch works, we can avoid the revert #6005 . :disappointed:

Co-authored-by: oxalica <oxalicc@pm.me>
3 years agoAvoid checking all ancestors and fix mis-completion
oxalica [Tue, 15 Sep 2020 17:16:06 +0000 (01:16 +0800)]
Avoid checking all ancestors and fix mis-completion

3 years agoMerge #6008
bors[bot] [Tue, 15 Sep 2020 16:18:30 +0000 (16:18 +0000)]
Merge #6008

6008: inline parameters for a function description r=jonas-schievink a=bnjjj

close #6002

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoinline parameters for a function description #6002
Benjamin Coenen [Tue, 15 Sep 2020 16:04:34 +0000 (18:04 +0200)]
inline parameters for a function description #6002

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoinline parameters for a function description #6002
Benjamin Coenen [Tue, 15 Sep 2020 15:14:48 +0000 (17:14 +0200)]
inline parameters for a function description #6002

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoUpdate chalk to 0.27 and adapt to chalk changes.
Charles Lew [Sun, 13 Sep 2020 02:24:19 +0000 (10:24 +0800)]
Update chalk to 0.27 and adapt to chalk changes.

3 years agoMerge #6006
bors[bot] [Tue, 15 Sep 2020 13:18:49 +0000 (13:18 +0000)]
Merge #6006

6006: Fix delimiter in SSR example r=jonas-schievink a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoFix delimiter in SSR example
Laurențiu Nicola [Tue, 15 Sep 2020 11:32:56 +0000 (14:32 +0300)]
Fix delimiter in SSR example

3 years agoMerge #6001
bors[bot] [Mon, 14 Sep 2020 13:55:48 +0000 (13:55 +0000)]
Merge #6001

6001: Add GitHub Sponsors link to blog post template r=jonas-schievink a=jonas-schievink

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
3 years agoAdd GitHub Sponsors link to blog post template
Jonas Schievink [Mon, 14 Sep 2020 13:56:30 +0000 (15:56 +0200)]
Add GitHub Sponsors link to blog post template

3 years agoMerge #5999
bors[bot] [Mon, 14 Sep 2020 12:44:34 +0000 (12:44 +0000)]
Merge #5999

5999: Update crates r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoUpdate crates
kjeremy [Mon, 14 Sep 2020 12:43:26 +0000 (08:43 -0400)]
Update crates

3 years agoMerge #5976
bors[bot] [Mon, 14 Sep 2020 10:22:20 +0000 (10:22 +0000)]
Merge #5976

5976: Complete trait impl immediately after type/const/fn r=jonas-schievink a=oxalica

Currently, we can complete type/const/fn but only if we typed an identifier.
That is, `impl .. { fn f<|> }` has completions with all trait fn including `f`, but `impl .. { fn <|> }` doesn't provide any suggestion (even if explicit trigger it).

This PR tweak the logic of completion match to make it possible.

However, we still need to explicit trigger suggestions (`Control + Space` by default) in vscode to show. Not sure if we can make it automatically triggered after typing the space after `fn`.

Another question is that I cannot figure out why `BLOCK_EXPR` need to be checked. A block expr directly inside a impl block should be invalid, and nested items will failed to locate impl block in specific offset and skip the suggestion. Now I simply removed it and no tests are broken.
https://github.com/rust-analyzer/rust-analyzer/blob/4f91478e50dc5c2a87235e9be8bd91e3f62de4b4/crates/ide/src/completion/complete_trait_impl.rs#L109

Co-authored-by: oxalica <oxalicc@pm.me>
3 years agoMerge #5985
bors[bot] [Mon, 14 Sep 2020 10:12:08 +0000 (10:12 +0000)]
Merge #5985

5985: Make MergeBehaviour configurable r=jonas-schievink a=Veykril

This should make the newly implemented `MergeBehaviour` for import insertion configurable as roughly outlined in https://github.com/rust-analyzer/rust-analyzer/pull/5935#issuecomment-685834257. For the config name and the like I just picked what came to mind so that might be up for bikeshedding.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #5971
bors[bot] [Sun, 13 Sep 2020 17:28:22 +0000 (17:28 +0000)]
Merge #5971

5971: Implement async blocks r=flodiebold a=oxalica

Fix #4018

@flodiebold already gave a generic guide in the issue. Here's some concern about implementation detail:
- Chalk doesn't support generator type yet.
- Adding generator type as a brand new type (ctor) can be complex and need to *re-introduced* builtin impls. (Like how we implement closures before native closure support of chalk, which is already removed in #5401 )
- The output type of async block should be known after type inference of the whole body.
  - We cannot directly get the type from source like return-positon-impl-trait. But we still need to provide trait bounds when chalk asking for `opaque_ty_data`.
  - During the inference, the output type of async block can be temporary unknown and participate the later inference.
    `let a = async { None }; let _: i32 = a.await.unwrap();`

So in this PR, the type of async blocks is inferred as an opaque type parameterized by the `Future::Output` type it should be, like what we do with closure type.
And it really works now.

Well, I still have some questions:
- The bounds `AsyncBlockImplType<T>: Future<Output = T>` is currently generated in `opaque_ty_data`. I'm not sure if we should put this code here.
- Type of async block is now rendered as `impl Future<Output = OutputType>`. Do we need to special display to hint that it's a async block? Note that closure type has its special format, instead of `impl Fn(..) -> ..` or function type.

Co-authored-by: oxalica <oxalicc@pm.me>
3 years agoFix merge imports failing if the `self` module import is in the wrong tree
Lukas Wirth [Sat, 12 Sep 2020 21:54:49 +0000 (23:54 +0200)]
Fix merge imports failing if the `self` module import is in the wrong tree

3 years agoTidy up `recursive_merge` implementation
Lukas Wirth [Sat, 12 Sep 2020 21:27:01 +0000 (23:27 +0200)]
Tidy up `recursive_merge` implementation

3 years agoMerge #5987
bors[bot] [Sat, 12 Sep 2020 20:55:01 +0000 (20:55 +0000)]
Merge #5987

5987: Bump node-fetch from 2.6.0 to 2.6.1 in /editors/code r=kjeremy a=dependabot[bot]

Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/bitinn/node-fetch/releases">node-fetch's releases</a>.</em></p>
<blockquote>
<h2>v2.6.1</h2>
<p><strong>This is an important security release. It is strongly recommended to update as soon as possible.</strong></p>
<p>See <a href="https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md#v261">CHANGELOG</a> for details.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md">node-fetch's changelog</a>.</em></p>
<blockquote>
<h2>v2.6.1</h2>
<p><strong>This is an important security release. It is strongly recommended to update as soon as possible.</strong></p>
<ul>
<li>Fix: honor the <code>size</code> option after following a redirect.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/node-fetch/node-fetch/commit/b5e2e41b2b50bf2997720d6125accaf0dd68c0ab"><code>b5e2e41</code></a> update version number</li>
<li><a href="https://github.com/node-fetch/node-fetch/commit/2358a6c2563d1730a0cdaccc197c611949f6a334"><code>2358a6c</code></a> Honor the <code>size</code> option after following a redirect and revert data uri support</li>
<li><a href="https://github.com/node-fetch/node-fetch/commit/8c197f8982a238b3c345c64b17bfa92e16b4f7c4"><code>8c197f8</code></a> docs: Fix typos and grammatical errors in README.md (<a href="https://github-redirect.dependabot.com/bitinn/node-fetch/issues/686">#686</a>)</li>
<li><a href="https://github.com/node-fetch/node-fetch/commit/1e99050f944ac435fce26a9549eadcc2419a968a"><code>1e99050</code></a> fix: Change error message thrown with redirect mode set to error (<a href="https://github-redirect.dependabot.com/bitinn/node-fetch/issues/653">#653</a>)</li>
<li><a href="https://github.com/node-fetch/node-fetch/commit/244e6f63d42025465796e3ca4ce813bf2c31fc5b"><code>244e6f6</code></a> docs: Show backers in README</li>
<li><a href="https://github.com/node-fetch/node-fetch/commit/6a5d192034a0f438551dffb6d2d8df2c00921d16"><code>6a5d192</code></a> fix: Properly parse meta tag when parameters are reversed (<a href="https://github-redirect.dependabot.com/bitinn/node-fetch/issues/682">#682</a>)</li>
<li><a href="https://github.com/node-fetch/node-fetch/commit/47a24a03eb49a49d81b768892aee10074ed54a91"><code>47a24a0</code></a> chore: Add opencollective badge</li>
<li><a href="https://github.com/node-fetch/node-fetch/commit/7b136627c537cb24430b0310638c9177a85acee1"><code>7b13662</code></a> chore: Add funding link</li>
<li><a href="https://github.com/node-fetch/node-fetch/commit/5535c2ed478d418969ecfd60c16453462de2a53f"><code>5535c2e</code></a> fix: Check for global.fetch before binding it (<a href="https://github-redirect.dependabot.com/bitinn/node-fetch/issues/674">#674</a>)</li>
<li><a href="https://github.com/node-fetch/node-fetch/commit/1d5778ad0d910dbd1584fb407a186f5a0bc1ea22"><code>1d5778a</code></a> docs: Add Discord badge</li>
<li>Additional commits viewable in <a href="https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1">compare view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a href="https://www.npmjs.com/~akepinski">akepinski</a>, a new releaser for node-fetch since your current version.</p>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=node-fetch&package-manager=npm_and_yarn&previous-version=2.6.0&new-version=2.6.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/configuring-github-dependabot-security-updates)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/rust-analyzer/rust-analyzer/network/alerts).

</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 years agoMerge #5990
bors[bot] [Sat, 12 Sep 2020 19:29:51 +0000 (19:29 +0000)]
Merge #5990

5990: Implement box patterns r=jonas-schievink a=jonas-schievink

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoImplement box pattern inference
Jonas Schievink [Sat, 12 Sep 2020 19:18:57 +0000 (21:18 +0200)]
Implement box pattern inference

3 years agoAdd box pattern test
Jonas Schievink [Sat, 12 Sep 2020 19:15:00 +0000 (21:15 +0200)]
Add box pattern test

3 years agoReimplement import merging by making it recursive properly nesting all levels
Lukas Wirth [Sat, 12 Sep 2020 17:18:14 +0000 (19:18 +0200)]
Reimplement import merging by making it recursive properly nesting all levels

3 years agoBump node-fetch from 2.6.0 to 2.6.1 in /editors/code
dependabot[bot] [Sat, 12 Sep 2020 14:50:54 +0000 (14:50 +0000)]
Bump node-fetch from 2.6.0 to 2.6.1 in /editors/code

Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
3 years agoMake MergeBehaviour configurable
Lukas Wirth [Sat, 12 Sep 2020 09:55:01 +0000 (11:55 +0200)]
Make MergeBehaviour configurable

3 years agoMerge #5981
bors[bot] [Fri, 11 Sep 2020 21:11:59 +0000 (21:11 +0000)]
Merge #5981

5981: Properly preserve macro braces during dbg! removal r=jonas-schievink a=SomeoneToIgnore

Do `dbg![2 + 2] * 5` -> `(2 + 2) * 5`

This PR also implicitly handles the `{}` case too, but I decided not to add it into the test case since it's a compiler error on the latest stable rustc.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
3 years agoProperly preserve macro braces
Kirill Bulatov [Fri, 11 Sep 2020 19:16:22 +0000 (22:16 +0300)]
Properly preserve macro braces

3 years agoMerge #5980
bors[bot] [Fri, 11 Sep 2020 19:08:52 +0000 (19:08 +0000)]
Merge #5980

5980: Update serde r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoUpdate serde
kjeremy [Fri, 11 Sep 2020 19:07:49 +0000 (15:07 -0400)]
Update serde

3 years agoFix type walking about type of async block
oxalica [Fri, 11 Sep 2020 17:03:28 +0000 (01:03 +0800)]
Fix type walking about type of async block

3 years agoFix and prettify comments
oxalica [Fri, 11 Sep 2020 16:12:42 +0000 (00:12 +0800)]
Fix and prettify comments

3 years agoMerge #5977
bors[bot] [Fri, 11 Sep 2020 15:40:33 +0000 (15:40 +0000)]
Merge #5977

5977: cargo update r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agocargo update
kjeremy [Fri, 11 Sep 2020 15:38:36 +0000 (11:38 -0400)]
cargo update

3 years agoComplete trait impl immediately after type/const/fn
oxalica [Fri, 11 Sep 2020 15:05:10 +0000 (23:05 +0800)]
Complete trait impl immediately after type/const/fn

3 years agoMerge #5955
bors[bot] [Fri, 11 Sep 2020 14:01:20 +0000 (14:01 +0000)]
Merge #5955

5955: Remove merge import code duplication r=jonas-schievink a=Veykril

This removes the code duplication caused by #5935, this also allows the assist to merge imports that have equal visibility and prevents merges of unequal visibility. This PR also fixes an iteration mistake in the mentioned PR:

Turns out I made a mistake when writing the `segment_iter` function, I was assuming that the `children` of a path will just be the segments, which is obviously not the case. This also brings insertion order of shorter paths in line with how `rustfmt` orders them.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #5951 #5975
bors[bot] [Fri, 11 Sep 2020 13:47:33 +0000 (13:47 +0000)]
Merge #5951 #5975

5951: Rename record_field_pat to record_pat_field r=jonas-schievink a=pksunkara

The token was renamed but not this.

5975: Report better errors in project.json/sysroot r=jonas-schievink a=jonas-schievink

This does a bunch of light refactoring so that the `Sysroot` is loaded later, which makes sure that any errors are reported to the user. I then added a check that reports an error if libcore is missing in the loaded sysroot. Since a sysroot without libcore is very useless, this indicates a configuration error.

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
3 years agoMerge #5970
bors[bot] [Fri, 11 Sep 2020 13:41:15 +0000 (13:41 +0000)]
Merge #5970

5970: Use better heuristics for replacement text when removing dbg! r=jonas-schievink a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/5911

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
3 years agoReport better errors in project.json/sysroot
Jonas Schievink [Fri, 11 Sep 2020 12:48:56 +0000 (14:48 +0200)]
Report better errors in project.json/sysroot

3 years agoMerge #5969
bors[bot] [Fri, 11 Sep 2020 11:37:04 +0000 (11:37 +0000)]
Merge #5969

5969: Propose module name completion options r=jonas-schievink a=SomeoneToIgnore

<img width="539" alt="image" src="https://user-images.githubusercontent.com/2690773/92663009-cb0aec00-f308-11ea-9ef5-1faa91518031.png">

Currently traverses the whole file set every time we try to complete the module, as discussed in https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/mod.3C.7C.3E.20completion

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
3 years agoAdjust the test comment
Kirill Bulatov [Fri, 11 Sep 2020 11:16:15 +0000 (14:16 +0300)]
Adjust the test comment

3 years agoMerge #5957
bors[bot] [Thu, 10 Sep 2020 21:59:00 +0000 (21:59 +0000)]
Merge #5957

5957: Add consuming modifier to lvalues that are passed by value and not Copy r=jonas-schievink a=Nashenas88

Related to #5856

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
3 years agoOne more test
Kirill Bulatov [Thu, 10 Sep 2020 21:20:13 +0000 (00:20 +0300)]
One more test

3 years agoMerge #5956
bors[bot] [Thu, 10 Sep 2020 20:55:06 +0000 (20:55 +0000)]
Merge #5956

5956: Highlight errors in macros r=jonas-schievink a=popzxc

Resolves #4924

This PR makes rust-analyzer highlight not only the source place when error originates in macro, but also the exact places in macro which caused an error.

This is done by creating an inverse diagnostic, which points to the macro and cross-references the source place.

![изображение](https://user-images.githubusercontent.com/12111581/92319594-b71e6c00-f022-11ea-94c1-f412905269dd.png)

Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
3 years agoRename record_field_pat to record_pat_field
Pavan Kumar Sunkara [Sat, 5 Sep 2020 01:06:05 +0000 (03:06 +0200)]
Rename record_field_pat to record_pat_field

3 years agoImplement async blocks
oxalica [Thu, 10 Sep 2020 12:01:23 +0000 (20:01 +0800)]
Implement async blocks

3 years agoUse better heuristics for replacement text when removing dbg!
Kirill Bulatov [Thu, 10 Sep 2020 11:14:24 +0000 (14:14 +0300)]
Use better heuristics for replacement text when removing dbg!

3 years agoOne more test
Kirill Bulatov [Wed, 9 Sep 2020 22:58:29 +0000 (01:58 +0300)]
One more test

3 years agoRename the method to avoid false promises
Kirill Bulatov [Wed, 9 Sep 2020 22:45:49 +0000 (01:45 +0300)]
Rename the method to avoid false promises

3 years agoAdd VirtualPath tests
Kirill Bulatov [Mon, 7 Sep 2020 23:42:45 +0000 (02:42 +0300)]
Add VirtualPath tests

3 years agoFix the tests
Kirill Bulatov [Mon, 7 Sep 2020 23:34:11 +0000 (02:34 +0300)]
Fix the tests

3 years agoAdd tests
Kirill Bulatov [Mon, 7 Sep 2020 23:26:55 +0000 (02:26 +0300)]
Add tests

3 years agoProperly handle mod.rs imports
Kirill Bulatov [Mon, 7 Sep 2020 22:45:05 +0000 (01:45 +0300)]
Properly handle mod.rs imports

3 years agoComplete semicolon when needed
Kirill Bulatov [Mon, 7 Sep 2020 22:24:16 +0000 (01:24 +0300)]
Complete semicolon when needed

3 years agoProperly reacto to keywords
Kirill Bulatov [Mon, 7 Sep 2020 21:54:58 +0000 (00:54 +0300)]
Properly reacto to keywords

3 years agoLess false positive completion candidates
Kirill Bulatov [Mon, 7 Sep 2020 21:00:00 +0000 (00:00 +0300)]
Less false positive completion candidates

3 years agoProperly handle nested submodules in the same file
Kirill Bulatov [Mon, 7 Sep 2020 18:39:23 +0000 (21:39 +0300)]
Properly handle nested submodules in the same file

3 years agoMove most of the logic into the completion module
Kirill Bulatov [Mon, 7 Sep 2020 17:52:37 +0000 (20:52 +0300)]
Move most of the logic into the completion module

3 years agoFinally cretae the mod completion module
Kirill Bulatov [Mon, 7 Sep 2020 16:21:39 +0000 (19:21 +0300)]
Finally cretae the mod completion module

3 years agoMove rust-related logic from vfs to base_db level
Kirill Bulatov [Mon, 7 Sep 2020 13:17:50 +0000 (16:17 +0300)]
Move rust-related logic from vfs to base_db level

3 years agoProperly handle special cases (binaries, mod.rs)
Kirill Bulatov [Sat, 5 Sep 2020 22:41:18 +0000 (01:41 +0300)]
Properly handle special cases (binaries, mod.rs)

3 years agoExclude special files
Kirill Bulatov [Fri, 4 Sep 2020 12:13:31 +0000 (15:13 +0300)]
Exclude special files

3 years agoImplement file name & extension retrieval method for VirtualPath
Kirill Bulatov [Fri, 4 Sep 2020 12:05:56 +0000 (15:05 +0300)]
Implement file name & extension retrieval method for VirtualPath

3 years agoSmall refactoring
Kirill Bulatov [Fri, 4 Sep 2020 10:33:07 +0000 (13:33 +0300)]
Small refactoring

3 years agoHappy path implemented
Kirill Bulatov [Thu, 3 Sep 2020 23:25:00 +0000 (02:25 +0300)]
Happy path implemented

3 years agoProperly use FileSet API
Kirill Bulatov [Thu, 3 Sep 2020 22:32:06 +0000 (01:32 +0300)]
Properly use FileSet API

3 years agoBetter API
Kirill Bulatov [Thu, 3 Sep 2020 20:18:23 +0000 (23:18 +0300)]
Better API

3 years agoFirst steps for mod<|> completion
Kirill Bulatov [Fri, 28 Aug 2020 18:28:30 +0000 (21:28 +0300)]
First steps for mod<|> completion

3 years agoMerge #5968
bors[bot] [Wed, 9 Sep 2020 17:20:39 +0000 (17:20 +0000)]
Merge #5968

5968: Lookup ADT and associated type names for chalk debugging / tweak chalk interner r=flodiebold a=nathanwhit

This PR improves the chalk program writing integration by looking up the names for ADTs and associated types, making the output much more readable.

There are also a few small changes to the interner, which gives some nice performance improvements. We clone `Ty`s and `ProgramClause`s relatively often in chalk, so wrapping them in `Arc`s is a perf win. This takes the time for performing type inference on the rust-analyzer codebase from 40s to 33s on my machine.

Co-authored-by: Nathan Whitaker <nathan.whitaker01@gmail.com>
3 years agoTweak interner for chalk
Nathan Whitaker [Wed, 9 Sep 2020 16:55:38 +0000 (12:55 -0400)]
Tweak interner for chalk

3 years agoLookup ADT and assoc. type names for chalk debug
Nathan Whitaker [Wed, 9 Sep 2020 16:55:05 +0000 (12:55 -0400)]
Lookup ADT and assoc. type names for chalk debug

3 years agoMerge #5965
bors[bot] [Tue, 8 Sep 2020 13:02:14 +0000 (13:02 +0000)]
Merge #5965

5965: Update crates r=kjeremy a=kjeremy

Moves past pulled crossbeam-channel crate

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoUpdate crates
kjeremy [Tue, 8 Sep 2020 12:50:03 +0000 (08:50 -0400)]
Update crates

Gets passed pulled crossbeam crate

3 years agoFix handling of consuming self, refactor shared logic into a single function
Paul Daniel Faria [Sun, 6 Sep 2020 18:34:01 +0000 (14:34 -0400)]
Fix handling of consuming self, refactor shared logic into a single function

3 years agoAdd consuming modifier to lvalues that are passed by value and not Copy
Paul Daniel Faria [Sun, 6 Sep 2020 16:26:53 +0000 (12:26 -0400)]
Add consuming modifier to lvalues that are passed by value and not Copy

3 years agoHighlight errors in macros
Igor Aleksanov [Sun, 6 Sep 2020 06:22:01 +0000 (09:22 +0300)]
Highlight errors in macros

3 years agoAllow merge_imports assists to merge imports of equal visibility
Lukas Wirth [Sat, 5 Sep 2020 14:15:16 +0000 (16:15 +0200)]
Allow merge_imports assists to merge imports of equal visibility

3 years agoRemove duplicated import merge logic
Lukas Wirth [Sat, 5 Sep 2020 13:51:26 +0000 (15:51 +0200)]
Remove duplicated import merge logic

3 years agoFix segment_iter not iterating segments properly
Lukas Wirth [Sat, 5 Sep 2020 13:00:06 +0000 (15:00 +0200)]
Fix segment_iter not iterating segments properly

3 years agoMerge #5940
bors[bot] [Fri, 4 Sep 2020 21:54:42 +0000 (21:54 +0000)]
Merge #5940

5940: Implement "Replace `impl Trait` function argument with the named generic" assist. r=matklad a=alekseysidorov

Fixes #5085

Co-authored-by: Aleksei Sidorov <gorthauer87@yandex.ru>
3 years agoRemove unnecessary comma
Aleksei Sidorov [Fri, 4 Sep 2020 19:58:50 +0000 (22:58 +0300)]
Remove unnecessary comma

3 years agoFix tests
Aleksei Sidorov [Fri, 4 Sep 2020 14:55:27 +0000 (17:55 +0300)]
Fix tests

3 years agoMerge #5935
bors[bot] [Fri, 4 Sep 2020 13:28:05 +0000 (13:28 +0000)]
Merge #5935

5935: Rewrite import insertion r=matklad a=Veykril

This is my attempt at refactoring the import insertion #3947. I hope what I created here is somewhat in line with what was requested, it wouldn't surprise me .

`common_prefix` is a copy from `merge_imports.rs` so those should be unified somewhere, `try_merge_trees` is also copied from there but slighly modified to take the `MergeBehaviour` enum into account.
`MergeBehaviour` should in the end become a configuration option, and the order if `ImportGroup` probably as well?

I'm not too familiar with the assist stuff and the like which is why I dont know what i have to do with `insert_use_statement` and `find_insert_use_container` for now.

I will most likely add more test cases in the end as well as I currently only tried to hit every path in `find_insert_position`.
Some of the merge tests also fail atm due to them not sorting what they insert. There is also this test case I'm not sure if we want to support it. I would assume we want to? https://github.com/rust-analyzer/rust-analyzer/pull/5935/files#diff-6923916dd8bdd2f1ab4b984adacd265fR540-R547

The entire module was rewritten so looking at the the file itself is probably better than looking at the diff.

Regarding the sub issues of #3947:
- #3301: This is fixed with the rewrite, what this implementation does is that it scans through the first occurence of groupings and picks the appropriate one out. This means the user can actually rearrange the groupings on a per file basis to their liking. If a group isnt being found it is inserted according to the `ImportGroup` variant order(Would be nice if this was configurable I imagine).
- #3831: This should be fixed with the introduced `MergeBehaviour` enum and it's `Last` variant.
- #3946: This should also be [fixed](https://github.com/rust-analyzer/rust-analyzer/pull/5935/files#diff-6923916dd8bdd2f1ab4b984adacd265fR87)
- #5795: This is fixed in the sense that the grouping search picks the first group that is of the same kind as the import that is being added. So if  there is a random import in the middle of the program it should only be considered if there is no group of the same kind in the file already present.
- the last point in the list I havent checked yet, tho I got the feeling that it's not gonna be too simple as that will require knowledge of whether in this example `ast` is a crate or the module that is already imported.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoUpdate codegen
Aleksei Sidorov [Fri, 4 Sep 2020 12:28:08 +0000 (15:28 +0300)]
Update codegen

3 years agoFix nitpicks
Aleksei Sidorov [Fri, 4 Sep 2020 12:24:36 +0000 (15:24 +0300)]
Fix nitpicks

3 years agoMerge #5948
bors[bot] [Thu, 3 Sep 2020 21:52:12 +0000 (21:52 +0000)]
Merge #5948

5948: Up proc-macro2 to 1.20 r=matklad a=kjeremy

This changes the way Display is implemented

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoUp proc-macro2 to 1.20
kjeremy [Thu, 3 Sep 2020 21:30:44 +0000 (17:30 -0400)]
Up proc-macro2 to 1.20

This changes the way Display is implemented

3 years agoAdd extra insert_use test for pub(crate) re-export handling
Lukas Wirth [Thu, 3 Sep 2020 16:44:39 +0000 (18:44 +0200)]
Add extra insert_use test for pub(crate) re-export handling

3 years agoDisable insert_import in extract_struct_from_enum_variant until its fixed
Lukas Wirth [Thu, 3 Sep 2020 16:32:29 +0000 (18:32 +0200)]
Disable insert_import in extract_struct_from_enum_variant until its fixed

3 years agoFix import insertion breaking nested modules
Lukas Wirth [Thu, 3 Sep 2020 14:23:33 +0000 (16:23 +0200)]
Fix import insertion breaking nested modules

3 years agoFix inserting imports in front of inner attributes
Lukas Wirth [Thu, 3 Sep 2020 12:38:34 +0000 (14:38 +0200)]
Fix inserting imports in front of inner attributes

3 years agoReplace insert_use_statement with the new insert_use
Lukas Wirth [Thu, 3 Sep 2020 12:22:22 +0000 (14:22 +0200)]
Replace insert_use_statement with the new insert_use