简体   繁体   English

Intellij IDEA,在编辑器中运行Javascript代码

[英]Intellij IDEA, run Javascript code right in the editor

After having written large amounts of code in Intellij Idea Ultimate edition, I often want to test a method, or big pieces. 在Intellij Idea Ultimate版本中编写了大量代码之后,我经常想要测试一个方法或大块。

I often resort to having to paste the code in firebug in firefox, a small annoying cramping space, with no editor features. 我常常不得不将代码粘贴到firefox中的firebug中,这是一个烦人的小烦恼空间,没有编辑器功能。 If the code needs adjusting I need to do it there, test again, copy and insert into Intellij Idea. 如果代码需要调整,我需要在那里进行,再次测试,复制并插入到Intellij Idea中。

Is it possible to run firebug like console code, right in Intellij ? 在Intellij中是否可以像控制台代码一样运行firebug? Similar to in Java debug mode with the Inspect tool ? 与使用Inspect工具的Java调试模式类似? It would have been really useful, even more useful just to highlight some code and press run. 它本来是非常有用的,只是为了突出显示一些代码和按下运行更有用。

Browser support is not important, any browser will do. 浏览器支持并不重要,任何浏览器都可以。

Is this possible already? 这可能吗? Is there an Intellij plugin for this? 这是一个Intellij插件吗? Why not? 为什么不? :( :(

Thanks! 谢谢!

Just stumbled over this. 只是偶然发现了这一点。 A bit late but anyway: Debugging Javascript, editing values, etc. works fine using intelliJ with its Chrome Plugin. 有点迟了但是无论如何:调试Javascript,编辑值等等使用intelJ及其Chrome插件工作正常。 See https://www.jetbrains.com/idea/webhelp/configuring-javascript-debugger.html or http://blog.jetbrains.com/idea/2011/03/intellij-idea-debugging-javascript-in-google-chrome/ You can set breakpoints to stop where you want and can from there evaluate expressions and all the other stuff you would like to do. 请参阅https://www.jetbrains.com/idea/webhelp/configuring-javascript-debugger.htmlhttp://blog.jetbrains.com/idea/2011/03/intellij-idea-debugging-javascript-in-google -chrome /您可以设置断点以停在您想要的位置,并可以从那里评估表达式以及您想要做的所有其他事情。 Hope this is what you wanted to know. 希望这是你想知道的。

If the browser is not important, you could use the node.js plugin as a javascript repl / debugger. 如果浏览器不重要,您可以使用node.js插件作为javascript repl / debugger。 Keep in mind that it will not provide an HTML DOM so if your code makes jQuery calls, it will not run out of the box. 请记住,它不会提供HTML DOM,因此如果您的代码进行jQuery调用,它将无法开箱即用。 Otherwise, if it's just plain javascript, it will run just fine. 否则,如果它只是简单的javascript,它将运行正常。

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

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