Skip to content

Commit 694721b

Browse files
committed
fix incorrect indent fixing for for
fix #2799
1 parent f02a145 commit 694721b

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* `NEW` When using `enum["<key>" or <index>]`, undefined fields will raise an 'undefined' error.
77
* `FIX` Renaming files in the directory leads to the auto-correction in "require" adding extra characters.
88
* `FIX` Performance issue
9+
* `FIX` Fix incorrect indent fixing for `for`
910

1011
## 3.10.4
1112
`2024-8-16`

script/core/fix-indent.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ local function fixWrongIndent(uri, change)
105105
if not util.stringStartWith(myIndent, lastIndent) then
106106
return
107107
end
108-
local myBlock = getBlock(state, position)
109-
if myBlock.bstart >= lastOffset then
108+
local myBlock = getBlock(state, lastPosition)
109+
if myBlock.bstart >= lastPosition then
110110
return
111111
end
112112

script/parser/compile.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3664,7 +3664,7 @@ local function parseFor()
36643664
or doToken == 'then' then
36653665
local left = getPosition(Tokens[Index], 'left')
36663666
local right = getPosition(Tokens[Index] + #doToken - 1, 'right')
3667-
action.finish = left
3667+
action.finish = right
36683668
action.bstart = action.finish
36693669
action.keyword[#action.keyword+1] = left
36703670
action.keyword[#action.keyword+1] = right

0 commit comments

Comments
 (0)