visual-studio 有没有人找到适用于 Visual Studio 的 PowerShell 语法突出显示或 IntelliSense 插件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/271292/
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
Anyone found a PowerShell Syntax highlighting or IntelliSense plugin for Visual Studio?
提问by Brian Adams
Has anyone found a plugin for Visual Studio to allow for PowerShell syntax highlighting or IntelliSense? If not, does anyone have any idea why not? I keep hoping someone else with copious free time would have tackled this by now. I have hope since other folks have managed to take the limited documentation and build custom IntelliSense providers for other languages such as NHaml.
有没有人找到 Visual Studio 的插件来允许 PowerShell 语法突出显示或 IntelliSense?如果没有,有没有人知道为什么不呢?我一直希望其他有大量空闲时间的人现在可以解决这个问题。我有希望,因为其他人已经设法利用有限的文档并为其他语言(如NHaml)构建自定义 IntelliSense 提供程序。
Edit: To clarify,I'm not looking for a list of IDEs that can be used to develop PowerShell . I spend 90% of my day in Visual Studio. It already does a really good job of slicing and dicing code. That is the IDE I prefer to use to edit all text and code. The lack of PowerShell syntax highlighting now that I work with PowerShell scripts is down right painful.
编辑:澄清一下,我不是在寻找可用于开发 PowerShell 的 IDE 列表。我一天中 90% 的时间都在 Visual Studio 中度过。它已经在切片和切割代码方面做得非常好。这是我更喜欢用来编辑所有文本和代码的 IDE。现在我使用 PowerShell 脚本,缺乏 PowerShell 语法高亮显示是非常痛苦的。
采纳答案by Justin R.
Here's a useful one: PowerGUI VS Extension.
这是一个有用的:PowerGUI VS Extension。
回答by Steffen Opel
Update 2013-08-20
更新 2013-08-20
Adam Driscoll has recently announced the PowerShell Tools for Visual Studioas successor of his former PowerGUI Visual Studio Extension- see his blog post about The Future of PowerGUI VSXfor details, where he acknowledges the drawbacks of the predecessor outlined by Simon Gillbee (see previous update below) and describes how they will be addressed by removing the dependency on PowerGUI:
Adam Driscoll 最近宣布了用于 Visual Studio的PowerShell 工具作为他以前的PowerGUI Visual Studio 扩展的继任者- 有关详细信息,请参阅他关于PowerGUI VSX 的未来的博客文章,他承认了 Simon Gillbee 概述的前任的缺点(请参阅先前的更新下面)并描述了如何通过删除对 PowerGUI 的依赖来解决这些问题:
[...] By embedding the PowerGUI editor directly in Visual Studioit caused a multitude of problems because it really wasn't a true language integration but more like a hack.
[...] PowerGUI VSX v2 will offer true Visual Studio language support for PowerShell. It uses the Visual Studio editor and the raw PowerShell debugger, tokenizer and completion engine.Currently, the requirement is PowerShell v3 and Visual Studio 2012. This requirement may change depending on community support and adoption. [emphasis mine]
[...] 通过将 PowerGUI 编辑器直接嵌入到 Visual Studio 中,它导致了许多问题,因为它确实不是真正的语言集成,而更像是一个 hack。
[...] PowerGUI VSX v2 将为 PowerShell 提供真正的 Visual Studio 语言支持。它使用 Visual Studio 编辑器和原始 PowerShell 调试器、标记器和完成引擎。目前,要求是 PowerShell v3 和 Visual Studio 2012。此要求可能会根据社区支持和采用情况而变化。[强调我的]
Update 2013-07-31
更新 2013-07-31
Simon Gillbee has just referenced/promoteda PowerShell syntax highlighting alternative, that doesn't expose the drawbacks of the PowerGUI Visual Studio Extensionhe previously summarized:
Simon Gillbee 刚刚引用/推广了一个 PowerShell 语法高亮替代方案,它没有暴露他之前总结的PowerGUI Visual Studio 扩展的缺点:
- TextHighlighterExtension2012(Visual Studio 2012)
- TextHighlighterExtension(Visual Studio 2010)
- TextHighlighterExtension2012(Visual Studio 2012)
- TextHighlighterExtension(Visual Studio 2010)
Initial Answer
初步答复
The recently released PowerGUI Visual Studio Extensionadds PowerShell IntelliSense support to Visual Studio. While it depends on the (free) PowerGUIgraphical user interface and script editor, reusing this editor component should be a sign of maturity rather than an impediment I'd hope. (See Kirk Munros PowerShell support in Visual Studio!blog post for an introduction.)
最近发布的PowerGUI Visual Studio 扩展为 Visual Studio 添加了 PowerShell IntelliSense 支持。虽然它依赖于(免费的)PowerGUI图形用户界面和脚本编辑器,但重用这个编辑器组件应该是成熟的标志,而不是我希望的障碍。(有关介绍,请参阅Visual Studio 中的Kirk Munros PowerShell 支持!博客文章。)
Being a 1.0 there are still some minor issueswith the extension as such, but Adam Driscoll seems to be pretty active tackling these - the PowerShell syntax highlighting and IntelliSense support is working most excellent for me already!
作为 1.0 ,扩展仍然存在一些小问题,但 Adam Driscoll 似乎非常积极地解决这些问题 - PowerShell 语法突出显示和 IntelliSense 支持对我来说已经非常出色了!
回答by CMS
I have not seen anything about Visual Studio Intellisense for PowerShell scripts.
我还没有看到有关 PowerShell 脚本的 Visual Studio Intellisense 的任何信息。
I recommend you to try some other tools like:
我建议您尝试其他一些工具,例如:
Look this screen cast:
看看这个屏幕投射:

(source: aaronlerch.com)

(来源:aaronlerch.com)
回答by Roman Kuzmin
The PowerConsoleextension for VS2010 is very nice and looks promising. I am not sure though that it is suitable (or able) to edit scripts. It is worth to try in any case.
VS2010的PowerConsole扩展非常好,看起来很有前途。我不确定它是否适合(或能够)编辑脚本。无论如何都值得一试。

