Commit Graph

2409 Commits

Author SHA1 Message Date
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