diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-09-22 11:30:39 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-09-22 11:30:39 +0800 |
commit | a847377582e5f22244aa587f9d79a07f9db03780 (patch) | |
tree | 2462bdbd70b7c1a303f3fb7159e032079d553051 /script/core | |
parent | 621ee2b3e79dd452ddb3b96cf63a2bc2792b9254 (diff) | |
download | lua-language-server-a847377582e5f22244aa587f9d79a07f9db03780.zip |
update
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/keyword.lua | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/script/core/keyword.lua b/script/core/keyword.lua index b0c75f7e..295026d7 100644 --- a/script/core/keyword.lua +++ b/script/core/keyword.lua @@ -271,15 +271,16 @@ until $1" return false end}, {'then', function (info, results) - local lines = files.getLines(info.uri) - local pos, first = info.text:match('%S+%s+()(%S+)', info.start) + local startOffset = guide.positionToOffset(info.state, info.start) + local pos, first = info.text:match('%S+%s+()(%S+)', startOffset + 1) if first == 'end' or first == 'else' or first == 'elseif' then - local startRow = guide.rowColOf(info.start) - local finishRow = guide.rowColOf(pos) - local startSp = info.text:match('^%s*', lines[startRow].start + 1) - local finishSp = info.text:match('^%s*', lines[finishRow].start + 1) + local startRow = guide.rowColOf(info.start) + local finishPosition = guide.offsetToPosition(info.state, pos) + local finishRow = guide.rowColOf(finishPosition) + local startSp = info.text:match('^%s*', info.state.lines[startRow]) + local finishSp = info.text:match('^%s*', info.state.lines[finishRow]) if startSp == finishSp then return false end |