mirror of
https://github.com/kevinhwang91/nvim-ufo
synced 2024-09-16 14:14:02 +02:00
fix(promise): handle rejection elegantly
This commit is contained in:
parent
f0ae3c77d9
commit
c01e3d81ef
4 changed files with 4 additions and 4 deletions
|
@ -21,7 +21,7 @@ exports.activate = async context => {
|
||||||
if (!languages.hasProvider('foldingRange', textDocument)) {
|
if (!languages.hasProvider('foldingRange', textDocument)) {
|
||||||
await wait(500)
|
await wait(500)
|
||||||
if (!languages.hasProvider('foldingRange', textDocument)) {
|
if (!languages.hasProvider('foldingRange', textDocument)) {
|
||||||
throw new Error('UfoFallbackException')
|
throw 'UfoFallbackException'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await doc.synchronize()
|
await doc.synchronize()
|
||||||
|
|
|
@ -110,7 +110,7 @@ function Fold.update(bufnr)
|
||||||
if not dispose(false) then
|
if not dispose(false) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
error(err)
|
promise.reject(err)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ function Provider:requestFoldingRange(providers, bufnr)
|
||||||
return {main, nil}
|
return {main, nil}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
error(reason)
|
return promise.reject(reason)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
if log.isEnabled('debug') then
|
if log.isEnabled('debug') then
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"main": "coc-extension/index.js",
|
"main": "coc-extension/index.js",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"engines": {
|
"engines": {
|
||||||
"coc": "^0.0.81"
|
"coc": "^0.0.82"
|
||||||
},
|
},
|
||||||
"activationEvents": [
|
"activationEvents": [
|
||||||
"*"
|
"*"
|
||||||
|
|
Loading…
Reference in a new issue