Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
21ce78cf
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,发现更多精彩内容 >>
提交
21ce78cf
编写于
8月 24, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
web - lift product config to be proper API
上级
b4679a37
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
51 addition
and
40 deletion
+51
-40
src/vs/code/browser/workbench/workbench.html
src/vs/code/browser/workbench/workbench.html
+1
-2
src/vs/workbench/browser/web.main.ts
src/vs/workbench/browser/web.main.ts
+44
-38
src/vs/workbench/workbench.web.api.ts
src/vs/workbench/workbench.web.api.ts
+6
-0
未找到文件。
src/vs/code/browser/workbench/workbench.html
浏览文件 @
21ce78cf
...
...
@@ -16,9 +16,8 @@
<!-- Workbench Configuration -->
<meta
id=
"vscode-workbench-web-configuration"
data-settings=
"{{WORKBENCH_WEB_CONGIGURATION}}"
>
<!-- Workarounds/Hacks (remote user data uri
, product configuration
) -->
<!-- Workarounds/Hacks (remote user data uri) -->
<meta
id=
"vscode-remote-user-data-uri"
data-settings=
"{{REMOTE_USER_DATA_URI}}"
>
<meta
id=
"vscode-remote-product-configuration"
data-settings=
"{{PRODUCT_CONFIGURATION}}"
>
<!-- Workbench Icon/CSS -->
<link
rel=
"icon"
href=
"/favicon.ico"
type=
"image/x-icon"
/>
...
...
src/vs/workbench/browser/web.main.ts
浏览文件 @
21ce78cf
...
...
@@ -18,7 +18,7 @@ import { RemoteAgentService } from 'vs/workbench/services/remote/browser/remoteA
import
{
RemoteAuthorityResolverService
}
from
'
vs/platform/remote/browser/remoteAuthorityResolverService
'
;
import
{
IRemoteAuthorityResolverService
}
from
'
vs/platform/remote/common/remoteAuthorityResolver
'
;
import
{
IRemoteAgentService
}
from
'
vs/workbench/services/remote/common/remoteAgentService
'
;
import
{
IFileService
,
IFileSystemProvider
}
from
'
vs/platform/files/common/files
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
FileService
}
from
'
vs/platform/files/common/fileService
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
...
...
@@ -124,7 +124,7 @@ class CodeRendererMain extends Disposable {
const
logService
=
new
BufferLogService
();
serviceCollection
.
set
(
ILogService
,
logService
);
const
payload
=
await
this
.
resolveWorkspaceInitializationPayload
();
const
payload
=
this
.
resolveWorkspaceInitializationPayload
();
// Environment
const
environmentService
=
new
BrowserWorkbenchEnvironmentService
({
workspaceId
:
payload
.
id
,
logsPath
,
...
this
.
configuration
});
...
...
@@ -149,6 +149,34 @@ class CodeRendererMain extends Disposable {
// Files
const
fileService
=
this
.
_register
(
new
FileService
(
logService
));
serviceCollection
.
set
(
IFileService
,
fileService
);
this
.
registerFileSystemProviders
(
environmentService
,
fileService
,
remoteAgentService
,
logService
,
logsPath
);
// Long running services (workspace, config, storage)
const
services
=
await
Promise
.
all
([
this
.
createWorkspaceService
(
payload
,
environmentService
,
fileService
,
remoteAgentService
,
logService
).
then
(
service
=>
{
// Workspace
serviceCollection
.
set
(
IWorkspaceContextService
,
service
);
// Configuration
serviceCollection
.
set
(
IConfigurationService
,
service
);
return
service
;
}),
this
.
createStorageService
(
payload
,
environmentService
,
fileService
,
logService
).
then
(
service
=>
{
// Storage
serviceCollection
.
set
(
IStorageService
,
service
);
return
service
;
})
]);
return
{
serviceCollection
,
logService
,
storageService
:
services
[
1
]
};
}
private
registerFileSystemProviders
(
environmentService
:
IWorkbenchEnvironmentService
,
fileService
:
IFileService
,
remoteAgentService
:
IRemoteAgentService
,
logService
:
BufferLogService
,
logsPath
:
URI
):
void
{
// Logger
const
indexedDBLogProvider
=
new
IndexedDBLogProvider
(
logsPath
.
scheme
);
...
...
@@ -169,61 +197,38 @@ class CodeRendererMain extends Disposable {
logService
.
logger
=
new
MultiplexLogService
([
consoleLogService
,
fileLogService
]);
})();
// User Data Provider
let
userDataProvider
:
IFileSystemProvider
|
undefined
=
this
.
configuration
.
userDataProvider
;
const
connection
=
remoteAgentService
.
getConnection
();
if
(
connection
)
{
// Remote file system
const
channel
=
connection
.
getChannel
<
IChannel
>
(
REMOTE_FILE_SYSTEM_CHANNEL_NAME
);
const
remoteFileSystemProvider
=
this
.
_register
(
new
RemoteExtensionsFileSystemProvider
(
channel
,
remoteAgentService
.
getEnvironment
()));
fileService
.
registerProvider
(
Schemas
.
vscodeRemote
,
remoteFileSystemProvider
);
if
(
!
userDataProvider
)
{
if
(
!
this
.
configuration
.
userDataProvider
)
{
const
remoteUserDataUri
=
this
.
getRemoteUserDataUri
();
if
(
remoteUserDataUri
)
{
userDataProvider
=
this
.
_register
(
new
FileUserDataProvider
(
remoteUserDataUri
,
joinPath
(
remoteUserDataUri
,
BACKUPS
),
remoteFileSystemProvider
,
environmentService
));
this
.
configuration
.
userDataProvider
=
this
.
_register
(
new
FileUserDataProvider
(
remoteUserDataUri
,
joinPath
(
remoteUserDataUri
,
BACKUPS
),
remoteFileSystemProvider
,
environmentService
));
}
}
}
if
(
!
userDataProvider
)
{
userDataProvider
=
this
.
_register
(
new
InMemoryUserDataProvider
());
}
fileService
.
registerProvider
(
Schemas
.
userData
,
userDataProvider
);
// Long running services (workspace, config, storage)
const
services
=
await
Promise
.
all
([
this
.
createWorkspaceService
(
payload
,
environmentService
,
fileService
,
remoteAgentService
,
logService
).
then
(
service
=>
{
// Workspace
serviceCollection
.
set
(
IWorkspaceContextService
,
service
);
// Configuration
serviceCollection
.
set
(
IConfigurationService
,
service
);
return
service
;
}),
this
.
createStorageService
(
payload
,
environmentService
,
fileService
,
logService
).
then
(
service
=>
{
// Storage
serviceCollection
.
set
(
IStorageService
,
service
);
return
service
;
})
]);
return
{
serviceCollection
,
logService
,
storageService
:
services
[
1
]
};
// User data
if
(
!
this
.
configuration
.
userDataProvider
)
{
this
.
configuration
.
userDataProvider
=
this
.
_register
(
new
InMemoryUserDataProvider
());
}
fileService
.
registerProvider
(
Schemas
.
userData
,
this
.
configuration
.
userDataProvider
);
}
private
createProductService
():
IProductService
{
const
element
=
document
.
getElementById
(
'
vscode-remote-product-configuration
'
);
const
productConfiguration
:
IProductConfiguration
=
{
...
element
?
JSON
.
parse
(
element
.
getAttribute
(
'
data-settings
'
)
!
)
:
{
const
productConfiguration
=
{
...
this
.
configuration
.
productConfiguration
?
this
.
configuration
.
productConfiguration
:
{
version
:
'
1.38.0-unknown
'
,
nameLong
:
'
Unknown
'
,
extensionAllowedProposedApi
:
[],
},
...{
urlProtocol
:
''
}
};
}
as
IProductConfiguration
;
return
{
_serviceBrand
:
undefined
,
...
productConfiguration
};
}
...
...
@@ -280,6 +285,7 @@ class CodeRendererMain extends Disposable {
return
joinPath
(
URI
.
revive
(
JSON
.
parse
(
remoteUserDataPath
)),
'
User
'
);
}
}
return
null
;
}
}
...
...
src/vs/workbench/workbench.web.api.ts
浏览文件 @
21ce78cf
...
...
@@ -11,6 +11,7 @@ import { IWebSocketFactory } from 'vs/platform/remote/browser/browserSocketFacto
import
{
ICredentialsProvider
}
from
'
vs/workbench/services/credentials/browser/credentialsService
'
;
import
{
IExtensionManifest
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IURLCallbackProvider
}
from
'
vs/workbench/services/url/browser/urlService
'
;
import
{
IProductConfiguration
}
from
'
vs/platform/product/common/product
'
;
export
interface
IWorkbenchConstructionOptions
{
...
...
@@ -71,6 +72,11 @@ export interface IWorkbenchConstructionOptions {
* Experimental: Support for URL callbacks.
*/
urlCallbackProvider
?:
IURLCallbackProvider
;
/**
* Experimental: Support for product configuration.
*/
productConfiguration
?:
IProductConfiguration
;
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录