Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a5d47335
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,发现更多精彩内容 >>
提交
a5d47335
编写于
11月 06, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
web api
上级
ef351d15
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
74 addition
and
44 deletion
+74
-44
src/vs/code/browser/workbench/workbench.ts
src/vs/code/browser/workbench/workbench.ts
+20
-17
src/vs/workbench/workbench.web.api.ts
src/vs/workbench/workbench.web.api.ts
+54
-27
未找到文件。
src/vs/code/browser/workbench/workbench.ts
浏览文件 @
a5d47335
...
@@ -277,13 +277,22 @@ class WorkspaceProvider implements IWorkspaceProvider {
...
@@ -277,13 +277,22 @@ class WorkspaceProvider implements IWorkspaceProvider {
(
function
()
{
(
function
()
{
// Find config
element in
DOM
// Find config
by checking for
DOM
const
configElement
=
document
.
getElementById
(
'
vscode-workbench-web-configuration
'
);
const
configElement
=
document
.
getElementById
(
'
vscode-workbench-web-configuration
'
);
const
configElementAttribute
=
configElement
?
configElement
.
getAttribute
(
'
data-settings
'
)
:
undefined
;
const
configElementAttribute
=
configElement
?
configElement
.
getAttribute
(
'
data-settings
'
)
:
undefined
;
if
(
!
configElement
||
!
configElementAttribute
)
{
if
(
!
configElement
||
!
configElementAttribute
)
{
throw
new
Error
(
'
Missing web configuration element
'
);
throw
new
Error
(
'
Missing web configuration element
'
);
}
}
const
config
:
IWorkbenchConstructionOptions
&
{
folderUri
?:
UriComponents
,
workspaceUri
?:
UriComponents
}
=
JSON
.
parse
(
configElementAttribute
);
// Revive static extension locations
if
(
Array
.
isArray
(
config
.
staticExtensions
))
{
config
.
staticExtensions
.
forEach
(
extension
=>
{
extension
.
extensionLocation
=
URI
.
revive
(
extension
.
extensionLocation
);
});
}
// Find workspace to open and payload
// Find workspace to open and payload
let
foundWorkspace
=
false
;
let
foundWorkspace
=
false
;
let
workspace
:
IWorkspace
;
let
workspace
:
IWorkspace
;
...
@@ -319,27 +328,21 @@ class WorkspaceProvider implements IWorkspaceProvider {
...
@@ -319,27 +328,21 @@ class WorkspaceProvider implements IWorkspaceProvider {
});
});
// If no workspace is provided through the URL, check for config attribute from server
// If no workspace is provided through the URL, check for config attribute from server
const
options
:
IWorkbenchConstructionOptions
&
{
folderUri
?:
UriComponents
,
workspaceUri
?:
UriComponents
}
=
JSON
.
parse
(
configElementAttribute
);
if
(
!
foundWorkspace
)
{
if
(
!
foundWorkspace
)
{
if
(
options
.
folderUri
)
{
if
(
config
.
folderUri
)
{
workspace
=
{
folderUri
:
URI
.
revive
(
options
.
folderUri
)
};
workspace
=
{
folderUri
:
URI
.
revive
(
config
.
folderUri
)
};
}
else
if
(
options
.
workspaceUri
)
{
}
else
if
(
config
.
workspaceUri
)
{
workspace
=
{
workspaceUri
:
URI
.
revive
(
options
.
workspaceUri
)
};
workspace
=
{
workspaceUri
:
URI
.
revive
(
config
.
workspaceUri
)
};
}
else
{
}
else
{
workspace
=
undefined
;
workspace
=
undefined
;
}
}
}
}
options
.
workspaceProvider
=
new
WorkspaceProvider
(
workspace
,
payload
);
options
.
urlCallbackProvider
=
new
PollingURLCallbackProvider
();
options
.
credentialsProvider
=
new
LocalStorageCredentialsProvider
();
if
(
Array
.
isArray
(
options
.
staticExtensions
))
{
options
.
staticExtensions
.
forEach
(
extension
=>
{
extension
.
extensionLocation
=
URI
.
revive
(
extension
.
extensionLocation
);
});
}
// Finally create workbench
// Finally create workbench
create
(
document
.
body
,
options
);
create
(
document
.
body
,
{
...
config
,
workspaceProvider
:
new
WorkspaceProvider
(
workspace
,
payload
),
urlCallbackProvider
:
new
PollingURLCallbackProvider
(),
credentialsProvider
:
new
LocalStorageCredentialsProvider
()
});
})();
})();
src/vs/workbench/workbench.web.api.ts
浏览文件 @
a5d47335
...
@@ -17,32 +17,49 @@ import { Event, Emitter } from 'vs/base/common/event';
...
@@ -17,32 +17,49 @@ import { Event, Emitter } from 'vs/base/common/event';
import
{
Disposable
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Disposable
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IWorkspaceProvider
,
IWorkspace
}
from
'
vs/workbench/services/host/browser/browserHostService
'
;
import
{
IWorkspaceProvider
,
IWorkspace
}
from
'
vs/workbench/services/host/browser/browserHostService
'
;
interface
IResourceUriProvider
{
(
uri
:
URI
):
URI
;
}
interface
IStaticExtension
{
packageJSON
:
IExtensionManifest
;
extensionLocation
:
URI
;
}
interface
ICommontTelemetryPropertiesResolver
{
():
{
[
key
:
string
]:
any
};
}
interface
IExternalUriResolver
{
(
uri
:
URI
):
Promise
<
URI
>
;
}
interface
IWorkbenchConstructionOptions
{
interface
IWorkbenchConstructionOptions
{
/**
/**
*
Experimental: t
he remote authority is the IP:PORT from where the workbench is served
*
T
he remote authority is the IP:PORT from where the workbench is served
* from. It is for example being used for the websocket connections as address.
* from. It is for example being used for the websocket connections as address.
*/
*/
remoteAuthority
?:
string
;
re
adonly
re
moteAuthority
?:
string
;
/**
/**
* The connection token to send to the server.
* The connection token to send to the server.
*/
*/
connectionToken
?:
string
;
readonly
connectionToken
?:
string
;
/**
/**
*
Experimental:
An endpoint to serve iframe content ("webview") from. This is required
* An endpoint to serve iframe content ("webview") from. This is required
* to provide full security isolation from the workbench host.
* to provide full security isolation from the workbench host.
*/
*/
webviewEndpoint
?:
string
;
readonly
webviewEndpoint
?:
string
;
/**
/**
*
Experimental: a
handler for opening workspaces and providing the initial workspace.
*
A
handler for opening workspaces and providing the initial workspace.
*/
*/
workspaceProvider
?:
IWorkspaceProvider
;
readonly
workspaceProvider
?:
IWorkspaceProvider
;
/**
/**
*
Experimental: The userDataP
rovider is used to handle user specific application
*
The user data p
rovider is used to handle user specific application
* state like settings, keybindings, UI state (e.g. opened editors) and snippets.
* state like settings, keybindings, UI state (e.g. opened editors) and snippets.
*/
*/
userDataProvider
?:
IFileSystemProvider
;
userDataProvider
?:
IFileSystemProvider
;
...
@@ -50,56 +67,56 @@ interface IWorkbenchConstructionOptions {
...
@@ -50,56 +67,56 @@ interface IWorkbenchConstructionOptions {
/**
/**
* A factory for web sockets.
* A factory for web sockets.
*/
*/
webSocketFactory
?:
IWebSocketFactory
;
readonly
webSocketFactory
?:
IWebSocketFactory
;
/**
/**
* A provider for resource URIs.
* A provider for resource URIs.
*/
*/
re
sourceUriProvider
?:
(
uri
:
URI
)
=>
URI
;
re
adonly
resourceUriProvider
?:
IResourceUriProvider
;
/**
/**
*
Experimental: Whether to enable the smoke test driver
.
*
The credentials provider to store and retrieve secrets
.
*/
*/
driver
?:
boolean
;
readonly
credentialsProvider
?:
ICredentialsProvider
;
/**
/**
*
Experimental: The credentials provider to store and retrieve secrets
.
*
Add static extensions that cannot be uninstalled but only be disabled
.
*/
*/
credentialsProvider
?:
ICredentialsProvider
;
readonly
staticExtensions
?:
ReadonlyArray
<
IStaticExtension
>
;
/**
/**
*
Experimental: Add static extensions that cannot be uninstalled but only be disabled
.
*
Support for URL callbacks
.
*/
*/
staticExtensions
?:
{
packageJSON
:
IExtensionManifest
,
extensionLocation
:
URI
}[]
;
readonly
urlCallbackProvider
?:
IURLCallbackProvider
;
/**
/**
*
Experimental: Support for URL callbacks
.
*
Support for update reporting
.
*/
*/
urlCallbackProvider
?:
IURLCallback
Provider
;
readonly
updateProvider
?:
IUpdate
Provider
;
/**
/**
*
Current logging level. Default is `LogLevel.Info`
.
*
Support adding additional properties to telemetry
.
*/
*/
logLevel
?:
LogLevel
;
readonly
resolveCommonTelemetryProperties
?:
ICommontTelemetryPropertiesResolver
;
/**
/**
*
Experimental: Support for update reporting
.
*
Resolves an external uri before it is opened
.
*/
*/
updateProvider
?:
IUpdateProvid
er
;
readonly
resolveExternalUri
?:
IExternalUriResolv
er
;
/**
/**
*
Experimental: Support adding additional properties to telemetry
.
*
Current logging level. Default is `LogLevel.Info`
.
*/
*/
re
solveCommonTelemetryProperties
?:
()
=>
{
[
key
:
string
]:
any
}
;
re
adonly
logLevel
?:
LogLevel
;
/**
/**
*
Experimental: Resolves an external uri before it is opened
.
*
Whether to enable the smoke test driver
.
*/
*/
readonly
resolveExternalUri
?:
(
uri
:
URI
)
=>
Promise
<
URI
>
;
readonly
driver
?:
boolean
;
}
}
/**
/**
*
Experimental:
Creates the workbench with the provided options in the provided container.
* Creates the workbench with the provided options in the provided container.
*
*
* @param domElement the container to create the workbench in
* @param domElement the container to create the workbench in
* @param options for setting up the workbench
* @param options for setting up the workbench
...
@@ -136,10 +153,14 @@ export {
...
@@ -136,10 +153,14 @@ export {
IWebSocketFactory
,
IWebSocketFactory
,
IWebSocket
,
IWebSocket
,
// Resources
IResourceUriProvider
,
// Credentials
// Credentials
ICredentialsProvider
,
ICredentialsProvider
,
// Static Extensions
// Static Extensions
IStaticExtension
,
IExtensionManifest
,
IExtensionManifest
,
// Callbacks
// Callbacks
...
@@ -151,4 +172,10 @@ export {
...
@@ -151,4 +172,10 @@ export {
// Updates
// Updates
IUpdateProvider
,
IUpdateProvider
,
IUpdate
,
IUpdate
,
// Telemetry
ICommontTelemetryPropertiesResolver
,
// External Uris
IExternalUriResolver
};
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录