Commit Graph

3003 Commits

Author SHA1 Message Date
Aleksey Kladov
b719a6cc07 simplify 2019-02-17 20:34:01 +03:00
Ville Penttinen
1c97c1ac11 Enable parsing of attributes inside a match block
We allow invalid inner attributes to be parsed, e.g. inner attributes that are
not directly after the opening brace of the match block.

Instead we run validation on `MatchArmList` to allow better reporting of errors.
2019-02-17 19:26:57 +02:00
Aleksey Kladov
7187fc5c2a rename method 2019-02-17 20:25:52 +03:00
Aleksey Kladov
e95fb7c9f9 remove duplicated method 2019-02-17 20:25:35 +03:00
Aleksey Kladov
162dea51bf hide root config 2019-02-17 20:22:46 +03:00
Aleksey Kladov
6b5d90972a move roots to a module 2019-02-17 19:46:55 +03:00
bors[bot]
982f72c022 Merge #844
844: Refactor find_all_refs to return ReferenceSearchResult r=vipentti a=vipentti

This refactors `find_all_refs` to return a new `ReferenceSearchResult` based on feedback in #839.

There are few questions/notes regarding the refactor:

1. Introducing `NavigationTarget::from_bind_pat` this simply forwards the call to `NavigationTarget::from_named`, could we just expose `from_named` directly as `pub(crate)` ?
2. Added an utility method `NavigationTarget::range` since there were few places where you would use `self.focus_range.unwrap_or(self.full_range)`
3. Implementing `IntoIterator` for `ReferenceSearchResult`. This turns `ReferenceSearchResult` into an iterator over `FileRanges` and allows previous code to mostly stay as it was based on the order that `find_all_refs` previously had (declaration first and then the references). I'm not sure if there is a way of doing the conversion to `IntoIter` without the allocation of a new vector
4. Is it possible to have a binding without a name? I'm not sure if the `NavigationTarget::from_bind_pat` can cause some edge-cases that previously were ok



This fixes #835.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-17 15:38:33 +00:00
Ville Penttinen
fd5307e60d Remove leading :: 2019-02-17 17:25:19 +02:00
bors[bot]
f937d11ad8 Merge #843
843: Impl generics r=matklad a=flodiebold

This handles type parameters on impls when typing method calls.

~One remaining problem is that the autoderefs aren't applied during the unification of the method receiver type with the actual receiver type, which means that the type parameters are only correctly inferred if no autoderefs happened.~

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-02-17 13:56:22 +00:00
Florian Diebold
3c7c7e5a04 Make GenericArgs::from_ast pub(crate) 2019-02-17 14:55:04 +01:00
Florian Diebold
795d718ba1 Unify with the autorefed/autoderefed receiver type during method resolution 2019-02-17 14:44:39 +01:00
Ville Penttinen
85a6bf3424 Refactor find_all_refs to return ReferenceSearchResult 2019-02-17 13:40:43 +02:00
Florian Diebold
a1bda3fc08 Handle generic args for method calls 2019-02-16 23:06:41 +01:00
Florian Diebold
65bd9bc3a8 Handle impl generics in method calls 2019-02-16 23:06:41 +01:00
Florian Diebold
2af067b391 Resolve impl generic params 2019-02-16 23:06:41 +01:00
Florian Diebold
da7056245d Add generic params to impl blocks 2019-02-16 23:06:41 +01:00
Florian Diebold
ccfc6b11c1 Add a test for impl generics 2019-02-16 23:06:41 +01:00
bors[bot]
edd4c1d8a6 Merge #842
842: Turn ImplBlock into a copy type just containing IDs r=matklad a=flodiebold

This makes it more like the other code model types.

Also make Module::definition_source/declaration_source return HirFileIds, to
make them more like the other source functions.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-02-16 21:10:26 +00:00
Florian Diebold
0242acae53 Turn ImplBlock into a copy type just containing IDs
This makes it more like the other code model types.

Also make Module::definition_source/declaration_source return HirFileIds, to
make them more like the other source functions.
2019-02-16 22:08:13 +01:00
bors[bot]
6932b77093 Merge #841
841: Add my emacs configuration r=matklad a=flodiebold

I cleaned up and extended my custom emacs code for RA a bit.
This relies on emacs-lsp instead of eglot, so I didn't want to just add it to the other one. It supports some more things, though.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-02-16 17:01:36 +00:00
Florian Diebold
d682ea8858 Add my emacs configuration
This relies on emacs-lsp instead of eglot, so I didn't want to just add it to
the other one.
2019-02-16 15:39:44 +01:00
Aleksey Kladov
2d131d63f9 document design guideline 2019-02-16 15:15:52 +03:00
bors[bot]
13f464edbd Merge #836
836: auto_import: fix bug when the common path was shorter than both the c… r=matklad a=eulerdisk

Fix bug when the common path was shorter than both the current use and target path.

Wrong 1 (unnecessary self)
```
use std::fmt::nested::Debug;
std::fmt::Display<|>
```
--->
```
use std::fmt::{ self, Display, nested::Debug};
Display<|>
```

Wrong 2 (unnecessary, Debug disappear!!)
```
use std::fmt::Debug;
std::fmt::nested::Display
```
-->
```
use std::fmt::Debug::{ self, nested::Display, };
Display<|>
```

Co-authored-by: Andrea Pretto <eulerdisk@gmail.com>
2019-02-16 11:29:03 +00:00
bors[bot]
c06f5d4979 Merge #838
838: Dont slow down everyone else's testing (especially the CI) just for Mac OS X r=matklad a=pnkfelix

The allowance for up to 7 events, and thus requiring anyone with fewer than 7 events to wait for the 3 second timeout, is only relevant to fsevents (i.e. Mac OS X)

Co-authored-by: Felix S. Klock II <pnkfelix@pnkfx.org>
2019-02-15 13:17:09 +00:00
Felix S. Klock II
cc15d3613c Dont slow down everyone else's testing (especially the CI's Linux) just for OS X.
Namely, the allowance for up to 7 events, and thus requiring anyone
with fewer than 7 events to wait for the 3 second timeout, is only
relevant to fsevents (i.e. Mac OS X)
2019-02-15 13:26:19 +01:00
bors[bot]
da04eb3770 Merge #837
837: Generalize vfs.rs test to address fsevents timing-dependent behavior. r=matklad a=pnkfelix

Generalize `tests/vfs.rs` processing to address wildly-varying timing-dependent behavior from fsevents (i.e. on Mac OS X).

Fix #734 

Co-authored-by: Felix S. Klock II <pnkfelix@pnkfx.org>
2019-02-15 12:01:27 +00:00
Felix S. Klock II
f7e711b77f Generalize tests/vfs.rs processing to address wildly-varying time-dependent behavior on Mac OS X. 2019-02-15 12:55:30 +01:00
bors[bot]
17370463e2 Merge #830
830: Fix test_vfs_works failing on Windows due to extra Write events r=pnkfelix a=vipentti

On Windows `notify` generates extra `Write` events for folders, which caused
`process_tasks` to not handle all tasks generated on Windows.

This fixes #827

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-14 22:00:11 +00:00
Andrea Pretto
e8f3c1650a auto_import: fix bug when the common path was shorter than both the current use and target path.
Shorter test names.
2019-02-14 21:58:36 +01:00
bors[bot]
f8d4cec342 Merge #834
834: use better label for &mut ref completion r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-02-14 18:34:47 +00:00
Aleksey Kladov
469301b603 use better label for &mut ref completion 2019-02-14 21:34:06 +03:00
bors[bot]
c530f04df5 Merge #833
833: automatically wait for worker threads r=matklad a=matklad

closes #817 



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-02-14 18:22:19 +00:00
Aleksey Kladov
e0b8942c56 simplify 2019-02-14 21:14:47 +03:00
Aleksey Kladov
bf352cd251 automatically wait for worker threads
closes #817
2019-02-14 21:11:07 +03:00
bors[bot]
10bf61b83b Merge #831
831: tweak postfix completions r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-02-14 17:38:51 +00:00
Aleksey Kladov
5f8ec8aa10 tweak postfix completions
* better label
* add refm for &mut
2019-02-14 20:38:26 +03:00
Aleksey Kladov
434f1520df add ref postfix template 2019-02-14 20:13:39 +03:00
Ville Penttinen
50e49e0bc0 Fix test_vfs_works failing on Windows due to extra Write events
On Windows `notify` generates extra `Write` events for folders, which caused
`process_tasks` to not handle all tasks generated on Windows.

This fixes #827
2019-02-14 18:30:21 +02:00
bors[bot]
9d22704064 Merge #829
829: Be precise about the argument list r=matklad a=kjeremy

Fixes #812

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-02-14 16:14:02 +00:00
Jeremy Kolb
1cd5966462 Be precise about the argument list
Fixes #812
2019-02-14 10:28:48 -05:00
bors[bot]
b85c189500 Merge #825
825: Remove call to canonicalize in BatchDatabase::load_cargo r=matklad a=vipentti

Instead of using canonicalize, we now join the given path to
`std::env::current_dir()`, which either replaces the path, if the given path is
absolute, or joins the paths.

This fixes #821.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-14 09:35:08 +00:00
Ville Penttinen
f7a78b2846 Remove call to canonicalize in BatchDatabase::load_cargo
Instead of using canonicalize, we now join the given path to
`std::env::current_dir()`, which either replaces the path, if the given path is
absolute, or joins the paths.

This fixes #821.
2019-02-14 10:57:06 +02:00
bors[bot]
ebfa26658e Merge #818
818: In `RootConfig::contains`, check against canonicalized version of root path r=matklad a=pnkfelix

In `RootConfig::contains`, check against canonicalized version of root path since OS may hand us data that uses the canonical form rather than the root as specified by the user.

This is a step towards a resolution of issue #734 but does not completely fix the problem there.

Co-authored-by: Felix S. Klock II <pnkfelix@pnkfx.org>
2019-02-13 21:33:31 +00:00
Felix S. Klock II
da300fd553 rustfmt 2019-02-13 22:31:33 +01:00
bors[bot]
cb4327b3a9 Merge #816
816: Prelude & Edition 2015 import resolution r=matklad a=flodiebold

I implemented the prelude import, but it turned out to be useless without being able to resolve any of the imports in the prelude 😅 So I had to add some edition handling and handle 2015-style imports (at least the simplified scheme proposed in rust-lang/rust#57745). So now finally `Option` resolves 😄 

One remaining problem is that we don't actually know the edition for sysroot crates. They're currently hardcoded to 2015, but there's already a bunch of PRs upgrading the editions of various rustc crates, so we'll have to detect the edition somehow, or just change the hardcoding to 2018 later, I guess...

~Also currently missing is completion for prelude names, though that shouldn't be hard to add. And `Vec` still doesn't resolve, so I need to look into that.~

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-02-13 20:14:39 +00:00
Florian Diebold
911e32bca9 Complete names from prelude 2019-02-13 21:13:08 +01:00
Florian Diebold
92c595a6a6 Handle extern crates better, so they work correctly in 2015 edition
(see the removed comment.)
2019-02-13 21:13:08 +01:00
Florian Diebold
70839b7ef8 Make edition handling a bit nicer and allow specifying edition in crate_graph macro 2019-02-13 20:31:47 +01:00
Florian Diebold
d5ad38cbb8 Resolve 2015 style imports 2019-02-13 20:10:46 +01:00
Florian Diebold
3a9934e2c3 Keep track of crate edition 2019-02-13 20:10:46 +01:00