]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoMerge #926
bors[bot] [Mon, 4 Mar 2019 12:49:37 +0000 (12:49 +0000)]
Merge #926

926: allow vararg functions r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
5 years agoMerge #925
bors[bot] [Mon, 4 Mar 2019 12:42:21 +0000 (12:42 +0000)]
Merge #925

925: improve error recovery r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
5 years agoimprove error recovery
Aleksey Kladov [Mon, 4 Mar 2019 11:24:02 +0000 (14:24 +0300)]
improve error recovery

parse the contents of error block as an expression

5 years agoallow vararg functions
Aleksey Kladov [Mon, 4 Mar 2019 11:34:59 +0000 (14:34 +0300)]
allow vararg functions

5 years agoextract block contents into a function
Aleksey Kladov [Mon, 4 Mar 2019 11:17:31 +0000 (14:17 +0300)]
extract block contents into a function

5 years agoMerge #916
bors[bot] [Mon, 4 Mar 2019 10:58:08 +0000 (10:58 +0000)]
Merge #916

916: Error handling for macros r=matklad a=detrumi

Part of #720

Co-authored-by: Wilco Kusee <wilcokusee@gmail.com>
5 years agoMerge #924
bors[bot] [Mon, 4 Mar 2019 10:50:40 +0000 (10:50 +0000)]
Merge #924

924: Improve show syntax tree r=matklad a=vipentti

This implements some of the features discussed in #820.

You can now select a range of syntax in a file and then use "Show Syntax Tree" to show its syntax. In addition you can select a range of syntax that is inside a string (typically test cases) and show its syntax as well.

Previous behavior is still available, simply use "Show Syntax Tree" without a selection, and you get the live updating syntax tree. Additionally now the live updating tree will update when the active file is changed. Previously you had to type something in the new file to get the syntax tree to update.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
5 years agoAllow syntax strings to contain test markers
Ville Penttinen [Mon, 4 Mar 2019 07:19:46 +0000 (09:19 +0200)]
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.

5 years agoImplement syntax tree support for syntax inside string
Ville Penttinen [Mon, 4 Mar 2019 06:54:54 +0000 (08:54 +0200)]
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.

5 years agoAllow syntax tree to update when changing files
Ville Penttinen [Sun, 3 Mar 2019 20:03:37 +0000 (22:03 +0200)]
Allow syntax tree to update when changing files

Previously when using the file based syntax tree, it would not update until a
change had been made in the new file. Now we automatically update the syntax
tree to match the current file.

5 years agoRename syntaxtree text provider to SyntaxTreeContentProvider
Ville Penttinen [Sun, 3 Mar 2019 19:54:51 +0000 (21:54 +0200)]
Rename syntaxtree text provider to SyntaxTreeContentProvider

5 years agoAdd vscode support for range in SyntaxTreeParams
Ville Penttinen [Sun, 3 Mar 2019 19:21:40 +0000 (21:21 +0200)]
Add vscode support for range in SyntaxTreeParams

This enables the client to use a command to either show the live-updating
version of the syntax tree for the current file. Or optionally when a selected
range is provided, we then provide a snapshot of the syntax tree for the range.

5 years agoAdd expander unit tests
Wilco Kusee [Sun, 3 Mar 2019 19:33:50 +0000 (20:33 +0100)]
Add expander unit tests

5 years agoAdd optional range parameter to SyntaxTreeParams
Ville Penttinen [Sun, 3 Mar 2019 10:02:55 +0000 (12:02 +0200)]
Add optional range parameter to SyntaxTreeParams

When range is provided, instead of showing the syntax for the whole file, we'll
show the syntax tree for the given range.

5 years agoAdd parser unit tests
Wilco Kusee [Sun, 3 Mar 2019 11:45:30 +0000 (12:45 +0100)]
Add parser unit tests

5 years agoMerge #917
bors[bot] [Sun, 3 Mar 2019 11:44:01 +0000 (11:44 +0000)]
Merge #917

917: Trait tests r=flodiebold a=flodiebold

This adds a bunch of basic tests for trait functionality, just to outline what seems like the first goals for that ;)

It also changes the display of `Ty::Unknown` to `{unknown}`, since `[unknown]` could be confused with a slice, and fixes an error in the emacs runnables code.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
5 years agoInline type inference test snapshots
Florian Diebold [Sun, 3 Mar 2019 11:40:36 +0000 (12:40 +0100)]
Inline type inference test snapshots

5 years agoSplit parse and expand errors
Wilco Kusee [Sun, 3 Mar 2019 09:40:03 +0000 (10:40 +0100)]
Split parse and expand errors

5 years agoemacs: Fix (void-variable rust-analyzer--last-runnable)
Florian Diebold [Sat, 2 Mar 2019 19:58:06 +0000 (20:58 +0100)]
emacs: Fix (void-variable rust-analyzer--last-runnable)

5 years agoRepresent unknown types as {unknown} instead of [unknown]
Florian Diebold [Sat, 2 Mar 2019 19:55:56 +0000 (20:55 +0100)]
Represent unknown types as {unknown} instead of [unknown]

Since the latter could actually be a real type...

5 years agoFormatting
Wilco Kusee [Sat, 2 Mar 2019 19:49:13 +0000 (20:49 +0100)]
Formatting

5 years agoReplace option with result in mbe
Wilco Kusee [Sat, 2 Mar 2019 19:20:26 +0000 (20:20 +0100)]
Replace option with result in mbe

5 years agoAdd a bunch of tests for type inference involving traits
Florian Diebold [Sat, 2 Mar 2019 13:53:26 +0000 (14:53 +0100)]
Add a bunch of tests for type inference involving traits

None of them works correctly yet, of course.

5 years agoMerge #908
bors[bot] [Sat, 2 Mar 2019 14:21:44 +0000 (14:21 +0000)]
Merge #908

908: Enable markup for hover on expressions which resolve using type_of r=matklad a=vipentti

This adds highlighting when hovering over items which are resolved using
`type_of`.

This adds basic highlighting, discussed in #904.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
5 years agoMerge #915
bors[bot] [Sat, 2 Mar 2019 14:09:46 +0000 (14:09 +0000)]
Merge #915

915: Bring BodySyntaxMapping in line with other source-map instances r=flodiebold a=matklad

* rename to SourceMap
* don't store the actual body inline, just return a pair

r? @flodiebold

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
5 years agoremove comment
Aleksey Kladov [Sat, 2 Mar 2019 14:01:20 +0000 (17:01 +0300)]
remove comment

5 years agoremove second way to get the body
Aleksey Kladov [Sat, 2 Mar 2019 13:59:18 +0000 (16:59 +0300)]
remove second way to get the body

5 years agorename syntax_mapping as well
Aleksey Kladov [Sat, 2 Mar 2019 13:56:09 +0000 (16:56 +0300)]
rename syntax_mapping as well

5 years agoMerge #914
bors[bot] [Sat, 2 Mar 2019 13:55:08 +0000 (13:55 +0000)]
Merge #914

914: A bit of cleanup in ty.rs r=flodiebold a=flodiebold

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
5 years agoA bit of cleanup in ty.rs
Florian Diebold [Sat, 2 Mar 2019 13:53:12 +0000 (14:53 +0100)]
A bit of cleanup in ty.rs

5 years agoalign lower module query names
Aleksey Kladov [Sat, 2 Mar 2019 13:49:06 +0000 (16:49 +0300)]
align lower module query names

5 years agorename scopes
Aleksey Kladov [Sat, 2 Mar 2019 13:38:28 +0000 (16:38 +0300)]
rename scopes

5 years agorename to source_map
Aleksey Kladov [Sat, 2 Mar 2019 13:36:25 +0000 (16:36 +0300)]
rename to source_map

5 years agodont store body inside source map
Aleksey Kladov [Sat, 2 Mar 2019 13:18:40 +0000 (16:18 +0300)]
dont store body inside source map

5 years agorename syntax-mapping -> source-map
Aleksey Kladov [Sat, 2 Mar 2019 12:14:37 +0000 (15:14 +0300)]
rename syntax-mapping -> source-map

5 years agoMerge #910
bors[bot] [Thu, 28 Feb 2019 19:53:15 +0000 (19:53 +0000)]
Merge #910

910: Update hover message since we do support globs r=matklad a=kjeremy

#909 drew attention to this.

Co-authored-by: kjeremy <kjeremy@gmail.com>
5 years agoUpdate hover message since we do support globs
kjeremy [Thu, 28 Feb 2019 19:48:21 +0000 (14:48 -0500)]
Update hover message since we do support globs

5 years agoadd syntax-trees video
Aleksey Kladov [Thu, 28 Feb 2019 19:08:17 +0000 (22:08 +0300)]
add syntax-trees video

5 years agoEnable markup for hover on expressions which resolve using type_of
Ville Penttinen [Thu, 28 Feb 2019 07:33:06 +0000 (09:33 +0200)]
Enable markup for hover on expressions which resolve using type_of

This adds highlighting when hovering over items which are resolved using
`type_of`.

5 years agoMerge #906
bors[bot] [Wed, 27 Feb 2019 15:59:56 +0000 (15:59 +0000)]
Merge #906

906: Add support for goto definition and hover for struct fields r=matklad a=vipentti

This works partially towards fixing #512

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
5 years agoEnable hover support for NamedFieldDefs
Ville Penttinen [Wed, 27 Feb 2019 15:52:37 +0000 (17:52 +0200)]
Enable hover support for NamedFieldDefs

Additionally add type ascription for const and statics as well.

5 years agoAllow goto-definition to work for named fields in struct initializer
Ville Penttinen [Wed, 27 Feb 2019 15:22:53 +0000 (17:22 +0200)]
Allow goto-definition to work for named fields in struct initializer

Now goto definition should work when done on a named field in a struct
initializer.

5 years agoMerge #905
bors[bot] [Wed, 27 Feb 2019 15:22:53 +0000 (15:22 +0000)]
Merge #905

905: Update deps r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
5 years agoFix the build
kjeremy [Wed, 27 Feb 2019 14:35:04 +0000 (09:35 -0500)]
Fix the build

5 years agoUpdate deps
kjeremy [Wed, 27 Feb 2019 13:58:13 +0000 (08:58 -0500)]
Update deps

5 years agoMerge #900
bors[bot] [Wed, 27 Feb 2019 12:18:55 +0000 (12:18 +0000)]
Merge #900

900: Add new trait ast::TypeAscriptionOwner r=vipentti a=vipentti

This trait should be implemented for nodes which have an ascribed type,
e.g. thing : Type. Such as let, const, static, param, named struct fields.

In addition, we update some places where previously we used node + node.type_ref() with `TypeAscriptionOwner` in the trait bounds.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
5 years agoRemove `TypeRef` from item opts which implement TypeAscriptionOwner
Ville Penttinen [Wed, 27 Feb 2019 12:00:08 +0000 (14:00 +0200)]
Remove `TypeRef` from item opts which implement TypeAscriptionOwner

5 years agoMerge #901
bors[bot] [Wed, 27 Feb 2019 11:50:38 +0000 (11:50 +0000)]
Merge #901

901: Add basic support for showing fn signature when hovering r=matklad a=vipentti

This adds basic support for displaying function signature when hovering over a usage of a function.

Additionally refactored `hover` to return `HoverResult` to ease with testing and in general to be more robust.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
5 years agoMerge #903
bors[bot] [Wed, 27 Feb 2019 11:09:47 +0000 (11:09 +0000)]
Merge #903

