Commit graph

9191 commits

Author SHA1 Message Date
Edwin Cheng
a569a19ef4 Use log info in trait_solve_query 2020-04-06 21:01:58 +08:00
veetaha
da091b1303 Migrate tests .txt -> .rast
The sytax tree output files now use .rast extension
(rust-analyzer syntax tree or rust abstract syntax tree
(whatever)).
This format has a editors/code/ra_syntax_tree.tmGrammar.json declaration
that supplies nice syntax highlighting for .rast files.
2020-04-06 14:04:26 +03:00
Aleksey Kladov
ec3fb1cdb4
Merge pull request #3853 from matklad/cf
Make control token modifier less ambiguous
2020-04-06 11:53:56 +02:00
bors[bot]
972816b6d4
Merge #3843
3843: Remove rustc_lexer dependency in favour of rustc-ap-rustc_lexer r=est31 a=est31

The latter is auto-published on a regular schedule (Right now weekly).

See also https://github.com/alexcrichton/rustc-auto-publish

Co-authored-by: est31 <MTest31@outlook.com>
2020-04-06 08:42:52 +00:00
bors[bot]
4f904b2970
Merge #3829
3829: Adds to SSR match for semantically equivalent call and method call r=matklad a=mikhail-m1

#3186 
maybe I've missed some corner cases, but it works in general

Co-authored-by: Mikhail Modin <mikhailm1@gmail.com>
2020-04-06 08:15:48 +00:00
est31
2f6914824a Remove rustc_lexer dependency in favour of rustc-ap-rustc_lexer
The latter is auto-published on a regular schedule (Right now weekly).
2020-04-06 10:08:51 +02:00
Aleksey Kladov
48bc0ca745 Make control token modifier less ambiguous
In textmate, keyword.control is used for all kinds of things; in fact,
the default scope mapping for keyword is keyword.control!

So let's add a less ambiguous controlFlow modifier

See Microsoft/vscode#94367
2020-04-06 09:57:50 +02:00
bors[bot]
a93a04fc9e
Merge #3744
3744: Upgrade Chalk r=matklad a=flodiebold



Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-06 07:49:09 +00:00
Aleksey Kladov
0625c76009
Merge pull request #3855 from edwin0cheng/add-back-deny-cc
Add back deny_c
2020-04-06 09:42:23 +02:00
bors[bot]
cc5e67d6b4
Merge #3859
3859: Update serde_json r=kjeremy a=kjeremy

Grabs fix for https://github.com/serde-rs/json/issues/647

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-05 20:06:03 +00:00
kjeremy
66c20495e7 Update serde_json 2020-04-05 16:03:21 -04:00
bors[bot]
bf2d91b26a
Merge #3858
3858: Hide unit function return types r=flodiebold a=lnicola

r? @flodiebold 

