diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-03-11 21:05:02 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-03-11 21:05:02 +0800 |
commit | 228613899d6d0562c1cd639e69c796fa65c2636d (patch) | |
tree | 9476134d1d89cdb038cfa07aac3e16a6228caa92 /script/provider/provider.lua | |
parent | 6b7a952d6537f389a85df7928ded74ca9c81eee0 (diff) | |
download | lua-language-server-228613899d6d0562c1cd639e69c796fa65c2636d.zip |
stash
Diffstat (limited to 'script/provider/provider.lua')
-rw-r--r-- | script/provider/provider.lua | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 917f66cc..bfd51416 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -17,6 +17,7 @@ local fs = require 'bee.filesystem' local lang = require 'language' local plugin = require 'plugin' local progress = require 'progress' +local tm = require 'text-merger' local function updateConfig() local diagnostics = require 'provider.diagnostic' @@ -270,18 +271,8 @@ proto.on('textDocument/didChange', function (params) if not files.isLua(uri) and not files.isOpen(uri) then return end - files.clearDiff(uri) - local text = files.getText(uri) or '' - for _, change in ipairs(changes) do - if change.range then - local start, finish = files.unrange(uri, change.range) - text = text:sub(1, start - 1) .. change.text .. text:sub(finish) - else - text = change.text - end - files.setRawText(uri, text) - end - files.setRawText(uri, '') + log.debug('changes', util.dump(changes)) + local text = tm(uri, changes) files.setText(uri, text, true) end) |