Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f8870d79
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,发现更多精彩内容 >>
提交
f8870d79
编写于
7月 24, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting and extration
上级
bf4a68a2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
12 deletion
+18
-12
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+1
-1
src/vs/workbench/api/node/extHostWebview.ts
src/vs/workbench/api/node/extHostWebview.ts
+17
-11
未找到文件。
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
f8870d79
...
@@ -425,7 +425,7 @@ export function createApiFactory(
...
@@ -425,7 +425,7 @@ export function createApiFactory(
return
extHostOutputService
.
createOutputChannel
(
name
);
return
extHostOutputService
.
createOutputChannel
(
name
);
},
},
createWebviewPanel
(
viewType
:
string
,
title
:
string
,
showOptions
:
vscode
.
ViewColumn
|
{
viewColumn
:
vscode
.
ViewColumn
,
preserveFocus
?:
boolean
},
options
:
vscode
.
WebviewPanelOptions
&
vscode
.
WebviewOptions
):
vscode
.
WebviewPanel
{
createWebviewPanel
(
viewType
:
string
,
title
:
string
,
showOptions
:
vscode
.
ViewColumn
|
{
viewColumn
:
vscode
.
ViewColumn
,
preserveFocus
?:
boolean
},
options
:
vscode
.
WebviewPanelOptions
&
vscode
.
WebviewOptions
):
vscode
.
WebviewPanel
{
return
extHostWebviews
.
createWebview
(
viewType
,
title
,
showOptions
,
options
,
extension
.
extensionLocation
);
return
extHostWebviews
.
createWebview
(
extension
.
extensionLocation
,
viewType
,
title
,
showOptions
,
options
);
},
},
createTerminal
(
nameOrOptions
:
vscode
.
TerminalOptions
|
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
vscode
.
Terminal
{
createTerminal
(
nameOrOptions
:
vscode
.
TerminalOptions
|
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
vscode
.
Terminal
{
if
(
typeof
nameOrOptions
===
'
object
'
)
{
if
(
typeof
nameOrOptions
===
'
object
'
)
{
...
...
src/vs/workbench/api/node/extHostWebview.ts
浏览文件 @
f8870d79
...
@@ -12,7 +12,6 @@ import * as vscode from 'vscode';
...
@@ -12,7 +12,6 @@ import * as vscode from 'vscode';
import
{
ExtHostWebviewsShape
,
IMainContext
,
MainContext
,
MainThreadWebviewsShape
,
WebviewPanelHandle
,
WebviewPanelViewState
}
from
'
./extHost.protocol
'
;
import
{
ExtHostWebviewsShape
,
IMainContext
,
MainContext
,
MainThreadWebviewsShape
,
WebviewPanelHandle
,
WebviewPanelViewState
}
from
'
./extHost.protocol
'
;
import
{
Disposable
}
from
'
./extHostTypes
'
;
import
{
Disposable
}
from
'
./extHostTypes
'
;
type
IconPath
=
URI
|
{
light
:
URI
,
dark
:
URI
};
type
IconPath
=
URI
|
{
light
:
URI
,
dark
:
URI
};
export
class
ExtHostWebview
implements
vscode
.
Webview
{
export
class
ExtHostWebview
implements
vscode
.
Webview
{
...
@@ -224,8 +223,11 @@ export class ExtHostWebviewPanel implements vscode.WebviewPanel {
...
@@ -224,8 +223,11 @@ export class ExtHostWebviewPanel implements vscode.WebviewPanel {
export
class
ExtHostWebviews
implements
ExtHostWebviewsShape
{
export
class
ExtHostWebviews
implements
ExtHostWebviewsShape
{
private
static
webviewHandlePool
=
1
;
private
static
webviewHandlePool
=
1
;
private
readonly
_proxy
:
MainThreadWebviewsShape
;
private
static
newHandle
():
WebviewPanelHandle
{
return
ExtHostWebviews
.
webviewHandlePool
++
+
''
;
}
private
readonly
_proxy
:
MainThreadWebviewsShape
;
private
readonly
_webviewPanels
=
new
Map
<
WebviewPanelHandle
,
ExtHostWebviewPanel
>
();
private
readonly
_webviewPanels
=
new
Map
<
WebviewPanelHandle
,
ExtHostWebviewPanel
>
();
private
readonly
_serializers
=
new
Map
<
string
,
vscode
.
WebviewPanelSerializer
>
();
private
readonly
_serializers
=
new
Map
<
string
,
vscode
.
WebviewPanelSerializer
>
();
...
@@ -235,22 +237,20 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
...
@@ -235,22 +237,20 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
this
.
_proxy
=
mainContext
.
getProxy
(
MainContext
.
MainThreadWebviews
);
this
.
_proxy
=
mainContext
.
getProxy
(
MainContext
.
MainThreadWebviews
);
}
}
createWebview
(
public
createWebview
(
extensionLocation
:
URI
,
viewType
:
string
,
viewType
:
string
,
title
:
string
,
title
:
string
,
showOptions
:
vscode
.
ViewColumn
|
{
viewColumn
:
vscode
.
ViewColumn
,
preserveFocus
?:
boolean
},
showOptions
:
vscode
.
ViewColumn
|
{
viewColumn
:
vscode
.
ViewColumn
,
preserveFocus
?:
boolean
},
options
:
(
vscode
.
WebviewPanelOptions
&
vscode
.
WebviewOptions
)
|
undefined
,
options
:
(
vscode
.
WebviewPanelOptions
&
vscode
.
WebviewOptions
)
=
{},
extensionLocation
:
URI
):
vscode
.
WebviewPanel
{
):
vscode
.
WebviewPanel
{
options
=
options
||
{};
const
viewColumn
=
typeof
showOptions
===
'
object
'
?
showOptions
.
viewColumn
:
showOptions
;
const
viewColumn
=
typeof
showOptions
===
'
object
'
?
showOptions
.
viewColumn
:
showOptions
;
const
webviewShowOptions
=
{
const
webviewShowOptions
=
{
viewColumn
:
typeConverters
.
ViewColumn
.
from
(
viewColumn
),
viewColumn
:
typeConverters
.
ViewColumn
.
from
(
viewColumn
),
preserveFocus
:
typeof
showOptions
===
'
object
'
&&
!!
showOptions
.
preserveFocus
preserveFocus
:
typeof
showOptions
===
'
object
'
&&
!!
showOptions
.
preserveFocus
};
};
const
handle
=
ExtHostWebviews
.
webviewHandlePool
++
+
''
;
const
handle
=
ExtHostWebviews
.
newHandle
()
;
this
.
_proxy
.
$createWebviewPanel
(
handle
,
viewType
,
title
,
webviewShowOptions
,
options
,
extensionLocation
);
this
.
_proxy
.
$createWebviewPanel
(
handle
,
viewType
,
title
,
webviewShowOptions
,
options
,
extensionLocation
);
const
webview
=
new
ExtHostWebview
(
handle
,
this
.
_proxy
,
options
);
const
webview
=
new
ExtHostWebview
(
handle
,
this
.
_proxy
,
options
);
...
@@ -259,7 +259,7 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
...
@@ -259,7 +259,7 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
return
panel
;
return
panel
;
}
}
registerWebviewPanelSerializer
(
public
registerWebviewPanelSerializer
(
viewType
:
string
,
viewType
:
string
,
serializer
:
vscode
.
WebviewPanelSerializer
serializer
:
vscode
.
WebviewPanelSerializer
):
vscode
.
Disposable
{
):
vscode
.
Disposable
{
...
@@ -276,14 +276,20 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
...
@@ -276,14 +276,20 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
});
});
}
}
$onMessage
(
handle
:
WebviewPanelHandle
,
message
:
any
):
void
{
public
$onMessage
(
handle
:
WebviewPanelHandle
,
message
:
any
):
void
{
const
panel
=
this
.
getWebviewPanel
(
handle
);
const
panel
=
this
.
getWebviewPanel
(
handle
);
if
(
panel
)
{
if
(
panel
)
{
panel
.
webview
.
_onMessageEmitter
.
fire
(
message
);
panel
.
webview
.
_onMessageEmitter
.
fire
(
message
);
}
}
}
}
$onDidChangeWebviewPanelViewState
(
handle
:
WebviewPanelHandle
,
newState
:
WebviewPanelViewState
):
void
{
public
$onDidChangeWebviewPanelViewState
(
handle
:
WebviewPanelHandle
,
newState
:
WebviewPanelViewState
):
void
{
const
panel
=
this
.
getWebviewPanel
(
handle
);
const
panel
=
this
.
getWebviewPanel
(
handle
);
if
(
panel
)
{
if
(
panel
)
{
const
viewColumn
=
typeConverters
.
ViewColumn
.
to
(
newState
.
position
);
const
viewColumn
=
typeConverters
.
ViewColumn
.
to
(
newState
.
position
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录