Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: make decorator document more simple #1095

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions kclvm/sema/src/builtin/decorator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,15 @@ 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,
)
info => Type::function(
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),
)
Expand Down
2 changes: 1 addition & 1 deletion kclvm/tools/src/LSP/src/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
Loading