diff options
Diffstat (limited to 'server/src/method/textDocument/codeAction.lua')
-rw-r--r-- | server/src/method/textDocument/codeAction.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/server/src/method/textDocument/codeAction.lua b/server/src/method/textDocument/codeAction.lua new file mode 100644 index 00000000..4c4e85a3 --- /dev/null +++ b/server/src/method/textDocument/codeAction.lua @@ -0,0 +1,32 @@ +return function (lsp, params) + log.debug(table.dump(params)) + local uri = params.textDocument.uri + local result = {} + + for _, data in ipairs(params.context.diagnostics) do + if data.code then + result[#result+1] = { + title = ('禁用诊断(%s)'):format(data.code), + kind = 'quickfix', + diagnostics = {data}, + command = { + title = '测试', + command = 'config', + arguments = { + key = {'diagnostics', 'disable'}, + action = 'add', + value = data.code, + } + } + } + end + end + + log.debug(table.dump(result)) + + if #result == 0 then + return nil + end + + return result +end |