Skip to content

Commit 83289ba

Browse files
committed
Fix line number font size in code block
1 parent 3d0c043 commit 83289ba

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

Core/Sources/SuggestionWidget/SuggestionPanelContent/CodeBlock.swift

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ struct CodeBlock: View {
4242
@ViewBuilder
4343
func vstack(@ViewBuilder content: () -> some View) -> some View {
4444
if disableLazyVStack {
45-
VStack(spacing: 4) {
45+
VStack(spacing: 2) {
4646
content()
4747
}
4848
} else {
49-
LazyVStack(spacing: 4) {
49+
LazyVStack(spacing: 2) {
5050
content()
5151
}
5252
}
@@ -78,7 +78,7 @@ struct CodeBlock: View {
7878
}
7979
}
8080
.foregroundColor(.white)
81-
.font(.system(size: 12, design: .monospaced))
81+
.font(.system(size: fontSize, design: .monospaced))
8282
.padding(.leading, 4)
8383
.padding([.trailing, .top, .bottom])
8484
}
@@ -99,3 +99,22 @@ struct CodeBlock: View {
9999
)
100100
}
101101
}
102+
103+
// MARK: - Preview
104+
105+
struct CodeBlock_Previews: PreviewProvider {
106+
static var previews: some View {
107+
CodeBlock(
108+
code: """
109+
let foo = Foo()
110+
let bar = Bar()
111+
""",
112+
language: "swift",
113+
startLineIndex: 0,
114+
colorScheme: .dark,
115+
firstLinePrecedingSpaceCount: 0,
116+
fontSize: 12
117+
)
118+
}
119+
}
120+

0 commit comments

Comments
 (0)