test: cover cases about completing after the dot operator (#1017)

* test: add field tests

* dev: add a snapshot
This commit is contained in:
Myriad-Dreamin 2024-12-18 13:12:55 +08:00 committed by GitHub
parent c0c6503f17
commit e116b0b645
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 164 additions and 0 deletions

View file

@ -0,0 +1,5 @@
/// contains: odd
#{
calc./* range 0..1 */
}

View file

@ -0,0 +1,5 @@
/// contains: odd
#{
calc. /* range 0..1 */
}

View file

@ -0,0 +1,3 @@
/// contains: odd
#calc./* range 0..1 */

View file

@ -0,0 +1,3 @@
/// contains: odd
#calc.o/* range 0..1 */

View file

@ -0,0 +1,3 @@
/// contains: odd
#calc. /* range 0..1 */

View file

@ -0,0 +1,3 @@
/// contains: odd
#calc.o /* range 0..1 */

View file

@ -0,0 +1,31 @@
---
source: crates/tinymist-query/src/completion.rs
description: Completion on / (29..30)
expression: "JsonRepr::new_pure(results)"
input_file: crates/tinymist-query/src/fixtures/completion/field_code.typ
snapshot_kind: text
---
[
{
"isIncomplete": false,
"items": [
{
"kind": 3,
"label": "odd",
"textEdit": {
"newText": "odd(${1:})",
"range": {
"end": {
"character": 7,
"line": 3
},
"start": {
"character": 7,
"line": 3
}
}
}
}
]
}
]

View file

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

View file

@ -0,0 +1,31 @@
---
source: crates/tinymist-query/src/completion.rs
description: Completion on / (25..26)
expression: "JsonRepr::new_pure(results)"
input_file: crates/tinymist-query/src/fixtures/completion/field_markup.typ
snapshot_kind: text
---
[
{
"isIncomplete": false,
"items": [
{
"kind": 3,
"label": "odd",
"textEdit": {
"newText": "odd(${1:})",
"range": {
"end": {
"character": 6,
"line": 2
},
"start": {
"character": 6,
"line": 2
}
}
}
}
]
}
]

View file

@ -0,0 +1,31 @@
---
source: crates/tinymist-query/src/completion.rs
description: Completion on / (26..27)
expression: "JsonRepr::new_pure(results)"
input_file: crates/tinymist-query/src/fixtures/completion/field_markup2.typ
snapshot_kind: text
---
[
{
"isIncomplete": false,
"items": [
{
"kind": 3,
"label": "odd",
"textEdit": {
"newText": "odd(${1:})",
"range": {
"end": {
"character": 7,
"line": 2
},
"start": {
"character": 6,
"line": 2
}
}
}
}
]
}
]

View file

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

View file

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

View file

@ -930,6 +930,16 @@ Text
#let f(x);
nnnnv v
");
assert_snapshot!(map_deref(r#"#{
calc.
}"#).trim(), @r"
#{
n
calc.
nnvvvvvnn
}
n
");
}
#[test]