summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-01-10 20:41:30 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-01-10 20:41:30 +0800
commite112035b49171693d2c492e329eae2df23ad0c87 (patch)
tree3be82b760d539a3ef0adab21bca75e82aeaf0223 /script/parser
parent14760a600837ec760fd9874bcc1076db4cfeb7dc (diff)
downloadlua-language-server-e112035b49171693d2c492e329eae2df23ad0c87.zip
fix
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/guide.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 544f3eaa..9c7f057d 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -802,6 +802,17 @@ function m.offsetToPosition(state, offset)
return m.offsetToPositionByLines(state.lines, offset)
end
+function m.getLineRange(state, row)
+ local nextLineStart = state.lines[row + 1] or #state.lua
+ for i = nextLineStart - 1, state.lines[row], -1 do
+ local w = state.lua:sub(i, i)
+ if w ~= '\r' and w ~= '\n' then
+ return i - state.lines[row] + 1
+ end
+ end
+ return 0
+end
+
local isSetMap = {
['setglobal'] = true,
['local'] = true,