summaryrefslogtreecommitdiff
path: root/script/parser/guide.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-09-17 16:45:17 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-09-17 16:45:17 +0800
commitbb5709481e7378901e8687beb7caac7521d48122 (patch)
tree867598faed29a7184c61fcfd7c4c006cd120b1d6 /script/parser/guide.lua
parentb944681c831b47c93b5b1f9a398f26ad3ca03c21 (diff)
downloadlua-language-server-bb5709481e7378901e8687beb7caac7521d48122.zip
cleanup
Diffstat (limited to 'script/parser/guide.lua')
-rw-r--r--script/parser/guide.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index be1305a3..4915f206 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -757,6 +757,15 @@ function m.positionOf(row, col)
return row * 10000 + col
end
+--- 返回全文光标位置
+---@param state any
+---@param position integer
+function m.offsetOf(state, position)
+ local lines = state.lines
+ local row, col = m.rowColOf(position)
+ return (lines[row] or 1) + col - 1
+end
+
function m.lineContent(lines, text, row, ignoreNL)
local line = lines[row]
if not line then