summaryrefslogtreecommitdiff
path: root/script/method/textDocument/codeAction.lua
blob: 80a40a0cb5f0cd3bdbf0630b1658a1a5f0559a31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
local core = require 'core'

--- @param lsp LSP
--- @param params table
--- @return table
return function (lsp, params)
    local uri = params.textDocument.uri
    local vm, lines = lsp:getVM(uri)
    if not vm then
        return
    end
    local diagnostics = params.context.diagnostics
    local range = params.range

    local results = core.codeAction(lsp
        , uri
        , diagnostics
        , range
    )

    if #results == 0 then
        return nil
    end

    return results
end