test: cases about completing field access in function call (#958)

This commit is contained in:
Myriad-Dreamin 2024-12-18 11:59:36 +08:00 committed by GitHub
parent 5f8a11bdc0
commit c0c6503f17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 152 additions and 0 deletions

View file

@ -0,0 +1,5 @@
/// contains: text
#show regex(":\S+:"): it => it./* range 0..1 */
:test:

View file

@ -0,0 +1,5 @@
/// contains: text, mode
#show regex(":\S+:"): it => eval("emoji." + /* range after 3..4 */it..slice(1, it.text.len() - 1))
:cat: :anger:

View file

@ -0,0 +1,5 @@
/// contains: text, mode
#show regex(":\S+:"): it => eval("emoji." + /* range after 5..6 */ it.te.slice(1, it.text.len() - 1))
:cat: :anger:

View file

@ -0,0 +1,5 @@
/// contains: text, mode
#show regex(":\S+:"): it => eval("emoji." + /* range after 3..4 */it..at)
:cat: :anger:

View file

@ -0,0 +1,5 @@
/// contains: text, mode
#show regex(":\S+:"): it => eval("emoji." + /* range after 3..4 */it.)
:cat: :anger:

View file

@ -0,0 +1,10 @@
---
source: crates/tinymist-query/src/completion.rs
description: Completion on / (55..56)
expression: "JsonRepr::new_pure(results)"
input_file: crates/tinymist-query/src/fixtures/completion/field_simple.typ
snapshot_kind: text
---
[
null
]

View file

@ -0,0 +1,35 @@
---
source: crates/tinymist-query/src/completion.rs
description: Completion on . (95..96)
expression: "JsonRepr::new_pure(results)"
input_file: crates/tinymist-query/src/fixtures/completion/func_pos_arg_field_call.typ
snapshot_kind: text
---
[
{
"isIncomplete": false,
"items": [
{
"kind": 5,
"label": "mode",
"labelDetails": {
"description": "\"code\" | \"markup\" | \"math\""
},
"sortText": "000",
"textEdit": {
"newText": "mode: ${1:}",
"range": {
"end": {
"character": 69,
"line": 2
},
"start": {
"character": 69,
"line": 2
}
}
}
}
]
}
]

View file

@ -0,0 +1,34 @@
---
source: crates/tinymist-query/src/completion.rs
description: Completion on e (97..98)
expression: "JsonRepr::new_pure(results)"
input_file: crates/tinymist-query/src/fixtures/completion/func_pos_arg_field_call2.typ
snapshot_kind: text
---
[
{
"isIncomplete": false,
"items": [
{
"kind": 3,
"label": "text",
"labelDetails": {
"description": "(content, str, alternates: bool, baseline: length, bottom-edge: \"baseline\" | \"bounds\" | \"descender\" | length, cjk-latin-spacing: auto | none, costs: dictionary, dir: dir, discretionary-ligatures: bool, fallback: bool, features: array | dictionary, fill: color, font: array | text.font, fractions: bool, historical-ligatures: bool, hyphenate: auto | bool, kerning: bool, lang: text.lang, ligatures: bool, number-type: \"lining\" | \"old-style\" | auto, number-width: \"proportional\" | \"tabular\" | auto, overhang: bool, region: text.region, script: auto | str, size: text.size, slashed-zero: bool, spacing: relative, stretch: ratio, stroke: stroke, style: \"italic\" | \"normal\" | \"oblique\", stylistic-set: array | int | none, top-edge: \"ascender\" | \"baseline\" | \"bounds\" | \"cap-height\" | \"x-height\" | length, tracking: length, weight: \"black\" | \"bold\" | \"extrabold\" | \"extralight\" | \"light\" | \"medium\" | \"regular\" | \"semibold\" | \"thin\" | int) => text"
},
"textEdit": {
"newText": "text(${1:}), ",
"range": {
"end": {
"character": 71,
"line": 2
},
"start": {
"character": 70,
"line": 2
}
}
}
}
]
}
]

View file

@ -0,0 +1,35 @@
---
source: crates/tinymist-query/src/completion.rs
description: Completion on . (95..96)
expression: "JsonRepr::new_pure(results)"
input_file: crates/tinymist-query/src/fixtures/completion/func_pos_arg_field_middle.typ
snapshot_kind: text
---
[
{
"isIncomplete": false,
"items": [
{
"kind": 5,
"label": "mode",
"labelDetails": {
"description": "\"code\" | \"markup\" | \"math\""
},
"sortText": "000",
"textEdit": {
"newText": "mode: ${1:}",
"range": {
"end": {
"character": 69,
"line": 2
},
"start": {
"character": 69,
"line": 2
}
}
}
}
]
}
]

View file

@ -0,0 +1,13 @@
---
source: crates/tinymist-query/src/completion.rs
description: Completion on / (62..63)
expression: "JsonRepr::new_pure(results)"
input_file: crates/tinymist-query/src/fixtures/completion/func_pos_arg_field_simple.typ
snapshot_kind: text
---
[
{
"isIncomplete": false,
"items": []
}
]