Adobe Brackets 和运行 Ruby/Python 程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28325291/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adobe Brackets and running Ruby/Python programs
提问by eox.dev
so I have been trying out various text editors and IDE's recently to see what I like. I really like the web developer side of Brackets, which is what I think it was designed for, but was also messing around with some of the extensions for building and running Python/Ruby programs.
所以我最近一直在尝试各种文本编辑器和 IDE,看看我喜欢什么。我真的很喜欢 Brackets 的 Web 开发人员方面,这就是我认为它的设计目的,但也搞砸了一些用于构建和运行 Python/Ruby 程序的扩展。
I have tried this, which honestly doesn't seem to do anything from what I can tell: https://github.com/vhornets/brackets-builder
我已经尝试过这个,老实说,从我能说的情况来看,它似乎没有做任何事情:https: //github.com/vhornets/brackets-builder
And this, which adds a run button to Brackets for running the program: https://github.com/jadbox/brackets-integrated-development
这个,它为 Brackets 添加了一个运行按钮来运行程序:https: //github.com/jadbox/brackets-integrated-development
The latter seems to work alright... until you make a small program that asks for user input then the program never runs, the program disappears, and then you have to restart Brackets to get it back. The code I have used is the following:
后者似乎工作正常......直到你制作一个要求用户输入的小程序,然后程序永远不会运行,程序消失,然后你必须重新启动 Brackets 才能恢复它。我使用的代码如下:
puts"Please enter your name: "
n = gets. chomp
Or
或者
n = input("Please enter your name: ")
Any idea what might be causing this? I asked the developer, but haven't heard back. I'd probably use Brackets exclusively if it wasn't for that issue.
知道是什么原因造成的吗?我问了开发商,但没有回音。如果不是因为那个问题,我可能会专门使用 Brackets。
Tried Sublime Text 3 for a little while, but didn't like the lack of a Brackets like live preview plugin. However, it looks like it runs Python/Ruby (in addition to Java and C/C++) code without issue.
尝试了 Sublime Text 3 一段时间,但不喜欢缺少像实时预览插件这样的 Brackets。但是,它看起来运行 Python/Ruby(除了 Java 和 C/C++)代码没有问题。
采纳答案by peterflynn
You might want to try a generic extension for running command line tools, such as one of these:
您可能想尝试使用通用扩展来运行命令行工具,例如以下之一:
- Command Line Shortcuts
- Brackets Build System
- Command Runner
- Brackets Shell access
- Brackets Terminal
- The Brackets Builderyou mentioned above - looks like you choose Edit > Edit Builderto configure the commands you want, and then you can press Ctrl-Alt-B to run them.
回答by Thom Ives
Brackets Builderhas worked best for me "right out of the box". However, I run into the same problem as you (when wanting to perform console inputs) in both Brackets AND Sublime, but NOT in SciTE.
Brackets Builder“开箱即用”对我来说效果最好。但是,我在 Brackets 和 Sublime 中遇到了与您相同的问题(当想要执行控制台输入时),但在SciTE 中没有。
A good clean work around inside Brackets, for when you need to test programs with console inputs, is to load the extension "Open project in terminal", which will allow you to open a terminal right from your current project folder and run your python script. This allowed me to run your case from Brackets with very little hassle, and of course, it works great in a real terminal.
当您需要使用控制台输入测试程序时,在 Brackets 内部进行的一个很好的清理工作是加载扩展“在终端中打开项目”,这将允许您直接从当前项目文件夹中打开终端并运行您的 python 脚本. 这使我可以轻松地从 Brackets 运行您的案例,当然,它在真正的终端中运行良好。
To make this approach even easier, I've asked the developers on GitHub, thru a raised issue, if they can add support for more terminal programs in Windows, such as ConEmu, and if they could allow intial command line arguments to be loaded, which would make this type of work that you want to do even more seamless and fast. I'll update my post once I see any improvements or alternatives to all the above points.
为了使这种方法更容易,我已经通过一个提出的问题询问了 GitHub 上的开发人员,他们是否可以在 Windows 中添加对更多终端程序的支持,例如 ConEmu,以及他们是否可以允许加载初始命令行参数,这将使您想要完成的此类工作更加无缝和快速。一旦我看到上述所有要点的任何改进或替代方案,我将更新我的帖子。