Commit Graph

4426 Commits

Author SHA1 Message Date
Edwin Cheng
7f1e93a3c9 Refactoring subtree_source 2019-04-07 21:42:53 +08:00
bors[bot]
1e2178eb8e Merge #1103
1103: Array inference r=flodiebold a=Lapz

Fixes the final item in #394. The only problem is that infering the repeat cause some types to be infered twices.
i.e 
```rust
fn test() {
    let y = unknown;
    [y, &y];
}
```

results in the following diff:

```diff
[11; 48) '{     ...&y]; }': ()
[21; 22) 'y': &{unknown}
[25; 32) 'unknown': &{unknown}
-[38; 45) '[y, &y]': [&&{unknown}]
+[38; 45) '[y, &y]': [&&{unknown};usize]
[39; 40) 'y': &{unknown}
+[39; 40) 'y': &{unknown}
[42; 44) '&y': &&{unknown}
[43; 44) 'y': &{unknown}
```

Should the code produce two inference results for 'y' and if not could any tell me what needs to change.

Co-authored-by: Lenard Pratt <l3np27@gmail.com>
2019-04-07 13:22:18 +00:00
Lenard Pratt
b27fa33a9f updated snapshots 2019-04-07 13:23:18 +01:00
Lenard Pratt
e175921932 Added ArrayExprKind,
changed the  display for fixed array types,
Added Array Enum to ra_hir/expr
2019-04-07 13:23:14 +01:00
Lenard Pratt
2d73c909fe Added inference of array length 2019-04-07 13:23:12 +01:00
bors[bot]
36f5d99756 Merge #1119
1119: Add warning when open file outside workspace r=matklad a=edwin0cheng

When file is not found in `ra_vfs` but exist, use `LspError` for warning instead of `error_fmt` to bail out error, 

Temporarily fix #967 .

edit: typo

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-07 10:48:49 +00:00
Edwin Cheng
ce3d78335d Remove checking file exists 2019-04-07 18:26:02 +08:00
Edwin Cheng
e92740c28b fix formatting 2019-04-07 12:46:45 +08:00
Edwin Cheng
333feb3869 Add warning when open file outside workspace 2019-04-07 01:20:33 +08:00
Edwin Cheng
aac9dfa464 Add TtCursorTokenSource and TtCursorTokenSink 2019-04-06 20:14:28 +08:00
Edwin Cheng
1d7735fbc6 Add path test and empty eat_path handling 2019-04-06 12:12:32 +08:00
bors[bot]
990e74ba7c Merge #1117
1117: [WIP] Tuple struct index inference r=matklad a=robojumper

The first commit adds a helper struct `ast::FieldKind` to facilitate inference.

The second commit adds a slightly modified test from #1109 while mentioning that there is a problem with how we're handling tuple indexing / floats.

cc #1109 

Co-authored-by: robojumper <robojumper@gmail.com>
2019-04-05 23:24:11 +00:00
robojumper
2caa690ef6 Rudimentarily autocomplete tuple struct field access 2019-04-06 01:10:48 +02:00
robojumper
ca40ca93a5 Parse and infer tuple indices 2019-04-06 01:07:35 +02:00
bors[bot]
9d39b7bc42 Merge #1118
1118: Updated the gitignore r=flodiebold a=Lapz

Updated the gitignore to ignore *.rs.pending-snap

Co-authored-by: Lenard Pratt <l3np27@gmail.com>
2019-04-05 21:20:24 +00:00
Lenard Pratt
5b82ca2fdd Updated the gitignore 2019-04-05 22:06:15 +01:00
bors[bot]
0372eca5b2 Merge #1115
1115: Add .gitattributes for fix Windows Line-ending problem in `generated_grammar_is_fresh` r=matklad a=edwin0cheng

Although https://github.com/rust-analyzer/rust-analyzer/issues/937 is marked as `Closed` . But it should work without setting `core.autocrlf` to `false` by this PR.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-05 17:21:48 +00:00
Edwin Cheng
7ca0a1012a add .gitattributes 2019-04-05 23:31:58 +08:00
bors[bot]
9d795a6784 Merge #1114
1114: Crate updates r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-04-05 15:01:36 +00:00
bors[bot]
a52e86f9a9 Merge #1112
1112: Fix literal support in token tree to ast item list r=matklad a=edwin0cheng

This PR implements following things :

1. Expose `next_token` from `ra_parse`
2. Fix the literal conversion in `token_tree_to_ast_item_list`
3. Add test for the conversion

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-05 14:17:07 +00:00
kjeremy
1af7ae506a Update deps 2019-04-05 10:14:02 -04:00
Edwin Cheng
7abc06bd57 Add proper test for literals and fixed typo bug 2019-04-05 20:58:24 +08:00
Edwin Cheng
1ea0238e53 Add classify_literal and undo expose next_token 2019-04-05 18:45:19 +08:00
Edwin Cheng
1ab78d6056 Fix literal support in token tree to ast item list 2019-04-05 18:23:01 +08:00
bors[bot]
be9a44e9ba Merge #1111
1111: Add multi-byte token support in token tree to ast item list r=matklad a=edwin0cheng

As discusion in https://github.com/rust-analyzer/rust-analyzer/pull/1105 ,  this PR add implement all multi-byte tokens in `ra_mbe` crate.




Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-05 08:55:50 +00:00
Edwin Cheng
6ff16c7ad9 Clean up 2019-04-05 03:54:18 +08:00
Edwin Cheng
c23408751c Add multi-byte token support in tkn tree to ast 2019-04-05 03:39:54 +08:00
bors[bot]
7713416477 Merge #1108
1108: Fix issue label link in docs/dev/README.md r=matklad a=pcpthm



