mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-24 13:13:43 +00:00
feat: consistently enrich colon after show selectors (#785)
This commit is contained in:
parent
bbee391995
commit
22621a966c
4 changed files with 78 additions and 6 deletions
2
crates/tinymist-query/src/fixtures/completion/show3.typ
Normal file
2
crates/tinymist-query/src/fixtures/completion/show3.typ
Normal file
|
@ -0,0 +1,2 @@
|
|||
/// contains: raw, read, raw.with, raw.where, read.with, read.where, replacement, regex selector
|
||||
#show /* range 0..1 */:
|
|
@ -15,7 +15,7 @@ input_file: crates/tinymist-query/src/fixtures/completion/show2.typ
|
|||
"description": "(str, align: alignment, block: bool, lang: none | str, syntaxes: [syntax], tab-size: int, theme: [theme]) => raw"
|
||||
},
|
||||
"textEdit": {
|
||||
"newText": "raw: ",
|
||||
"newText": "raw: ${1:}",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 6,
|
||||
|
@ -35,7 +35,7 @@ input_file: crates/tinymist-query/src/fixtures/completion/show2.typ
|
|||
"description": "(str, align: alignment, block: bool, lang: none | str, syntaxes: [syntax], tab-size: int, theme: [theme]) => raw"
|
||||
},
|
||||
"textEdit": {
|
||||
"newText": "raw.where(${1:}): ",
|
||||
"newText": "raw.where(${1:}): ${2:}",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 6,
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
source: crates/tinymist-query/src/completion.rs
|
||||
description: Completion on / (103..104)
|
||||
expression: "JsonRepr::new_pure(results)"
|
||||
input_file: crates/tinymist-query/src/fixtures/completion/show3.typ
|
||||
---
|
||||
[
|
||||
{
|
||||
"isIncomplete": false,
|
||||
"items": [
|
||||
{
|
||||
"kind": 3,
|
||||
"label": "raw",
|
||||
"labelDetails": {
|
||||
"description": "(str, align: alignment, block: bool, lang: none | str, syntaxes: [syntax], tab-size: int, theme: [theme]) => raw"
|
||||
},
|
||||
"textEdit": {
|
||||
"newText": "raw: ${1:}",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 6,
|
||||
"line": 1
|
||||
},
|
||||
"start": {
|
||||
"character": 6,
|
||||
"line": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": 3,
|
||||
"label": "raw.where",
|
||||
"labelDetails": {
|
||||
"description": "(str, align: alignment, block: bool, lang: none | str, syntaxes: [syntax], tab-size: int, theme: [theme]) => raw"
|
||||
},
|
||||
"textEdit": {
|
||||
"newText": "raw.where(${1:}): ${2:}",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 6,
|
||||
"line": 1
|
||||
},
|
||||
"start": {
|
||||
"character": 6,
|
||||
"line": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": 15,
|
||||
"label": "regex selector",
|
||||
"textEdit": {
|
||||
"newText": "regex(\"${1:regex}\"): ${2:}",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 6,
|
||||
"line": 1
|
||||
},
|
||||
"start": {
|
||||
"character": 6,
|
||||
"line": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -634,19 +634,19 @@ fn show_rule_selector_completions(ctx: &mut CompletionContext) {
|
|||
|value| matches!(value, Value::Func(func) if func.element().is_some()),
|
||||
);
|
||||
|
||||
ctx.enrich("", ": ");
|
||||
|
||||
ctx.snippet_completion(
|
||||
"text selector",
|
||||
"\"${text}\": ${}",
|
||||
"\"${text}\"",
|
||||
"Replace occurrences of specific text.",
|
||||
);
|
||||
|
||||
ctx.snippet_completion(
|
||||
"regex selector",
|
||||
"regex(\"${regex}\"): ${}",
|
||||
"regex(\"${regex}\")",
|
||||
"Replace matches of a regular expression.",
|
||||
);
|
||||
|
||||
ctx.enrich("", ": ${}");
|
||||
}
|
||||
|
||||
/// Add completions for recipes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue