如果在源文件评论中有一个URL,我可以“按CTRL +单击以关注链接”。但是,当我这样做时,链接将在Visual Studio中打开。我如何在我的网络浏览器中打开它 - 在我的情况下,Google Chrome?如何在Visual Studio中打开Web浏览器中的链接而不是Visual Studio中的链接?
131
A
回答
58
有提供这种行为称为Open in External Browser的延伸。它的工作原理在Visual Studio 2012年,2013年,2015年和2017年(旧版本available on GitHub支持Visual Studio 2010中)
由于去Dmitry在his answer指出这一点这个类似的问题。
编辑:Visual Studio团队终于开始上把这个权利到Visual Studio工作。 this功能请求的状态刚刚从“审阅中”移至“已启动”。
-4
在VS2008,只需右键点击链接并选择“在外部窗口中打开链接”。您必须选择Chrome作为默认浏览器。
7
我找不到此设置,所以我写了一个简单的宏,您可以使用。你可以像所有宏一样将它绑定到一个键组合。这将完成工作,直到我们得到更好的答案。
Sub OpenURLInChrome()
'copy to end of line
DTE.ActiveDocument.Selection.EndOfLine(True)
'set var
Dim url As String = DTE.ActiveDocument.Selection.Text
'launch chrome with url
System.Diagnostics.Process.Start(_
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) _
+ "\Google\Chrome\Application\chrome.exe", url)
End Sub
只要把你的光标在网址前和运行宏...
5
这是宏观上的改进由mracoker上述建议。
这个宏查找当前行的URL和URL后不捕获文本作为以前的答案一样。
Sub OpenURLInChrome()
' Select to end of line
DTE.ActiveDocument.Selection.EndOfLine(True)
Dim selection As TextSelection = DTE.ActiveDocument.Selection
' Find URL within selection
Dim match = System.Text.RegularExpressions.Regex.Match(_
selection.Text, ".*(http\S+)")
Dim url As String = ""
If (match.Success) Then
If match.Groups.Count = 2 Then
url = match.Groups(1).Value
End If
End If
' Remove selection
selection.SwapAnchor()
selection.Collapse()
If (url = String.Empty) Then
MsgBox("No URL found")
End If
' Launch chrome with url
System.Diagnostics.Process.Start(_
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) _
+ "\Google\Chrome\Application\chrome.exe", url)
End Sub
使用方法:将光标放在URL之前的某处;运行宏(I映射为Ctrl移-G)
相关问题
- 1. 浏览器链接在Visual Studio中工作不
- 2. 在Visual Studio中链接DLL
- 3. 在Visual Studio中链接库
- 4. Visual Studio中的查询在浏览器,而不是内部的Visual Studio开放
- 5. 如何在不打开链接的情况下打开Visual Studio中的内置浏览器?
- 6. 如何链接Visual Studio中的fmod库
- 7. Visual Studio的Web浏览器
- 8. visual studio链接器错误
- 9. 在Visual Studio中的动态链接
- 10. 在Visual Studio中链接的MySQL库10
- 11. 在visual studio中的cublas链接
- 12. 在Visual Studio中的MSDN链接
- 13. 如何在HTA的默认Web浏览器中打开链接?
- 14. “在Visual Studio中打开”链接的ASP.net异常默认页面
- 15. 在浏览器中打开链接?
- 16. Visual Studio 2008的C++链接
- 17. Wikitude Studio离线应用在默认浏览器(而不是应用内浏览器)中打开链接
- 18. Visual Studio中的Win32 C++项目链接
- 19. Visual Studio中的奇怪链接错误
- 20. Visual Studio中的链接评论?
- 21. Visual Studio 2012中的FFTW链接
- 22. MS Visual Studio中的部分链接?
- 23. 无法在Visual Studio中的浏览器中打开页面
- 24. 在Visual Studio 2010中链接DLL C++
- 25. 在Visual Studio中静态链接库
- 26. 在Visual Studio 2008 Express中链接libcURL
- 27. 在Visual Studio中静态链接ffmpeg库
- 28. 在Visual Studio 2012中链接zlib
- 29. 在Visual Studio 2010中链接库
- 30. extern在Microsoft Visual Studio中链接问题
我正要说提交功能请求,但你猜怎么着。在VS2010beta1的编辑器视图中,自动链接实际上没有了。 – Bahbar 2009-11-27 17:06:19
@Bahbar:在VS2010 RC中,链接已恢复。 – 2010-03-23 09:11:37
2.5年后对此问题的任何更新?现在有更好的方法吗? – Borek 2011-12-13 19:54:32