diff options
author | gfreezy <[email protected]> | 2019-01-23 05:21:29 +0000 |
---|---|---|
committer | gfreezy <[email protected]> | 2019-01-23 07:43:47 +0000 |
commit | 13d2fd32ab5df598496c6abbf46591ff05cd3def (patch) | |
tree | ebfe1de5f52c088f20ffd3d1c591514e844307e0 /crates/ra_hir/src | |
parent | 488326ffa74bea2773eed9c1849e9d3b9eac9b2d (diff) |
fix completion bugs
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/code_model_impl/module.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres.rs | 9 | ||||
-rw-r--r-- | crates/ra_hir/src/path.rs | 7 |
3 files changed, 18 insertions, 2 deletions
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index 73c212de8..d94079f11 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs | |||
@@ -143,6 +143,10 @@ impl Module { | |||
143 | return PerNs::none(); | 143 | return PerNs::none(); |
144 | } | 144 | } |
145 | } | 145 | } |
146 | PathKind::Abs => { | ||
147 | // TODO: absolute use is not supported | ||
148 | return PerNs::none(); | ||
149 | } | ||
146 | } | 150 | } |
147 | .def_id, | 151 | .def_id, |
148 | ); | 152 | ); |
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs index 4874e82f3..72791ed49 100644 --- a/crates/ra_hir/src/nameres.rs +++ b/crates/ra_hir/src/nameres.rs | |||
@@ -15,7 +15,8 @@ | |||
15 | //! so that the results of name resolution can be preserved unless the module | 15 | //! so that the results of name resolution can be preserved unless the module |
16 | //! structure itself is modified. | 16 | //! structure itself is modified. |
17 | pub(crate) mod lower; | 17 | pub(crate) mod lower; |
18 | use lower::*; | 18 | |
19 | use crate::nameres::lower::*; | ||
19 | 20 | ||
20 | use std::sync::Arc; | 21 | use std::sync::Arc; |
21 | 22 | ||
@@ -59,7 +60,7 @@ impl ModuleScope { | |||
59 | pub struct Resolution { | 60 | pub struct Resolution { |
60 | /// None for unresolved | 61 | /// None for unresolved |
61 | pub def_id: PerNs<DefId>, | 62 | pub def_id: PerNs<DefId>, |
62 | /// ident by whitch this is imported into local scope. | 63 | /// ident by which this is imported into local scope. |
63 | pub import: Option<ImportId>, | 64 | pub import: Option<ImportId>, |
64 | } | 65 | } |
65 | 66 | ||
@@ -317,6 +318,10 @@ where | |||
317 | } | 318 | } |
318 | } | 319 | } |
319 | PathKind::Crate => module_id.crate_root(&self.module_tree), | 320 | PathKind::Crate => module_id.crate_root(&self.module_tree), |
321 | PathKind::Abs => { | ||
322 | // TODO: absolute use is not supported for now | ||
323 | return false; | ||
324 | } | ||
320 | }; | 325 | }; |
321 | 326 | ||
322 | for (i, segment) in import.path.segments.iter().enumerate() { | 327 | for (i, segment) in import.path.segments.iter().enumerate() { |
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs index c3d14c689..e13d84c57 100644 --- a/crates/ra_hir/src/path.rs +++ b/crates/ra_hir/src/path.rs | |||
@@ -38,6 +38,8 @@ pub enum PathKind { | |||
38 | Self_, | 38 | Self_, |
39 | Super, | 39 | Super, |
40 | Crate, | 40 | Crate, |
41 | // Absolute path | ||
42 | Abs, | ||
41 | } | 43 | } |
42 | 44 | ||
43 | impl Path { | 45 | impl Path { |
@@ -57,6 +59,11 @@ impl Path { | |||
57 | let mut segments = Vec::new(); | 59 | let mut segments = Vec::new(); |
58 | loop { | 60 | loop { |
59 | let segment = path.segment()?; | 61 | let segment = path.segment()?; |
62 | |||
63 | if segment.has_colon_colon() { | ||
64 | kind = PathKind::Abs; | ||
65 | } | ||
66 | |||
60 | match segment.kind()? { | 67 | match segment.kind()? { |
61 | ast::PathSegmentKind::Name(name) => { | 68 | ast::PathSegmentKind::Name(name) => { |
62 | let args = segment | 69 | let args = segment |