summaryrefslogtreecommitdiff
path: root/script/provider
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/provider
parent79a72eb5ef235b8d8272e06855f9817e85a36c78 (diff)
downloadlua-language-server-476be8f94aaea078fd29550ae768e46b58f7d4e2.zip
clean up code
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/provider.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 3508116f..71062933 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -549,7 +549,14 @@ proto.on('textDocument/codeAction', function (params)
local uri = params.textDocument.uri
local range = params.range
local diagnostics = params.context.diagnostics
- local results = core(uri, range, diagnostics)
+ local text = files.getText(uri)
+ local lines = files.getLines(uri)
+ if not text or not lines then
+ return nil
+ end
+
+ local start, finish = define.unrange(lines, text, range)
+ local results = core(uri, start, finish, diagnostics)
if not results or #results == 0 then
return nil