diff options
author | Arcanox <arcanox@arcanox.me> | 2021-09-26 15:04:14 -0500 |
---|---|---|
committer | Arcanox <arcanox@arcanox.me> | 2021-09-26 15:04:14 -0500 |
commit | 55e30e88ba33a28acc53265b249860b0bbc06fba (patch) | |
tree | 891cd2ff893e875696bc0eed6ed798f01002a91c /script | |
parent | a963b2958eed7388a72d3b14b563b602dd419914 (diff) | |
download | lua-language-server-55e30e88ba33a28acc53265b249860b0bbc06fba.zip |
Revert changes related to canceled requests
Diffstat (limited to 'script')
-rw-r--r-- | script/proto/define.lua | 1 | ||||
-rw-r--r-- | script/proto/proto.lua | 21 | ||||
-rw-r--r-- | script/provider/provider.lua | 12 |
3 files changed, 9 insertions, 25 deletions
diff --git a/script/proto/define.lua b/script/proto/define.lua index 22e4cb04..731c5cc6 100644 --- a/script/proto/define.lua +++ b/script/proto/define.lua @@ -174,7 +174,6 @@ m.ErrorCodes = { -- Defined by the protocol. RequestCancelled = -32800, - ContentModified = -32801, } m.SymbolKind = { diff --git a/script/proto/proto.lua b/script/proto/proto.lua index 29b632fd..61306b9f 100644 --- a/script/proto/proto.lua +++ b/script/proto/proto.lua @@ -10,10 +10,9 @@ local reqCounter = util.counter() local m = {} -m.ability = {} -m.waiting = {} -m.holdon = {} -m.closeReasons = {} +m.ability = {} +m.waiting = {} +m.holdon = {} function m.getMethodName(proto) if proto.method:sub(1, 2) == '$/' then @@ -27,10 +26,6 @@ function m.on(method, callback) m.ability[method] = callback end -function m.close(id, reason) - m.closeReasons[id] = reason -end - function m.response(id, res) if id == nil then log.error('Response id is nil!', util.dump(res)) @@ -143,18 +138,12 @@ function m.doMethod(proto) end await.close('proto:' .. proto.id) if ok then - if m.closeReasons[proto.id] then - -- return an error with the reason it was cancelled - m.responseErr(proto.id, m.closeReasons[proto.id], res) - m.closeReasons[proto.id] = nil - else - m.response(proto.id, res) - end + m.response(proto.id, res) else m.responseErr(proto.id, define.ErrorCodes.InternalError, res) end end - ok, res = xpcall(abil, log.error, proto.params, proto.id) + ok, res = xpcall(abil, log.error, proto.params) end) end diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 632dae6f..6373fe7e 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -680,13 +680,11 @@ proto.on('workspace/symbol', function (params) end) -proto.on('textDocument/semanticTokens/full', function (params, id) +proto.on('textDocument/semanticTokens/full', function (params) local uri = params.textDocument.uri await.close('textDocument/semanticTokens/full') await.setID('textDocument/semanticTokens/full') - await.setID('update:' .. uri, function() - proto.close(id, define.ErrorCodes.ContentModified) - end) + await.setID('update:' .. uri) workspace.awaitReady() local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_SEMANTIC_FULL, 0.5) local core = require 'core.semantic-tokens' @@ -696,13 +694,11 @@ proto.on('textDocument/semanticTokens/full', function (params, id) } end) -proto.on('textDocument/semanticTokens/range', function (params, id) +proto.on('textDocument/semanticTokens/range', function (params) local uri = params.textDocument.uri await.close('textDocument/semanticTokens/range') await.setID('textDocument/semanticTokens/range') - await.setID('update:' .. uri, function() - proto.close(id, define.ErrorCodes.ContentModified) - end) + await.setID('update:' .. uri) workspace.awaitReady() local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_SEMANTIC_RANGE, 0.5) local core = require 'core.semantic-tokens' |