Commit Graph

6377 Commits

Author SHA1 Message Date
Jeremy Kolb
83dc5e7949 cargo fmt 2019-12-18 09:11:47 -05:00
Jeremy Kolb
cdc6af6bda Pass test 2019-12-18 08:58:48 -05:00
kjeremy
7ec43ee07a WIP: See through Macros for SignatureHelp
Note: we meed to skip the trivia filter to make sure that
`covers!(call_info_bad_offset)` succeeds otherwise we exit call_info
too early.

Also the test doesn't pass: `FnCallNode::with_node` always detects
a MacroCall.
2019-12-18 08:49:06 -05:00
bors[bot]
242f0ae1d8
Merge #2545
2545: Add Token id to all tt::TokenTree r=matklad a=edwin0cheng

This PR try to add token id to all `tt::Leaf` and `tt::Delimiter`.

~~Some tests are failed now because of #2544~~ 

~~Still blocked by a test in goto-definition : see https://github.com/rust-analyzer/rust-analyzer/pull/2544#issuecomment-565572553~~

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-18 11:47:50 +00:00
Edwin Cheng
41544a4088 Refactoring 2019-12-18 13:10:37 +08:00
Edwin Cheng
2ea1cfd780 Rename range to by_kind 2019-12-18 11:36:10 +08:00
Edwin Cheng
e16f3a5ee2 Add test for token map 2019-12-18 11:20:23 +08:00
Edwin Cheng
325532d119 Fix shift id for delim and other tokens 2019-12-18 11:20:23 +08:00
Edwin Cheng
320416d756 Add TokenTextRange 2019-12-18 11:20:22 +08:00
Edwin Cheng
59295854f8 Add token id to delims 2019-12-18 11:20:22 +08:00
Edwin Cheng
aceb9d7fb0 Add token ids for all tt::Leaf 2019-12-18 11:20:22 +08:00
bors[bot]
46ca40ccfc
Merge #2575
2575: [VS Code Extension] Remap error location if it extracted inside macros r=edwin0cheng a=edwin0cheng

It should fix for #2569






Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-18 03:03:51 +00:00
Edwin Cheng
bb9c60d908 Use substr instead of endswith 2019-12-18 10:50:54 +08:00
Edwin Cheng
63c59308e6 Add tests 2019-12-18 10:47:45 +08:00
Edwin Cheng
d2c1f8ee26 Add macro span handling 2019-12-18 10:47:45 +08:00
bors[bot]
ee93fac776
Merge #2583
2583: Use prettier settings in ts-lint r=matklad a=edwin0cheng

This PR add `tslint-plugin-prettier` extension in ts-lint, which "runs prettier rules as tslint rules." and remove  `quotemark` from ts-lint and let prettier to handle it. 

And also fix #2515

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-17 21:12:18 +00:00
Edwin Cheng
da29b7fb14 use pretter settings in ts-lint 2019-12-17 23:50:18 +08:00
bors[bot]
ff8f80579a
Merge #2582
2582: Drop dead code r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 15:03:38 +00:00
Aleksey Kladov
0630f8110f Drop dead code 2019-12-17 16:03:15 +01:00
bors[bot]
b90f9e6d59
Merge #2581
2581: Refactor PathKind r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 14:39:07 +00:00
Aleksey Kladov
aca022f1d4 Refactor PathKind 2019-12-17 15:38:28 +01:00
bors[bot]
f51a3fed9f
Merge #2580
2580: Fix highlighting token names r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 13:46:12 +00:00
Aleksey Kladov
1c8467e20a Fix highlighting token names 2019-12-17 14:45:46 +01:00
bors[bot]
4a58522119
Merge #2562
2562: Fix NavigationTarget ranges r=matklad a=edwin0cheng

Fix the issue described in https://github.com/rust-analyzer/rust-analyzer/pull/2544#issuecomment-565572553

This PR change the order for finding `full_range` of `focus_range` in following orders:
1. map both ranges to macro_call
2. map focus range to a token inside macro call, and full range to the whole of macro call
3. map both ranges to the whole of macro call

And fix the corresponding tests and make these tests easily to follow.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-17 13:37:32 +00:00
bors[bot]
a26840d603
Merge #2568
2568: Add option to disable all-targets. r=matklad a=pftbest

Can be useful in embedded.

Co-authored-by: Vadzim Dambrouski <vadzim.dambrouski@promwad.com>
2019-12-17 13:28:37 +00:00
bors[bot]
ba6312a2df
Merge #2571
2571: Fixed a typo in settings r=matklad a=omerbenamram

@lnicola found a typo in the description for one of the settings introduced in #2559.

Co-authored-by: Omer Ben-Amram <omerbenamram@gmail.com>
2019-12-17 13:19:59 +00:00
bors[bot]
7191dd7d53
Merge #2578
2578: Default to client watching on VS Code r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 11:42:19 +00:00
Aleksey Kladov
2432f278cb Default to client watching on VS Code 2019-12-17 12:41:44 +01:00
bors[bot]
827831de87
Merge #2577
2577: Improve recovery for incomplete lambdas r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 11:12:50 +00:00
Aleksey Kladov
3e2f4e4293 Improve recovery for incomplete lambdas 2019-12-17 12:11:01 +01:00
bors[bot]
cb79e30d53
Merge #2572
2572: link website r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-16 17:47:43 +00:00
Aleksey Kladov
dd2f2dc376 link website 2019-12-16 18:41:03 +01:00
Omer Ben-Amram
624abc1db3 Fixed a typo
thanks @lnicola
2019-12-16 17:32:46 +02:00
Vadzim Dambrouski
22ae4cb906 Fix formatting 2019-12-16 09:01:38 +05:30
bors[bot]
0ef8ace012
Merge #2567
2567: Handle impl Trait more correctly r=flodiebold a=flodiebold

When calling a function, argument-position impl Trait is transparent; same for return-position impl Trait when inside the function. 

So in these cases, we need to represent that type not by `Ty::Opaque`, but by a type variable that can be unified with whatever flows into there.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-15 20:08:12 +00:00
Florian Diebold
91853590a9 Add test mark 2019-12-15 21:06:08 +01:00
Vadzim Dambrouski
a85cd6455a Add option to disable all-targets.
Can be useful in embedded.
2019-12-15 23:32:13 +05:30
Florian Diebold
6e1c2d0df8 Handle impl Trait more correctly
When calling a function, argument-position impl Trait is transparent; same for
return-position impl Trait when inside the function. So in these cases, we need
to represent that type not by `Ty::Opaque`, but by a type variable that can be
unified with whatever flows into there.
2019-12-15 18:56:38 +01:00
Florian Diebold
ac961b2614 Add test for unifying impl Trait 2019-12-15 17:45:32 +01:00
bors[bot]
4e24b25c66
Merge #2565
2565: Fixed syntax highlighting not refreshing on windows. r=matklad a=omerbenamram

I was encoutering the same probelm described in #1690.

It seems that events initiated by the frontend with `rust-analyzer/decorationsRequest` would go through.
So whenever a user switches tabs, highlighting will update.

However, when decorations are initiated by a notification with `rust-analyzer/publishDecorations`, it would fail on this check here 6cbd8a4a4b/editors/code/src/notifications/publish_decorations.ts (L15) (`targetEditor` will always be `undefined`).

This is because it's trying to match the uri `rust-analyzer` sends (which uses an uppercase drive letter) to the uri provided at `editor.document.uri.toString()`, which is both escaped (uses `%3a` for `:`), and uses a lowercase letter drive.

Aparrently this was an issue for some other extensions aswell - https://github.com/Microsoft/vscode/issues/68325.

But this is the defined behavior - c110d84460/src/vs/vscode.d.ts (L1304)

This fix is only relevant for windows.
I've opted for a server-side fix, since rust will always return uppercase letters for drives, there seems to be no other easy solution than manipulating the Url string before sending it to the frontend.


Closes #1690.

Co-authored-by: Omer Ben-Amram <omerbenamram@gmail.com>
2019-12-15 16:35:23 +00:00
bors[bot]
4c1b2b9218
Merge #2566
2566: Add a rudimentary json regex to get at information like `endLine` r=matklad a=oli-obk



Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2019-12-15 16:20:13 +00:00
Oliver Scherer
5166f6e5f2 Properly format json 2019-12-15 17:19:41 +01:00
Omer Ben-Amram
6fba427bf3 remove unnecessary turbofish. 2019-12-15 18:15:24 +02:00
Oliver Scherer
eed57dcded Add a rudimentary json regex to get at information like endLine 2019-12-15 17:12:52 +01:00
Omer Ben-Amram
40116af598 cfg gated tests that only work on windows. 2019-12-15 17:54:24 +02:00
Omer Ben-Amram
2e2fae32df improved path checking to consider only paths that may contain a windows drive. 2019-12-15 17:46:00 +02:00
Omer Ben-Amram
75353753cd npm run fix 2019-12-15 17:10:39 +02:00
Omer Ben-Amram
ebf302d261 move import inside cfg block 2019-12-15 17:03:39 +02:00
Omer Ben-Amram
498a7912e9 fixed comment 2019-12-15 16:55:39 +02:00
Omer Ben-Amram
324cbe839f Lowercase drive letters on windows before sending to extension. 2019-12-15 16:51:57 +02:00