Commit Graph

8616 Commits

Author SHA1 Message Date
veetaha
dc1fbef985 ra_hir_def: fix typo 2020-03-22 19:38:55 +02:00
veetaha
bfb6e3fd83 ra_hir: migrate some stuff to matches!() 2020-03-22 15:45:32 +02:00
veetaha
a8e5da8a70 ra_hir_ty: fix formatting 2020-03-22 15:44:38 +02:00
bors[bot]
5e827bd948
Merge #3668
3668: disable invert-if assist for if-let r=matklad a=JoshMcguigan

Fixes #3281 

This disables the invert-if assist for if-let expressions, fixing the bug reported in #3281.

While in the exact case reported in #3281, `if let Some(_) = foo { ...`, it would be possible to invert the if-let pattern, in most cases it will not be possible, so disabling this assist for if-let expressions seems reasonable. 

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-03-21 13:59:03 +00:00
Josh Mcguigan
c3702a6b71 disable invert if assist for if-let to fix #3281 2020-03-21 06:40:18 -07:00
bors[bot]
10867336e6
Merge #3665
3665: vscode: remove unnecessary code r=matklad a=Veetaha

This cancel is unnecessary since we cancel the previous inlay hints requests in `fetchHints()` method itself. This is not a hard error, we just called cancel() 2 times.

Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-03-21 05:17:14 +00:00
Veetaha
95b5129a8a
vscode: remove unnecessary code
This cancel is unnecessary since we cancel the previous inlay hints requests in `fetchHints()` method itself. This is not a hard error, we just called cancel() 2 times.
2020-03-20 21:23:56 +02:00
bors[bot]
92b561b5c7
Merge #3663
3663: Make from-source install use cargo installed binary by default r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-20 12:08:36 +00:00
Aleksey Kladov
8ee7780ca9 ⬆️ npm 2020-03-20 13:07:43 +01:00
Aleksey Kladov
4b5435b52b Make from-source install use cargo installed binary by default 2020-03-20 13:07:12 +01:00
bors[bot]
467a040509
Merge #3623
3623: 'Fill match arms' should work with existing match arms r=matklad a=slyngbaek

Addresses #3039

This essentially adds missing match arms. The algorithm for this
can get complicated rather quickly so bail in certain conditions
and rely on a PlaceholderPat.

The algorighm works as such:
- Iterate through the Enum Def Variants
- Attempt to see if the variant already exists as a match arm
- If yes, skip the enum variant. If no, include it.
- If it becomes complicated, rather than exhaustively deal with every
  branch, mark it as a "partial match" and simply include the
  placeholder.

  Conditions for "complication":
  - The match arm contains a match guard
  - Any kind of nested destrucuring

Order the resulting merged match branches as such:
1. Provided match arms
2. Missing enum variant branch arms
3. End with Placeholder if required

- Add extra tests

Co-authored-by: Steffen Lyngbaek <steffenlyngbaek@gmail.com>
2020-03-20 08:26:15 +00:00
bors[bot]
e0952899ae
Merge #3662
3662: Support arbitrary discriminants r=matklad a=matklad

Closes #3661



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-20 07:51:24 +00:00
Aleksey Kladov
89694ec8f6 Support arbitrary discriminants
Closes #3661
2020-03-20 08:50:34 +01:00
bors[bot]
1878fbe8bd
Merge #3541
3541: Completition for type name? #3418 r=matklad a=slyngbaek

Iterate through TupleStructPat's until a MatchArm if
one exists. Store in a new is_pat_bind_and_path bool
and allow the `complete_scope` to find matches.

Added some tests to ensure it works in simple and nested cases.

Co-authored-by: Steffen Lyngbaek <steffenlyngbaek@gmail.com>
2020-03-20 07:32:19 +00:00
Steffen Lyngbaek
ec24c09006 Remove const
- Add test for @ matching
- Address comments
2020-03-19 14:17:34 -07:00
Steffen Lyngbaek
eb51abdc64 Fixes to more accurately give complete_scope completions
- Exclude const, static, functions form is_pat_binding_and_path
  (there might be more?)
