【发布时间】:2014-08-30 05:22:19
【问题描述】:
所以,我发现函数中 return 语句之后声明的变量不会出现在 VS2013 intellisense 中。
一个例子:
function getService(){
var service = {
getNames: getNames
};
return service; //<--intellisense not working on variables declared
// below this line
function getNames(){
var test = {
first: '',
second: ''
};
test. //<-- here intellisense does not show
// either the test variable or the first or
// second properites of the object.
}
}
有没有办法解决这个问题?
还是我只需要重新排列代码并将 return 语句放在最后?
【问题讨论】:
-
好吧,
return语句之后的代码没有多大意义。所以是的,重新安排似乎是这里的路 -
@GôTô 在这种情况下,return 之后的代码确实有意义;
getNames在getService中仍然可用。所以我可能会提交一个错误报告并将返回放在函数的末尾。 -
@jgillich 把这个函数放在
return语句之后有什么意义?有什么好处? -
你的例子适合我
-
对我来说,智能感知一直有点不稳定。但请记住,您始终可以使用 ctrl-space 手动触发它。
标签: javascript visual-studio-2013 intellisense javascript-intellisense