fix: correct field access dot target (#1489)

* fix: correct field access dot target

* test: add cases about #1267
This commit is contained in:
Myriad-Dreamin 2025-03-11 23:33:46 +08:00 committed by GitHub
parent db1ff20a6d
commit 4bf6cdb9ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 182 additions and 2 deletions

View file

@ -0,0 +1,4 @@
/// contains: first
#let dict = (first: (second: "value"))
#dict.fi/* range 0..1 */

View file

@ -0,0 +1,4 @@
/// contains: second
#let dict = (first: (second: "value"))
#dict.first.sec/* range 0..1 */

View file

@ -0,0 +1,3 @@
/// contains: sin
#if std.calc./* range 0..1 */

View file

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

View file

@ -0,0 +1,30 @@
---
source: crates/tinymist-query/src/completion.rs
description: Completion on / (68..69)
expression: "JsonRepr::new_pure(results)"
input_file: crates/tinymist-query/src/fixtures/completion/dict_chain_access.typ
---
[
{
"isIncomplete": false,
"items": [
{
"kind": 6,
"label": "first",
"textEdit": {
"newText": "first",
"range": {
"end": {
"character": 8,
"line": 3
},
"start": {
"character": 6,
"line": 3
}
}
}
}
]
}
]

View file

@ -0,0 +1,30 @@
---
source: crates/tinymist-query/src/completion.rs
description: Completion on / (76..77)
expression: "JsonRepr::new_pure(results)"
input_file: crates/tinymist-query/src/fixtures/completion/dict_chain_access2.typ
---
[
{
"isIncomplete": false,
"items": [
{
"kind": 6,
"label": "second",
"textEdit": {
"newText": "second",
"range": {
"end": {
"character": 15,
"line": 3
},
"start": {
"character": 12,
"line": 3
}
}
}
}
]
}
]

View file

@ -0,0 +1,30 @@
---
source: crates/tinymist-query/src/completion.rs
description: Completion on / (32..33)
expression: "JsonRepr::new_pure(results)"
input_file: crates/tinymist-query/src/fixtures/completion/markup_chain.typ
---
[
{
"isIncomplete": false,
"items": [
{
"kind": 3,
"label": "sin",
"textEdit": {
"newText": "sin(${1:})",
"range": {
"end": {
"character": 13,
"line": 2
},
"start": {
"character": 13,
"line": 2
}
}
}
}
]
}
]

View file

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