Co-authored-by: pcpthm <43881370+pcpthm@users.noreply.github.com>
2019-04-04 11:05:40 +00:00
pcpthm
58ae6948c1
Fix issue label link in docs/dev/README.md 2019-04-04 19:51:43 +09:00
bors[bot]
b1ac2dfec7 Merge #1107
1107: Fix test fails when different target directory is used r=matklad a=pcpthm



Co-authored-by: pcpthm <pcpthm@gmail.com>
2019-04-04 09:59:27 +00:00
pcpthm
0010d62cad Make robust about target directory 2019-04-04 18:57:10 +09:00
bors[bot]
c083515eec Merge #1106
1106: ⬆️ salsa r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-04 07:03:18 +00:00
Aleksey Kladov
afd64756dd ⬆️ salsa 2019-04-04 10:02:53 +03:00
bors[bot]
84d8665e13 Merge #1101
1101: Parse unsafe async / const unsafe fns properly r=matklad a=robojumper

Also adds tests that `unsafe async fn` as well as `const unsafe fn` parse properly and that these keywords in the reversed order cause parse errors.

[Playground link to verify that this is the correct order.](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=7850b8d92579de31c38f835f76afa4ce)

Closes #1086.


Co-authored-by: robojumper <robojumper@gmail.com>
2019-04-03 15:33:58 +00:00
bors[bot]
f1ac9c8f55 Merge #1098
1098: added some docs to public functions r=matklad a=pasa

some docs for #961

Co-authored-by: Sergey Parilin <sergey.parilin@fxdd.com>
2019-04-03 15:13:51 +00:00
robojumper
636270f4a4 Parse unsafe async / const unsafe fns properly 2019-04-03 17:11:56 +02:00
Sergey Parilin
cc2212f3cb added some docs to public functions 2019-04-03 16:05:55 +03:00
bors[bot]
c6c88070c4 Merge #1068
1068: profiling crate first draft r=matklad a=pasa

I've made this first draft for #961 
Could you look at it? Is this something what you are looking for?
It has lack of tests. I can't figure out how to test stderr output in rust right now. Do you have some clues?
Additionally I'm thinking about to implement procedural  macros to annotate methods with this profiler. Will it be helpful?



Co-authored-by: Sergey Parilin <sergey.parilin@fxdd.com>
2019-04-03 09:09:11 +00:00
bors[bot]
b8e58d4a2f Merge #1097
1097: Fix VSCode cargo-watch functionality on Linux. r=matklad a=kiljacken

As of #1079 the VSCode cargo-watch functionality has been broken on
Linux systems.

The cause seems to be that linux takes the added quotes inside process
arguments literally, so it attempts to make cargo-watch run the command
`cargo "check --message-format json"` with the entire quoted part being
treated as a single long subcommand, which cargo doesn't know how to
handle.

Removing the extra quotes solves the issue.

Closes #1096 

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-04-03 09:02:24 +00:00
Emil Lauridsen
b8ea91ae2d Fix eslint errors 2019-04-03 11:01:34 +02:00
Emil Lauridsen
3a79490187 Add extra double quotes only on Windows.
As tested by @edwin0cheng, Windows requires the quotes removed in the
previous commit. This commit re-adds the quotes gated by an if statement
on the node environment, so that quotes are only added on Windows.
2019-04-03 10:38:18 +02:00
Emil Lauridsen
4d78c85de2 Fix VSCode cargo-watch functionality on Linux.
As of #1079 the VSCode cargo-watch functionality has been broken on
Linux systems.

The cause seems to be that linux takes the added quotes inside process
arguments literally, so it attempts to make cargo-watch run the command
`cargo "check --message-format json"` with the entire quoted part being
treated as a single long subcommand, which cargo doesn't know how to
handle.

Removing the extra quotes solves the issue.
2019-04-03 09:50:38 +02:00
bors[bot]
fdbebccd71 Merge #1076
1076: Const body inference r=flodiebold a=Lapz

This is the second part of #887. I've added type inference on const bodies and introduced the DefWithBody containing Function, Const and Static. I want to add tests but im unsure on how I would go about testing that completions work.


Co-authored-by: Lenard Pratt <l3np27@gmail.com>
2019-04-02 19:01:54 +00:00
Lenard Pratt
b9d2c2c21f made ExprCollector pub(crate) and moved
collect_fn_body_syntax
2019-04-02 19:22:06 +01:00
Lenard Pratt
88e22e9d70 Added const bodies and static body to the ast
and added inference the inference test

reduce code duplication
2019-04-02 19:21:36 +01:00
bors[bot]
01a54f094b Merge #1094
1094: Improve cargo-watch animation and refactoring r=matklad a=edwin0cheng

* Refactoring code and fixed some minor bugs.
* Add more error log and better error handling.
* Add current checking artifact name in Cargo-watch animation.

![new_status_animation](https://i.imgur.com/Zr2JLa5.gif)

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-02 18:14:00 +00:00
Edwin Cheng
88bcaf0e18 Add cargo-watch package animation and refactoring 2019-04-03 01:47:10 +08:00
bors[bot]
5cdf525caa Merge #1093
1093: simplify r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-02 16:15:46 +00:00
Aleksey Kladov
cf1caf5181 simplify 2019-04-02 19:15:13 +03:00
bors[bot]
9e46400e0c Merge #1092
1092: always produce source for import r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-02 14:58:27 +00:00