mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-03 09:52:27 +00:00
fix: complete field access even if its parent is a closure (#1019)
* dev: complete field access even if it's parent is a closure * test: update snapshot
This commit is contained in:
parent
e116b0b645
commit
142138297e
3 changed files with 12 additions and 4 deletions
|
@ -98,7 +98,12 @@ impl StatefulRequest for CompletionRequest {
|
||||||
let parent_init = parent.find(parent_init.span())?;
|
let parent_init = parent.find(parent_init.span())?;
|
||||||
parent_init.find(node.span())?;
|
parent_init.find(node.span())?;
|
||||||
}
|
}
|
||||||
Some(SyntaxKind::Closure) => return None,
|
Some(SyntaxKind::Closure) => {
|
||||||
|
let parent = node.parent()?;
|
||||||
|
let parent_body = parent.cast::<ast::Closure>()?.body();
|
||||||
|
let parent_body = parent.find(parent_body.span())?;
|
||||||
|
parent_body.find(node.span())?;
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
---
|
---
|
||||||
source: crates/tinymist-query/src/completion.rs
|
source: crates/tinymist-query/src/completion.rs
|
||||||
description: Completion on / (55..56)
|
description: Completion on / (51..52)
|
||||||
expression: "JsonRepr::new_pure(results)"
|
expression: "JsonRepr::new_pure(results)"
|
||||||
input_file: crates/tinymist-query/src/fixtures/completion/field_simple.typ
|
input_file: crates/tinymist-query/src/fixtures/completion/field_simple.typ
|
||||||
snapshot_kind: text
|
snapshot_kind: text
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
null
|
{
|
||||||
|
"isIncomplete": false,
|
||||||
|
"items": []
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -374,7 +374,7 @@ fn e2e() {
|
||||||
});
|
});
|
||||||
|
|
||||||
let hash = replay_log(&tinymist_binary, &root.join("neovim"));
|
let hash = replay_log(&tinymist_binary, &root.join("neovim"));
|
||||||
insta::assert_snapshot!(hash, @"siphash128_13:1b57e3cb3fd4ba2a088a4eaf7aa6d4bb");
|
insta::assert_snapshot!(hash, @"siphash128_13:a46fdba2828c3e0b2fa431509c12d45e");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue