diff --git a/sway-lsp/src/capabilities/code_actions/diagnostic/auto_import.rs b/sway-lsp/src/capabilities/code_actions/diagnostic/auto_import.rs index 06aecd9a80d..22889c6eea6 100644 --- a/sway-lsp/src/capabilities/code_actions/diagnostic/auto_import.rs +++ b/sway-lsp/src/capabilities/code_actions/diagnostic/auto_import.rs @@ -118,6 +118,27 @@ pub(crate) fn get_call_paths_for_name<'s>( trait_decl.call_path.to_import_path(ctx.engines, &namespace); Some(call_path) } + TyDecl::FunctionDecl(decl) => { + let function_decl = ctx.engines.de().get_function(&decl.decl_id); + let call_path = function_decl + .call_path + .to_import_path(ctx.engines, &namespace); + Some(call_path) + } + TyDecl::ConstantDecl(decl) => { + let constant_decl = ctx.engines.de().get_constant(&decl.decl_id); + let call_path = constant_decl + .call_path + .to_import_path(ctx.engines, &namespace); + Some(call_path) + } + TyDecl::TypeAliasDecl(decl) => { + let type_alias_decl = ctx.engines.de().get_type_alias(&decl.decl_id); + let call_path = type_alias_decl + .call_path + .to_import_path(ctx.engines, &namespace); + Some(call_path) + } _ => None, }; }