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

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