@@ -3,6 +3,7 @@ local guide = require 'parser.guide'
33local proto = require ' proto.proto'
44local lookBackward = require ' core.look-backward'
55local 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
115116end
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)
189190end
190191
191192return 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