Commit Graph

9504 Commits

Author SHA1 Message Date
Aleksey Kladov
09a4b78775 Introduce ActiveParameter 2020-04-24 01:46:00 +02:00
Aleksey Kladov
4b8e9d5483 Move tests to where they belong 2020-04-24 01:26:27 +02:00
Aleksey Kladov
174952e89b Refactor 2020-04-24 01:24:08 +02:00
Aleksey Kladov
953b5f23cc Restore CompletionItem immutability 2020-04-24 01:17:33 +02:00
Aleksey Kladov
6654b9aff3 More functional 2020-04-24 01:08:27 +02:00
Aleksey Kladov
75cb1c1806 Move 2020-04-24 00:11:33 +02:00
bors[bot]
5eb51c1e60
Merge #4106
4106: Fix wrong substitution code r=matklad a=flodiebold

We need to shift in when we're substituting inside a binder.

This should fix #4053 (it doesn't fix the occasional overflow that also occurs on the Diesel codebase though).

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-23 21:58:52 +00:00
Florian Diebold
0c01b4eb6a Fix wrong substitution code
We need to shift in when we're substituting inside a binder.

This should fix #4053 (it doesn't fix the occasional overflow that also occurs
on the Diesel codebase though).
2020-04-23 23:53:08 +02:00
bors[bot]
e833e03783
Merge #3954
3954: Improve autocompletion by looking on the type and name r=matklad a=bnjjj

