Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
caf39c78
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,发现更多精彩内容 >>
提交
caf39c78
编写于
10月 29, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delay updateStyleSheet until we are starting the workbench
上级
16ee9639
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
13 deletion
+23
-13
src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts
...rkbench/contrib/customEditor/browser/customEditorInput.ts
+3
-1
src/vs/workbench/contrib/webview/browser/webviewEditorInput.ts
...s/workbench/contrib/webview/browser/webviewEditorInput.ts
+10
-5
src/vs/workbench/contrib/webview/browser/webviewWorkbenchService.ts
...kbench/contrib/webview/browser/webviewWorkbenchService.ts
+10
-7
未找到文件。
src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts
浏览文件 @
caf39c78
...
...
@@ -14,6 +14,7 @@ import { URI } from 'vs/base/common/uri';
import
{
WebviewContentState
}
from
'
vs/editor/common/modes
'
;
import
{
IDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
ConfirmResult
,
IEditorInput
,
Verbosity
}
from
'
vs/workbench/common/editor
'
;
import
{
WebviewEditorOverlay
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
{
IWebviewWorkbenchService
,
LazilyResolvedWebviewEditorInput
}
from
'
vs/workbench/contrib/webview/browser/webviewWorkbenchService
'
;
...
...
@@ -31,11 +32,12 @@ export class CustomFileEditorInput extends LazilyResolvedWebviewEditorInput {
viewType
:
string
,
id
:
string
,
webview
:
Lazy
<
UnownedDisposable
<
WebviewEditorOverlay
>>
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IWebviewWorkbenchService
webviewWorkbenchService
:
IWebviewWorkbenchService
,
@
IDialogService
private
readonly
dialogService
:
IDialogService
,
@
ILabelService
private
readonly
labelService
:
ILabelService
,
)
{
super
(
id
,
viewType
,
''
,
webview
,
webviewWorkbenchService
);
super
(
id
,
viewType
,
''
,
webview
,
webviewWorkbenchService
,
lifecycleService
);
this
.
_editorResource
=
resource
;
}
...
...
src/vs/workbench/contrib/webview/browser/webviewEditorInput.ts
浏览文件 @
caf39c78
...
...
@@ -9,6 +9,7 @@ import { Lazy } from 'vs/base/common/lazy';
import
{
UnownedDisposable
as
Unowned
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IEditorModel
}
from
'
vs/platform/editor/common/editor
'
;
import
{
ILifecycleService
,
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
EditorInput
,
EditorModel
,
GroupIdentifier
,
IEditorInput
,
Verbosity
}
from
'
vs/workbench/common/editor
'
;
import
{
WebviewEditorOverlay
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
...
...
@@ -17,6 +18,7 @@ const WebviewPanelResourceScheme = 'webview-panel';
class
WebviewIconsManager
{
private
readonly
_icons
=
new
Map
<
string
,
{
light
:
URI
,
dark
:
URI
}
>
();
@
memoize
private
get
_styleElement
():
HTMLStyleElement
{
const
element
=
dom
.
createStyleSheet
();
...
...
@@ -26,7 +28,8 @@ class WebviewIconsManager {
public
setIcons
(
webviewId
:
string
,
iconPath
:
{
light
:
URI
,
dark
:
URI
}
|
undefined
iconPath
:
{
light
:
URI
,
dark
:
URI
}
|
undefined
,
lifecycleService
:
ILifecycleService
,
)
{
if
(
iconPath
)
{
this
.
_icons
.
set
(
webviewId
,
iconPath
);
...
...
@@ -34,10 +37,11 @@ class WebviewIconsManager {
this
.
_icons
.
delete
(
webviewId
);
}
this
.
updateStyleSheet
();
this
.
updateStyleSheet
(
lifecycleService
);
}
private
updateStyleSheet
()
{
private
async
updateStyleSheet
(
lifecycleService
:
ILifecycleService
,
)
{
await
lifecycleService
.
when
(
LifecyclePhase
.
Starting
);
const
cssRules
:
string
[]
=
[];
this
.
_icons
.
forEach
((
value
,
key
)
=>
{
const
webviewSelector
=
`.show-file-icons .webview-
${
key
}
-name-file-icon::before`
;
...
...
@@ -67,7 +71,8 @@ export class WebviewInput extends EditorInput {
public
readonly
id
:
string
,
public
readonly
viewType
:
string
,
name
:
string
,
webview
:
Lazy
<
Unowned
<
WebviewEditorOverlay
>>
webview
:
Lazy
<
Unowned
<
WebviewEditorOverlay
>>
,
@
ILifecycleService
private
readonly
lifecycleService
:
ILifecycleService
,
)
{
super
();
...
...
@@ -118,7 +123,7 @@ export class WebviewInput extends EditorInput {
public
set
iconPath
(
value
:
{
light
:
URI
,
dark
:
URI
}
|
undefined
)
{
this
.
_iconPath
=
value
;
WebviewInput
.
iconsManager
.
setIcons
(
this
.
id
,
value
);
WebviewInput
.
iconsManager
.
setIcons
(
this
.
id
,
value
,
this
.
lifecycleService
);
}
public
matches
(
other
:
IEditorInput
):
boolean
{
...
...
src/vs/workbench/contrib/webview/browser/webviewWorkbenchService.ts
浏览文件 @
caf39c78
...
...
@@ -5,19 +5,20 @@
import
{
equals
}
from
'
vs/base/common/arrays
'
;
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
import
{
Lazy
}
from
'
vs/base/common/lazy
'
;
import
{
IDisposable
,
toDisposable
,
UnownedDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
values
}
from
'
vs/base/common/map
'
;
import
{
isEqual
}
from
'
vs/base/common/resources
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
EditorActivation
,
IEditorModel
}
from
'
vs/platform/editor/common/editor
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
createDecorator
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
GroupIdentifier
}
from
'
vs/workbench/common/editor
'
;
import
{
IWebviewService
,
WebviewContentOptions
,
WebviewEditorOverlay
,
Webview
Options
,
WebviewExtensionDescription
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
{
IWebviewService
,
WebviewContentOptions
,
WebviewEditorOverlay
,
Webview
ExtensionDescription
,
WebviewOptions
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
{
IEditorGroup
,
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
ACTIVE_GROUP_TYPE
,
IEditorService
,
SIDE_GROUP_TYPE
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
WebviewInput
}
from
'
./webviewEditorInput
'
;
import
{
Lazy
}
from
'
vs/base/common/lazy
'
;
export
const
IWebviewWorkbenchService
=
createDecorator
<
IWebviewWorkbenchService
>
(
'
webviewEditorService
'
);
...
...
@@ -109,8 +110,9 @@ export class LazilyResolvedWebviewEditorInput extends WebviewInput {
name
:
string
,
webview
:
Lazy
<
UnownedDisposable
<
WebviewEditorOverlay
>>
,
@
IWebviewWorkbenchService
private
readonly
_webviewWorkbenchService
:
IWebviewWorkbenchService
,
@
ILifecycleService
lifeCycleService
:
ILifecycleService
,
)
{
super
(
id
,
viewType
,
name
,
webview
);
super
(
id
,
viewType
,
name
,
webview
,
lifeCycleService
);
}
@
memoize
...
...
@@ -145,8 +147,9 @@ export class WebviewEditorService implements IWebviewWorkbenchService {
private
readonly
_revivalPool
=
new
RevivalPool
();
constructor
(
@
IEditorService
private
readonly
_editorService
:
IEditorService
,
@
IEditorGroupsService
private
readonly
_editorGroupService
:
IEditorGroupsService
,
@
IEditorService
private
readonly
_editorService
:
IEditorService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
IWebviewService
private
readonly
_webviewService
:
IWebviewService
,
)
{
}
...
...
@@ -159,7 +162,7 @@ export class WebviewEditorService implements IWebviewWorkbenchService {
extension
:
WebviewExtensionDescription
|
undefined
,
):
WebviewInput
{
const
webview
=
new
Lazy
(()
=>
new
UnownedDisposable
(
this
.
createWebiew
(
id
,
extension
,
options
)));
const
webviewInput
=
new
WebviewInput
(
id
,
viewType
,
title
,
webview
);
const
webviewInput
=
this
.
_instantiationService
.
createInstance
(
WebviewInput
,
id
,
viewType
,
title
,
webview
);
this
.
_editorService
.
openEditor
(
webviewInput
,
{
pinned
:
true
,
preserveFocus
:
showOptions
.
preserveFocus
,
...
...
@@ -206,7 +209,7 @@ export class WebviewEditorService implements IWebviewWorkbenchService {
return
new
UnownedDisposable
(
webview
);
});
const
webviewInput
=
new
LazilyResolvedWebviewEditorInput
(
id
,
viewType
,
title
,
webview
,
this
);
const
webviewInput
=
this
.
_instantiationService
.
createInstance
(
LazilyResolvedWebviewEditorInput
,
id
,
viewType
,
title
,
webview
);
webviewInput
.
iconPath
=
iconPath
;
if
(
typeof
group
===
'
number
'
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录