mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-04 10:18:16 +00:00
dev: check previous syntax first for show/set syntax (#859)
This commit is contained in:
parent
6f8d9750d7
commit
698d86f9b0
3 changed files with 40 additions and 2 deletions
|
@ -0,0 +1,5 @@
|
|||
/// contains: raw, read, raw.with, raw.where, read.with, read.where, replacement, red
|
||||
#show figure: it => {
|
||||
set /* range 0..1 */
|
||||
it
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
source: crates/tinymist-query/src/completion.rs
|
||||
description: Completion on / (114..115)
|
||||
expression: "JsonRepr::new_pure(results)"
|
||||
input_file: crates/tinymist-query/src/fixtures/completion/set_in_show.typ
|
||||
---
|
||||
[
|
||||
{
|
||||
"isIncomplete": false,
|
||||
"items": [
|
||||
{
|
||||
"kind": 3,
|
||||
"label": "raw",
|
||||
"labelDetails": {
|
||||
"description": "(str, align: alignment, block: bool, lang: none | str, syntaxes: [syntax], tab-size: int, theme: [theme]) => raw"
|
||||
},
|
||||
"textEdit": {
|
||||
"newText": "raw(${1:})",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 6,
|
||||
"line": 2
|
||||
},
|
||||
"start": {
|
||||
"character": 6,
|
||||
"line": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -120,8 +120,8 @@ impl<'a> CompletionContext<'a> {
|
|||
}
|
||||
|
||||
fn surrounding_syntax(&mut self) -> SurroundingSyntax {
|
||||
check_surrounding_syntax(&self.leaf)
|
||||
.or_else(|| check_previous_syntax(&self.leaf))
|
||||
check_previous_syntax(&self.leaf)
|
||||
.or_else(|| check_surrounding_syntax(&self.leaf))
|
||||
.unwrap_or(SurroundingSyntax::Regular)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue