mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-24 13:13:43 +00:00
fix: don't check context type of hash token (#1432)
This commit is contained in:
parent
51530034f7
commit
afc5d31377
9 changed files with 153 additions and 4 deletions
|
@ -181,10 +181,11 @@ impl<'a> PostTypeChecker<'a> {
|
|||
None
|
||||
};
|
||||
|
||||
let can_penetrate_context = !(matches!(context.kind(), SyntaxKind::FieldAccess) && {
|
||||
let field_access = context.cast::<ast::FieldAccess>()?;
|
||||
field_access.field().span() == node.span()
|
||||
});
|
||||
let can_penetrate_context = !(matches!(node.kind(), SyntaxKind::Hash)
|
||||
|| matches!(context.kind(), SyntaxKind::FieldAccess) && {
|
||||
let field_access = context.cast::<ast::FieldAccess>()?;
|
||||
field_access.field().span() == node.span()
|
||||
});
|
||||
|
||||
let contextual_self_ty = can_penetrate_context
|
||||
.then(|| self.check_cursor(classify_context(node.clone(), None), context_ty));
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
/// contains: center, caption
|
||||
|
||||
#figure[# /* range -1..0 */]
|
|
@ -0,0 +1,3 @@
|
|||
/// contains: center, caption
|
||||
|
||||
#figure([# /* range -1..0 */])
|
|
@ -0,0 +1,3 @@
|
|||
/// contains: center, caption
|
||||
|
||||
#figure[#c /* range -1..0 */ ]
|
|
@ -0,0 +1,3 @@
|
|||
/// contains: center, caption
|
||||
|
||||
#figure([#c /* range -1..0 */ ])
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
source: crates/tinymist-query/src/completion.rs
|
||||
description: Completion on (40..41)
|
||||
expression: "JsonRepr::new_pure(results)"
|
||||
input_file: crates/tinymist-query/src/fixtures/completion/arg_content.typ
|
||||
---
|
||||
[
|
||||
{
|
||||
"isIncomplete": false,
|
||||
"items": [
|
||||
{
|
||||
"kind": 6,
|
||||
"label": "center",
|
||||
"labelDetails": {
|
||||
"description": "alignment"
|
||||
},
|
||||
"sortText": "022",
|
||||
"textEdit": {
|
||||
"newText": "center",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 9,
|
||||
"line": 2
|
||||
},
|
||||
"start": {
|
||||
"character": 9,
|
||||
"line": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
source: crates/tinymist-query/src/completion.rs
|
||||
description: Completion on (41..42)
|
||||
expression: "JsonRepr::new_pure(results)"
|
||||
input_file: crates/tinymist-query/src/fixtures/completion/arg_content2.typ
|
||||
---
|
||||
[
|
||||
{
|
||||
"isIncomplete": false,
|
||||
"items": [
|
||||
{
|
||||
"kind": 6,
|
||||
"label": "center",
|
||||
"labelDetails": {
|
||||
"description": "alignment"
|
||||
},
|
||||
"sortText": "022",
|
||||
"textEdit": {
|
||||
"newText": "center",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 10,
|
||||
"line": 2
|
||||
},
|
||||
"start": {
|
||||
"character": 10,
|
||||
"line": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
source: crates/tinymist-query/src/completion.rs
|
||||
description: Completion on (41..42)
|
||||
expression: "JsonRepr::new_pure(results)"
|
||||
input_file: crates/tinymist-query/src/fixtures/completion/arg_content3.typ
|
||||
---
|
||||
[
|
||||
{
|
||||
"isIncomplete": false,
|
||||
"items": [
|
||||
{
|
||||
"kind": 6,
|
||||
"label": "center",
|
||||
"labelDetails": {
|
||||
"description": "alignment"
|
||||
},
|
||||
"sortText": "022",
|
||||
"textEdit": {
|
||||
"newText": "center",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 10,
|
||||
"line": 2
|
||||
},
|
||||
"start": {
|
||||
"character": 9,
|
||||
"line": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
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/arg_content4.typ
|
||||
---
|
||||
[
|
||||
{
|
||||
"isIncomplete": false,
|
||||
"items": [
|
||||
{
|
||||
"kind": 6,
|
||||
"label": "center",
|
||||
"labelDetails": {
|
||||
"description": "alignment"
|
||||
},
|
||||
"sortText": "022",
|
||||
"textEdit": {
|
||||
"newText": "center",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 11,
|
||||
"line": 2
|
||||
},
|
||||
"start": {
|
||||
"character": 10,
|
||||
"line": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue