Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
abe0207f
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
abe0207f
编写于
5月 20, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - maintain ViewColumn API compatibility (webview)
上级
dd5afa5b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
100 addition
and
68 deletion
+100
-68
src/vs/workbench/api/electron-browser/mainThreadEditors.ts
src/vs/workbench/api/electron-browser/mainThreadEditors.ts
+22
-22
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
+39
-20
src/vs/workbench/parts/html/electron-browser/html.contribution.ts
...orkbench/parts/html/electron-browser/html.contribution.ts
+18
-10
src/vs/workbench/parts/update/electron-browser/releaseNotesEditor.ts
...bench/parts/update/electron-browser/releaseNotesEditor.ts
+3
-4
src/vs/workbench/parts/webview/electron-browser/webviewEditorService.ts
...ch/parts/webview/electron-browser/webviewEditorService.ts
+18
-12
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadEditors.ts
浏览文件 @
abe0207f
...
...
@@ -119,7 +119,7 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
options
:
editorOptions
};
return
this
.
_editorService
.
openEditor
(
input
,
this
.
_findEditorGroup
(
options
.
position
)).
then
(
editor
=>
{
return
this
.
_editorService
.
openEditor
(
input
,
findEditorGroup
(
this
.
_editorGroupService
,
options
.
position
)).
then
(
editor
=>
{
if
(
!
editor
)
{
return
undefined
;
}
...
...
@@ -134,31 +134,11 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
return
this
.
_editorService
.
openEditor
({
resource
:
model
.
uri
,
options
:
{
preserveFocus
:
false
}
},
this
.
_findEditorGroup
(
position
)).
then
(()
=>
{
return
;
});
},
findEditorGroup
(
this
.
_editorGroupService
,
position
)).
then
(()
=>
{
return
;
});
}
return
undefined
;
}
private
_findEditorGroup
(
position
?:
EditorPosition
):
GroupIdentifier
{
if
(
typeof
position
!==
'
number
'
)
{
return
ACTIVE_GROUP
;
// prefer active group when position is undefined
}
const
groups
=
this
.
_editorGroupService
.
groups
;
let
candidate
=
groups
[
position
];
if
(
candidate
)
{
return
candidate
.
id
;
// found direct match
}
let
firstGroup
=
groups
[
0
];
if
(
groups
.
length
===
1
&&
firstGroup
.
count
===
0
)
{
return
firstGroup
.
id
;
// first editor should always open in first group
}
return
SIDE_GROUP
;
// open to the side if group not found
}
$tryHideEditor
(
id
:
string
):
TPromise
<
void
>
{
let
mainThreadEditor
=
this
.
_documentsAndEditors
.
getEditor
(
id
);
if
(
mainThreadEditor
)
{
...
...
@@ -260,3 +240,23 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
return
TPromise
.
as
(
diffEditor
.
getLineChanges
());
}
}
export
function
findEditorGroup
(
editorGroupService
:
INextEditorGroupsService
,
position
?:
EditorPosition
):
GroupIdentifier
{
if
(
typeof
position
!==
'
number
'
)
{
return
ACTIVE_GROUP
;
// prefer active group when position is undefined
}
const
groups
=
editorGroupService
.
groups
;
let
candidate
=
groups
[
position
];
if
(
candidate
)
{
return
candidate
.
id
;
// found direct match
}
let
firstGroup
=
groups
[
0
];
if
(
groups
.
length
===
1
&&
firstGroup
.
count
===
0
)
{
return
firstGroup
.
id
;
// first editor should always open in first group
}
return
SIDE_GROUP
;
// open to the side if group not found
}
\ No newline at end of file
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
浏览文件 @
abe0207f
...
...
@@ -14,11 +14,13 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import
{
ExtHostContext
,
ExtHostWebviewsShape
,
IExtHostContext
,
MainContext
,
MainThreadWebviewsShape
,
WebviewPanelHandle
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
WebviewEditor
}
from
'
vs/workbench/parts/webview/electron-browser/webviewEditor
'
;
import
{
WebviewEditorInput
}
from
'
vs/workbench/parts/webview/electron-browser/webviewEditorInput
'
;
import
{
IWebviewEditorService
,
WebviewInputOptions
,
WebviewReviver
}
from
'
vs/workbench/parts/webview/electron-browser/webviewEditorService
'
;
import
{
I
WorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/e
ditorService
'
;
import
{
IWebviewEditorService
,
WebviewInputOptions
,
WebviewReviver
,
ICreateWebViewShowOptions
}
from
'
vs/workbench/parts/webview/electron-browser/webviewEditorService
'
;
import
{
I
NextEditorService
}
from
'
vs/workbench/services/editor/common/nextE
ditorService
'
;
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
I
EditorGroupService
}
from
'
vs/workbench/services/group/common/group
Service
'
;
import
{
I
NextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroups
Service
'
;
import
{
extHostNamedCustomer
}
from
'
./extHostCustomers
'
;
import
{
findEditorGroup
}
from
'
vs/workbench/api/electron-browser/mainThreadEditors
'
;
import
{
GroupIdentifier
}
from
'
vs/workbench/common/editor
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadWebviews
)
export
class
MainThreadWebviews
implements
MainThreadWebviewsShape
,
WebviewReviver
{
...
...
@@ -40,17 +42,17 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
constructor
(
context
:
IExtHostContext
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
I
EditorGroupService
editorGroupService
:
IEditorGroup
Service
,
@
I
NextEditorGroupsService
private
readonly
_editorGroupService
:
INextEditorGroups
Service
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
I
WorkbenchEditorService
private
readonly
_editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
readonly
_editorService
:
INext
EditorService
,
@
IWebviewEditorService
private
readonly
_webviewService
:
IWebviewEditorService
,
@
IOpenerService
private
readonly
_openerService
:
IOpenerService
,
@
IExtensionService
private
readonly
_extensionService
:
IExtensionService
,
)
{
this
.
_proxy
=
context
.
getProxy
(
ExtHostContext
.
ExtHostWebviews
);
editorGroupService
.
onEditorsChanged
(
this
.
onEditors
Changed
,
this
,
this
.
_toDispose
);
editorGroupService
.
onEditorGroupMoved
(
this
.
onEditorGroupMov
ed
,
this
,
this
.
_toDispose
);
_editorService
.
onDidActiveEditorChange
(
this
.
onActiveEditor
Changed
,
this
,
this
.
_toDispose
);
_editorService
.
onDidVisibleEditorsChange
(
this
.
onVisibleEditorsChang
ed
,
this
,
this
.
_toDispose
);
this
.
_toDispose
.
push
(
_webviewService
.
registerReviver
(
MainThreadWebviews
.
viewType
,
this
));
...
...
@@ -71,7 +73,13 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
options
:
WebviewInputOptions
,
extensionLocation
:
UriComponents
):
void
{
const
webview
=
this
.
_webviewService
.
createWebview
(
MainThreadWebviews
.
viewType
,
title
,
showOptions
,
options
,
URI
.
revive
(
extensionLocation
),
this
.
createWebviewEventDelegate
(
handle
));
const
mainThreadShowOptions
:
ICreateWebViewShowOptions
=
Object
.
create
(
null
);
if
(
showOptions
)
{
mainThreadShowOptions
.
preserveFocus
=
showOptions
.
preserveFocus
;
mainThreadShowOptions
.
group
=
findEditorGroup
(
this
.
_editorGroupService
,
showOptions
.
viewColumn
);
}
const
webview
=
this
.
_webviewService
.
createWebview
(
MainThreadWebviews
.
viewType
,
title
,
mainThreadShowOptions
,
options
,
URI
.
revive
(
extensionLocation
),
this
.
createWebviewEventDelegate
(
handle
));
webview
.
state
=
{
viewType
:
viewType
,
state
:
undefined
...
...
@@ -102,12 +110,14 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
return
;
}
this
.
_webviewService
.
revealWebview
(
webview
,
viewColumn
,
preserveFocus
);
const
targetGroup
=
this
.
_editorGroupService
.
getGroup
(
findEditorGroup
(
this
.
_editorGroupService
,
viewColumn
));
this
.
_webviewService
.
revealWebview
(
webview
,
targetGroup
||
this
.
_editorGroupService
.
activeGroup
,
preserveFocus
);
}
async
$postMessage
(
handle
:
WebviewPanelHandle
,
message
:
any
):
TPromise
<
boolean
>
{
const
webview
=
this
.
getWebview
(
handle
);
const
editors
=
this
.
_editorService
.
getVisibleEditors
()
const
editors
=
this
.
_editorService
.
visibleControls
.
filter
(
e
=>
e
instanceof
WebviewEditor
)
.
map
(
e
=>
e
as
WebviewEditor
)
.
filter
(
e
=>
e
.
input
.
matches
(
webview
));
...
...
@@ -141,7 +151,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
state
=
{};
}
return
this
.
_proxy
.
$deserializeWebviewPanel
(
handle
,
webview
.
state
.
viewType
,
webview
.
getTitle
(),
state
,
webview
.
group
,
webview
.
options
)
// TODO@grid [EXTENSIONS] adopt group identifier
return
this
.
_proxy
.
$deserializeWebviewPanel
(
handle
,
webview
.
state
.
viewType
,
webview
.
getTitle
(),
state
,
this
.
positionOfGroup
(
webview
.
group
),
webview
.
options
)
.
then
(
undefined
,
()
=>
{
webview
.
html
=
MainThreadWebviews
.
getDeserializationFailedContents
(
viewType
);
});
...
...
@@ -187,8 +197,8 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
return
webview
;
}
private
on
Editors
Changed
()
{
const
activeEditor
=
this
.
_editorService
.
getActiveEditor
()
;
private
on
ActiveEditor
Changed
()
{
const
activeEditor
=
this
.
_editorService
.
activeControl
;
let
newActiveWebview
:
{
input
:
WebviewEditorInput
,
handle
:
WebviewPanelHandle
}
|
undefined
=
undefined
;
if
(
activeEditor
&&
activeEditor
.
input
instanceof
WebviewEditorInput
)
{
for
(
const
handle
of
map
.
keys
(
this
.
_webviews
))
{
...
...
@@ -202,7 +212,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
if
(
newActiveWebview
&&
newActiveWebview
.
handle
===
this
.
_activeWebview
)
{
// Webview itself unchanged but position may have changed
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
newActiveWebview
.
handle
,
true
,
newActiveWebview
.
input
.
group
);
// TODO@grid [EXTENSIONS] adopt group identifier
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
newActiveWebview
.
handle
,
true
,
this
.
positionOfGroup
(
newActiveWebview
.
input
.
group
));
return
;
}
...
...
@@ -210,29 +220,38 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
if
(
typeof
this
.
_activeWebview
!==
'
undefined
'
)
{
const
oldActiveWebview
=
this
.
_webviews
.
get
(
this
.
_activeWebview
);
if
(
oldActiveWebview
)
{
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
this
.
_activeWebview
,
false
,
oldActiveWebview
.
group
);
// TODO@grid [EXTENSIONS] adopt group identifier
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
this
.
_activeWebview
,
false
,
this
.
positionOfGroup
(
oldActiveWebview
.
group
));
}
}
// Then for newly active
if
(
newActiveWebview
)
{
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
newActiveWebview
.
handle
,
true
,
activeEditor
.
group
.
id
);
// TODO@grid [EXTENSIONS] adopt in extension host
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
newActiveWebview
.
handle
,
true
,
this
.
positionOfGroup
(
activeEditor
.
group
.
id
));
this
.
_activeWebview
=
newActiveWebview
.
handle
;
}
else
{
this
.
_activeWebview
=
undefined
;
}
}
private
onEditorGroupMoved
():
void
{
for
(
const
workbenchEditor
of
this
.
_editorService
.
getVisibleEditors
())
{
private
positionOfGroup
(
groupId
:
GroupIdentifier
):
number
{
const
group
=
this
.
_editorGroupService
.
getGroup
(
groupId
);
return
this
.
_editorGroupService
.
groups
.
indexOf
(
group
);
}
private
onVisibleEditorsChanged
():
void
{
for
(
const
workbenchEditor
of
this
.
_editorService
.
visibleControls
)
{
if
(
!
workbenchEditor
.
input
)
{
return
;
}
this
.
_webviews
.
forEach
((
input
,
handle
)
=>
{
if
(
workbenchEditor
.
input
.
matches
(
input
)
&&
input
.
group
!==
workbenchEditor
.
group
.
id
)
{
// TODO@grid [EXTENSIONS] adopt group identifier
const
inputPosition
=
this
.
positionOfGroup
(
input
.
group
);
const
editorPosition
=
this
.
positionOfGroup
(
workbenchEditor
.
group
.
id
);
if
(
workbenchEditor
.
input
.
matches
(
input
)
&&
inputPosition
!==
editorPosition
)
{
input
.
updateGroup
(
workbenchEditor
.
group
.
id
);
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
handle
,
handle
===
this
.
_activeWebview
,
workbenchEditor
.
group
.
id
);
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
handle
,
handle
===
this
.
_activeWebview
,
editorPosition
);
}
});
}
...
...
src/vs/workbench/parts/html/electron-browser/html.contribution.ts
浏览文件 @
abe0207f
...
...
@@ -8,19 +8,20 @@ import URI from 'vs/base/common/uri';
import
{
localize
}
from
'
vs/nls
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
I
WorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/e
ditorService
'
;
import
{
I
NextEditorService
}
from
'
vs/workbench/services/editor/common/nextE
ditorService
'
;
import
{
Position
as
EditorPosition
}
from
'
vs/platform/editor/common/editor
'
;
import
{
HtmlInput
,
HtmlInputOptions
}
from
'
../common/htmlInput
'
;
import
{
HtmlPreviewPart
}
from
'
./htmlPreviewPart
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
I
EditorGroupService
}
from
'
vs/workbench/services/group/common/group
Service
'
;
import
{
I
NextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroups
Service
'
;
import
{
IExtensionsWorkbenchService
}
from
'
vs/workbench/parts/extensions/common/extensions
'
;
import
{
IEditorRegistry
,
EditorDescriptor
,
Extensions
as
EditorExtensions
}
from
'
vs/workbench/browser/editor
'
;
import
{
findEditorGroup
}
from
'
vs/workbench/api/electron-browser/mainThreadEditors
'
;
function
getActivePreviewsForResource
(
accessor
:
ServicesAccessor
,
resource
:
URI
|
string
)
{
const
uri
=
resource
instanceof
URI
?
resource
:
URI
.
parse
(
resource
);
return
accessor
.
get
(
I
WorkbenchEditorService
).
getVisibleEditors
()
return
accessor
.
get
(
I
NextEditorService
).
visibleControls
.
filter
(
c
=>
c
instanceof
HtmlPreviewPart
&&
c
.
model
)
.
map
(
e
=>
e
as
HtmlPreviewPart
)
.
filter
(
e
=>
e
.
model
.
uri
.
scheme
===
uri
.
scheme
&&
e
.
model
.
uri
.
toString
()
===
uri
.
toString
());
...
...
@@ -47,13 +48,20 @@ CommandsRegistry.registerCommand('_workbench.previewHtml', function (
let
input
:
HtmlInput
;
const
editorGroupService
=
accessor
.
get
(
INextEditorGroupsService
);
const
groups
=
editorGroupService
.
groups
;
// Find already opened HTML input if any
const
stacks
=
accessor
.
get
(
IEditorGroupService
).
getStacksModel
();
const
targetGroup
=
stacks
.
groupAt
(
position
)
||
stacks
.
activeGroup
;
const
targetGroup
=
groups
[
position
]
||
editorGroupService
.
activeGroup
;
if
(
targetGroup
)
{
const
existingInput
=
targetGroup
.
getEditor
(
uri
);
if
(
existingInput
instanceof
HtmlInput
)
{
input
=
existingInput
;
const
editors
=
targetGroup
.
editors
;
for
(
let
i
=
0
;
i
<
editors
.
length
;
i
++
)
{
const
editor
=
editors
[
i
];
const
editorResource
=
editor
.
getResource
();
if
(
editor
instanceof
HtmlInput
&&
editorResource
&&
editorResource
.
toString
()
===
resource
.
toString
())
{
input
=
editor
;
break
;
}
}
}
...
...
@@ -72,8 +80,8 @@ CommandsRegistry.registerCommand('_workbench.previewHtml', function (
input
.
setName
(
label
);
// make sure to use passed in label
}
return
accessor
.
get
(
I
Workbench
EditorService
)
.
openEditor
(
input
,
{
pinned
:
true
},
position
)
return
accessor
.
get
(
I
Next
EditorService
)
.
openEditor
(
input
,
{
pinned
:
true
},
findEditorGroup
(
editorGroupService
,
position
)
)
.
then
(
editor
=>
true
);
});
...
...
src/vs/workbench/parts/update/electron-browser/releaseNotesEditor.ts
浏览文件 @
abe0207f
...
...
@@ -24,9 +24,8 @@ import { IRequestService } from 'vs/platform/request/node/request';
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
addGAParameters
}
from
'
vs/platform/telemetry/node/telemetryNodeUtils
'
;
import
{
IWebviewEditorService
}
from
'
vs/workbench/parts/webview/electron-browser/webviewEditorService
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
import
{
INextEditorService
,
ACTIVE_GROUP
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
import
{
KeybindingIO
}
from
'
vs/workbench/services/keybinding/common/keybindingIO
'
;
import
{
Position
}
from
'
vs/platform/editor/common/editor
'
;
import
{
WebviewEditorInput
}
from
'
vs/workbench/parts/webview/electron-browser/webviewEditorInput
'
;
function
renderBody
(
...
...
@@ -76,12 +75,12 @@ export class ReleaseNotesManager {
if
(
this
.
_currentReleaseNotes
)
{
this
.
_currentReleaseNotes
.
setName
(
title
);
this
.
_currentReleaseNotes
.
html
=
html
;
this
.
_webviewEditorService
.
revealWebview
(
this
.
_currentReleaseNotes
,
activeControl
?
activeControl
.
group
.
id
:
undefined
,
false
);
// TODO@grid [EXTENSIONS] adopt group identifier
this
.
_webviewEditorService
.
revealWebview
(
this
.
_currentReleaseNotes
,
activeControl
?
activeControl
.
group
:
undefined
,
false
);
}
else
{
this
.
_currentReleaseNotes
=
this
.
_webviewEditorService
.
createWebview
(
'
releaseNotes
'
,
title
,
{
viewColumn
:
activeControl
?
activeControl
.
group
.
id
:
Position
.
ONE
,
preserveFocus
:
false
},
// TODO@grid [EXTENSIONS] adopt group identifier
{
group
:
ACTIVE_GROUP
,
preserveFocus
:
false
},
{
tryRestoreScrollPosition
:
true
,
enableFindWidget
:
true
},
undefined
,
{
onDidClickLink
:
uri
=>
this
.
onDidClickLink
(
uri
),
...
...
src/vs/workbench/parts/webview/electron-browser/webviewEditorService.ts
浏览文件 @
abe0207f
...
...
@@ -8,20 +8,26 @@ import URI from 'vs/base/common/uri';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Position
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IInstantiationService
,
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
I
WorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/e
ditorService
'
;
import
{
I
EditorGroupService
}
from
'
vs/workbench/services/group/common/group
Service
'
;
import
{
I
NextEditorService
,
ACTIVE_GROUP_TYPE
,
SIDE_GROUP_TYPE
}
from
'
vs/workbench/services/editor/common/nextE
ditorService
'
;
import
{
I
NextEditorGroupsService
,
IEditorGroup
}
from
'
vs/workbench/services/group/common/nextEditorGroups
Service
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
WebviewEditorInput
}
from
'
./webviewEditorInput
'
;
import
{
GroupIdentifier
}
from
'
vs/workbench/common/editor
'
;
export
const
IWebviewEditorService
=
createDecorator
<
IWebviewEditorService
>
(
'
webviewEditorService
'
);
export
interface
ICreateWebViewShowOptions
{
group
:
IEditorGroup
|
GroupIdentifier
|
ACTIVE_GROUP_TYPE
|
SIDE_GROUP_TYPE
;
preserveFocus
:
boolean
;
}
export
interface
IWebviewEditorService
{
_serviceBrand
:
any
;
createWebview
(
viewType
:
string
,
title
:
string
,
showOptions
:
{
viewColumn
:
Position
,
preserveFocus
:
boolean
}
,
showOptions
:
ICreateWebViewShowOptions
,
options
:
WebviewInputOptions
,
extensionLocation
:
URI
,
events
:
WebviewEvents
...
...
@@ -37,7 +43,7 @@ export interface IWebviewEditorService {
revealWebview
(
webview
:
WebviewEditorInput
,
column
:
Position
|
null
,
group
:
IEditorGroup
,
preserveFocus
:
boolean
):
void
;
...
...
@@ -79,33 +85,33 @@ export class WebviewEditorService implements IWebviewEditorService {
private
_awaitingRevival
:
{
input
:
WebviewEditorInput
,
resolve
:
(
x
:
any
)
=>
void
}[]
=
[];
constructor
(
@
I
WorkbenchEditorService
private
readonly
_editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
readonly
_editorService
:
INext
EditorService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
I
EditorGroupService
private
readonly
_editorGroupService
:
IEditorGroup
Service
,
@
I
NextEditorGroupsService
private
readonly
_editorGroupService
:
INextEditorGroups
Service
,
)
{
}
createWebview
(
viewType
:
string
,
title
:
string
,
showOptions
:
{
viewColumn
:
Position
,
preserveFocus
:
boolean
}
,
showOptions
:
ICreateWebViewShowOptions
,
options
:
vscode
.
WebviewOptions
,
extensionLocation
:
URI
,
events
:
WebviewEvents
):
WebviewEditorInput
{
const
webviewInput
=
this
.
_instantiationService
.
createInstance
(
WebviewEditorInput
,
viewType
,
title
,
options
,
{},
events
,
extensionLocation
,
undefined
);
this
.
_editorService
.
openEditor
(
webviewInput
,
{
pinned
:
true
,
preserveFocus
:
showOptions
.
preserveFocus
},
showOptions
.
viewColumn
);
this
.
_editorService
.
openEditor
(
webviewInput
,
{
pinned
:
true
,
preserveFocus
:
showOptions
.
preserveFocus
},
showOptions
.
group
);
return
webviewInput
;
}
revealWebview
(
webview
:
WebviewEditorInput
,
column
:
Position
|
null
,
group
:
IEditorGroup
,
preserveFocus
:
boolean
):
void
{
if
(
!
column
||
webview
.
group
===
column
)
{
// TODO@grid [EXTENSIONS] adopt group identifier
this
.
_editorService
.
openEditor
(
webview
,
{
preserveFocus
},
column
||
webview
.
group
);
if
(
webview
.
group
===
group
.
id
)
{
this
.
_editorService
.
openEditor
(
webview
,
{
preserveFocus
},
webview
.
group
);
}
else
{
this
.
_editorGroupService
.
moveEditor
(
webview
,
webview
.
group
,
column
,
{
preserveFocus
});
this
.
_editorGroupService
.
getGroup
(
webview
.
group
).
moveEditor
(
webview
,
group
,
{
preserveFocus
});
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录