- Add a check to filter out Record Fields
- Fix tests
2020-03-19 14:12:00 -07:00
Steffen Lyngbaek
6941a7faba - Exclude Local Scope for BindPats
- Exclude BindPats with @ or ref
- Remove outdated test and add one testing for ref
2020-03-19 14:12:00 -07:00
Steffen Lyngbaek
b6d6277362 Completition for type name? #3418
Iterate through TupleStructPat's until a MatchArm if
one exists. Store in a new is_pat_bind_and_path bool
and allow the `complete_scope` to find matches.

Added some tests to ensure it works in simple and nested cases.
2020-03-19 14:12:00 -07:00
Steffen Lyngbaek
b5ba9c3e3a Address nits and suggestions.
Simplify the logic a lot by removing the check for a placeholder pat.
This means the auto-fill no longer returns a compile-able value.
2020-03-19 11:49:01 -07:00
Steffen Lyngbaek
5f8f8a38a2 Don't show assist if all arms are present 2020-03-19 11:47:33 -07:00
Steffen Lyngbaek
6087c01460 'Fill match arms' should work with existing match arms
Addresses #3039

This essentially adds missing match arms. The algorithm for this
can get complicated rather quickly so bail in certain conditions
and rely on a PlaceholderPat.

The algorighm works as such:
- Iterate through the Enum Def Variants
- Attempt to see if the variant already exists as a match arm
- If yes, skip the enum variant. If no, include it.
- If it becomes complicated, rather than exhaustively deal with every
  branch, mark it as a "partial match" and simply include the
  placeholder.

  Conditions for "complication":
  - The match arm contains a match guard
  - Any kind of nested destrucuring

Order the resulting merged match branches as such:
1. Provided match arms
2. Missing enum variant branch arms
3. End with Placeholder if required

- Add extra tests
2020-03-19 11:47:33 -07:00
bors[bot]
1ba03c6995
Merge #3656
3656: Simplify arenas r=matklad a=matklad

At the moment, Arena is paranetrized by two types: index and data. The original motivation was to allow index to be defined in the downstream crate, so that you can add inherent impls to the index. 

However, it seems like we've never actually used that capability, so perhaps we should switch to a generic Index impl? This PR tries this out, switching only `raw.rs` and parts of `hir_def`. 

wdyt?

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-19 17:47:43 +00:00
Aleksey Kladov
f840fcb2f5 Simplify Arena to use a generic index 2020-03-19 18:46:30 +01:00
bors[bot]
988f1dda6b
Merge #3658
3658: More direct CargoWorkspace r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-19 17:01:14 +00:00
Aleksey Kladov
fc230b943b Simplify Sysroot 2020-03-19 17:59:31 +01:00
Aleksey Kladov
516fe293a8 More direct CargoWorkspace 2020-03-19 17:53:31 +01:00
bors[bot]
d013a05fee
Merge #3655
3655: Downgrade vscode-langaugeclient r=matklad a=matklad

