Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2d3727b3
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,发现更多精彩内容 >>
提交
2d3727b3
编写于
9月 10, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Push `editorResource` concept back into `CustomFileEditorInput`
上级
6f459807
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
27 addition
and
20 deletion
+27
-20
src/vs/workbench/api/browser/mainThreadWebview.ts
src/vs/workbench/api/browser/mainThreadWebview.ts
+4
-4
src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts
...rkbench/contrib/customEditor/browser/customEditorInput.ts
+16
-6
src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.ts
.../contrib/customEditor/browser/customEditorInputFactory.ts
+1
-1
src/vs/workbench/contrib/customEditor/browser/customEditors.ts
...s/workbench/contrib/customEditor/browser/customEditors.ts
+1
-1
src/vs/workbench/contrib/webview/browser/webviewEditorInput.ts
...s/workbench/contrib/webview/browser/webviewEditorInput.ts
+4
-7
src/vs/workbench/contrib/webview/browser/webviewEditorService.ts
...workbench/contrib/webview/browser/webviewEditorService.ts
+1
-1
未找到文件。
src/vs/workbench/api/browser/mainThreadWebview.ts
浏览文件 @
2d3727b3
...
@@ -99,7 +99,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
...
@@ -99,7 +99,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
// This should trigger the real reviver to be registered from the extension host side.
// This should trigger the real reviver to be registered from the extension host side.
this
.
_register
(
_webviewEditorService
.
registerResolver
({
this
.
_register
(
_webviewEditorService
.
registerResolver
({
canResolve
:
(
webview
:
WebviewEditorInput
)
=>
{
canResolve
:
(
webview
:
WebviewEditorInput
)
=>
{
if
(
!
webview
.
webview
.
state
&&
!
webview
.
editorResource
)
{
if
(
!
webview
.
webview
.
state
&&
webview
.
getTypeId
()
===
WebviewEditorInput
.
typeId
)
{
// TODO: The typeid check is a workaround for the CustomFileEditorInput case
return
false
;
return
false
;
}
}
...
@@ -252,16 +252,16 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
...
@@ -252,16 +252,16 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
this
.
_editorProviders
.
set
(
viewType
,
this
.
_webviewEditorService
.
registerResolver
({
this
.
_editorProviders
.
set
(
viewType
,
this
.
_webviewEditorService
.
registerResolver
({
canResolve
:
(
webviewEditorInput
)
=>
{
canResolve
:
(
webviewEditorInput
)
=>
{
return
!!
webviewEditorInput
.
editorResource
&&
webviewEditorInput
.
viewType
===
viewType
;
return
webviewEditorInput
.
getTypeId
()
!==
WebviewEditorInput
.
typeId
&&
webviewEditorInput
.
viewType
===
viewType
;
},
},
resolveWebview
:
async
(
webview
:
WebviewEditorInput
)
=>
{
resolveWebview
:
async
(
webview
)
=>
{
const
handle
=
`resolved-
${
MainThreadWebviews
.
revivalPool
++
}
`
;
const
handle
=
`resolved-
${
MainThreadWebviews
.
revivalPool
++
}
`
;
this
.
_webviewEditorInputs
.
add
(
handle
,
webview
);
this
.
_webviewEditorInputs
.
add
(
handle
,
webview
);
this
.
hookupWebviewEventDelegate
(
handle
,
webview
);
this
.
hookupWebviewEventDelegate
(
handle
,
webview
);
try
{
try
{
await
this
.
_proxy
.
$resolveWebviewEditor
(
await
this
.
_proxy
.
$resolveWebviewEditor
(
webview
.
editorResource
,
webview
.
getResource
()
,
handle
,
handle
,
viewType
,
viewType
,
webview
.
getTitle
(),
webview
.
getTitle
(),
...
...
src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts
浏览文件 @
2d3727b3
...
@@ -20,6 +20,7 @@ export class CustomFileEditorInput extends WebviewEditorInput {
...
@@ -20,6 +20,7 @@ export class CustomFileEditorInput extends WebviewEditorInput {
private
name
?:
string
;
private
name
?:
string
;
private
_hasResolved
=
false
;
private
_hasResolved
=
false
;
private
readonly
_editorResource
:
URI
;
constructor
(
constructor
(
resource
:
URI
,
resource
:
URI
,
...
@@ -33,12 +34,21 @@ export class CustomFileEditorInput extends WebviewEditorInput {
...
@@ -33,12 +34,21 @@ export class CustomFileEditorInput extends WebviewEditorInput {
@
IExtensionService
@
IExtensionService
private
readonly
_extensionService
:
IExtensionService
private
readonly
_extensionService
:
IExtensionService
)
{
)
{
super
(
id
,
viewType
,
''
,
undefined
,
webview
,
resource
);
super
(
id
,
viewType
,
''
,
undefined
,
webview
);
this
.
_editorResource
=
resource
;
}
public
getTypeId
():
string
{
return
CustomFileEditorInput
.
typeId
;
}
public
getResource
():
URI
{
return
this
.
_editorResource
;
}
}
getName
():
string
{
getName
():
string
{
if
(
!
this
.
name
)
{
if
(
!
this
.
name
)
{
this
.
name
=
basename
(
this
.
labelService
.
getUriLabel
(
this
.
editorResource
));
this
.
name
=
basename
(
this
.
labelService
.
getUriLabel
(
this
.
getResource
()
));
}
}
return
this
.
name
;
return
this
.
name
;
}
}
...
@@ -46,7 +56,7 @@ export class CustomFileEditorInput extends WebviewEditorInput {
...
@@ -46,7 +56,7 @@ export class CustomFileEditorInput extends WebviewEditorInput {
matches
(
other
:
IEditorInput
):
boolean
{
matches
(
other
:
IEditorInput
):
boolean
{
return
this
===
other
||
(
other
instanceof
CustomFileEditorInput
return
this
===
other
||
(
other
instanceof
CustomFileEditorInput
&&
this
.
viewType
===
other
.
viewType
&&
this
.
viewType
===
other
.
viewType
&&
this
.
editorResource
.
toString
()
===
other
.
editorResource
.
toString
());
&&
this
.
getResource
().
toString
()
===
other
.
getResource
()
.
toString
());
}
}
@
memoize
@
memoize
...
@@ -56,15 +66,15 @@ export class CustomFileEditorInput extends WebviewEditorInput {
...
@@ -56,15 +66,15 @@ export class CustomFileEditorInput extends WebviewEditorInput {
@
memoize
@
memoize
private
get
mediumTitle
():
string
{
private
get
mediumTitle
():
string
{
return
this
.
labelService
.
getUriLabel
(
this
.
editorResource
,
{
relative
:
true
});
return
this
.
labelService
.
getUriLabel
(
this
.
getResource
()
,
{
relative
:
true
});
}
}
@
memoize
@
memoize
private
get
longTitle
():
string
{
private
get
longTitle
():
string
{
return
this
.
labelService
.
getUriLabel
(
this
.
editorResource
);
return
this
.
labelService
.
getUriLabel
(
this
.
getResource
()
);
}
}
getTitle
(
verbosity
:
Verbosity
):
string
{
getTitle
(
verbosity
?
:
Verbosity
):
string
{
switch
(
verbosity
)
{
switch
(
verbosity
)
{
case
Verbosity
.
SHORT
:
case
Verbosity
.
SHORT
:
return
this
.
shortTitle
;
return
this
.
shortTitle
;
...
...
src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.ts
浏览文件 @
2d3727b3
...
@@ -25,7 +25,7 @@ export class CustomEditoInputFactory extends WebviewEditorInputFactory {
...
@@ -25,7 +25,7 @@ export class CustomEditoInputFactory extends WebviewEditorInputFactory {
public
serialize
(
input
:
CustomFileEditorInput
):
string
|
undefined
{
public
serialize
(
input
:
CustomFileEditorInput
):
string
|
undefined
{
const
data
=
{
const
data
=
{
...
this
.
toJson
(
input
),
...
this
.
toJson
(
input
),
editorResource
:
input
.
editorResource
.
toJSON
()
editorResource
:
input
.
getResource
()
.
toJSON
()
};
};
try
{
try
{
...
...
src/vs/workbench/contrib/customEditor/browser/customEditors.ts
浏览文件 @
2d3727b3
...
@@ -157,7 +157,7 @@ export class CustomEditorContribution implements IWorkbenchContribution {
...
@@ -157,7 +157,7 @@ export class CustomEditorContribution implements IWorkbenchContribution {
}
}
for
(
const
input
of
group
.
editors
)
{
for
(
const
input
of
group
.
editors
)
{
if
(
input
instanceof
CustomFileEditorInput
&&
input
.
editorResource
.
toString
()
===
resource
.
toString
())
{
if
(
input
instanceof
CustomFileEditorInput
&&
input
.
getResource
()
.
toString
()
===
resource
.
toString
())
{
return
{
return
{
override
:
group
.
openEditor
(
input
,
options
).
then
(
withNullAsUndefined
)
override
:
group
.
openEditor
(
input
,
options
).
then
(
withNullAsUndefined
)
};
};
...
...
src/vs/workbench/contrib/webview/browser/webviewEditorInput.ts
浏览文件 @
2d3727b3
...
@@ -71,8 +71,7 @@ export class WebviewEditorInput extends EditorInput {
...
@@ -71,8 +71,7 @@ export class WebviewEditorInput extends EditorInput {
readonly
location
:
URI
;
readonly
location
:
URI
;
readonly
id
:
ExtensionIdentifier
;
readonly
id
:
ExtensionIdentifier
;
},
},
webview
:
Unowned
<
WebviewEditorOverlay
>
,
webview
:
Unowned
<
WebviewEditorOverlay
>
public
readonly
editorResource
:
URI
,
)
{
)
{
super
();
super
();
...
@@ -89,8 +88,7 @@ export class WebviewEditorInput extends EditorInput {
...
@@ -89,8 +88,7 @@ export class WebviewEditorInput extends EditorInput {
public
getResource
():
URI
{
public
getResource
():
URI
{
return
URI
.
from
({
return
URI
.
from
({
scheme
:
WebviewPanelResourceScheme
,
scheme
:
WebviewPanelResourceScheme
,
path
:
`webview-panel/webview-
${
this
.
id
}
`
,
path
:
`webview-panel/webview-
${
this
.
id
}
`
query
:
this
.
editorResource
?
encodeURIComponent
(
this
.
editorResource
.
toString
(
true
))
:
''
});
});
}
}
...
@@ -157,10 +155,9 @@ export class RevivedWebviewEditorInput extends WebviewEditorInput {
...
@@ -157,10 +155,9 @@ export class RevivedWebviewEditorInput extends WebviewEditorInput {
readonly
id
:
ExtensionIdentifier
readonly
id
:
ExtensionIdentifier
},
},
private
readonly
reviver
:
(
input
:
WebviewEditorInput
)
=>
Promise
<
void
>
,
private
readonly
reviver
:
(
input
:
WebviewEditorInput
)
=>
Promise
<
void
>
,
webview
:
Unowned
<
WebviewEditorOverlay
>
,
webview
:
Unowned
<
WebviewEditorOverlay
>
public
readonly
editorResource
:
URI
,
)
{
)
{
super
(
id
,
viewType
,
name
,
extension
,
webview
,
editorResource
);
super
(
id
,
viewType
,
name
,
extension
,
webview
);
}
}
public
async
resolve
():
Promise
<
IEditorModel
>
{
public
async
resolve
():
Promise
<
IEditorModel
>
{
...
...
src/vs/workbench/contrib/webview/browser/webviewEditorService.ts
浏览文件 @
2d3727b3
...
@@ -208,7 +208,7 @@ export class WebviewEditorService implements IWebviewEditorService {
...
@@ -208,7 +208,7 @@ export class WebviewEditorService implements IWebviewEditorService {
const
promise
=
new
Promise
<
void
>
(
r
=>
{
resolve
=
r
;
});
const
promise
=
new
Promise
<
void
>
(
r
=>
{
resolve
=
r
;
});
this
.
_revivalPool
.
add
(
webview
,
resolve
!
);
this
.
_revivalPool
.
add
(
webview
,
resolve
!
);
return
promise
;
return
promise
;
},
new
UnownedDisposable
(
webview
)
,
null
!
/*TODO*/
);
},
new
UnownedDisposable
(
webview
));
webviewInput
.
iconPath
=
iconPath
;
webviewInput
.
iconPath
=
iconPath
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录