Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e9ae0082
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e9ae0082
编写于
1月 11, 2021
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use in-mem fsp in tests
上级
3f3e35bf
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
264 addition
and
246 deletion
+264
-246
src/vs/workbench/electron-browser/desktop.main.ts
src/vs/workbench/electron-browser/desktop.main.ts
+1
-1
src/vs/workbench/services/configuration/electron-browser/configurationCache.ts
...ices/configuration/electron-browser/configurationCache.ts
+25
-16
src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts
...test/electron-browser/configurationEditingService.test.ts
+232
-223
src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts
...ration/test/electron-browser/configurationService.test.ts
+6
-6
未找到文件。
src/vs/workbench/electron-browser/desktop.main.ts
浏览文件 @
e9ae0082
...
...
@@ -393,7 +393,7 @@ class DesktopMain extends Disposable {
}
private
async
createWorkspaceService
(
payload
:
IWorkspaceInitializationPayload
,
fileService
:
FileService
,
remoteAgentService
:
IRemoteAgentService
,
uriIdentityService
:
IUriIdentityService
,
logService
:
ILogService
):
Promise
<
WorkspaceService
>
{
const
workspaceService
=
new
WorkspaceService
({
remoteAuthority
:
this
.
environmentService
.
remoteAuthority
,
configurationCache
:
new
ConfigurationCache
(
this
.
environmentService
)
},
this
.
environmentService
,
fileService
,
remoteAgentService
,
uriIdentityService
,
logService
);
const
workspaceService
=
new
WorkspaceService
({
remoteAuthority
:
this
.
environmentService
.
remoteAuthority
,
configurationCache
:
new
ConfigurationCache
(
this
.
environmentService
,
fileService
)
},
this
.
environmentService
,
fileService
,
remoteAgentService
,
uriIdentityService
,
logService
);
try
{
await
workspaceService
.
initialize
(
payload
);
...
...
src/vs/workbench/services/configuration/electron-browser/configurationCache.ts
浏览文件 @
e9ae0082
...
...
@@ -3,18 +3,20 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
pfs
from
'
vs/base/node/pfs
'
;
import
{
join
}
from
'
vs/base/common/path
'
;
import
{
INativeWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/electron-sandbox/environmentService
'
;
import
{
IConfigurationCache
,
ConfigurationKey
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
joinPath
}
from
'
vs/base/common/resources
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
export
class
ConfigurationCache
implements
IConfigurationCache
{
private
readonly
cachedConfigurations
:
Map
<
string
,
CachedConfiguration
>
=
new
Map
<
string
,
CachedConfiguration
>
();
constructor
(
private
readonly
environmentService
:
INativeWorkbenchEnvironmentService
)
{
constructor
(
private
readonly
environmentService
:
INativeWorkbenchEnvironmentService
,
private
readonly
fileService
:
IFileService
)
{
}
needsCaching
(
resource
:
URI
):
boolean
{
...
...
@@ -38,7 +40,7 @@ export class ConfigurationCache implements IConfigurationCache {
const
k
=
`
${
type
}
:
${
key
}
`
;
let
cachedConfiguration
=
this
.
cachedConfigurations
.
get
(
k
);
if
(
!
cachedConfiguration
)
{
cachedConfiguration
=
new
CachedConfiguration
({
type
,
key
},
this
.
environmentService
);
cachedConfiguration
=
new
CachedConfiguration
({
type
,
key
},
this
.
environmentService
,
this
.
fileService
);
this
.
cachedConfigurations
.
set
(
k
,
cachedConfiguration
);
}
return
cachedConfiguration
;
...
...
@@ -49,21 +51,22 @@ export class ConfigurationCache implements IConfigurationCache {
class
CachedConfiguration
{
private
cachedConfigurationFolder
Path
:
string
;
private
cachedConfigurationFile
Path
:
string
;
private
cachedConfigurationFolder
Resource
:
URI
;
private
cachedConfigurationFile
Resource
:
URI
;
constructor
(
{
type
,
key
}:
ConfigurationKey
,
environmentService
:
INativeWorkbenchEnvironmentService
environmentService
:
INativeWorkbenchEnvironmentService
,
private
readonly
fileService
:
IFileService
)
{
this
.
cachedConfigurationFolder
Path
=
join
(
environmentService
.
userDataPath
,
'
CachedConfigurations
'
,
type
,
key
);
this
.
cachedConfigurationFile
Path
=
join
(
this
.
cachedConfigurationFolderPath
,
type
===
'
workspaces
'
?
'
workspace.json
'
:
'
configuration.json
'
);
this
.
cachedConfigurationFolder
Resource
=
URI
.
file
(
join
(
environmentService
.
userDataPath
,
'
CachedConfigurations
'
,
type
,
key
)
);
this
.
cachedConfigurationFile
Resource
=
joinPath
(
this
.
cachedConfigurationFolderResource
,
type
===
'
workspaces
'
?
'
workspace.json
'
:
'
configuration.json
'
);
}
async
read
():
Promise
<
string
>
{
try
{
const
content
=
await
pfs
.
readFile
(
this
.
cachedConfigurationFilePath
);
return
content
.
toString
();
const
content
=
await
this
.
fileService
.
readFile
(
this
.
cachedConfigurationFileResource
);
return
content
.
value
.
toString
();
}
catch
(
e
)
{
return
''
;
}
...
...
@@ -72,18 +75,24 @@ class CachedConfiguration {
async
save
(
content
:
string
):
Promise
<
void
>
{
const
created
=
await
this
.
createCachedFolder
();
if
(
created
)
{
await
pfs
.
writeFile
(
this
.
cachedConfigurationFilePath
,
content
);
await
this
.
fileService
.
writeFile
(
this
.
cachedConfigurationFileResource
,
VSBuffer
.
fromString
(
content
)
);
}
}
remove
():
Promise
<
void
>
{
return
pfs
.
rimraf
(
this
.
cachedConfigurationFolderPath
);
return
this
.
fileService
.
del
(
this
.
cachedConfigurationFolderResource
,
{
recursive
:
true
,
useTrash
:
false
}
);
}
private
createCachedFolder
():
Promise
<
boolean
>
{
return
Promise
.
resolve
(
pfs
.
exists
(
this
.
cachedConfigurationFolderPath
))
.
then
(
undefined
,
()
=>
false
)
.
then
(
exists
=>
exists
?
exists
:
pfs
.
mkdirp
(
this
.
cachedConfigurationFolderPath
).
then
(()
=>
true
,
()
=>
false
));
private
async
createCachedFolder
():
Promise
<
boolean
>
{
if
(
await
this
.
fileService
.
exists
(
this
.
cachedConfigurationFolderResource
))
{
return
true
;
}
try
{
await
this
.
fileService
.
createFolder
(
this
.
cachedConfigurationFolderResource
);
return
true
;
}
catch
(
error
)
{
return
false
;
}
}
}
src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts
浏览文件 @
e9ae0082
此差异已折叠。
点击以展开。
src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts
浏览文件 @
e9ae0082
...
...
@@ -119,7 +119,7 @@ flakySuite('WorkspaceContextService - Folder', () => {
const
diskFileSystemProvider
=
disposables
.
add
(
new
DiskFileSystemProvider
(
new
NullLogService
()));
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
disposables
.
add
(
new
FileUserDataProvider
(
Schemas
.
file
,
new
DiskFileSystemProvider
(
new
NullLogService
()),
Schemas
.
userData
,
new
NullLogService
())));
workspaceContextService
=
disposables
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
new
RemoteAgentService
(
environmentService
,
{
_serviceBrand
:
undefined
,
...
product
},
new
RemoteAuthorityResolverService
(),
new
SignService
(
undefined
),
new
NullLogService
()),
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
workspaceContextService
=
disposables
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
,
fileService
)
},
environmentService
,
fileService
,
new
RemoteAgentService
(
environmentService
,
{
_serviceBrand
:
undefined
,
...
product
},
new
RemoteAuthorityResolverService
(),
new
SignService
(
undefined
),
new
NullLogService
()),
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
return
(
<
WorkspaceService
>
workspaceContextService
).
initialize
(
convertToWorkspacePayload
(
URI
.
file
(
folderDir
)));
});
});
...
...
@@ -184,7 +184,7 @@ flakySuite('WorkspaceContextService - Workspace', () => {
const
diskFileSystemProvider
=
disposables
.
add
(
new
DiskFileSystemProvider
(
new
NullLogService
()));
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
disposables
.
add
(
new
FileUserDataProvider
(
Schemas
.
file
,
diskFileSystemProvider
,
Schemas
.
userData
,
new
NullLogService
())));
const
workspaceService
=
disposables
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
const
workspaceService
=
disposables
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
,
fileService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
...
...
@@ -243,7 +243,7 @@ flakySuite('WorkspaceContextService - Workspace Editing', () => {
const
diskFileSystemProvider
=
disposables
.
add
(
new
DiskFileSystemProvider
(
new
NullLogService
()));
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
disposables
.
add
(
new
FileUserDataProvider
(
Schemas
.
file
,
diskFileSystemProvider
,
Schemas
.
userData
,
new
NullLogService
())));
const
workspaceService
=
disposables
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
const
workspaceService
=
disposables
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
,
fileService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
...
...
@@ -506,7 +506,7 @@ flakySuite('WorkspaceService - Initialization', () => {
const
diskFileSystemProvider
=
disposables
.
add
(
new
DiskFileSystemProvider
(
new
NullLogService
()));
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
disposables
.
add
(
new
FileUserDataProvider
(
Schemas
.
file
,
diskFileSystemProvider
,
Schemas
.
userData
,
new
NullLogService
())));
const
workspaceService
=
disposables
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
const
workspaceService
=
disposables
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
,
fileService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
instantiationService
.
stub
(
IEnvironmentService
,
environmentService
);
...
...
@@ -781,7 +781,7 @@ flakySuite('WorkspaceConfigurationService - Folder', () => {
const
diskFileSystemProvider
=
disposables
.
add
(
new
DiskFileSystemProvider
(
new
NullLogService
()));
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
disposables
.
add
(
new
FileUserDataProvider
(
Schemas
.
file
,
diskFileSystemProvider
,
Schemas
.
userData
,
new
NullLogService
())));
workspaceService
=
disposables
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
workspaceService
=
disposables
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
,
fileService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
instantiationService
.
stub
(
IEnvironmentService
,
environmentService
);
...
...
@@ -1311,7 +1311,7 @@ flakySuite('WorkspaceConfigurationService-Multiroot', () => {
const
diskFileSystemProvider
=
disposables
.
add
(
new
DiskFileSystemProvider
(
new
NullLogService
()));
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
disposables
.
add
(
new
FileUserDataProvider
(
Schemas
.
file
,
diskFileSystemProvider
,
Schemas
.
userData
,
new
NullLogService
())));
const
workspaceService
=
disposables
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
const
workspaceService
=
disposables
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
,
fileService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录