mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-25 05:22:52 +00:00
fix: don't match the right paren for arg completion (#1480)
* fix: don't match the right paren for arg completion * feat: arg_range_math * fix: fmt
This commit is contained in:
parent
1b141868eb
commit
7b35973741
5 changed files with 32 additions and 0 deletions
|
|
@ -174,6 +174,16 @@ impl<'a> CompletionCursor<'a> {
|
|||
let syntax_context = classify_context(leaf.clone(), Some(cursor));
|
||||
let surrounding_syntax = surrounding_syntax(&leaf);
|
||||
|
||||
// todo: don't match here?
|
||||
if matches!(syntax, Some(SyntaxClass::Callee(..)))
|
||||
&& matches!(syntax_context.as_ref(), Some(
|
||||
SyntaxContext::Element { container, .. } |
|
||||
SyntaxContext::Arg { args: container, .. } |
|
||||
SyntaxContext::Paren { container, .. }) if container.rightmost_leaf().map(|s| s.offset()) == Some(leaf.offset()))
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
crate::log_debug_ct!("CompletionCursor: syntax {leaf:?} -> {syntax:#?}");
|
||||
crate::log_debug_ct!("CompletionCursor: context {leaf:?} -> {syntax_context:#?}");
|
||||
crate::log_debug_ct!("CompletionCursor: surrounding {leaf:?} -> {surrounding_syntax:#?}");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
/// contains: alignment
|
||||
#align()/* range 0..1 */
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
/// contains: size
|
||||
$norm(x)/* range 0..1 */$
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
source: crates/tinymist-query/src/completion.rs
|
||||
description: Completion on / (32..33)
|
||||
expression: "JsonRepr::new_pure(results)"
|
||||
input_file: crates/tinymist-query/src/fixtures/completion/arg_range.typ
|
||||
---
|
||||
[
|
||||
null
|
||||
]
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
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/arg_range_math.typ
|
||||
---
|
||||
[
|
||||
null
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue