简体   繁体   English

在Eclipse中为javascript“定义”工作吗?

[英]Does “go to definition” work in Eclipse for javascript?

Working with Eclipse for Javascript, Ctrl-click seems to work on some objects but will not take me outside of the current javascript file. 使用Eclipse进行Javascript,Ctrl-click似乎可以处理某些对象但不会将我带到当前的javascript文件之外。 Is there any way to get this "go to definition" to work more fully? 有没有办法让这个“去定义”更全面地工作? I use Eclipse for Java and depend on this functionality, would like to see it work better in Javascript as I'm just trying to learn Javascript. 我使用Eclipse for Java并依赖于这个功能,希望看到它在Javascript中工作得更好,因为我只是想学习Javascript。

I think it probably doesn't work because of the many ways in JavaScript to define something.. 我认为它可能不起作用,因为JavaScript中有许多方法来定义某些内容。

  • function foo() {}
  • var foo = function() {};
  • window.foo = function() {};
  • window['foo'] = function() {};
  • var z = 'foobar'; window[z.substr(0, 3)] = function() {};

Especially the last one would be - even though it's unlikely to be ever used in real code - pretty much impossible to be detected by an IDE without executing the whole code and then tracking where a global is defined for the first time. 特别是最后一个 - 即使它不可能在实际代码中使用 - 在没有执行整个代码然后跟踪第一次定义全局的位置时,IDE几乎不可能检测到它。

Another example would be with libraries implementing a class system. 另一个例子是库实现类系统。 Without knowing the details of every library it's pretty hard to find out what class names they define. 在不知道每个库的细节的情况下,很难找出它们定义的类名。

Intellij Idea support that functionality. Intellij Idea支持该功能。 I was looking to see if Eclipse has a plugin and came across your post, I use to work with Intellij Idea and I have that functionality that is very helpful so to the user that is saying that is impossible for a IDEA please take a look in Intellij Idea you will be surprise of all the functionality that you can find. 我想看看Eclipse是否有插件并且发现了你的帖子,我使用Intellij Idea并且我有这个非常有用的功能,所以对于那个说IDA不可能的用户请看一下Intellij Idea您会对所有可以找到的功能感到惊讶。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM