mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 11:06:54 -04:00
fix(typst): indentation for block and branch
This commit is contained in:
parent
67d0fd3e0a
commit
0f5b204603
8 changed files with 81 additions and 1 deletions
|
|
@ -3,10 +3,12 @@
|
||||||
(let)
|
(let)
|
||||||
(show)
|
(show)
|
||||||
(call)
|
(call)
|
||||||
|
(for)
|
||||||
|
(branch)
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
[
|
[
|
||||||
"]"
|
"]"
|
||||||
"}"
|
"}"
|
||||||
")"
|
")"
|
||||||
] @indent.branch @indent.end
|
] @indent.end @indent.branch
|
||||||
|
|
|
||||||
14
tests/indent/typst/call.typ
Normal file
14
tests/indent/typst/call.typ
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#foo(
|
||||||
|
arg1,
|
||||||
|
arg2,
|
||||||
|
)
|
||||||
|
|
||||||
|
#bar[
|
||||||
|
content here
|
||||||
|
]
|
||||||
|
|
||||||
|
#baz(
|
||||||
|
inner(
|
||||||
|
nested,
|
||||||
|
),
|
||||||
|
)
|
||||||
8
tests/indent/typst/for.typ
Normal file
8
tests/indent/typst/for.typ
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#for x in (1, 2, 3) {
|
||||||
|
x
|
||||||
|
}
|
||||||
|
|
||||||
|
#for x in (1, 2, 3) {
|
||||||
|
let y = x + 1
|
||||||
|
y
|
||||||
|
}
|
||||||
15
tests/indent/typst/if.typ
Normal file
15
tests/indent/typst/if.typ
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#if true {
|
||||||
|
"this is one leve"
|
||||||
|
}
|
||||||
|
|
||||||
|
#set page(header: {
|
||||||
|
if true {
|
||||||
|
"this is internal on level"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
#if true {
|
||||||
|
if false {
|
||||||
|
"this is it"
|
||||||
|
}
|
||||||
|
}
|
||||||
13
tests/indent/typst/let.typ
Normal file
13
tests/indent/typst/let.typ
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#let foo(
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
) = x + y
|
||||||
|
|
||||||
|
#let bar = {
|
||||||
|
let x = 1
|
||||||
|
x
|
||||||
|
}
|
||||||
|
|
||||||
|
#let baz(x) = {
|
||||||
|
x + 1
|
||||||
|
}
|
||||||
9
tests/indent/typst/set.typ
Normal file
9
tests/indent/typst/set.typ
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
#set text(
|
||||||
|
size: 12pt,
|
||||||
|
font: "Arial",
|
||||||
|
)
|
||||||
|
|
||||||
|
#set page(
|
||||||
|
width: 210mm,
|
||||||
|
height: 297mm,
|
||||||
|
)
|
||||||
7
tests/indent/typst/show.typ
Normal file
7
tests/indent/typst/show.typ
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#show heading: it => {
|
||||||
|
it
|
||||||
|
}
|
||||||
|
|
||||||
|
#show link: it => {
|
||||||
|
underline(it)
|
||||||
|
}
|
||||||
12
tests/indent/typst_spec.lua
Normal file
12
tests/indent/typst_spec.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
local Runner = require('tests.indent.common').Runner
|
||||||
|
|
||||||
|
local run = Runner:new(it, 'tests/indent/typst', {
|
||||||
|
tabstop = 4,
|
||||||
|
shiftwidth = 4,
|
||||||
|
softtabstop = 4,
|
||||||
|
expandtab = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('indent typst:', function()
|
||||||
|
run:whole_file('.')
|
||||||
|
end)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue