diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-08-29 18:40:50 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-08-29 18:45:11 +0200 |
| commit | bd27a71ec294b5d388bc2c233d397a76c3f21cf2 (patch) | |
| tree | d94e486f1dbcf4b31321169b1814490f97736e04 /init.lua | |
| parent | b1db5ae2a8aeeb72dca127e62d5cbf5b3c7caced (diff) | |
| download | vis-lspc-bd27a71ec294b5d388bc2c233d397a76c3f21cf2.tar.gz vis-lspc-bd27a71ec294b5d388bc2c233d397a76c3f21cf2.zip | |
try to convert workspaceEdit.documentChanges to plain changes
We do not support workspaceEdit.documentChanges but some LSP servers
do not respect our capabilities and send them anyways.
Try to optimistically convert simple documentChanges to plain changes.
We only support simple TextDocumentEdit[].
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -499,7 +499,18 @@ end -- apply a WorkspaceEdit received from the language server local function vis_apply_workspaceEdit(_, _, workspaceEdit) local file_edits = workspaceEdit.changes - assert(file_edits) + assert(file_edits or workspaceEdit.documentChanges) + + -- try to convert NOT SUPPORTED TextDocumentEdit[] + -- We do not announce suppport for versioned DocumentChanges in our + -- client capabilities, but some LSP servers ignore our capabilities + -- sending them anyway. + if not file_edits then + file_edits = {} + for _, edit in ipairs(workspaceEdit.documentChanges) do + file_edits[edit.textDocument.uri] = edit.edits + end + end -- generate change summary local summary = '--- workspace edit summary ---\n' |
