Add full text_edit implementation.

- Implements textDocument/formatting, textDocument/rangeFormatting,
workspace/applyEdit.
TODO:
- still has edge cases around replacement probably. Only tested with
inserts on the same position.
This commit is contained in:
Ashkan Kiani
2019-11-20 20:51:44 -08:00
parent b984f613c1
commit 6fc409d593
3 changed files with 228 additions and 37 deletions

View File

@@ -10,6 +10,15 @@ local function err_message(...)
api.nvim_command("redraw")
end
M['workspace/applyEdit'] = function(_, _, workspace_edit)
if not workspace_edit then return end
-- TODO(ashkan) Do something more with label?
if workspace_edit.label then
print("Workspace edit", workspace_edit.label)
end
util.apply_workspace_edit(workspace_edit.edit)
end
M['textDocument/publishDiagnostics'] = function(_, _, result)
if not result then return end
local uri = result.uri