fix: correct bound self checking (#1564)

This commit is contained in:
Myriad-Dreamin 2025-03-21 14:40:07 +08:00 committed by GitHub
parent af78414788
commit 87651913af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 50 additions and 8 deletions

View file

@ -134,7 +134,16 @@ impl CompletionPair<'_, '_, '_> {
continue;
}
self.value_completion(Some(name.clone()), bind.read(), elem_parens, None);
self.value_completion_(
bind.read(),
ValueCompletionInfo {
label: Some(name.clone()),
parens: elem_parens,
docs: None,
label_details: None,
bound_self: true,
},
);
}
if let Some(scope) = value.scope() {
@ -150,7 +159,7 @@ impl CompletionPair<'_, '_, '_> {
parens: elem_parens,
docs: None,
label_details: None,
bound_self: true,
bound_self: false,
},
);
}

View file

@ -0,0 +1,3 @@
/// contains: clusters
#"".clu/* range 0..1 */

View file

@ -0,0 +1,30 @@
---
source: crates/tinymist-query/src/completion.rs
description: Completion on / (31..32)
expression: "JsonRepr::new_pure(results)"
input_file: crates/tinymist-query/src/fixtures/completion/func_cluster.typ
---
[
{
"isIncomplete": false,
"items": [
{
"kind": 3,
"label": "clusters",
"textEdit": {
"newText": "clusters()${1:}",
"range": {
"end": {
"character": 7,
"line": 2
},
"start": {
"character": 4,
"line": 2
}
}
}
}
]
}
]

View file

@ -9,14 +9,10 @@ input_file: crates/tinymist-query/src/fixtures/completion/func_self.typ
"isIncomplete": false,
"items": [
{
"command": {
"command": "tinymist.triggerSuggestAndParameterHints",
"title": ""
},
"kind": 3,
"label": "flatten",
"textEdit": {
"newText": "flatten(${1:})",
"newText": "flatten()${1:}",
"range": {
"end": {
"character": 7,

View file

@ -9,10 +9,14 @@ input_file: crates/tinymist-query/src/fixtures/completion/func_self2.typ
"isIncomplete": false,
"items": [
{
"command": {
"command": "tinymist.triggerSuggestAndParameterHints",
"title": ""
},
"kind": 3,
"label": "flatten",
"textEdit": {
"newText": "flatten()${1:}",
"newText": "flatten(${1:})",
"range": {
"end": {
"character": 11,