903: Work around for issue in vscode reporting a failure in request r=matklad a=vipentti

vscode would report "A request has failed" when it got "Content modified"
message and this would cause a pop-up to appear. This works around the issue by
returning an "empty" response that vscode can ignore.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
5 years agoRemove RawResponse::empty()
Ville Penttinen [Wed, 27 Feb 2019 10:57:59 +0000 (12:57 +0200)]
Remove RawResponse::empty()

5 years agoWork around for issue in vscode reporting a failure in request
Ville Penttinen [Wed, 27 Feb 2019 10:49:04 +0000 (12:49 +0200)]
Work around for issue in vscode reporting a failure in request

vscode would report "A request has failed" when it got "Content modified"
message and this would cause a pop-up to appear. This works around the issue by
returning an "empty" response that vscode can ignore.

5 years agoAdd support for hovering over the name of an item
Ville Penttinen [Wed, 27 Feb 2019 07:49:22 +0000 (09:49 +0200)]
Add support for hovering over the name of an item

5 years agoReplace visit_fn with crate::completion::function_label
Ville Penttinen [Tue, 26 Feb 2019 19:30:46 +0000 (21:30 +0200)]
Replace visit_fn with crate::completion::function_label

5 years agoMerge #902
bors[bot] [Tue, 26 Feb 2019 18:04:24 +0000 (18:04 +0000)]
Merge #902

902: Fix a typo r=matklad a=dwijnand

Co-authored-by: Dale Wijnand <dale.wijnand@gmail.com>
5 years agoFix a typo
Dale Wijnand [Tue, 26 Feb 2019 17:59:32 +0000 (17:59 +0000)]
Fix a typo

5 years agoAdd new type HoverResult to contain the results of hovering
Ville Penttinen [Tue, 26 Feb 2019 16:56:04 +0000 (18:56 +0200)]
Add new type HoverResult to contain the results of hovering

This makes testing hovers easier as well as allows us to do more things with the
results if needed.

5 years agoAdd support for showing fn signature when hovering
Ville Penttinen [Tue, 26 Feb 2019 16:55:08 +0000 (18:55 +0200)]
Add support for showing fn signature when hovering

5 years agoUse TypeAscriptionOwner
Ville Penttinen [Tue, 26 Feb 2019 09:47:13 +0000 (11:47 +0200)]
Use TypeAscriptionOwner

This replaces places where we would use node + node.type_ref() with things that
have an ascribed type, with using the TypeAscriptionOwner as the trait bound so
we can simply pass the node.

5 years agoAdd new trait TypeAscriptionOwner
Ville Penttinen [Tue, 26 Feb 2019 09:35:57 +0000 (11:35 +0200)]
Add new trait TypeAscriptionOwner

This trait should be implemented for nodes which have an ascribed type,
e.g. thing : Type. Such as let, const, static, param, named struct fields.

5 years agoMerge #899
bors[bot] [Tue, 26 Feb 2019 08:49:17 +0000 (08:49 +0000)]
Merge #899

899: Change default value of highlightingOn to false r=matklad a=vipentti

This changes the default value for the vscode setting `rust-analyzer.highlightingOn` to `false`. Since currently the highlighting only supports Zenburn, which people may not be using, I think it makes sense to have this feature disabled by default.

This was discussed in #896

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
5 years agoChange default value of highlightingOn to false
Ville Penttinen [Tue, 26 Feb 2019 06:56:11 +0000 (08:56 +0200)]
Change default value of highlightingOn to false

5 years agoMerge #897
bors[bot] [Mon, 25 Feb 2019 12:03:57 +0000 (12:03 +0000)]
Merge #897

897: Add basic const/static type inference r=flodiebold a=vipentti

This adds basic const/static type inference discussed in #887.

