mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-25 21:37:32 +00:00
fix: wrong check of param completion position at comma (#205)
This commit is contained in:
parent
b52ad52760
commit
c33f14e761
3 changed files with 39 additions and 3 deletions
|
|
@ -177,7 +177,8 @@ pub struct DynCallTarget {
|
|||
pub this: Option<Value>,
|
||||
}
|
||||
|
||||
/// The calling convention of a function.
|
||||
/// The call of a function with calling convention identified.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum CallConvention {
|
||||
/// A static function.
|
||||
Static(Func),
|
||||
|
|
|
|||
|
|
@ -7,6 +7,41 @@ input_file: crates/tinymist-query/src/fixtures/completion/func_args2.typ
|
|||
[
|
||||
{
|
||||
"isIncomplete": false,
|
||||
"items": []
|
||||
"items": [
|
||||
{
|
||||
"kind": 6,
|
||||
"label": "class",
|
||||
"textEdit": {
|
||||
"newText": " class: ${1:}",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 18,
|
||||
"line": 14
|
||||
},
|
||||
"start": {
|
||||
"character": 18,
|
||||
"line": 14
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": 6,
|
||||
"label": "font",
|
||||
"textEdit": {
|
||||
"newText": " font: ${1:}",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 18,
|
||||
"line": 14
|
||||
},
|
||||
"start": {
|
||||
"character": 18,
|
||||
"line": 14
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -732,7 +732,7 @@ fn complete_params(ctx: &mut CompletionContext) -> bool {
|
|||
// Parameters: "func(|)", "func(hi|)", "func(12,|)".
|
||||
if_chain! {
|
||||
if matches!(deciding.kind(), SyntaxKind::LeftParen | SyntaxKind::Comma);
|
||||
if deciding.kind() != SyntaxKind::Comma || deciding.range().end < ctx.cursor;
|
||||
if deciding.kind() != SyntaxKind::Comma || deciding.range().end <= ctx.cursor;
|
||||
then {
|
||||
if let Some(next) = deciding.next_leaf() {
|
||||
ctx.from = ctx.cursor.min(next.offset());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue