【发布时间】:2019-07-08 12:22:54
【问题描述】:
所以我一直在开发我的第一个 vscode 扩展,一切都很顺利,直到调试器停止执行我的扩展。
我对 javascript 还很陌生,所以也许我在“thenables”上遗漏了一些东西,但这是我的问题。
我使用键盘快捷键运行我的扩展程序,例如。 "ctrl + alt + o" 运行良好,但是当我更改 "activeTextEditor" 时,我得到 "rejected promise nothanded in 1 seconds ”在我的调试控制台中。
可疑部分是这样的:
const checkOutHeader = (history) => {
console.log("Path: checkOutHeader");
activeTextEditor.edit((editor) => {
editor.replace(new vscode.Range(0,0,10,100), commentHeader(
populateCheckOutHeader(head.out, history).substring(1), languageId));
}).then((none)=>{
console.log("We are here!");
saveFile();
});
};
这是基于我的扩展在调试控制台中记录的路径:
CheckoutHeader: Now active!
Path: getHeaderConfig
lang: makefile
Path: supportHeaderLanguage
Path: checkInHandler
Path: getCurrentHeader
Path: getHistoryFileStatus
Path: getHeaderHistory
Path: getHistoryFileName
Path: getHistoryFileStatus
Path: getHistoryTimeIn
Path: getHistoryInBy
Path: getHistoryTimeOut
Path: getHistoryOutBy
Path: checkInHeader
rejected promise not handled within 1 second
我读到有人声称它是 c++tools,但我没有安装该扩展。
谢谢!
【问题讨论】:
-
你可能在
then(之后需要catch((e) =>。 -
哪个 promise 被拒绝了,错误信息是什么?
-
@jcbuic 我试过了,但似乎没有用。
-
@Bergi 我不知道它只说“拒绝承诺未在 1 秒内处理”
-
@Bergi,感谢您的建议,我花了一些时间寻找答案,发现很多人遇到此问题,随机出现此错误,许多人已经报告了它。感谢您尝试提供帮助。
标签: javascript api visual-studio-code vscode-extensions