Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
7a977ac1
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
7a977ac1
编写于
6月 22, 2018
作者:
D
David Kean
提交者:
GitHub
6月 22, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #26230 from davkean/OutputPane
Avoid stealing focus from the active output window pane
上级
6284c1c6
8dfea863
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
51 addition
and
13 deletion
+51
-13
src/VisualStudio/Core/Def/Implementation/Workspace/WorkspaceFailureOutputPane.cs
...ef/Implementation/Workspace/WorkspaceFailureOutputPane.cs
+51
-13
未找到文件。
src/VisualStudio/Core/Def/Implementation/Workspace/WorkspaceFailureOutputPane.cs
浏览文件 @
7a977ac1
...
...
@@ -49,26 +49,64 @@ private IVsOutputWindowPane OutputPane
{
var
outputWindow
=
(
IVsOutputWindow
)
_serviceProvider
.
GetService
(
typeof
(
SVsOutputWindow
));
// Try to get the workspace pane if it has already been registered
var
workspacePaneGuid
=
s_workspacePaneGuid
;
var
hr
=
outputWindow
.
GetPane
(
ref
workspacePaneGuid
,
out
_doNotAccessDirectlyOutputPane
);
// Output Window panes have two states; initialized and active. The former is used to indicate that the pane
// can be made active ("selected") by the user, the latter indicates that the pane is currently active.
// There's no way to only initialize a pane without also making it active so we remember the last active pane
// and reactivate it after we've created ourselves to avoid stealing focus away from it.
var
lastActivePane
=
GetActivePane
(
outputWindow
);
// If the workspace pane has not been registered before, create it
if
(
_doNotAccessDirectlyOutputPane
==
null
||
hr
!=
VSConstants
.
S_OK
)
_doNotAccessDirectlyOutputPane
=
CreateOutputPane
(
outputWindow
);
if
(
lastActivePane
!=
Guid
.
Empty
)
{
if
(
ErrorHandler
.
Failed
(
outputWindow
.
CreatePane
(
ref
workspacePaneGuid
,
ServicesVSResources
.
IntelliSense
,
fInitVisible
:
1
,
fClearWithSolution
:
1
))
||
ErrorHandler
.
Failed
(
outputWindow
.
GetPane
(
ref
workspacePaneGuid
,
out
_doNotAccessDirectlyOutputPane
)))
{
return
null
;
}
// Must activate the workspace pane for it to show up in the output window
_doNotAccessDirectlyOutputPane
.
Activate
();
ActivatePane
(
outputWindow
,
lastActivePane
);
}
}
return
_doNotAccessDirectlyOutputPane
;
}
}
private
IVsOutputWindowPane
CreateOutputPane
(
IVsOutputWindow
outputWindow
)
{
AssertIsForeground
();
// Try to get the workspace pane if it has already been registered
var
workspacePaneGuid
=
s_workspacePaneGuid
;
// If the pane has already been created, CreatePane returns it
if
(
ErrorHandler
.
Succeeded
(
outputWindow
.
CreatePane
(
ref
workspacePaneGuid
,
ServicesVSResources
.
IntelliSense
,
fInitVisible
:
1
,
fClearWithSolution
:
1
))
&&
ErrorHandler
.
Succeeded
(
outputWindow
.
GetPane
(
ref
workspacePaneGuid
,
out
var
pane
)))
{
return
pane
;
}
return
null
;
}
private
Guid
GetActivePane
(
IVsOutputWindow
outputWindow
)
{
AssertIsForeground
();
if
(
outputWindow
is
IVsOutputWindow2
outputWindow2
)
{
if
(
ErrorHandler
.
Succeeded
(
outputWindow2
.
GetActivePaneGUID
(
out
var
activePaneGuid
)))
{
return
activePaneGuid
;
}
}
return
Guid
.
Empty
;
}
private
void
ActivatePane
(
IVsOutputWindow
outputWindow
,
Guid
paneGuid
)
{
AssertIsForeground
();
if
(
ErrorHandler
.
Succeeded
(
outputWindow
.
GetPane
(
ref
paneGuid
,
out
var
pane
)))
{
pane
.
Activate
();
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录