From 5015dc92ac27617d81bb14c470195808b09c9619 Mon Sep 17 00:00:00 2001 From: peefy Date: Thu, 29 Feb 2024 19:54:24 +0800 Subject: [PATCH] refactor: make decorator document more simple Signed-off-by: peefy --- kclvm/sema/src/builtin/decorator.rs | 20 ++------------------ kclvm/tools/src/LSP/src/hover.rs | 2 +- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/kclvm/sema/src/builtin/decorator.rs b/kclvm/sema/src/builtin/decorator.rs index 5febf1a7c..6a453bfed 100644 --- a/kclvm/sema/src/builtin/decorator.rs +++ b/kclvm/sema/src/builtin/decorator.rs @@ -40,15 +40,7 @@ register_decorator! { has_default: true, }, ], - r#"This decorator is used to get the deprecation message according to the wrapped key-value pair. - -Examples --------- -@deprecated(version="v1.16", reason="The age attribute was deprecated", strict=True) -schema Person: - name: str - age: int - "#, + r#"This decorator is used to get the deprecation message according to the wrapped key-value pair."#, false, None, ) @@ -56,15 +48,7 @@ schema Person: None, Arc::new(Type::ANY), &[], - r#"Info decorator is used to mark some compile-time information for external API queries - -Examples --------- -@info(message="User message") -schema Person: - name: str - age: int - "#, + r#"Info decorator is used to mark some compile-time information for external API queries"#, true, Some(0), ) diff --git a/kclvm/tools/src/LSP/src/hover.rs b/kclvm/tools/src/LSP/src/hover.rs index ace6aab70..1ea8a0f58 100644 --- a/kclvm/tools/src/LSP/src/hover.rs +++ b/kclvm/tools/src/LSP/src/hover.rs @@ -515,7 +515,7 @@ mod tests { let expect_content = vec![MarkedString::String( "fn deprecated(version: str, reason: str, strict: bool) -> any".to_string(), ), MarkedString::String( - "This decorator is used to get the deprecation message according to the wrapped key-value pair.\n\n\n\nExamples\n\n--------\n\n@deprecated(version=\"v1.16\", reason=\"The age attribute was deprecated\", strict=True)\n\nschema Person:\n\n name: str\n\n age: int\n\n ".to_string(), + "This decorator is used to get the deprecation message according to the wrapped key-value pair.".to_string(), )]; match got.contents { lsp_types::HoverContents::Array(vec) => {