summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-09-23 20:51:25 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-09-23 20:51:25 +0800
commit291a7b3a7fcaee5bc761722ca46265f3cd7f70f3 (patch)
tree58565b28f24d9ea536d1cffbc5dbf77f194af2b9 /script/core
parent7ddc57e0f0a8b32d7d8bfa9228e856d897fc8de9 (diff)
downloadlua-language-server-291a7b3a7fcaee5bc761722ca46265f3cd7f70f3.zip
fix
Diffstat (limited to 'script/core')
-rw-r--r--script/core/code-action.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/script/core/code-action.lua b/script/core/code-action.lua
index ff141bbf..8256107e 100644
--- a/script/core/code-action.lua
+++ b/script/core/code-action.lua
@@ -6,10 +6,13 @@ local guide = require "parser.guide"
local converter = require 'proto.converter'
local function checkDisableByLuaDocExits(uri, row, mode, code)
+ if row < 0 then
+ return nil
+ end
local state = files.getState(uri)
local lines = state.lines
if state.ast.docs and lines then
- guide.eachSourceBetween(state.ast.docs, guide.positionOf(row, 0), guide.positionOf(row + 1, 0), function (doc)
+ return guide.eachSourceBetween(state.ast.docs, guide.positionOf(row, 0), guide.positionOf(row + 1, 0), function (doc)
if doc.type == 'doc.diagnostic'
and doc.mode == mode then
if doc.names then
@@ -73,8 +76,8 @@ local function disableDiagnostic(uri, code, start, results)
checkDisableByLuaDocExits (uri, row - 1, 'disable-next-line', code)
or checkDisableByLuaDocInsert(uri, row, 'disable-next-line', code))
pushEdit(lang.script('ACTION_DISABLE_DIAG_FILE', code),
- checkDisableByLuaDocExits (uri, 1, 'disable', code)
- or checkDisableByLuaDocInsert(uri, 1, 'disable', code))
+ checkDisableByLuaDocExits (uri, 0, 'disable', code)
+ or checkDisableByLuaDocInsert(uri, 0, 'disable', code))
end
local function markGlobal(uri, name, results)