Skip to content

Commit

Permalink
feat: add more postfix snippets (#880)
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin authored Nov 22, 2024
1 parent 5e498ef commit 3207f57
Showing 1 changed file with 58 additions and 4 deletions.
62 changes: 58 additions & 4 deletions crates/tinymist-query/src/upstream/complete/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1712,10 +1712,28 @@ static DEFAULT_POSTFIX_SNIPPET: LazyLock<Vec<PostfixSnippet>> = LazyLock::new(||
PostfixSnippet {
scope: PostfixSnippetScope::Content,
mode: eco_vec![InterpretMode::Code, InterpretMode::Markup],
label: "aleft".into(),
label_detail: Some(".align left".into()),
snippet: "align(left, ${node})".into(),
description: "wrap as with align left".into(),
label: eco_format!("text fill"),
label_detail: Some(eco_format!(".text fill")),
snippet: "text(fill: ${}, ${node})".into(),
description: eco_format!("wrap with text fill"),
parsed_snippet: OnceLock::new(),
},
PostfixSnippet {
scope: PostfixSnippetScope::Content,
mode: eco_vec![InterpretMode::Code, InterpretMode::Markup],
label: eco_format!("text size"),
label_detail: Some(eco_format!(".text size")),
snippet: "text(size: ${}, ${node})".into(),
description: eco_format!("wrap with text size"),
parsed_snippet: OnceLock::new(),
},
PostfixSnippet {
scope: PostfixSnippetScope::Content,
mode: eco_vec![InterpretMode::Code, InterpretMode::Markup],
label: eco_format!("align"),
label_detail: Some(eco_format!(".align")),
snippet: "align(${}, ${node})".into(),
description: eco_format!("wrap with alignment"),
parsed_snippet: OnceLock::new(),
},
PostfixSnippet {
Expand All @@ -1727,6 +1745,33 @@ static DEFAULT_POSTFIX_SNIPPET: LazyLock<Vec<PostfixSnippet>> = LazyLock::new(||
description: "wrap as if expression".into(),
parsed_snippet: OnceLock::new(),
},
PostfixSnippet {
scope: PostfixSnippetScope::Value,
mode: eco_vec![InterpretMode::Code, InterpretMode::Markup],
label: "else".into(),
label_detail: Some(".else".into()),
snippet: "if not ${node} { ${} }".into(),
description: "wrap as if not expression".into(),
parsed_snippet: OnceLock::new(),
},
PostfixSnippet {
scope: PostfixSnippetScope::Value,
mode: eco_vec![InterpretMode::Code, InterpretMode::Markup],
label: "none".into(),
label_detail: Some(".if none".into()),
snippet: "if ${node} == none { ${} }".into(),
description: "wrap as if expression to check none-ish".into(),
parsed_snippet: OnceLock::new(),
},
PostfixSnippet {
scope: PostfixSnippetScope::Value,
mode: eco_vec![InterpretMode::Code, InterpretMode::Markup],
label: "notnone".into(),
label_detail: Some(".if not none".into()),
snippet: "if ${node} != none { ${} }".into(),
description: "wrap as if expression to check none-ish".into(),
parsed_snippet: OnceLock::new(),
},
PostfixSnippet {
scope: PostfixSnippetScope::Value,
mode: eco_vec![InterpretMode::Code, InterpretMode::Markup],
Expand All @@ -1736,6 +1781,15 @@ static DEFAULT_POSTFIX_SNIPPET: LazyLock<Vec<PostfixSnippet>> = LazyLock::new(||
description: "wrap as return expression".into(),
parsed_snippet: OnceLock::new(),
},
PostfixSnippet {
scope: PostfixSnippetScope::Value,
mode: eco_vec![InterpretMode::Code, InterpretMode::Markup],
label: "tup".into(),
label_detail: Some(".tup".into()),
snippet: "(${node}, ${})".into(),
description: "wrap as tuple (array) expression".into(),
parsed_snippet: OnceLock::new(),
},
PostfixSnippet {
scope: PostfixSnippetScope::Value,
mode: eco_vec![InterpretMode::Code, InterpretMode::Markup],
Expand Down

0 comments on commit 3207f57

Please sign in to comment.