Commit Graph

2690 Commits

Author SHA1 Message Date
Aleksey Kladov
8876f44054 Revert "eagarly clean astd maps"
This reverts commit 6c63a59425.

This causes massive slowdowns: looks like we accidentally have some source-depndent
2019-05-04 16:04:34 +03:00
bors[bot]
b1febf2e6d Merge #1235
1235: revert eagarly clean astd maps r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-04 12:30:13 +00:00
Aleksey Kladov
ca5aedc9bf revert eagarly clean astd maps
This causes massive slowdown :-(
2019-05-04 15:29:35 +03:00
bors[bot]
dc666c8101 Merge #1230
1230: Desugar doc comments to `#[doc = "...."]` attributes in `syntax node` to tt conversion r=matklad a=edwin0cheng

As discussed in [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/MBE.20discussion/near/164446835), this PR desugar doc comments to  `#[doc = "...."]` in `syntax node` to tt conversion. 

Note that after this PR, all obvious mbe bugs in dogfooding are fixed. (i.e. No parsing or expanding mbe error in `env RUST_LOG=ra_hir=WARN target\release\ra_cli.exe analysis-stats`) 🎉

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-05-04 12:17:13 +00:00
Edwin Cheng
036141663b Quote the quoted comment 2019-05-04 19:34:02 +08:00
Edwin Cheng
048f12d9f0 Use explict escape_default instead of dbg print 2019-05-04 17:03:22 +08:00
Aleksey Kladov
6c63a59425 eagarly clean astd maps 2019-05-04 11:53:44 +03:00
Edwin Cheng
e7e896170a Convert doc comment to attr 2019-05-04 15:00:16 +08:00
Edwin Cheng
4ba4747578 Mark unused mbe variable as Binding::Empty 2019-05-04 01:14:25 +08:00
Edwin Cheng
31909cc7d7 By pass unbind $var while mbe expanding 2019-05-03 23:23:21 +08:00
Edwin Cheng
e8e46100d6 Refactor out tests module and remove empty subtree 2019-05-03 21:38:00 +08:00
bors[bot]
b29f442c8b Merge #1227
1227: Add `default_type` method in `TypeParam` Node r=matklad a=edwin0cheng

This PR add a `default_type` method in `TypeParam` Node which allow future PR to handle #1099 case.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-05-03 13:06:55 +00:00
Edwin Cheng
9e4fee8b41 Add default type param in TypeParam Node 2019-05-03 12:18:35 +08:00
Edwin Cheng
11d6a1449d Fixed old incorrect test 2019-05-03 00:20:27 +08:00
Edwin Cheng
ab91050d49 Fix typo 2019-05-03 00:01:48 +08:00
Edwin Cheng
91745c62f8 Compare text instead 2019-05-02 23:59:13 +08:00
Edwin Cheng
1446d620c5 Add empty bindings and some refactoring 2019-05-02 23:23:14 +08:00
Edwin Cheng
35c4633150 Make vis matcher optional and fix typo 2019-05-02 21:24:51 +08:00
Edwin Cheng
779676f782 Remove unused code in subtree_source 2019-05-02 10:19:12 +08:00
Edwin Cheng
a7ef9bac4e Formating 2019-05-02 10:08:11 +08:00
Edwin Cheng
6b2985ebc7 Remove unused code and add space bewteen tt 2019-05-02 10:02:17 +08:00
bors[bot]
12629d5e4f Merge #1222
1222: Skip Dollars when bump raw  token r=matklad a=edwin0cheng

This PR fixed a bug while parsing token_tree, it should skip all L_DOLLAR AND R_DOLLAR.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-05-01 17:45:56 +00:00
bors[bot]
817a38538f Merge #1223
1223: Move guard to arm body assist r=matklad a=unrealhoang

This is my attempt at #1206 

Co-authored-by: Unreal Hoang <unrealhoang@gmail.com>
2019-05-01 17:28:07 +00:00
Unreal Hoang
d1c21b85cf
add complex match case and documentation 2019-05-02 01:41:02 +09:00
Unreal Hoang
f83e452b1e
move guard to arm body assist. 2019-05-02 00:42:00 +09:00
Edwin Cheng
a42f26502d Skip Dollars when bump raw token 2019-05-01 22:39:47 +08:00
bors[bot]
71c13528cd Merge #1220
1220: Add macro pat parsing r=matklad a=edwin0cheng

This PR add support to parsing macro call in pattern , e.g :
```
let m!(x) = 0;
```

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-05-01 14:09:44 +00:00
Aleksey Kladov
594aac059e Use correct FileId when expanding macros in expressions 2019-05-01 15:53:13 +03:00
Edwin Cheng
b454eb5a60 Add macro pat parsing 2019-04-30 23:22:48 +08:00
Felix S. Klock II
d694b0174a Sidestep two-phase borrow violation signaled by mutable_borrow_reservation_conflict.
See rust-lang/rust#59159 for further information/discussion.
2019-04-29 14:03:51 +02:00
bors[bot]
6618d1edc3 Merge #1213
1213: Make lexer produce only single character puncts r=matklad a=edwin0cheng

As discussed in Zulip, this PR change `lexer` to produce only single char punct.

* Remove producing `DOTDOTDOT, DOTDOTEQ, DOTDOT, COLONCOLON, EQEQ, FAT_ARROW, NEQ, THIN_ARROW` in lexer.
* Add required code in parser to make sure everythings works fine.
* Change some tests (Mainly because the `ast::token_tree` is different)

Note: i think the use of `COLON` in rust is too overloaded :)


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-28 16:51:02 +00:00
Edwin Cheng
d436ab0581 Refactor parser handle mult-char punct internally 2019-04-28 23:46:03 +08:00
Florian Diebold
85633656df Fix hover on the beginning of a nested expression
E.g. in
```
let foo = 1u32;
if true {
   <|>foo;
}
```
the hover shows `()`, the type of the whole if expression, instead of the more
sensible `u32`. The reason for this was that the search for an expression was
slightly left-biased: When on the edge between two tokens, it first looked at
all ancestors of the left token and then of the right token. Instead merge the
ancestors in ascending order, so that we get the smaller of the two possible
expressions.
2019-04-28 16:03:49 +02:00
kjeremy
d8649c1af8 Simplify 2019-04-26 11:42:56 -04:00
kjeremy
4251f083b5 Add is_empty to Arena 2019-04-26 11:42:10 -04:00
kjeremy
47f10fce8a Pass in char instead of single-char string 2019-04-26 11:41:58 -04:00
kjeremy
70dc33e00c Elide lifetime 2019-04-26 11:41:14 -04:00
Edwin Cheng
1908819bf6 Use panic instead of unwrap 2019-04-26 02:56:44 +08:00
Edwin Cheng
c55a2dbc1d Fix more bugs 2019-04-26 02:03:56 +08:00
Edwin Cheng
299d97b6d9 Add handling token seperator in mbe 2019-04-26 02:03:55 +08:00
Edwin Cheng
dfab545d5d Add more information on macro rules fail to parse 2019-04-26 02:03:55 +08:00
Edwin Cheng
e4e2338f97 Fix incorrect repeat sep eating 2019-04-26 02:03:55 +08:00
Aleksey Kladov
848cb16a01 drop empty file 2019-04-25 10:07:23 +03:00
kjeremy
558bdf73c8 simplify match 2019-04-24 14:45:02 -04:00
kjeremy
f69bf6a12b See through references 2019-04-24 12:09:29 -04:00
bors[bot]
6009af9b7c Merge #1200
1200: Allows searching for case-equivalent symbols (fixes #1151) r=matklad a=jrvidal

I couldn't find a nice, functional way of calculating the ranges in one pass so I resorted to a plain old `for` loop.

Co-authored-by: Roberto Vidal <vidal.roberto.j@gmail.com>
2019-04-23 21:25:37 +00:00
Roberto Vidal
dd8c3840cb CR corrections 2019-04-23 22:19:45 +02:00
kjeremy
a5bf0cdb97 Simplify 2019-04-23 15:44:37 -04:00
kjeremy
7125192c1e Basic resolution for ADT 2019-04-23 14:32:47 -04:00
Roberto Vidal
b56f010201 Allows searching for case-equivalent symbols (fixes #1151) 2019-04-23 20:11:45 +02:00
bors[bot]
a094d5c621 Merge #1147
1147: Handle macros in type checking / HIR r=matklad a=Lapz

An other attempt at  #1102. I will need to flatten the nested if statements and im also not sure if the way that i get the resolver and module will always work

Co-authored-by: Lenard Pratt <l3np27@gmail.com>
2019-04-23 12:49:31 +00:00
Lenard Pratt
1ab7066e32 Introduced resolve_macro_call on resolver
changed to manual expansion

fix for nested macros
2019-04-23 10:17:31 +01:00
Edwin Cheng
6c913d8fa7 Add ... parsing for fn pointer type 2019-04-23 11:10:41 +08:00
Lenard Pratt
ce211434a6 Added macro resolution and expansion 2019-04-22 21:35:44 +01:00
Lenard Pratt
afaeb18910 Addeded resolver and db 2019-04-22 21:33:48 +01:00
Edwin Cheng
fccd045229 Add cached for SubtreeSource 2019-04-22 22:46:39 +08:00
bors[bot]
c416caeda2 Merge #1194
1194: Pr 1190 r=matklad a=matklad



Co-authored-by: Andrea Pretto <eulerdisk@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-22 13:19:47 +00:00
Aleksey Kladov
aa1ef6ae9a unused import 2019-04-22 16:18:14 +03:00
Aleksey Kladov
c27a3da5e8 remove path_ident from CompletionContext
We really shouldn't be looking at the identifier at point. Instead,
all filtering and sorting should be implemented at the layer above.

This layer should probably be home for auto-import completions as
well, but, since that is not yet implemented, let's just stick this
into complete_scope.
2019-04-22 16:04:56 +03:00
Aleksey Kladov
e01052d1f0 move auto-imoprter into IDE
auto-import is purely an IDE concern, so it should be done outside of
HIR
2019-04-22 15:56:28 +03:00
bors[bot]
6162278075 Merge #1193
1193: Add a test for #1178 case r=edwin0cheng a=edwin0cheng

A little PR to add a test case for #1178

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-22 12:22:08 +00:00
Edwin Cheng
bb84fce1a4 Remove unused print out 2019-04-22 20:21:14 +08:00
Edwin Cheng
1cdfc38066 Add a test for #1178 case 2019-04-22 20:14:46 +08:00
bors[bot]
38c0a1e333 Merge #1184
1184: Start structured editing API r=matklad a=matklad

I think I finally understand how to provide nice, mutable structured editing API on top of red-green trees.

The problem I am trying to solve is that any modification to a particular `SyntaxNode` returns an independent new file. So, if you are editing a struct literal, and add a field, you get back a SourceFile, and you have to find the struct literal inside it yourself! This happens because our trees are immutable, but have parent pointers. 

The main idea here is to introduce `AstEditor<T>` type, which abstracts away that API. So, you create an `AstEditor` for node you want to edit and call various `&mut` taking methods on it. Internally, `AstEditor` stores both the original node and the current node. All edits are applied to the current node, which is replaced by the corresponding node in the new file. In the end, `AstEditor` computes a text edit between old and new nodes.

Note that this also should sole a problem when you create an anchor pointing to a subnode and mutate the parent node, invalidating anchor. Because mutation needs `&mut`, all anchors must be killed before modification. 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-22 10:08:18 +00:00
Aleksey Kladov
b73a978b95 drop useless test 2019-04-22 13:05:01 +03:00
Aleksey Kladov
268e739c94 move add_missing_members to structured editing API
Currently, this is more code, and we also loose auto-indenting of
bodies, but, long-term, this is the right approach
2019-04-22 13:01:33 +03:00
Edwin Cheng
ad1c3b5bd6 Use map, sum in Subtree::coount instead of fold 2019-04-22 17:37:27 +08:00
Edwin Cheng
d6d9aa2003 Change macro stack monitor test to func ptr based 2019-04-22 17:15:22 +08:00
Aleksey Kladov
b811922a53 fix postfix match indent 2019-04-22 10:38:39 +03:00
Edwin Cheng
b177813f3b Add mbe expand limit and poision macro set 2019-04-22 15:33:55 +08:00
Aleksey Kladov
5b2fd86d25 more type safety 2019-04-22 10:11:06 +03:00
Andrea Pretto
200032852b complete_import: prevent panic when the anchor is the completion source range
(fix rebase mess)

 Please enter the commit message for your changes. Lines starting
2019-04-22 00:48:43 +02:00
Andrea Pretto
9144214958 complete_import: add new import resolver infrastructure with some hardcoded importable name.
Changes complete_scope to support that.
2019-04-22 00:14:58 +02:00
Andrea Pretto
cf0eff2e33 auto_import: better no anchor management 2019-04-22 00:13:00 +02:00
Andrea Pretto
766813898f auto_import: make auto import working with target as a list of SmolStr instead of ast::Path 2019-04-22 00:13:00 +02:00
Andrea Pretto
0e0ae47b47 auto_import: use TextEditBuilder instead of AssistBuilder to make it more reusable 2019-04-22 00:13:00 +02:00
Aleksey Kladov
97f41d7343 test short structs 2019-04-22 00:52:21 +03:00
Edwin Cheng
120bfde3c2 Add tests 2019-04-22 05:04:37 +08:00
Edwin Cheng
3d1cdc834d Fix offset bug in SourceWalker 2019-04-22 05:04:37 +08:00
Edwin Cheng
49c9686c3c Handle *+ case and single token case 2019-04-22 05:04:37 +08:00
Edwin Cheng
bcf5cf8ac6 fix mbe_parser rhs colon parsing 2019-04-22 05:04:37 +08:00
Edwin Cheng
9a5b9638c1 Add more information on parse_macro fail 2019-04-22 05:04:37 +08:00
Edwin Cheng
da05bbcfb1 Fix lifetime in tt to syntax node conversion 2019-04-22 05:04:36 +08:00
Aleksey Kladov
f313ac45af use structured editing API for fill struct assist 2019-04-21 22:13:52 +03:00
Aleksey Kladov
7cc845e88d start structured editing API 2019-04-21 20:51:20 +03:00
Florian Diebold
787fb3e5ec Add HIR for where clauses & ignore impls with where clauses in trait resolution
This prevents any `impl<T> Trait for T where ...` from being treated as a
blanket impl while we don't handle where clauses yet.
2019-04-21 15:01:17 +02:00
Aleksey Kladov
47672726d8 ⬆️ lsp 2019-04-21 15:17:22 +03:00
bors[bot]
fa15c4d75e Merge #1175
1175: Fix bugs and add error log about macro expansion r=matklad a=edwin0cheng

This PR fixed / add following things:

* Add a fused count which stop recursion of macro expansion in name resolution.
* Add some logs when macro expansion fails
* Add `$crate` meta variable support in mbe, which create a `$crate` ident token in token tree.
* Fixed matching a `$REPEAT` pattern inside a subtree, e.g. `(fn $name:ident {$($i:ident)*} ) => {...}`
* Remove composite-able punct token in syntax node to token conversion. 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-21 10:34:07 +00:00
Aleksey Kladov
fa12ed2b8f switch to official extend selection API 2019-04-21 12:13:48 +03:00
Florian Diebold
82751f8a4a Add a simple test for str method completion 2019-04-20 18:26:53 +02:00
bors[bot]
4ad2e4ce4e Merge #1154
1154: Initial support for lang items (and str completion) r=flodiebold a=marcogroppo

This PR adds partial support for lang items.
For now, the only supported lang items are the ones that target an impl block.

Lang items are now resolved during type inference - this means that `str` completion now works.

Fixes #1139.

(thanks Florian Diebold for the help!)


Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-04-20 16:13:50 +00:00
Edwin Cheng
9e35bf91b8 Fix bugs 2019-04-20 23:53:39 +08:00
Marco Groppo
8ac3d1f9aa lang_item_lookup is now a salsa query. 2019-04-20 00:29:16 +02:00
Marco Groppo
8ebb20edce New krate() method in Resolver.
Renamed Impl to ImplBlock.
2019-04-20 00:20:26 +02:00
Marco Groppo
e85ee60c42 Initial support for lang items. 2019-04-20 00:10:19 +02:00
Edwin Cheng
210c762fe6 Disable test_tt_xx 2019-04-20 02:41:13 +08:00
Edwin Cheng
41c1a639c3 Disable tt matcher 2019-04-20 02:19:46 +08:00
Edwin Cheng
1afde29adb Add back missing assert 2019-04-19 21:52:54 +08:00
Edwin Cheng
763569017a Fix bug for ident to lifetime 2019-04-19 21:43:41 +08:00
Edwin Cheng
87ff908135 Add vis matcher 2019-04-19 21:38:26 +08:00
Edwin Cheng
c5983b85fc Add literal matcher 2019-04-19 21:21:47 +08:00
Edwin Cheng
313854c728 Add lifetime matcher 2019-04-19 21:15:19 +08:00
Edwin Cheng
59b6cc780b add tt matcher 2019-04-19 19:41:59 +08:00
Edwin Cheng
762819864f add block matcher 2019-04-19 19:33:29 +08:00
Edwin Cheng
8092b6487f Add block matcher 2019-04-19 18:30:43 +08:00
bors[bot]
ab0a96586f Merge #1148
1148: Add token_tree_to_xxx functions r=matklad a=edwin0cheng

<del>As discus in  PR #1147 , this PR added a `mbe::MacroKind` .
Currently only 2 kind of macro are supported, `SourceFile` and `Block`.</del>

Added following functions for `tt::TokenTree` and `ast::Node` conversion:

* token_tree_to_expr
* token_tree_to_pat
* token_tree_to_ty
* token_tree_to_macro_stmts
* token_tree_to_macro_items

And added two new syntax kind:

* MACRO_ITEMS
* MACRO_STMTS

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-19 08:56:39 +00:00
Edwin Cheng
a6d51e0961 Return Result for token_tree_to_xx functions 2019-04-19 04:03:22 +08:00
Edwin Cheng
c0f19d7005 Add expr, pat, ty and macro_stmts 2019-04-19 03:49:56 +08:00
Edwin Cheng
3ff5440a50 Add MacroItems and MacroStmts in grammer.ron 2019-04-19 02:47:29 +08:00
Edwin Cheng
e8ddeb869d Fix missing last token in mbe $repeat parsing 2019-04-18 23:33:54 +08:00
Edwin Cheng
e944fd059d Add item matcher in mbe 2019-04-18 10:21:36 +08:00
bors[bot]
112fd0ec7d Merge #1160
1160: better formatting when adding trait members r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-17 11:11:31 +00:00
Aleksey Kladov
a27fc96aa1 better formatting when adding trait members
* it's conventional not to use one-liners
* new placement is more predictable, b/c it does not depend on
  header's length
2019-04-17 14:05:02 +03:00
bors[bot]
4c8e6e89aa Merge #1145
1145: Fix #1099, plug self type type parameters in infer_path_expr r=flodiebold a=edwin0cheng

As discussed in #1099, this PR try to "plug" a `self type` type parameters in `infer_path_expr`.
All the cases in 1099 was fixed and tested.
And luckily, this PR fixed bug #1030 again and make the test output correct.





Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-17 11:03:34 +00:00
Aleksey Kladov
f75feb6724 cleanup cancellation
Now that we explicitelly exit the reading loop on exit notification,
we can assume that the sender is always alive
2019-04-17 11:47:38 +03:00
bors[bot]
d3afb1b378 Merge #1153
1153: "Restart server" command r=jrvidal a=jrvidal

The only tricky aspect is that fact that once the `exit` command has been received, we no longer need to join on the reader thread. 

Also, I think `terminateProcesses.sh` was not working properly. In fact, the very same script from the vscode language server implementation is not working either! It's because of that I noticed the reader thread issue 😮 

Co-authored-by: Roberto Vidal <vidal.roberto.j@gmail.com>
2019-04-17 05:51:12 +00:00
Edwin Cheng
57e4122b89 Add mbe stmt matcher 2019-04-17 12:34:43 +08:00
Edwin Cheng
8747c903a2 Refactoring 2019-04-17 09:35:03 +08:00
Edwin Cheng
039ab2e820 Simpliy code 2019-04-17 09:31:53 +08:00
Edwin Cheng
0edb5ce97a Bug fix and add more comments 2019-04-17 09:31:52 +08:00
Edwin Cheng
180655077a Fix 1099 2019-04-17 09:31:52 +08:00
Roberto Vidal
8d569d49d2 Breaks read loop on 'exit' 2019-04-17 00:38:56 +02:00
Roberto Vidal
13d92b3f11 Fixes doctest 2019-04-16 22:25:17 +02:00
Roberto Vidal
12f28f6276 Adds "restart server" command 2019-04-16 22:07:33 +02:00
Aleksey Kladov
247ac265f1 fix test 2019-04-15 01:17:26 +03:00
Aleksey Kladov
c4a5aa45dc add a couple of profiling points 2019-04-15 01:10:07 +03:00
Aleksey Kladov
06615bd331 more intuitive name 2019-04-15 01:10:07 +03:00
Aleksey Kladov
5b7012318c filter by time 2019-04-15 01:10:07 +03:00
Aleksey Kladov
b228947b68 cleanup syntax 2019-04-15 01:10:07 +03:00
Aleksey Kladov
e6f32c6d3a fast path for disabled profiler 2019-04-15 01:10:07 +03:00
Aleksey Kladov
30a4099ea7 switch to modern paths 2019-04-15 01:10:07 +03:00
Florian Diebold
4f8a49f43c Refactor method candidate generation a bit
This fixes the order in which candidates are chosen a bit (not completely
though, as the ignored test demonstrates), and makes autoderef work with trait
methods. As a side effect, this also makes completion of trait methods work :)
2019-04-14 21:53:35 +02:00
bors[bot]
88be6f3217 Merge #1137
1137: Adds support for multiple editor workspaces on initialization r=matklad a=jrvidal

OK, so this "simple hack" turned out to be way more contrived than I expected 😂

### What works
This patch only handles multi-folder editor workspaces _on initialization_.
  * I've found that modifying the layout of a workspace in VSCode just reloads the extension, so this hack should be enough for now.
  * Not sure about how emacs-lsp behaves, but we fallback gracefully to the mono-folder workspace, so it should be fine.

### What doesn't work
* [x] `cargo watch` can only watch a single root folder with a `Cargo.toml`. I've left this part untouched but we could either warn that it's not supported or launch _multiple_ `cargo-watch` processes.
* [x] The `rust-analyzer/runnables` command is not functional, since we don't send the correct `cwd`.
* [x] Should we add some happy path test to `heavy_tests`?
* [ ] Going from a single `root` to multiple `roots` leaves us with a couple of `n * m` loops that smell a bit. The number of folders in the editor workspace is probably low though.

Co-authored-by: Roberto Vidal <vidal.roberto.j@gmail.com>
2019-04-14 17:26:07 +00:00
bors[bot]
5d35f284f5 Merge #1138
1138: Add L_DOLLAR and R_DOLLAR r=matklad a=edwin0cheng

As discussion in issue https://github.com/rust-analyzer/rust-analyzer/issues/1132 and PR #1125 , this PR add 2 `Syntax::Kind` : `L_DOLLAR` and `R_DOLLAR` for representing `Delimiter::None` in mbe and proc_marco. By design, It should not affect the final syntax tree, and will be discard in `TreeSink`.

My original idea is handling these 2 tokens case by case, but i found that they will appear in every place in the parser (imagine `tt` matcher). So this PR only handle it in `Parser::do_bump` and `Parser::start`, although It will not fix the `expr` matcher executing order problem in original idea.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-14 14:16:42 +00:00
Florian Diebold
8bcbcc454c Extract generic_params method to a HasGenericParams trait 2019-04-14 13:07:45 +02:00
Florian Diebold
4497e1d3ea Add Container enum to handle both kinds of container (impl/trait) 2019-04-14 11:28:53 +02:00
Florian Diebold
7650a44640 Make callable signature handling a bit nicer 2019-04-14 11:28:53 +02:00
Florian Diebold
9339241b78 Some cleanup 2019-04-14 11:28:53 +02:00
Florian Diebold
a1ed53a4f1 More trait infrastructure
- make it possible to get parent trait from method
 - add 'obligation' machinery for checking that a type implements a
   trait (and inferring facts about type variables from that)
 - handle type parameters of traits (to a certain degree)
 - improve the hacky implements check to cover enough cases to exercise the
   handling of traits with type parameters
 - basic canonicalization (will probably also be done by Chalk)
2019-04-14 11:28:53 +02:00
Florian Diebold
413c87f155 Get substs for trait refs in impl blocks 2019-04-14 11:28:53 +02:00
Roberto Vidal
c2dfc8a229 Modifies runnables test to use multi-workspace root 2019-04-14 10:04:38 +02:00
Roberto Vidal
7c7cfc5f04 Sends cwd info for runnables and code lenses 2019-04-14 10:04:38 +02:00
Roberto Vidal
3507bcb97a Adds support for multiple editor workspaces on initialization
This is a quick, partial fix for #1104
2019-04-14 10:04:38 +02:00
Edwin Cheng
6646d49f23 Fix bug and add expr , pat , ty matcher 2019-04-14 11:42:20 +08:00
Robin Freyler
6aae0cf7fa
replace usages of algo::generate with iter::successors from std 2019-04-13 16:43:49 +02:00
Aleksey Kladov
2facb5e061 cleanups 2019-04-13 14:16:46 +03:00
Aleksey Kladov
b260641e0c slight encapsulation 2019-04-13 11:29:47 +03:00
Aleksey Kladov
f9e825d956 move ScopeEntryWithSyntax 2019-04-13 11:24:09 +03:00
Aleksey Kladov
d387bdccba drop obsolete fixme 2019-04-13 11:21:32 +03:00
Aleksey Kladov
4f8dc1b9f0 make expr scope stuff private 2019-04-13 11:06:53 +03:00
Aleksey Kladov
a2cc76ce63 make resolver private 2019-04-13 11:03:02 +03:00
Aleksey Kladov
62d01dd4df hide resolver 2019-04-13 11:00:15 +03:00
Aleksey Kladov
f4a94e74bc fold ScopeWithSyntax into SourceAnalyzer 2019-04-13 10:49:01 +03:00
Aleksey Kladov
30481808fb make stuff private 2019-04-13 09:53:02 +03:00
Aleksey Kladov
cec67b2b65 obsolete fixm 2019-04-13 09:50:02 +03:00
Aleksey Kladov
1e8569dce9 make private 2019-04-13 09:46:39 +03:00
Aleksey Kladov
d4043a8dba only def-with-body remains 2019-04-13 09:45:52 +03:00
Aleksey Kladov
d88269bc2d generalize 2019-04-13 09:38:37 +03:00
Aleksey Kladov
17a0e22883 simplify 2019-04-13 09:36:28 +03:00
Aleksey Kladov
65b0073653 simplify 2019-04-13 09:33:34 +03:00
Aleksey Kladov
9ead801a9c make private 2019-04-13 09:32:25 +03:00
Aleksey Kladov
3aae223d93 hide some scopes 2019-04-13 09:31:03 +03:00
Aleksey Kladov
58fe5598e7 simplify 2019-04-13 01:32:43 +03:00
Aleksey Kladov
b0d8f9ff5d make stuff private 2019-04-13 01:07:24 +03:00
Aleksey Kladov
81e91980dd simplify 2019-04-13 01:05:18 +03:00
Aleksey Kladov
7c13e22334 simplify tests 2019-04-13 00:56:57 +03:00
Aleksey Kladov
0fd93bc14a use really correct resolver for expressions 2019-04-13 00:44:47 +03:00
Edwin Cheng
f66300ccd1 Remove skip Delimiter::None and handle Dollars 2019-04-13 01:50:05 +08:00
Aleksey Kladov
20013de2ab fix typo 2019-04-11 17:15:20 +03:00
Aleksey Kladov
cf2ba2791d add todo 2019-04-11 17:14:41 +03:00
Aleksey Kladov
a347208bb2 use correct resolver for expressions 2019-04-11 16:51:30 +03:00
Aleksey Kladov
ebb0c377f0 remove resolver from CompletonContext 2019-04-11 16:49:35 +03:00
Aleksey Kladov
3c9f2d0e37 simplify 2019-04-11 16:39:56 +03:00
Aleksey Kladov
5471c1ef4b generalize SourceAnalyzer to handle all defs with bodies 2019-04-11 16:37:29 +03:00
Aleksey Kladov
07cc047b4f minimize the API 2019-04-11 16:29:33 +03:00
Aleksey Kladov
b6809b6695 rename 2019-04-11 16:29:33 +03:00
Aleksey Kladov
6c2ba945ed reduce visibility 2019-04-11 16:29:33 +03:00
Aleksey Kladov
505acc973b Make call info to use real name resolution 2019-04-11 16:29:33 +03:00
Aleksey Kladov
10d66d63d7 introduce SourceAnalyzer 2019-04-11 16:29:33 +03:00
Aleksey Kladov
6a8b3c1d4b fix typo 2019-04-11 11:13:31 +03:00
Edwin Cheng
74e846b9ec Add L_DOLLAR and R_DOLLAR 2019-04-11 11:02:41 +08:00
bors[bot]
6d9acb8753 Merge #1131
1131: Use inline snapshots in complete_dot r=matklad a=vipentti

Relates to #1127 

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-04-10 11:05:31 +00:00
Ville Penttinen
57283b4e5f Use inline snapshots in complete_dot 2019-04-10 13:47:20 +03:00
Ville Penttinen
1b19c1c8f2 Use inline snapshots in complete_fn_param 2019-04-10 13:22:50 +03:00
Aleksey Kladov
10726fdb65 type-safer source-map for bindings 2019-04-10 10:48:15 +03:00
Aleksey Kladov
1cd184d653 use either for uses 2019-04-10 10:12:54 +03:00
bors[bot]
b863272899 Merge #1126
1126: Swithc to native salsa interning r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-09 20:04:42 +00:00
Aleksey Kladov
88189c4282 drop old interning infra 2019-04-09 22:52:06 +03:00
Aleksey Kladov
6b993a9760 migrate to salsas interning 2019-04-09 22:51:22 +03:00
bors[bot]
cc284dad30 Merge #1122
1122: Add explicit type assist. r=matklad a=marcogroppo

This assist can be used to specify the explicit type in let statements. For example `let num = 1;` becomes `let num: i32 = 1;`. 

The assist is applicable only if the inferred type is fully known.


Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-04-09 19:16:28 +00:00
Marco Groppo
c5f8f3b1f4 Stylistic changes. Updated features.md with the new assists. 2019-04-09 21:12:54 +02:00
Ville Penttinen
45a2b92524 Fix doc comment 2019-04-09 16:08:24 +03:00
Ville Penttinen
07f0069f34 Move display related things from hover to display 2019-04-09 14:45:05 +03:00
Ville Penttinen
fead60aa27 Move FunctionSignature to display/function_signature 2019-04-09 14:45:05 +03:00
Ville Penttinen
bd6ddfcdde Make display modules private 2019-04-09 14:45:05 +03:00
Ville Penttinen
7821c56be7 Move structure to display/structure 2019-04-09 14:45:05 +03:00
Ville Penttinen
027d4d229d Move navigation_target to display/navigation_target 2019-04-09 14:45:05 +03:00
Ville Penttinen
946b5789d1 Move completion label functions to display 2019-04-09 14:45:05 +03:00
Ville Penttinen
dfaebd76ab Add FunctionSignature::from_hir 2019-04-09 14:45:05 +03:00
Ville Penttinen
2fe075f56e Normalize line-endings in display.rs
This changes from CRLF to LF
2019-04-09 14:45:05 +03:00