diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-01-02 13:59:25 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-01-02 13:59:25 +0100 |
| commit | dcaf81f511c47ca8be9860e4237c1faae0fd3a89 (patch) | |
| tree | 7ffb6a7f68ba63092616105332e0f7f1db71f4ee /init.lua | |
| parent | e41ab2b985c03477025cb518dc8f7903f597e5d9 (diff) | |
| download | vis-lspc-dcaf81f511c47ca8be9860e4237c1faae0fd3a89.tar.gz vis-lspc-dcaf81f511c47ca8be9860e4237c1faae0fd3a89.zip | |
fix textDocumentSync.save ServerCapability check
The ServerCapability textDocumentSync is optional and may be of kind
TextDocumentSyncOptions | TextDocumentSyncKind;
If a server uses TextDocumentSyncKind which is a integer enum
our .save check fails.
Test if it is save to use textDocumentSync as table before checking the
save capability.
Fixes !35.
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1054,7 +1054,8 @@ local function lspc_open(ls, win, file) end) -- the server is interested in didSave notifications - if ls.capabilities.textDocumentSync.save then + if ls.capabilities.textDocumentSync and type(ls.capabilities.textDocumentSync) == + 'table' and ls.capabilities.textDocumentSync.save then vis.events.subscribe(vis.events.FILE_SAVE_POST, function(file, path) -- luacheck: ignore file for _, ls in pairs(lspc.running) do -- luacheck: ignore ls |
