为什么Intellisense在Visual Studio 2015中继承承诺不起作用?
它在方法中运行良好,在"尝试"承诺的一部分,承诺的捕获块,但它在"然后"延续。我希望它能看到封闭范围内的变量。见下面的评论。
// Initialize View Models
var vm = {
boards: ko.observableArray([]),
cards: [],
currentBoard: null,
selectBoard: selectBoard
};
function updateDataToService() {
// Intellisense works here (e.g., vm.xxx )
Excel.run(function (ctx) {
var names = ctx.workbook.names;
var range = names.getItem('MyRange').getRange();
range.load('address');
// Intellisense works here (e.g., range.xxx, vm.xxx )
return ctx.sync().then(function() {
// Intellisense DOES NOT WORK HERE
// (e.g., range.xxx, ctx.xxx, vm.xxx)
// ALL DO NOT WORK
console.log(range.address);
});
}).catch(function(error) {
// Intellisense works here (e.g., error.xxx, vm.xxx)
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
}