diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-23 17:31:41 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-23 17:31:41 +0800 |
commit | 476be8f94aaea078fd29550ae768e46b58f7d4e2 (patch) | |
tree | e854f9ef78451aefd1973fffe0f5616161be562c /script/provider | |
parent | 79a72eb5ef235b8d8272e06855f9817e85a36c78 (diff) | |
download | lua-language-server-476be8f94aaea078fd29550ae768e46b58f7d4e2.zip |
clean up code
Diffstat (limited to 'script/provider')
-rw-r--r-- | script/provider/provider.lua | 9 |
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 |