mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-24 05:05:00 +00:00
test: add completion tests about nodes in math calls (#1139)
This commit is contained in:
parent
db62791908
commit
fb717ef4d5
13 changed files with 248 additions and 0 deletions
|
@ -173,7 +173,9 @@ impl<'a> CompletionCursor<'a> {
|
||||||
let syntax_context = classify_context(leaf.clone(), Some(cursor));
|
let syntax_context = classify_context(leaf.clone(), Some(cursor));
|
||||||
let surrounding_syntax = surrounding_syntax(&leaf);
|
let surrounding_syntax = surrounding_syntax(&leaf);
|
||||||
|
|
||||||
|
crate::log_debug_ct!("CompletionCursor: syntax {leaf:?} -> {syntax:#?}");
|
||||||
crate::log_debug_ct!("CompletionCursor: context {leaf:?} -> {syntax_context:#?}");
|
crate::log_debug_ct!("CompletionCursor: context {leaf:?} -> {syntax_context:#?}");
|
||||||
|
crate::log_debug_ct!("CompletionCursor: surrounding {leaf:?} -> {surrounding_syntax:#?}");
|
||||||
Some(Self {
|
Some(Self {
|
||||||
ctx,
|
ctx,
|
||||||
text,
|
text,
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
/// contains: abs
|
||||||
|
|
||||||
|
$ abs(abs/* range 0..1 */) $
|
|
@ -0,0 +1,3 @@
|
||||||
|
/// contains: abs
|
||||||
|
|
||||||
|
$ abs(ab/* range 0..1 */) $
|
|
@ -0,0 +1,3 @@
|
||||||
|
/// contains: abs
|
||||||
|
|
||||||
|
$ abs(1 a/* range 0..1 */) $
|
|
@ -0,0 +1,3 @@
|
||||||
|
/// contains: abs
|
||||||
|
|
||||||
|
$ abs(1 ab/* range 0..1 */) $
|
|
@ -0,0 +1,3 @@
|
||||||
|
/// contains: norm
|
||||||
|
|
||||||
|
$ abs(n/* range 0..1 */) $
|
|
@ -0,0 +1,3 @@
|
||||||
|
/// contains: norm
|
||||||
|
|
||||||
|
$ abs(no/* range 0..1 */) $
|
|
@ -0,0 +1,53 @@
|
||||||
|
---
|
||||||
|
source: crates/tinymist-query/src/completion.rs
|
||||||
|
description: Completion on / (28..29)
|
||||||
|
expression: "JsonRepr::new_pure(results)"
|
||||||
|
input_file: crates/tinymist-query/src/fixtures/completion/math_call_in_call.typ
|
||||||
|
snapshot_kind: text
|
||||||
|
---
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"isIncomplete": false,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"kind": 3,
|
||||||
|
"label": "abs",
|
||||||
|
"sortText": "000",
|
||||||
|
"textEdit": {
|
||||||
|
"newText": "abs(${1:})",
|
||||||
|
"range": {
|
||||||
|
"end": {
|
||||||
|
"character": 9,
|
||||||
|
"line": 2
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"character": 6,
|
||||||
|
"line": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": 3,
|
||||||
|
"label": "abs",
|
||||||
|
"labelDetails": {
|
||||||
|
"description": "(content, size: auto | relative) => content"
|
||||||
|
},
|
||||||
|
"sortText": "058",
|
||||||
|
"textEdit": {
|
||||||
|
"newText": "abs(${1:})",
|
||||||
|
"range": {
|
||||||
|
"end": {
|
||||||
|
"character": 9,
|
||||||
|
"line": 2
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"character": 6,
|
||||||
|
"line": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1,35 @@
|
||||||
|
---
|
||||||
|
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/math_call_in_call2.typ
|
||||||
|
snapshot_kind: text
|
||||||
|
---
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"isIncomplete": false,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"kind": 3,
|
||||||
|
"label": "abs",
|
||||||
|
"labelDetails": {
|
||||||
|
"description": "(content, size: auto | relative) => content"
|
||||||
|
},
|
||||||
|
"sortText": "057",
|
||||||
|
"textEdit": {
|
||||||
|
"newText": "abs(${1:})",
|
||||||
|
"range": {
|
||||||
|
"end": {
|
||||||
|
"character": 8,
|
||||||
|
"line": 2
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"character": 6,
|
||||||
|
"line": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1,35 @@
|
||||||
|
---
|
||||||
|
source: crates/tinymist-query/src/completion.rs
|
||||||
|
description: Completion on / (28..29)
|
||||||
|
expression: "JsonRepr::new_pure(results)"
|
||||||
|
input_file: crates/tinymist-query/src/fixtures/completion/math_call_in_call3.typ
|
||||||
|
snapshot_kind: text
|
||||||
|
---
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"isIncomplete": false,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"kind": 3,
|
||||||
|
"label": "abs",
|
||||||
|
"labelDetails": {
|
||||||
|
"description": "(content, size: auto | relative) => content"
|
||||||
|
},
|
||||||
|
"sortText": "055",
|
||||||
|
"textEdit": {
|
||||||
|
"newText": "abs(${1:})",
|
||||||
|
"range": {
|
||||||
|
"end": {
|
||||||
|
"character": 9,
|
||||||
|
"line": 2
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"character": 8,
|
||||||
|
"line": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1,35 @@
|
||||||
|
---
|
||||||
|
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/math_call_in_call4.typ
|
||||||
|
snapshot_kind: text
|
||||||
|
---
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"isIncomplete": false,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"kind": 3,
|
||||||
|
"label": "abs",
|
||||||
|
"labelDetails": {
|
||||||
|
"description": "(content, size: auto | relative) => content"
|
||||||
|
},
|
||||||
|
"sortText": "055",
|
||||||
|
"textEdit": {
|
||||||
|
"newText": "abs(${1:})",
|
||||||
|
"range": {
|
||||||
|
"end": {
|
||||||
|
"character": 10,
|
||||||
|
"line": 2
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"character": 8,
|
||||||
|
"line": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1,35 @@
|
||||||
|
---
|
||||||
|
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/math_ident_in_call.typ
|
||||||
|
snapshot_kind: text
|
||||||
|
---
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"isIncomplete": false,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"kind": 3,
|
||||||
|
"label": "norm",
|
||||||
|
"labelDetails": {
|
||||||
|
"description": "(content, size: auto | relative) => content"
|
||||||
|
},
|
||||||
|
"sortText": "221",
|
||||||
|
"textEdit": {
|
||||||
|
"newText": "norm(${1:})",
|
||||||
|
"range": {
|
||||||
|
"end": {
|
||||||
|
"character": 7,
|
||||||
|
"line": 2
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"character": 6,
|
||||||
|
"line": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1,35 @@
|
||||||
|
---
|
||||||
|
source: crates/tinymist-query/src/completion.rs
|
||||||
|
description: Completion on / (28..29)
|
||||||
|
expression: "JsonRepr::new_pure(results)"
|
||||||
|
input_file: crates/tinymist-query/src/fixtures/completion/math_ident_in_call2.typ
|
||||||
|
snapshot_kind: text
|
||||||
|
---
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"isIncomplete": false,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"kind": 3,
|
||||||
|
"label": "norm",
|
||||||
|
"labelDetails": {
|
||||||
|
"description": "(content, size: auto | relative) => content"
|
||||||
|
},
|
||||||
|
"sortText": "223",
|
||||||
|
"textEdit": {
|
||||||
|
"newText": "norm(${1:})",
|
||||||
|
"range": {
|
||||||
|
"end": {
|
||||||
|
"character": 8,
|
||||||
|
"line": 2
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"character": 6,
|
||||||
|
"line": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
Loading…
Add table
Add a link
Reference in a new issue