mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-04 18:28:02 +00:00
fix: complete body of let/closure in markup mode (#1072)
This commit is contained in:
parent
1dcb034b91
commit
38941b8169
3 changed files with 47 additions and 5 deletions
|
@ -8,6 +8,27 @@ snapshot_kind: text
|
|||
[
|
||||
{
|
||||
"isIncomplete": false,
|
||||
"items": []
|
||||
"items": [
|
||||
{
|
||||
"kind": 3,
|
||||
"label": "pagebreak",
|
||||
"labelDetails": {
|
||||
"description": "(to: \"even\" | \"odd\" | none, weak: bool) => pagebreak"
|
||||
},
|
||||
"textEdit": {
|
||||
"newText": "pagebreak()${1:}",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 15,
|
||||
"line": 2
|
||||
},
|
||||
"start": {
|
||||
"character": 15,
|
||||
"line": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -8,6 +8,27 @@ snapshot_kind: text
|
|||
[
|
||||
{
|
||||
"isIncomplete": false,
|
||||
"items": []
|
||||
"items": [
|
||||
{
|
||||
"kind": 3,
|
||||
"label": "pagebreak",
|
||||
"labelDetails": {
|
||||
"description": "(to: \"even\" | \"odd\" | none, weak: bool) => pagebreak"
|
||||
},
|
||||
"textEdit": {
|
||||
"newText": "pagebreak()${1:}",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 12,
|
||||
"line": 2
|
||||
},
|
||||
"start": {
|
||||
"character": 12,
|
||||
"line": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -208,11 +208,11 @@ fn complete_markup(ctx: &mut CompletionContext) -> bool {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Behind a half-completed binding: "#let x = |".
|
||||
// Behind a half-completed binding: "#let x = |" or `#let f(x) = |`.
|
||||
if_chain! {
|
||||
if let Some(prev) = ctx.leaf.prev_leaf();
|
||||
if prev.kind() == SyntaxKind::Eq;
|
||||
if prev.parent_kind() == Some(SyntaxKind::LetBinding);
|
||||
if matches!(prev.kind(), SyntaxKind::Eq | SyntaxKind::Arrow);
|
||||
if matches!( prev.parent_kind(), Some(SyntaxKind::LetBinding | SyntaxKind::Closure));
|
||||
then {
|
||||
ctx.from = ctx.cursor;
|
||||
code_completions(ctx, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue