diff --git a/noir/noir-repo/tooling/lsp/src/requests/hover.rs b/noir/noir-repo/tooling/lsp/src/requests/hover.rs index 498d18857e8..d88593da217 100644 --- a/noir/noir-repo/tooling/lsp/src/requests/hover.rs +++ b/noir/noir-repo/tooling/lsp/src/requests/hover.rs @@ -1431,6 +1431,85 @@ mod hover_tests { " two::Color Red(Field) +--- + + Like a tomato" + )); + } + + #[test] + async fn hover_on_trait_impl_method_uses_docs_from_trait_method() { + let hover_text = + get_hover_text("workspace", "two/src/lib.nr", Position { line: 92, character: 8 }) + .await; + assert!(hover_text.contains("Some docs")); + } + + #[test] + async fn hover_on_function_with_mut_self() { + let hover_text = + get_hover_text("workspace", "two/src/lib.nr", Position { line: 96, character: 10 }) + .await; + assert!(hover_text.contains("fn mut_self(&mut self)")); + } + + #[test] + async fn hover_on_empty_enum_type() { + let hover_text = + get_hover_text("workspace", "two/src/lib.nr", Position { line: 100, character: 8 }) + .await; + assert!(hover_text.contains( + " two + enum EmptyColor { + } + +--- + + Red, blue, etc." + )); + } + + #[test] + async fn hover_on_non_empty_enum_type() { + let hover_text = + get_hover_text("workspace", "two/src/lib.nr", Position { line: 103, character: 8 }) + .await; + assert!(hover_text.contains( + " two + enum Color { + Red(Field), + } + +--- + + Red, blue, etc." + )); + } + + #[test] + async fn hover_on_enum_variant() { + let hover_text = + get_hover_text("workspace", "two/src/lib.nr", Position { line: 105, character: 6 }) + .await; + assert!(hover_text.contains( + " two::Color + Red(Field) + +--- + + Like a tomato" + )); + } + + #[test] + async fn hover_on_enum_variant_in_call() { + let hover_text = + get_hover_text("workspace", "two/src/lib.nr", Position { line: 109, character: 12 }) + .await; + assert!(hover_text.contains( + " two::Color + Red(Field) + --- Like a tomato"