mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-16 09:25:01 +00:00
fix: don't complete import items across line (#952)
This commit is contained in:
parent
9b3eaf9926
commit
22d2ed88a3
3 changed files with 22 additions and 0 deletions
|
@ -0,0 +1,7 @@
|
|||
/// path: base.typ
|
||||
#let aa() = 1;
|
||||
|
||||
-----
|
||||
/// contains: base,aa
|
||||
#import "base.typ":
|
||||
/* range 0..1 */
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
source: crates/tinymist-query/src/completion.rs
|
||||
description: Completion on / (42..43)
|
||||
expression: "JsonRepr::new_pure(results)"
|
||||
input_file: crates/tinymist-query/src/fixtures/completion/import_item_cross_line.typ
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
"isIncomplete": false,
|
||||
"items": []
|
||||
}
|
||||
]
|
|
@ -535,6 +535,8 @@ fn complete_imports(ctx: &mut CompletionContext) -> bool {
|
|||
if_chain! {
|
||||
if let Some(prev) = ctx.leaf.prev_sibling();
|
||||
if let Some(ast::Expr::Import(import)) = prev.get().cast();
|
||||
if ctx.leaf.range().end <= prev.range().end ||
|
||||
!ctx.text[prev.offset()..ctx.leaf.range().end].contains('\n');
|
||||
if let Some(ast::Imports::Items(items)) = import.imports();
|
||||
if let Some(source) = prev.children().find(|child| child.is::<ast::Expr>());
|
||||
then {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue