Skip to content

Commit bc303ac

Browse files
committed
Disable indentation fixing for Non-VSCode
fix 2778
1 parent 8ecec08 commit bc303ac

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
## 3.10.1
77
* `FIX` Runtime error
8+
* `FIX` Disable indentation fixing for Non-VSCode
89

910
## 3.10.0
1011
`2024-8-1`

script/core/fix-indent.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ local guide = require 'parser.guide'
33
local proto = require 'proto.proto'
44
local lookBackward = require 'core.look-backward'
55
local util = require 'utility'
6+
local client = require 'client'
67

78
---@param state parser.state
89
---@param change table
@@ -114,7 +115,7 @@ local function isInBlock(state, position)
114115
return block ~= nil
115116
end
116117

117-
local function fixWrongIdent(state, change)
118+
local function fixWrongIndent(state, change)
118119
if not change.text:match '^\r?\n[\t ]+$' then
119120
return false
120121
end
@@ -189,6 +190,9 @@ local function applyEdits(state, edits)
189190
end
190191

191192
return function (uri, changes)
193+
if not client.getOption('fixIndents') then
194+
return
195+
end
192196
local state = files.compileState(uri)
193197
if not state then
194198
return
@@ -197,7 +201,7 @@ return function (uri, changes)
197201
local firstChange = changes[1]
198202
if firstChange.range then
199203
local edits = removeSpacesAfterEnter(state, firstChange)
200-
or fixWrongIdent(state, firstChange)
204+
or fixWrongIndent(state, firstChange)
201205
if edits then
202206
applyEdits(state, edits)
203207
end

0 commit comments

Comments
 (0)