diff --git a/sway-core/src/language/call_path.rs b/sway-core/src/language/call_path.rs index a829442d4ef..b7d67d11fc6 100644 --- a/sway-core/src/language/call_path.rs +++ b/sway-core/src/language/call_path.rs @@ -1,6 +1,6 @@ use std::{fmt, sync::Arc}; -use crate::{Ident, Namespace}; +use crate::{namespace::Module, Ident}; use sway_types::{span::Span, Spanned}; @@ -100,7 +100,7 @@ impl CallPath { /// /// Paths to _external_ libraries such `std::lib1::lib2::my_obj` are considered full already /// and are left unchanged since `std` is a root of the package `std`. - pub fn to_fullpath(&self, namespace: &mut Namespace) -> CallPath { + pub fn to_fullpath(&self, namespace: &Module) -> CallPath { if self.is_absolute { return self.clone(); } @@ -123,11 +123,11 @@ impl CallPath { let mut prefixes: Vec = vec![]; if !is_external { - if let Some(pkg_name) = &namespace.root().module.name { + if let Some(pkg_name) = &namespace.name { prefixes.push(pkg_name.clone()); } - for mod_path in namespace.mod_path() { + for mod_path in &namespace.mod_path { prefixes.push(mod_path.clone()); } } @@ -149,10 +149,10 @@ impl CallPath { self.clone() } else { let mut prefixes: Vec = vec![]; - if let Some(pkg_name) = &namespace.root().module.name { + if let Some(pkg_name) = &namespace.name { prefixes.push(pkg_name.clone()); } - for mod_path in namespace.mod_path() { + for mod_path in &namespace.mod_path { prefixes.push(mod_path.clone()); } diff --git a/sway-lsp/src/capabilities/hover/hover_link_contents.rs b/sway-lsp/src/capabilities/hover/hover_link_contents.rs index 27172e183df..865d9f18534 100644 --- a/sway-lsp/src/capabilities/hover/hover_link_contents.rs +++ b/sway-lsp/src/capabilities/hover/hover_link_contents.rs @@ -78,11 +78,10 @@ impl<'a> HoverLinkContents<'a> { }); }; } - /// Adds all implementations of the given [TyTraitDecl] to the list of implementations. pub fn add_implementations_for_trait(&mut self, trait_decl: &TyTraitDecl) { if let Some(namespace) = self.session.namespace() { - let call_path = CallPath::from(trait_decl.name.clone()); //.to_fullpath(&namespace); + let call_path = CallPath::from(trait_decl.name.clone()).to_fullpath(&namespace); let impl_spans = namespace.get_impl_spans_for_trait_name(&call_path); self.add_implementations(&trait_decl.span(), impl_spans); }