Looks like it broke completion :(



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-19 14:23:48 +00:00
Aleksey Kladov
7adcadd279 Downgrade vscode-langaugeclient
Looks like it broke completion :(
2020-03-19 15:08:10 +01:00
bors[bot]
774043759f
Merge #3652
3652: Cleanup imports r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-19 11:37:00 +00:00
Aleksey Kladov
7e2bca4ec3 Cleanup imports 2020-03-19 12:36:33 +01:00
bors[bot]
525feb0acd
Merge #3651
3651: Merge nested use trees r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-19 11:19:24 +00:00
Aleksey Kladov
0c55c06944 Merge nested use trees 2020-03-19 12:18:59 +01:00
bors[bot]
11f2c6908b
Merge #3650
3650: Generalize r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-19 10:38:59 +00:00
Aleksey Kladov
ef3bf906c4 Generalize 2020-03-19 11:38:26 +01:00
Aleksey Kladov
13af63a403
Merge pull request #3641 from darinmorrison/rollup-typescript
Some improvements to rollup and ts config
2020-03-19 11:26:00 +01:00
bors[bot]
5b0a7c7d16
Merge #3649
3649: ⬆️ npm r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-19 09:31:03 +00:00
Aleksey Kladov
8f8f6b47de ⬆️ npm 2020-03-19 10:30:41 +01:00
Aleksey Kladov
ee4fe18ac8 Don't trigger stable release when pushing to nightly branch 2020-03-19 09:48:36 +01:00
Aleksey Kladov
b792e4abbd
Merge pull request #3635 from matklad/tags
Simplify extension tag sniffing
2020-03-19 09:38:08 +01:00
Aleksey Kladov
3d1cb5e20f Simplify extension tag sniffing 2020-03-19 09:37:03 +01:00
bors[bot]
aca3c3086e
Merge #3629
3629: Alternative aproach to plugin auto update r=matklad a=matklad

This is very much WIP (as in, I haven't run this once), but I like the result so far.

cc @Veetaha 

The primary focus here on simplification:

* local simplification of data structures and control-flow: using union of strings instead of an enum, using unwrapped GitHub API responses
* global simplification of control flow: all logic is now in `main.ts`, implemented as linear functions without abstractions. This is stateful side-effective code, so arguments from [Carmack](http://number-none.com/blow/john_carmack_on_inlined_code.html) very much apply. We need all user interractions, all mutations, and all network requests to happen in a single file. 
* as a side-effect of condensing everything to functions, we can get rid of various enums. The enums were basically a reified control flow:

```
enum E { A, B }

fn foo() -> E {
    if cond { E::A } else { E::B }
}

fn bar(e: E) {
    match e {
        E::A => do_a(),
        E::B => do_b(),
    }
}

==>>

fn all() {
    if cond { do_a() } else { do_b() }
}
```

* simplification of model: we don't need to reinstall on settings update, we can just ask the user to reload, we don't need to handle nightly=>stable fallback, we can ask the user to reinstall extension, (todo) we don't need to parse out the date from the version, we can use build id for nightly and for stable we can write the info directly into package.json.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-19 08:06:48 +00:00
Aleksey Kladov
fb6e655de8 Rewrite auto-update
Everything now happens in main.ts, in the bootstrap family of
functions. The current flow is:

* check everything only on extension installation.
* if the user is on nightly channel, try to download the nightly
  extension and reload.
* when we install nightly extension, we persist its release id, so
  that we can check if the current release is different.
* if server binary was not downloaded by the current version of the
  extension, redownload it (we persist the version of ext that
  downloaded the server).
2020-03-19 09:04:59 +01:00
Aleksey Kladov
55336722b3
Merge pull request #3646 from Veetaha/feature/revive-npm-audit
cicd: revive npm audit
2020-03-18 23:32:16 +01:00
Darin Morrison
630888df5b Target es2019 (code 1.43 uses chromium 78) 2020-03-18 16:30:34 -06:00
Darin Morrison
0ec20234a7 Add typing annotations for rollup config 2020-03-18 16:30:34 -06:00
bors[bot]
21a35b49ee
Merge #3645
3645: cargo update r=matklad a=CAD97

Closes #3644 as well.

Would setting up [dependabot](https://dependabot.com/) make sense for this repository?

Co-authored-by: CAD97 <cad97@cad97.com>
2020-03-18 21:24:23 +00:00
CAD97
27d9516105 cargo update 2020-03-18 17:17:45 -04:00
veetaha
e1e41c8b32 cicd: revive npm audit 2020-03-18 23:15:48 +02:00
bors[bot]
b376cabe5e
Merge #3643
3643: Use match_ast r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-18 19:52:10 +00:00
Aleksey Kladov
0bf903411c Use match_ast 2020-03-18 20:51:47 +01:00