fix(typst): indentation for block and branch

This commit is contained in:
Ilya Ilyinykh
2026-02-25 20:35:46 +03:00
committed by GitHub
parent 67d0fd3e0a
commit 0f5b204603
8 changed files with 81 additions and 1 deletions

View File

@@ -3,10 +3,12 @@
(let)
(show)
(call)
(for)
(branch)
] @indent.begin
[
"]"
"}"
")"
] @indent.branch @indent.end
] @indent.end @indent.branch

View File

@@ -0,0 +1,14 @@
#foo(
arg1,
arg2,
)
#bar[
content here
]
#baz(
inner(
nested,
),
)

View 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
View 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"
}
}

View File

@@ -0,0 +1,13 @@
#let foo(
x,
y,
) = x + y
#let bar = {
let x = 1
x
}
#let baz(x) = {
x + 1
}

View File

@@ -0,0 +1,9 @@
#set text(
size: 12pt,
font: "Arial",
)
#set page(
width: 210mm,
height: 297mm,
)

View File

@@ -0,0 +1,7 @@
#show heading: it => {
it
}
#show link: it => {
underline(it)
}

View 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)