pcpthm
76075c7410
Use Marker argument for item parsers
...
- Fix pub_expr
- Fix incorrect parsing of crate::path
2019-03-18 14:34:08 +09:00
bors[bot]
4c1ea0b628
Merge #987
...
987: Refactor maybe_item to use Marker argument r=pcpthm a=pcpthm
As suggested at <https://github.com/rust-analyzer/rust-analyzer/pull/980#issuecomment-473659745 >.
For expression paring functions, changing signature
- from `fn(&mut Parser) -> Option<CompletedMarker>` to `fn(&mut Parser, Marker) -> Result<CompletedMarker, Marker>`
- from `fn(&mut Parser) -> CompletedMarker` to `fn(&mut Parser, Marker) -> CompletedMarker`
is my plan.
Co-authored-by: pcpthm <pcpthm@gmail.com>
2019-03-18 04:16:20 +00:00
pcpthm
3d9c2beb8e
Apply stylistic changes suggested
2019-03-18 13:14:47 +09:00
bors[bot]
40c6dd1f4c
Merge #982
...
982: Implement BindingMode for pattern matching. r=flodiebold a=mjkillough
Implement `BindingMode` for pattern matching, so that types can be
correctly inferred using match ergonomics. The binding mode defaults to
`Move` (referred to as 'BindingMode::BindByValue` in rustc), and is
updated by automatic dereferencing of the value being matched.
Fixes #888 .
- [Binding modes in The Reference](https://doc.rust-lang.org/reference/patterns.html#binding-modes )
- [`rustc` implementation](e17c48e2f2/src/librustc_typeck/check/_match.rs (L77)
) (and [definition of `BindingMode`](e957ed9d10/src/librustc/ty/binding.rs
))
- [Match Ergonomics RFC](https://github.com/rust-lang/rfcs/blob/master/text/2005-match-ergonomics.md#binding-mode-rules )
Co-authored-by: Michael Killough <michaeljkillough@gmail.com>
2019-03-17 21:41:37 +00:00
Michael Killough
6299ccd350
Split test case and use tested_by!.
2019-03-17 19:08:51 +00:00
Michael Killough
33add0ee30
Simplify match statement.
2019-03-17 18:50:22 +00:00
yanchith
907f7307af
Implement naive version of fill_struct_fields assist
2019-03-17 19:48:25 +01:00
Michael Killough
354134ffb4
impl Default for BindingMode.
...
This decouples callers from knowing what the default binding mode of
pattern matching is.
2019-03-17 18:46:01 +00:00
bors[bot]
91e7a3b6f2
Merge #983
...
983: support remainder assignment operator r=matklad a=JeanMertz
`%=` was returning errors for me, turns out it wasn't added as a valid assignment operation.
I'm not sure what the best location would be to add a test for this. Please let me know and I'll add one.
Co-authored-by: Jean Mertz <jean@mertz.fm>
2019-03-17 14:34:14 +00:00
Jean Mertz
a8ee994ae0
support remainder assignment operator
2019-03-17 14:11:24 +01:00
pcpthm
e570267515
Refactor maybe_item to use Marker argument
2019-03-17 22:04:25 +09:00
pcpthm
a67fe4ea7e
Fix parse tree of attribute on match arm
2019-03-17 20:57:27 +09:00
bors[bot]
aea9c98f53
Merge #985
...
985: simplify parsing blocks a bit r=pcpthm a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-17 10:26:45 +00:00
Aleksey Kladov
a8271cb31f
simplify parsing blocks a bit
2019-03-17 13:14:17 +03:00
pcpthm
a1d84f5fb0
Allow attribute on struct literal field
2019-03-17 19:08:35 +09:00
Aleksey Kladov
3a77023365
docs
2019-03-17 12:53:22 +03:00
Aleksey Kladov
4d7fa6d30b
remove fixme
2019-03-17 12:53:22 +03:00
Aleksey Kladov
6955e392f8
remove old macro support
2019-03-17 12:53:22 +03:00
Aleksey Kladov
ee3cf6172b
rename ModuleId -> CrateModuleId
2019-03-17 12:53:22 +03:00
Aleksey Kladov
c51a6a7bdd
fix error on wrong path
2019-03-17 12:53:22 +03:00
Aleksey Kladov
0d6b8baa89
log time
2019-03-17 12:53:22 +03:00
Aleksey Kladov
967a4b64af
Reorganize name resolution
2019-03-17 12:53:22 +03:00
Aleksey Kladov
d4449945a0
hack around non-terminating macro expansion
2019-03-17 12:52:52 +03:00
Aleksey Kladov
b2a6c17362
remove lower module
2019-03-17 12:52:52 +03:00
Aleksey Kladov
c7259a899c
remove ItemMap
2019-03-17 12:52:05 +03:00
Aleksey Kladov
71e5adf694
move tests over to crate-def-map
2019-03-17 12:49:07 +03:00
Aleksey Kladov
2195d1db6d
Replace module_tree with CrateDefMap
2019-03-17 12:49:07 +03:00
Aleksey Kladov
182c05a96c
add name resolution from the old impl
...
unlike the old impl, this also handles macro imports across crates
2019-03-17 12:46:13 +03:00
Aleksey Kladov
0d8d918656
add skeleton for macro-aware name resolutions
2019-03-17 12:46:13 +03:00
Igor Matuszewski
30a226c725
Move the primary assist fn to the top of the file
2019-03-16 23:24:17 +01:00
Igor Matuszewski
5b0b87f8de
Provide assist when cursor is immediately outside impl item block
2019-03-16 23:19:14 +01:00
Igor Matuszewski
2f36f47dab
Do a cleanup/legibility pass
2019-03-16 22:41:13 +01:00
Igor Matuszewski
1df81f3d65
Take into account parent indent when filling trait members
2019-03-16 22:41:13 +01:00
Igor Matuszewski
b3742873d9
Simplify trait resolution fragment
2019-03-16 22:41:13 +01:00
Igor Matuszewski
0e47c371fd
Ignore unnamed trait fns and add more tests
2019-03-16 22:41:13 +01:00
Igor Matuszewski
406343492c
Simplify calculation of missing functions
...
Asymptotically computing a set difference is faster but in the average
case we won't have more than ~10 functions. Also prefer not using hash
sets as these may yield nondeterministic results.
2019-03-16 22:41:13 +01:00
Igor Matuszewski
713975b1c1
Properly support the case when the cursor is inside an empty block or outside
2019-03-16 22:41:13 +01:00
Igor Matuszewski
38eece97ec
Redo indent calculation when adding missing impl members
2019-03-16 22:41:13 +01:00
Igor Matuszewski
2f616eea9c
Implement a simple working assist
2019-03-16 22:41:13 +01:00
Igor Matuszewski
1c07c5ccf9
Calculate missing functions from impl body
2019-03-16 22:41:13 +01:00
Igor Matuszewski
fc060573f9
Add 'add_missing_impl_members' assist stub
2019-03-16 22:41:13 +01:00
Michael Killough
b42c5ced68
Implement BindingMode for pattern matching.
...
Implement `BindingMode` for pattern matching, so that types can be
correctly inferred using match ergonomics. The binding mode defaults to
`Move` (referred to as 'BindingMode::BindByValue` in rustc), and is
updated by automatic dereferencing of the value being matched.
2019-03-16 18:13:13 +00:00
Florian Diebold
7faae12311
Remove FnSig from FnDef type
...
It doesn't need to be in there since it's just information from the def. Another
step towards aligning Ty with Chalk's representation.
2019-03-16 17:29:55 +01:00
Florian Diebold
a9ddaba905
Refactor FnSig a bit
2019-03-16 17:21:32 +01:00
Florian Diebold
628b530e92
Some more Ty displaying cleanup
2019-03-16 16:50:31 +01:00
Florian Diebold
c5ee60e05b
Replace Display by a pretty printing trait for Ty
...
This allows removing the names from Adt and FnDef (and more later), as a first
step towards aligning more with chalk's Ty :)
2019-03-16 16:36:59 +01:00
Aleksey Kladov
8774067a87
sort navigations to make tests stable
2019-03-14 13:28:45 +03:00
Michael Chesser
943d2fb781
Add test for minus in inner pattern
2019-03-14 19:24:12 +10:30
Michael Chesser
16418c35bc
Allow MINUS at the start of a pattern.
2019-03-14 19:24:11 +10:30
pcpthm
adad641c52
derive Hash for ra_hir::ModuleDef
2019-03-14 17:25:51 +09:00
bors[bot]
65a9066115
Merge #958
...
958: LSP: Support EnumMember and Field r=matklad a=kjeremy
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-03-12 10:16:04 +00:00
Aleksey Kladov
e9e792f2d7
remove Def
2019-03-12 12:36:37 +03:00
kjeremy
31b69e685d
LSP: Support EnumMember and Field
2019-03-11 13:58:38 -04:00
Caio
cc9721996c
Add test for async block
2019-03-10 14:35:25 -03:00
Caio
ad72699553
Add async keyword
2019-03-09 20:40:22 -03:00
Florian Diebold
c30c5fb4dd
Don't default publishDecorations to true on the server
...
If the client doesn't specify this explicitly, that very likely means it doesn't
know about it and so we shouldn't send decorations. In particular, the recent
change to this default caused decorations to be sent to emacs, resulting in a
lot of warning spam.
2019-03-09 12:55:15 +01:00
kjeremy
27fc99776f
Remove superfluous semicolons
...
Doesn't change the result of the test but it does prevent the
syntax tree from rendering.
2019-03-08 16:45:26 -05:00
Ville Penttinen
b168104d95
Use ast::Name::text() instead of name().syntax().text()
2019-03-07 20:58:41 +02:00
Ville Penttinen
5c0556c2ca
Fix EnumVariants not showing properly when hovering
...
This fixes documentation as well for EnumVariants
2019-03-07 20:33:33 +02:00
bors[bot]
4ce962f64e
Merge #948
...
948: Fix test_missing_module_code_action_in_json_project on Windows r=matklad a=vipentti
The test would fail on Windows due to the paths not being properly escaped for
JSON.
In addition adds extra braces around the fn main to actually introduce braces in
the file.
Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-03-07 17:35:57 +00:00
Ville Penttinen
84e1d50a2a
Fix test_missing_module_code_action_in_json_project on Windows
...
The test would fail on Windows due to the paths not being properly escaped for
JSON.
In addition adds extra braces around the fn main to actually introduce braces in
the file.
2019-03-07 19:27:06 +02:00
pcpthm
d4108cdd60
Specify derive feature for serde
2019-03-08 01:58:29 +09:00
Ville Penttinen
4a0bb3d7c5
Add support for goto definition and hover on Self
...
This fixes #943
2019-03-07 17:34:44 +02:00
Aleksey Kladov
1aa11eb7e9
when loading workspace, say how many packages were loaded
...
this should help to debug configuration issues, when you see `0
packages loaded` or something like that.
2019-03-07 17:46:17 +03:00
bors[bot]
5232099977
Merge #939
...
939: Initial implementation of project-lock.json. r=davidtwco a=davidtwco
Fixes #792 .
This PR adds a initial implementation of project-lock.json, a build
system agnostic method of specifying the crate graph and roots.
Co-authored-by: David Wood <david@davidtw.co>
2019-03-07 11:36:04 +00:00
David Wood
4cd757c1e3
Remove rust-project.json test w/ dependencies.
2019-03-07 12:28:19 +01:00
David Wood
3bc33ae712
Add test demonstrating logic for handling deps.
2019-03-07 01:06:46 +01:00
David Wood
614dd3c347
Rename and change add_roots
to return a Vec
.
2019-03-07 01:05:07 +01:00
David Wood
00d927a188
Initial implementation of project-lock.json.
...
This commit adds a initial implementation of project-lock.json, a build
system agnostic method of specifying the crate graph and roots.
2019-03-07 01:05:03 +01:00
kjeremy
064707c5a0
Use source map
2019-03-06 14:40:42 -05:00
kjeremy
aac421b135
Hover for associated items in patterns
2019-03-06 11:39:11 -05:00
bors[bot]
b1a1d20e06
Merge #933
...
933: Check installed extension r=matklad a=c410-f3r
Fixes #918 .
Edit: Windows encoding for Unicode is UTF-16 so String::from_utf8 will probably fail unless `Vec<u8>` is already UTF-8 somehow, which I don't know for sure.
Co-authored-by: Caio <c410.f3r@gmail.com>
2019-03-06 12:21:55 +00:00
Ville Penttinen
0dcb1cb569
Add showWorkspaceLoadedNotification to vscode client
...
This allows users to control whether or not they want to see the "workspace
loaded" notification.
This is done on the server side using InitializationOptions which are provided
by the client. By default show_workspace_loaded is true, meaning the
notification is sent.
2019-03-06 11:34:38 +02:00
Caio
cb60416cb5
Check installed extension
2019-03-05 18:19:36 -03:00
Ville Penttinen
ce118da149
Rename feedback to show_message
2019-03-05 22:25:24 +02:00
Ville Penttinen
80347b8187
Remove InternalFeedback
2019-03-05 22:20:11 +02:00
Ville Penttinen
9063dabcca
Send an actual ShowMessage instead of InternalFeedback in feedback()
...
This now allows us to send a notification that can be shown in the UI when the
workspace has been loaded.
Additionally this removes the need for internal_mode flag.
2019-03-05 21:59:01 +02:00
kjeremy
eb3ee7b8e5
Updates
2019-03-05 10:26:36 -05:00
Aleksey Kladov
d1c982d3c7
dont produce giant debug dumps
2019-03-05 17:09:48 +03:00
Aleksey Kladov
73b892aaa3
show message in client's UI if workspace fails to load
2019-03-05 16:33:05 +03:00
bors[bot]
e7241274ef
Merge #930
...
930: Add support for parsing multiple if and while-let patterns r=matklad a=vipentti
Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-03-05 10:28:24 +00:00
Ville Penttinen
eb1ac43867
Introduce pattern_list to parse pipe separated patterns
...
pattern_list comes in two variants, one uses the default PAT_RECOVERY_SET as the
recovery set, while other allows the user to provide a recovery set.
2019-03-05 11:31:25 +02:00
bors[bot]
fe48f9f4d2
Merge #912
...
912: Make goto definition/hover work for associated items r=matklad a=kjeremy
Just functions so far. Looking for comments.
Fixes #911
Towards #832
Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-03-05 07:30:19 +00:00
Ville Penttinen
1f4468a8da
Add support for parsing multiple if and while-let patterns
2019-03-04 19:10:14 +02:00
kjeremy
ac678473b8
Use impl_froms!
2019-03-04 09:52:48 -05:00
kjeremy
1578375b89
Make ExpOrPatId private
2019-03-04 09:49:18 -05:00
Aleksey Kladov
90122542b2
allow mut ident
patterns in trait methods
...
closes #928
2019-03-04 17:47:02 +03:00
Aleksey Kladov
0a19f4f1b4
allow aliases in underscores
...
this helps with
use foo::Trait as _;
syntax
2019-03-04 16:40:08 +03:00
Jeremy Kolb
79f61dcb0e
Format
2019-03-04 08:34:41 -05:00
Jeremy Kolb
e1b59bfe0b
Add NavigationTarget::from_impl_item
2019-03-04 08:27:08 -05:00
Jeremy Kolb
ad2da5b1da
Remove commented out code
2019-03-04 08:27:08 -05:00
Jeremy Kolb
3d8d880c59
Use ImplItems instead of just Function
2019-03-04 08:27:08 -05:00
kjeremy
49da9a3e81
Make goto definition/hover resolve constructors
2019-03-04 08:27:08 -05:00
bors[bot]
dc8bcc1e42
Merge #926
...
926: allow vararg functions r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-04 12:49:37 +00:00
Aleksey Kladov
77f2381eea
improve error recovery
...
parse the contents of error block as an expression
2019-03-04 15:31:18 +03:00
Aleksey Kladov
a99b1db49f
allow vararg functions
2019-03-04 14:34:59 +03:00
Aleksey Kladov
3000b13df2
extract block contents into a function
2019-03-04 14:17:31 +03:00
bors[bot]
5197e16648
Merge #916
...
916: Error handling for macros r=matklad a=detrumi
Part of #720
Co-authored-by: Wilco Kusee <wilcokusee@gmail.com>
2019-03-04 10:58:08 +00:00
Ville Penttinen
1ef2c06131
Allow syntax strings to contain test markers
...
We simply remove all the CUSTOM_MARKERS before attempting to parse the file.
This allows for the syntax selection to work with most of the test strings.
2019-03-04 09:19:46 +02:00
Ville Penttinen
16ecd276f0
Implement syntax tree support for syntax inside string
...
This allows us to select a string or portions of it and try parsing it as rust
syntax. This is mostly helpful when developing tests where the test
itself contains some rust syntax as a string.
2019-03-04 09:02:01 +02:00