summaryrefslogtreecommitdiff
path: root/script/proto
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-23 17:31:41 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-23 17:31:41 +0800
commit476be8f94aaea078fd29550ae768e46b58f7d4e2 (patch)
treee854f9ef78451aefd1973fffe0f5616161be562c /script/proto
parent79a72eb5ef235b8d8272e06855f9817e85a36c78 (diff)
downloadlua-language-server-476be8f94aaea078fd29550ae768e46b58f7d4e2.zip
clean up code
Diffstat (limited to 'script/proto')
-rw-r--r--script/proto/define.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/script/proto/define.lua b/script/proto/define.lua
index 966a5161..1cbb8de9 100644
--- a/script/proto/define.lua
+++ b/script/proto/define.lua
@@ -76,6 +76,13 @@ function m.range(lines, text, offset1, offset2)
return range
end
+--- convert `range` to `offsetStart` and `offsetFinish`
+function m.unrange(lines, text, range)
+ local start = m.offset(lines, text, range.start)
+ local finish = m.offset(lines, text, range['end'])
+ return start, finish
+end
+
---@alias location table
---@param uri string
---@param range range