Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
d770ce50
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d770ce50
编写于
4月 19, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make sure we handle webview position updates when an entire editor group moves
上级
be4e48fb
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
25 addition
and
17 deletion
+25
-17
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+3
-1
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
+16
-1
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostWebview.ts
src/vs/workbench/api/node/extHostWebview.ts
+2
-7
src/vs/workbench/parts/webview/electron-browser/webviewEditor.ts
...workbench/parts/webview/electron-browser/webviewEditor.ts
+1
-1
src/vs/workbench/parts/webview/electron-browser/webviewEditorInput.ts
...ench/parts/webview/electron-browser/webviewEditorInput.ts
+1
-1
src/vs/workbench/parts/webview/electron-browser/webviewEditorService.ts
...ch/parts/webview/electron-browser/webviewEditorService.ts
+1
-5
未找到文件。
src/vs/vscode.d.ts
浏览文件 @
d770ce50
...
...
@@ -4964,8 +4964,10 @@ declare module 'vscode' {
*
* A webview panel may only show in a single column at a time. If it is already showing, this
* method moves it to a new column.
*
* @param viewColumn View column to show the panel in. Shows in the current `viewColumn` if undefined.
*/
reveal
(
viewColumn
:
ViewColumn
):
void
;
reveal
(
viewColumn
?
:
ViewColumn
):
void
;
/**
* Dispose of the webview panel.
...
...
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
浏览文件 @
d770ce50
...
...
@@ -52,6 +52,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
)
{
this
.
_proxy
=
context
.
getProxy
(
ExtHostContext
.
ExtHostWebviews
);
editorGroupService
.
onEditorsChanged
(
this
.
onEditorsChanged
,
this
,
this
.
_toDispose
);
editorGroupService
.
onEditorGroupMoved
(
this
.
onEditorGroupMoved
,
this
,
this
.
_toDispose
);
this
.
_toDispose
.
push
(
_webviewService
.
registerReviver
(
MainThreadWebviews
.
viewType
,
this
));
...
...
@@ -96,7 +97,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
webview
.
html
=
value
;
}
$reveal
(
handle
:
WebviewPanelHandle
,
column
:
Position
):
void
{
$reveal
(
handle
:
WebviewPanelHandle
,
column
:
Position
|
undefined
):
void
{
const
webview
=
this
.
getWebview
(
handle
);
this
.
_webviewService
.
revealWebview
(
webview
,
column
);
}
...
...
@@ -227,6 +228,20 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
}
}
private
onEditorGroupMoved
():
void
{
for
(
const
workbenchEditor
of
this
.
_editorService
.
getVisibleEditors
())
{
if
(
!
workbenchEditor
.
input
)
{
return
;
}
this
.
_webviews
.
forEach
((
input
,
handle
)
=>
{
if
(
workbenchEditor
.
input
.
matches
(
input
)
&&
input
.
position
!==
workbenchEditor
.
position
)
{
input
.
updatePosition
(
workbenchEditor
.
position
);
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
handle
,
handle
===
this
.
_activeWebview
,
workbenchEditor
.
position
);
}
});
}
}
private
onDidClickLink
(
handle
:
WebviewPanelHandle
,
link
:
URI
):
void
{
if
(
!
link
)
{
return
;
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
d770ce50
...
...
@@ -355,7 +355,7 @@ export type WebviewPanelHandle = string;
export
interface
MainThreadWebviewsShape
extends
IDisposable
{
$createWebviewPanel
(
handle
:
WebviewPanelHandle
,
viewType
:
string
,
title
:
string
,
column
:
EditorPosition
,
options
:
vscode
.
WebviewPanelOptions
&
vscode
.
WebviewOptions
,
extensionFolderPath
:
string
):
void
;
$disposeWebview
(
handle
:
WebviewPanelHandle
):
void
;
$reveal
(
handle
:
WebviewPanelHandle
,
column
:
EditorPosition
):
void
;
$reveal
(
handle
:
WebviewPanelHandle
,
column
:
EditorPosition
|
undefined
):
void
;
$setTitle
(
handle
:
WebviewPanelHandle
,
value
:
string
):
void
;
$setHtml
(
handle
:
WebviewPanelHandle
,
value
:
string
):
void
;
$postMessage
(
handle
:
WebviewPanelHandle
,
value
:
any
):
Thenable
<
boolean
>
;
...
...
src/vs/workbench/api/node/extHostWebview.ts
浏览文件 @
d770ce50
...
...
@@ -58,11 +58,6 @@ export class ExtHostWebview implements vscode.Webview {
return
this
.
_proxy
.
$postMessage
(
this
.
_handle
,
message
);
}
public
reveal
(
viewColumn
:
vscode
.
ViewColumn
):
void
{
this
.
assertNotDisposed
();
this
.
_proxy
.
$reveal
(
this
.
_handle
,
typeConverters
.
fromViewColumn
(
viewColumn
));
}
private
assertNotDisposed
()
{
if
(
this
.
_isDisposed
)
{
throw
new
Error
(
'
Webview is disposed
'
);
...
...
@@ -176,9 +171,9 @@ export class ExtHostWebviewPanel implements vscode.WebviewPanel {
return
this
.
_proxy
.
$postMessage
(
this
.
_handle
,
message
);
}
public
reveal
(
viewColumn
:
vscode
.
ViewColumn
):
void
{
public
reveal
(
viewColumn
?
:
vscode
.
ViewColumn
):
void
{
this
.
assertNotDisposed
();
this
.
_proxy
.
$reveal
(
this
.
_handle
,
typeConverters
.
fromViewColumn
(
viewColumn
)
);
this
.
_proxy
.
$reveal
(
this
.
_handle
,
viewColumn
?
typeConverters
.
fromViewColumn
(
viewColumn
)
:
undefined
);
}
private
assertNotDisposed
()
{
...
...
src/vs/workbench/parts/webview/electron-browser/webviewEditor.ts
浏览文件 @
d770ce50
...
...
@@ -148,7 +148,7 @@ export class WebviewEditor extends BaseWebviewEditor {
await
super
.
setInput
(
input
,
options
);
await
input
.
resolve
();
await
input
.
onBecameActive
(
this
.
position
);
await
input
.
updatePosition
(
this
.
position
);
this
.
updateWebview
(
input
);
}
...
...
src/vs/workbench/parts/webview/electron-browser/webviewEditorInput.ts
浏览文件 @
d770ce50
...
...
@@ -224,7 +224,7 @@ export class WebviewEditorInput extends EditorInput {
this
.
_currentWebviewHtml
=
''
;
}
public
onBecameActive
(
position
:
Position
):
void
{
public
updatePosition
(
position
:
Position
):
void
{
this
.
_position
=
position
;
}
}
src/vs/workbench/parts/webview/electron-browser/webviewEditorService.ts
浏览文件 @
d770ce50
...
...
@@ -100,11 +100,7 @@ export class WebviewEditorService implements IWebviewEditorService {
webview
:
WebviewEditorInput
,
column
:
Position
|
undefined
):
void
{
if
(
typeof
column
===
'
undefined
'
)
{
column
=
webview
.
position
;
}
if
(
webview
.
position
===
column
)
{
if
(
typeof
column
===
'
undefined
'
||
webview
.
position
===
column
)
{
this
.
_editorService
.
openEditor
(
webview
,
{
preserveFocus
:
false
},
column
);
}
else
{
this
.
_editorGroupService
.
moveEditor
(
webview
,
webview
.
position
,
column
,
{
preserveFocus
:
false
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录