Commit Graph

1859 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Jeremy Kolb
1cd5966462 Be precise about the argument list
Fixes #812
2019-02-14 10:28:48 -05: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
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
Florian Diebold
1526eb25c9 Import the prelude 2019-02-13 20:10:09 +01:00
bors[bot]
65266c644a Merge #813
813: Add support for container_name in workspace/symbol query r=matklad a=vipentti

Currently this does not fill in the container_info if a type is defined on the top level in a file. 

e.g. `foo.rs`
```rust
enum Foo { }
```
`Foo` will have None as the container_name, however

```rust
mod foo_mod {
    enum Foo { } 
}
```
`Foo` has `foo_mod` as the container_name. 

This closes #559 

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-13 16:17:10 +00:00
Felix S. Klock II
cfed7c59f4 In RootConfig::contains, check against canonicalized version of root
path since OS may hand us data that uses that rather than the root as
specified by the user.
2019-02-13 17:16:28 +01:00
Ville Penttinen
3973974de1 Fix possible issue where unnamed is_symbol_def would pop stack wrongly
This removes is_symbol_def as unnecessary.
2019-02-13 18:02:18 +02:00
Ville Penttinen
0c37a9cc28 Use cloned over map + clone 2019-02-13 17:42:15 +02:00
Ville Penttinen
d9905f7be5 Use clone directly rather than map + clone 2019-02-13 17:28:15 +02:00
Ville Penttinen
2ef6c469ef Remove unnecessary braces 2019-02-13 11:08:25 +02:00
bors[bot]
74d03d57e7 Merge #814
814: auto_import: import in enclosing module by default r=matklad a=eulerdisk

Simpler version of #795 

Co-authored-by: Andrea Pretto <eulerdisk@gmail.com>
2019-02-13 08:26:34 +00:00
Florian Diebold
e5f9d54661 Fix another crash 2019-02-12 21:49:54 +01:00
Andrea Pretto
6518fb2bf8 auto_import: import in enclosing module instead of file 2019-02-12 21:18:55 +01:00
Andrea Pretto
468e1d4c5e auto_import: more tests and some refactorings 2019-02-12 21:18:42 +01:00
Ville Penttinen
dd6307ddc4 Add support for container_name in workspace/symbol query 2019-02-12 22:06:14 +02:00
bors[bot]
61324a845b Merge #811
811: Filter attributes from the completion details/label r=kjeremy a=lnicola

Before:

![image](https://user-images.githubusercontent.com/308347/52657254-efba9a00-2f00-11e9-952f-901910cfc459.png)

After:

![image](https://user-images.githubusercontent.com/308347/52657278-fb0dc580-2f00-11e9-9267-8aff44c93447.png)

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2019-02-12 19:31:22 +00:00
Laurențiu Nicola
040fb91387 Filter attributes from the completion details/label 2019-02-12 20:35:10 +02:00
Aleksey Kladov
5f89180fd9 make token trees eq 2019-02-12 20:57:13 +03:00
bors[bot]
3e367b5760 Merge #809
809: what goes bump in the night? r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-02-12 16:11:19 +00:00