diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-12-29 16:43:41 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-12-29 16:43:41 +0800 |
commit | 647a225f4b95d8fddc47d151261c52851b3eb9f2 (patch) | |
tree | 7a65b6fde66da6441d8a8419eeea72cf7d9908fe | |
parent | a3fa029fa38f107ef288d602f2939b1a95268c30 (diff) | |
download | lua-language-server-647a225f4b95d8fddc47d151261c52851b3eb9f2.zip |
fix #879
-rw-r--r-- | changelog.md | 3 | ||||
-rw-r--r-- | script/proto/proto.lua | 5 | ||||
-rw-r--r-- | script/provider/provider.lua | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/changelog.md b/changelog.md index 6f1d640b..73541ac0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # changelog +## 2.5.7 +* `FIX` [#879](https://github.com/sumneko/lua-language-server/issues/879) + ## 2.5.6 `2021-12-27` * `CHG` diagnostic: now syntax errors in `LuaDoc` are shown as `Warning` diff --git a/script/proto/proto.lua b/script/proto/proto.lua index e692c205..a73e462e 100644 --- a/script/proto/proto.lua +++ b/script/proto/proto.lua @@ -164,7 +164,7 @@ function m.doMethod(proto) if ok then m.response(proto.id, res) else - m.responseErr(proto.id, proto._closeReason or define.ErrorCodes.InternalError, res) + m.responseErr(proto.id, proto._closeReason or define.ErrorCodes.InternalError, proto._closeMessage or res) end end ok, res = xpcall(abil, log.error, proto.params) @@ -172,12 +172,13 @@ function m.doMethod(proto) end) end -function m.close(id, reason) +function m.close(id, reason, message) local proto = m.holdon[id] if not proto then return end proto._closeReason = reason + proto._closeMessage = message await.close('proto:' .. id) end diff --git a/script/provider/provider.lua b/script/provider/provider.lua index addfe320..df2a95f2 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -918,7 +918,7 @@ m.register 'textDocument/onTypeFormatting' { m.register '$/cancelRequest' { function (params) - proto.close(params.id, define.ErrorCodes.RequestCancelled) + proto.close(params.id, define.ErrorCodes.RequestCancelled, 'Request cancelled.') end } @@ -1021,7 +1021,7 @@ files.watch(function (ev, uri) for id, p in pairs(proto.holdon) do if m.attributes[p.method].abortByFileUpdate then log.debug('close proto(ContentModified):', id, p.method) - proto.close(id, define.ErrorCodes.ContentModified) + proto.close(id, define.ErrorCodes.ContentModified, 'Content modified.') end end end |