summaryrefslogtreecommitdiff
path: root/meta/3rd/example/plugin.lua
blob: 0ece12f5e9ea9c9954e69c6e3fa99c8960b6f5ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-- if this file exists, then change setting `Lua.runtime.plugin`
-- see https://github.com/LuaLS/lua-language-server/wiki/Plugins

function OnSetText(uri, text)
    local diffs = {}

    for start, finish in text:gmatch '()pairs()' do
        diffs[#diffs+1] = {
            start  = start,
            finish = finish - 1,
            text   = 'safepairs'
        }
    end

    return diffs
end