This might be a bit heavy-handed (e.g. `|| -> ()` to `||`), what do you think?

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-04-05 18:27:44 +00:00
Laurențiu Nicola
7d62280a71 Hide unit fn return types 2020-04-05 21:06:47 +03:00
Florian Diebold
952714685a Upgrade Chalk again
The big change here is counting binders, not
variables (https://github.com/rust-lang/chalk/pull/360). We have to adapt to the
same scheme for our `Ty::Bound`. It's mostly fine though, even makes some things
more clear.
2020-04-05 19:23:18 +02:00
Florian Diebold
3659502816 Upgrade Chalk 2020-04-05 19:23:18 +02:00
bors[bot]
3431312418
Merge #3857
3857: Fix inference of function pointer return types r=flodiebold a=lnicola

Fixes #3852.

r? @flodiebold

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-04-05 15:23:10 +00:00
Laurențiu Nicola
b58a7f41f1 Fix inference of function pointer return types 2020-04-05 18:18:40 +03:00
Edwin Cheng
53058dd73a Add back deny_c 2020-04-05 21:45:57 +08:00
bors[bot]
e300e1e8d8
Merge #3849
3849: Cargo update r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-04 22:10:00 +00:00
kjeremy
e37e8d52f1 Cargo update 2020-04-04 17:47:19 -04:00
bors[bot]
7c2f141591
Merge #3848
3848: Remove unused dependencies r=kjeremy a=est31

Found by cargo-udeps

Co-authored-by: est31 <MTest31@outlook.com>
2020-04-04 18:00:45 +00:00
est31
dc142152e6 Remove unused dependencies 2020-04-04 19:22:14 +02:00
bors[bot]
45b9d6d553
Merge #3844
3844: vscode: restore removed default values r=matklad a=Veetaha

After refactoring the config we forgot to set defaults for
some properties like workspaceLoaded, callInfo.full, etc.
This commit restored them to being turned on by defult,
as well added defaults for other props to be more explicit
on their defualt value.
cc @matklad 

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-04 13:32:18 +00:00
bors[bot]
2071d0b827
Merge #3845
3845: Simplify config r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-04 13:25:20 +00:00
bors[bot]
cdb80ef039
Merge #3846
3846: vscode: log server binary path r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-04 13:18:51 +00:00
veetaha
a1773f8a67 Remove explicit generic type parameter 2020-04-04 16:12:09 +03:00
veetaha
90959b29e0 vscode: log server binary path 2020-04-04 16:10:06 +03:00
veetaha
b5a7cb331f Simplify config 2020-04-04 16:04:49 +03:00
veetaha
486cb5b79a vscode: restore removed default values
After refactoring the config we forgot to set defaults for
some properties like workspaceLoaded, callInfo.full, etc.
This commit restored them to being turned on by defult,
as well added defaults for other props to be more explicit
on their defualt value.
2020-04-04 15:57:23 +03:00
bors[bot]
6207ac90da
Merge #3840
3840: Add parens for enums r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-03 19:11:40 +00:00
Aleksey Kladov
a5e8dfd024 Add parens for enums 2020-04-03 21:11:05 +02:00
Aleksey Kladov
b1cf95f691 Generalize call parenthesis insertion 2020-04-03 21:01:18 +02:00
Aleksey Kladov
adbcedde18 Remove the second code-path for completing names in patterns 2020-04-03 21:00:15 +02:00
bors[bot]
cde92d0fe1
Merge #3837
3837: Include grammar for syntax trees into vsix r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-03 18:05:43 +00:00
Aleksey Kladov
ab29806f32 Include grammar for syntax trees into vsix 2020-04-03 20:00:06 +02:00
bors[bot]
6a2dd7bafc
Merge #3836
3836: Macro patterns are not confused with expressions. r=matklad a=matklad

We treat macro calls as expressions (there's appropriate Into impl),
which causes problem if there's expresison and non-expression macro in
the same node (like in the match arm).

We fix this problem by nesting macor patterns into another node (the
same way we nest path into PathExpr or PathPat). Ideally, we probably
should add a similar nesting for macro expressions, but that needs
some careful thinking about macros in blocks: `{ am_i_expression!() }`.



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-03 14:13:15 +00:00
Aleksey Kladov
da8eb29a2f Macro patterns are not confused with expressions.
We treat macro calls as expressions (there's appropriate Into impl),
which causes problem if there's expresison and non-expression macro in
the same node (like in the match arm).

We fix this problem by nesting macor patterns into another node (the
same way we nest path into PathExpr or PathPat). Ideally, we probably
should add a similar nesting for macro expressions, but that needs
some careful thinking about macros in blocks: `{ am_i_expression!() }`.
2020-04-03 16:12:38 +02:00
Aleksey Kladov
0e46ed8420 Cleanups 2020-04-03 15:44:06 +02:00
bors[bot]
795b8cf9c5
Merge #3834
3834: Set semantic tokens supertypes r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-03 12:16:40 +00:00
Aleksey Kladov
2a968d4554 Set semantic tokens supertypes 2020-04-03 14:09:12 +02:00
bors[bot]
1a8779bce0
Merge #3800
3800: Introduce ra_proc_macro_srv r=matklad a=edwin0cheng

This PR add preliminary for server side of proc macro : 

1. Add crate setup
2. IO for server side


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-03 12:06:04 +00:00
Edwin Cheng
9a2114b0dd Add doc comment on main.rs 2020-04-03 19:16:54 +08:00
Edwin Cheng
84fb9b44c3 Introduce ra_proc_macro_srv 2020-04-03 19:01:44 +08:00
Aleksey Kladov
ac91de1525
Merge pull request #3833 from edwin0cheng/remove-deny-c
Remove deny_c in CI
2020-04-03 12:46:29 +02:00
Edwin Cheng
3277079412 Remove deny_c in CI 2020-04-03 18:11:28 +08:00
bors[bot]
77462bba62
Merge #3746
3746: Add create_function assist r=flodiebold a=TimoFreiberg

The function part of #3639, creating methods will come later

- [X] Function arguments
     - [X] Function call arguments
     - [x] Method call arguments
     - [x] Literal arguments
     - [x] Variable reference arguments
- [X] Migrate to `ast::make` API
    Done, but there are some ugly spots.

Issues to handle in another PR:
- function reference arguments: Their type isn't printed properly right now.
    The "insert explicit type" assist has the same issue and this is probably a relatively rare usecase.

- generating proper names for all kinds of argument expressions (if, loop, ...?)
    Without this, it's totally possible for the assist to generate invalid argument names.
    I think the assist it's already helpful enough to be shipped as it is, at least for me the main usecase involves passing in named references.
    Besides, the Rust tooling ecosystem is immature enough that some janky behaviour in a new assist probably won't scare anyone off.

- select the generated placeholder body so it's a bit easier to overwrite it

- create method (`self.foo<|>(..)` or `some_foo.foo<|>(..)`) instead of create_function.
    The main difference would be finding (or creating) the impl block and inserting the `self` argument correctly

- more specific default arg names for literals.
    So far, every generated argument whose name can't be taken from the call site is called `arg` (with a number suffix if necessary).

- creating functions in another module of the same crate.
    E.g. when typing `some_mod::foo<|>(...)` when in `lib.rs`, I'd want to have `foo` generated in `some_mod.rs` and jump there.
    Issues: the mod could exist in `some_mod.rs`, in `lib.rs` as `mod some_mod`, or inside another mod but be imported via `use other_mod::some_mod`.

- refer to arguments of the generated function with a qualified path if the types aren't imported yet
    (alternative: run autoimport. i think starting with a qualified path is cleaner and there's already an assist to replace a qualified path with an import and an unqualified path)

- add type arguments of the arguments to the generated function

- Autocomplete functions with information from unresolved calls (see https://github.com/rust-analyzer/rust-analyzer/pull/3746#issuecomment-605281323)
    Issues: see https://github.com/rust-analyzer/rust-analyzer/pull/3746#issuecomment-605282542. The unresolved call could be anywhere. But just offering this autocompletion for unresolved calls in the same module would already be cool.

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-04-03 08:23:44 +00:00
bors[bot]
2cee8531c5
Merge #3814
3814: Add impl From for enum variant assist r=flodiebold a=mattyhall

Basically adds a From impl for tuple enum variants with one field. It was recommended to me on the zulip to maybe try using the trait solver, but I had trouble with that as, although it could resolve the trait impl, it couldn't resolve the variable unambiguously in real use. I'm also unsure of how it would work if there were already multiple From impls to resolve - I can't see a way we could get more than one solution to my query.

Fixes #3766

Co-authored-by: Matthew Hall <matthew@quickbeam.me.uk>
2020-04-03 07:46:46 +00:00
Leander Tentrup
bb45aca909 Flatten nested highlight ranges during DFS traversal 2020-04-03 09:46:07 +02:00
Mikhail Modin
35a2cd08c1 Adds to SSR match for semantically equivalent call and method call 2020-04-02 20:18:44 +01:00
bors[bot]
642f3f4bd6
Merge #3798
3798: Simplify r=Veetaha a=Veetaha

bear with me

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-02 18:13:38 +00:00