summaryrefslogtreecommitdiff
path: root/server/src/method/textDocument/didChange.lua
blob: b2cad74d29604215b42c37f9dc9ca6bc58863931 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
return function (lsp, params)
    local doc = params.textDocument
    local change = params.contentChanges
    if lsp.workspace then
        local path = lsp.workspace:relativePathByUri(doc.uri)
        if not lsp.workspace:isLuaFile(path) then
            return
        end
        if not lsp:isOpen(doc.uri) and lsp.workspace.gitignore(path:string()) then
            return
        end
    end
    -- TODO 支持差量更新
    lsp:saveText(doc.uri, doc.version, change[1].text)
    return true
end