Skip to content

Commit 645295a

Browse files
fix(editor): use configured tab size for block indentation (#678)
1 parent 60d99d2 commit 645295a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/renderer/components/editor/Editor.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ async function init() {
129129
lineWrapping: settings.wrap,
130130
lineNumbers: true,
131131
tabSize: settings.tabSize,
132+
indentUnit: settings.tabSize,
133+
indentWithTabs: true,
132134
autoCloseBrackets: true,
133135
matchBrackets: settings.matchBrackets,
134136
styleActiveLine: settings.highlightLine,
@@ -252,6 +254,16 @@ async function init() {
252254
},
253255
)
254256
257+
watch(
258+
() => settings.tabSize,
259+
(tabSize) => {
260+
const normalizedTabSize = Math.max(1, Number(tabSize) || 1)
261+
262+
editor?.setOption('tabSize', normalizedTabSize)
263+
editor?.setOption('indentUnit', normalizedTabSize)
264+
},
265+
)
266+
255267
watch(searchQuery, () => {
256268
nextTick(() => {
257269
updateSearchOverlay()

0 commit comments

Comments
 (0)