0

因此,我发现函数中 return 语句之后声明的变量不会出现在 VS2013 智能感知中。

一个例子:

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 语句放在最后?

4

1 回答 1

0

你的例子对我来说很好。

尝试确保您启用了智能感知并且没有冲突的插件。

在此处输入图像描述

于 2014-07-09T12:20:47.170 回答