Currently the inference does not work for const/static declared inside a block. In addition the inference does not work inside the bodies of const/static.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
5 years agokill accidently commited file
Aleksey Kladov [Mon, 25 Feb 2019 12:02:12 +0000 (15:02 +0300)]
kill accidently commited file

5 years agoMerge #898
bors[bot] [Mon, 25 Feb 2019 10:51:37 +0000 (10:51 +0000)]
Merge #898

898: rename type to type_alias in the AST as well r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
5 years agorename type to type_alias in the AST as well
Aleksey Kladov [Mon, 25 Feb 2019 10:38:52 +0000 (13:38 +0300)]
rename type to type_alias in the AST as well

5 years agoMove ConstSignature creation to a single method
Ville Penttinen [Mon, 25 Feb 2019 08:29:56 +0000 (10:29 +0200)]
Move ConstSignature creation to a single method

5 years agoAdd static type inference
Ville Penttinen [Mon, 25 Feb 2019 08:21:01 +0000 (10:21 +0200)]
Add static type inference

5 years agoAdd const type inference
Ville Penttinen [Mon, 25 Feb 2019 07:27:47 +0000 (09:27 +0200)]
Add const type inference

5 years agoMerge #895
bors[bot] [Sun, 24 Feb 2019 20:52:04 +0000 (20:52 +0000)]
Merge #895

895: complete patterns r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
5 years agocomplete patterns
Aleksey Kladov [Sun, 24 Feb 2019 20:49:47 +0000 (23:49 +0300)]
complete patterns

5 years agoMerge #894
bors[bot] [Sun, 24 Feb 2019 20:39:27 +0000 (20:39 +0000)]
Merge #894

894: Rename Type => TypeAlias r=matklad a=flodiebold

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
5 years agoRename Type => TypeAlias
Florian Diebold [Sun, 24 Feb 2019 20:36:49 +0000 (21:36 +0100)]
Rename Type => TypeAlias

5 years agoMerge #892
bors[bot] [Sun, 24 Feb 2019 20:08:10 +0000 (20:08 +0000)]
Merge #892

892: Type aliases r=matklad a=flodiebold

This implements type aliases (i.e. `type` definitions).