This tweet (https://twitter.com/tjholowaychuk/status/1248918374731714560) gaves me the idea to implement that in rust-analyzer.

Basically for this first example I made some examples when we are in a function call definition. I look on the parameter list to prioritize autocompletions for the same types and if it's the same type + the same name then it's displayed first in the completion list.

So here is a draft, first step to open a discussion and know what you think about the implementation. It works (cf tests) but maybe I can make a better implementation at some places. Be careful the code needs some refactoring to be better and concise.

PS: It was lot of fun writing this haha

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-23 21:48:45 +00:00
bors[bot]
01f1f10fec
Merge #4111 #4112
4111: Record definitions in `extern` blocks r=jonas-schievink a=jonas-schievink

Enables completion of extern functions and statics.

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

4112: Add Launch configuration for release build r=matklad a=jonas-schievink

The debug build takes very long until I can test anything useful, with the release build it's much quicker. Add another Run configuration for it.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-04-23 21:37:06 +00:00
Jonas Schievink
5cc9546ca0 Record definitions in extern blocks 2020-04-23 23:36:23 +02:00
Jonas Schievink
80a42a0628 Add Launch configuration for release build 2020-04-23 23:29:40 +02:00
bors[bot]
4f0cb81a2e
Merge #4110
4110: minor r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-23 21:18:41 +00:00
Aleksey Kladov
dd59237e0c minor 2020-04-23 23:18:18 +02:00
bors[bot]
189ac4abbf
Merge #4108
4108: Fully get rid of SyntaxNodePtr::range r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-23 19:24:20 +00:00
Aleksey Kladov
27dd0086ea Fully get rid of SyntaxNodePtr::range 2020-04-23 21:23:36 +02:00
bors[bot]
d283f87f6d
Merge #4107
4107: Disable onEnter command by default r=matklad a=matklad

We are transitioning from experimental to production-ready stance, so
it makes sense to disable potentially disruptive features by default.



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-23 19:06:50 +00:00
Aleksey Kladov
919015ce8a Disable onEnter command by default
We are transitioning from experimental to production-ready stance, so
it makes sense to disable potentially disruptive features by default.
2020-04-23 21:01:17 +02:00
Edwin Cheng
1627b55028 Bubble up error 2020-04-24 01:38:58 +08:00
bors[bot]
29bc218fba
Merge #4102
4102: Cleanup proc_macro config r=matklad a=matklad

In general, there should be no reason to call `.to_string_lossy`.
If you want to display the path, use `.display()`.
If you want to pass the path to an OS API (like std::process::Command)
than use `PathBuf` or `OsString`.



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-23 16:56:05 +00:00
Aleksey Kladov
ca6d7bfe61 Cleanup proc_macro config
In general, there should be no reason to call `.to_string_lossy`.
If you want to display the path, use `.display()`.
If you want to pass the path to an OS API (like std::process::Command)
than use `PathBuf` or `OsString`.
2020-04-23 18:55:26 +02:00
bors[bot]
9b53e79aeb
Merge #4100
4100: Bump required rust to 1.43 r=matklad a=kjeremy

This only impacts source builds

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-23 16:40:26 +00:00
Edwin Cheng
25e8f5ded9 Fix typo 2020-04-24 00:16:17 +08:00
Edwin Cheng
0744497699 Panic proc macro srv if read request failed 2020-04-24 00:06:01 +08:00
kjeremy
4378c63272 Bump required rust to 1.43 2020-04-23 11:56:32 -04:00
bors[bot]
278bf351e3
Merge #4065
4065: Complete unqualified enum names in patterns and expressions r=matklad a=nathanwhit

This PR implements the completion described in #4014.
The result looks like so for patterns:
<img width="542" alt="Screen Shot 2020-04-20 at 3 53 55 PM" src="https://user-images.githubusercontent.com/17734409/79794010-8f529400-831f-11ea-9673-f838aa9bc962.png">

and for `expr`s:
<img width="620" alt="Screen Shot 2020-04-21 at 3 51 24 PM" src="https://user-images.githubusercontent.com/17734409/79908784-d73ded80-83e9-11ea-991d-921f0cb27e6f.png">


I'm not confident that the completion text itself is very robust, as it will unconditionally add completions for enum variants with the form `Enum::Variant`. This means (I believe) it would still suggest `Enum::Variant` even if the local name is changed i.e. `use Enum as Foo` or the variants are brought into scope such as through `use Enum::*`.

Co-authored-by: nathanwhit <nathan.whitaker01@gmail.com>
2020-04-23 15:35:31 +00:00
bors[bot]
4a18509a98
Merge #4099
4099: Remove SyntaxPtr::range from more places r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-23 14:40:07 +00:00
Aleksey Kladov
4176c03d12 Remove SyntaxPtr::range from more places 2020-04-23 16:33:01 +02:00
bors[bot]
0502be3bf4
Merge #4093
4093: Simplify config r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-23 09:49:03 +00:00
bors[bot]
6ec64805e3
Merge #4094
4094: proc_macro: add ability to log to stderr and view output in vscode r=matklad a=Veetaha

r? @edwin0cheng 

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-23 09:32:45 +00:00
bors[bot]
604b936ca0
Merge #4092
4092: feat: run ignored tests r=matklad a=hdevalke

I started making some exercices on https://exercism.io/ and a lot of test have the `#[ignore]` attribute.
The `Run Test|Debug` code lens show up, but running the test results in:

```
running 1 test
test test_one_piece ... ignored

test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 5 filtered out
```

This pull request adds the `--ignored` flag if needed.

Co-authored-by: Hannes De Valkeneer <hannes@de-valkeneer.be>
2020-04-23 09:24:15 +00:00
bors[bot]
1101e74b10
Merge #4098
4098: Add YouCompleteMe as a LSP option for vim/neovim r=matklad a=weihanglo

As YouCompleteMe supports [arbitrary LSP implementation](https://ycm-core.github.io/YouCompleteMe/#plugging-an-arbitrary-lsp-server), it could be added to the list of vim LSP implementation. It works like a charm.

Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
2020-04-23 09:11:56 +00:00
Weihang Lo
313409af9e
Add YouCompleteMe as a LSP option for vim/neovim 2020-04-23 17:09:37 +08:00
bors[bot]
8026a95a2a
Merge #4096
4096: tasks.json Support r=matklad a=jcdickinson

Move the task provider anonymous class into a real class, as this seems to be how Microsoft do this in their documentation.

resolveTask is now implemented, which is used by VSCode to determine how to execute tasks that the user has defined in tasks.json.

Resolves #3983

Co-authored-by: Jonathan Dickinson <jonathanD@k2.com>
2020-04-23 08:55:07 +00:00
bors[bot]
ad3f1da2ea
Merge #4095
4095: Fix typo r=edwin0cheng a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-23 05:35:12 +00:00
Jonathan Dickinson
1d8c25b75c tasks.json Support
Move the task provider anonymous class into a real class, as this seems
to be how Microsoft do this in their documentation.

resolveTask is now implemented, which is used by VSCode to determine how
to execute tasks that the user has defined in tasks.json.
2020-04-22 17:05:04 -07:00
veetaha
a3a8d10191 Fix typo 2020-04-23 02:00:56 +03:00
veetaha
b5620341fc proc_macro: add ability to log to stderr and view output in vscode 2020-04-23 01:57:02 +03:00
veetaha
364fbd7fc7 Simplify config 2020-04-23 01:30:55 +03:00
Hannes De Valkeneer
380a2870c7 feat: run ignored tests 2020-04-22 23:54:09 +02:00
nathanwhit
dfde73ef90 Update tests to reflect new completions 2020-04-22 12:21:22 -04:00
nathanwhit
18ad86fdda Add tests for enum completion
Adds tests for completion of enum variants in match arms, if-let statements, and basic expressions.
2020-04-22 12:21:22 -04:00
nathanwhit
8664509745 Complete unqualified enum variants when possible 2020-04-22 12:21:14 -04:00
nathanwhit
6c61a7b22f Add utility fn for expected type of a node
Adds `expected_type_of` to `CompletionContext` to return the expected type of a
node, if it is known.
2020-04-22 12:20:18 -04:00
bors[bot]
3f1f3a835a
Merge #4090
4090: Fix config naming r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-22 15:26:47 +00:00
Aleksey Kladov
9e16e2b279 Align the name of proc-macro enabling flag
We use `enable`, not `enabled` elsewhere
2020-04-22 17:22:59 +02:00
Aleksey Kladov
d436beeb04 Match implementation of diagnostics flag to the docs 2020-04-22 17:22:18 +02:00
bors[bot]
0f8ae29cd6
Merge #4089
4089: npm update r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-22 15:05:15 +00:00
kjeremy
c6a50aead7 npm update 2020-04-22 10:58:50 -04:00
bors[bot]
e7afc04416
Merge #4088
4088: cargo update r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-22 14:54:30 +00:00