There's just one snag: handling recursion. E.g. `type Foo = Foo` makes type inference panic with a query cycle. I think the best way to handle this would be if Salsa provided the ability to catch cycle errors? It seems that there's some work underway to support this [here](https://github.com/salsa-rs/salsa/issues/6) and [here](https://github.com/salsa-rs/salsa/pull/147). Should we wait for this? I don't see a good way to handle this without help from Salsa.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
5 years agoAdd test for recursive type aliases
Florian Diebold [Sun, 24 Feb 2019 16:29:07 +0000 (17:29 +0100)]
Add test for recursive type aliases

5 years agoImplement support for type aliases
Florian Diebold [Sun, 24 Feb 2019 16:25:41 +0000 (17:25 +0100)]
Implement support for type aliases

5 years agoMerge #893
bors[bot] [Sun, 24 Feb 2019 18:56:49 +0000 (18:56 +0000)]
Merge #893

893: Completion presentation r=matklad a=matklad

Just moves completion code around a bit, to keep logic for producing completions and logic for rendering them into completion items separate.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
5 years agomove testing functions
Aleksey Kladov [Sun, 24 Feb 2019 18:54:13 +0000 (21:54 +0300)]
move testing functions

5 years agomove the rest of presentation to presentation
Aleksey Kladov [Sun, 24 Feb 2019 18:46:04 +0000 (21:46 +0300)]
move the rest of presentation to presentation

5 years agomove more code to presentation
Aleksey Kladov [Sun, 24 Feb 2019 18:34:38 +0000 (21:34 +0300)]
move more code to presentation

5 years agomove res completion to presentation
Aleksey Kladov [Sun, 24 Feb 2019 18:21:31 +0000 (21:21 +0300)]
move res completion to presentation

5 years agosimplify
Aleksey Kladov [Sun, 24 Feb 2019 17:59:12 +0000 (20:59 +0300)]
simplify

5 years agomove enum-variants to presentation
Aleksey Kladov [Sun, 24 Feb 2019 17:56:19 +0000 (20:56 +0300)]
move enum-variants to presentation

5 years agosimplify
Aleksey Kladov [Sun, 24 Feb 2019 17:49:55 +0000 (20:49 +0300)]
simplify

5 years agomove presentaion completion to presentation
Aleksey Kladov [Sun, 24 Feb 2019 16:37:22 +0000 (19:37 +0300)]
move presentaion completion to presentation

5 years agomove function rendering to presentation
Aleksey Kladov [Sun, 24 Feb 2019 16:34:27 +0000 (19:34 +0300)]
move function rendering to presentation

5 years agointroduce completion presentation
Aleksey Kladov [Sun, 24 Feb 2019 15:51:38 +0000 (18:51 +0300)]
introduce completion presentation

This module should remove completion rendering boilerplate from the
"brains" of completion engine.

5 years agoMerge #891
bors[bot] [Sun, 24 Feb 2019 14:39:38 +0000 (14:39 +0000)]
Merge #891

891: Field completion r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
5 years agocomplete fields in struct literals
Aleksey Kladov [Sun, 24 Feb 2019 14:23:54 +0000 (17:23 +0300)]
complete fields in struct literals

5 years agoMerge #890
bors[bot] [Sun, 24 Feb 2019 14:19:54 +0000 (14:19 +0000)]
Merge #890

890: Clean up imports a bit r=flodiebold a=flodiebold

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
5 years agoClean up imports a bit
Florian Diebold [Sun, 24 Feb 2019 14:12:10 +0000 (15:12 +0100)]
Clean up imports a bit

5 years agocomplete struct literals
Aleksey Kladov [Sun, 24 Feb 2019 14:01:56 +0000 (17:01 +0300)]
complete struct literals

5 years agosupport upcastig in AST enum
Aleksey Kladov [Sun, 24 Feb 2019 13:57:05 +0000 (16:57 +0300)]
support upcastig in AST enum

5 years agoMerge #889
bors[bot] [Sun, 24 Feb 2019 12:52:44 +0000 (12:52 +0000)]
Merge #889

889: Refactor assits r=matklad a=matklad

* assign unique IDs to assists so that clients could do custom stuff
* specify kinds for assists,
* make introduce_variable a `refactoring.extract` and make it available only when expression is selected
* introduce marks to assists

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
5 years agoadd marks to assists
Aleksey Kladov [Sun, 24 Feb 2019 11:22:25 +0000 (14:22 +0300)]
add marks to assists

5 years agodont show introduce variable everywhere
Aleksey Kladov [Sun, 24 Feb 2019 11:18:10 +0000 (14:18 +0300)]
dont show introduce variable everywhere

5 years agoAssign IDs to assists
Aleksey Kladov [Sun, 24 Feb 2019 10:53:35 +0000 (13:53 +0300)]
Assign IDs to assists

5 years agoMerge #885
bors[bot] [Sun, 24 Feb 2019 10:15:43 +0000 (10:15 +0000)]
Merge #885

885: Parse token trees directy r=matklad a=matklad

This takes advantage of the recent macro refactoring to directly parse token stream into a syntax tree.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
5 years agorename
Aleksey Kladov [Sun, 24 Feb 2019 10:14:14 +0000 (13:14 +0300)]
rename

5 years agoMerge #886
bors[bot] [Sun, 24 Feb 2019 06:45:08 +0000 (06:45 +0000)]
Merge #886

886: Associated method generics r=matklad a=flodiebold

Refactor associated method resolution a bit and make it work with generics.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
5 years agoRefactor associated method resolution a bit and make it work with generics
Florian Diebold [Sat, 23 Feb 2019 21:59:01 +0000 (22:59 +0100)]
Refactor associated method resolution a bit and make it work with generics