Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1eb2a37e
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,发现更多精彩内容 >>
提交
1eb2a37e
编写于
10月 25, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
do not sync extension state when extension has not registered any keys to sync
上级
20601293
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
20 addition
and
27 deletion
+20
-27
src/vs/platform/userDataSync/common/extensionsMerge.ts
src/vs/platform/userDataSync/common/extensionsMerge.ts
+9
-16
src/vs/platform/userDataSync/common/extensionsSync.ts
src/vs/platform/userDataSync/common/extensionsSync.ts
+7
-7
src/vs/platform/userDataSync/common/storageKeys.ts
src/vs/platform/userDataSync/common/storageKeys.ts
+3
-3
src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts
src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts
+1
-1
未找到文件。
src/vs/platform/userDataSync/common/extensionsMerge.ts
浏览文件 @
1eb2a37e
...
...
@@ -74,10 +74,14 @@ export function merge(localExtensions: ISyncExtension[], remoteExtensions: ISync
const
baseToRemote
=
compare
(
lastSyncExtensionsMap
,
remoteExtensionsMap
,
ignoredExtensionsSet
);
const
mergeAndUpdate
=
(
key
:
string
):
void
=>
{
const
extension
=
remoteExtensionsMap
.
get
(
key
)
!
;
extension
.
state
=
mergeExtensionState
(
localExtensionsMap
.
get
(
key
)?.
state
,
extension
.
state
,
lastSyncExtensionsMap
?.
get
(
key
)?.
state
);
updated
.
push
(
massageOutgoingExtension
(
extension
,
key
));
newRemoteExtensionsMap
.
set
(
key
,
extension
);
const
localExtension
=
localExtensionsMap
.
get
(
key
)
!
;
const
remoteExtension
=
remoteExtensionsMap
.
get
(
key
)
!
;
// merge extension state only when version matches and local extension has state
if
(
remoteExtension
.
version
===
localExtension
.
version
&&
localExtension
.
state
)
{
remoteExtension
.
state
=
mergeExtensionState
(
localExtension
.
state
,
remoteExtension
.
state
,
lastSyncExtensionsMap
?.
get
(
key
)?.
state
);
}
updated
.
push
(
massageOutgoingExtension
(
remoteExtension
,
key
));
newRemoteExtensionsMap
.
set
(
key
,
remoteExtension
);
};
// Remotely removed extension.
...
...
@@ -183,18 +187,7 @@ function compare(from: Map<string, ISyncExtension> | null, to: Map<string, ISync
return
{
added
,
removed
,
updated
};
}
function
mergeExtensionState
(
local
:
IStringDictionary
<
any
>
|
undefined
,
remote
:
IStringDictionary
<
any
>
|
undefined
,
base
:
IStringDictionary
<
any
>
|
undefined
):
IStringDictionary
<
any
>
|
undefined
{
if
(
!
local
&&
!
remote
&&
!
base
)
{
return
undefined
;
}
if
(
local
&&
!
remote
&&
!
base
)
{
return
local
;
}
if
(
remote
&&
!
local
&&
!
base
)
{
return
remote
;
}
local
=
local
||
{};
function
mergeExtensionState
(
local
:
IStringDictionary
<
any
>
,
remote
:
IStringDictionary
<
any
>
|
undefined
,
base
:
IStringDictionary
<
any
>
|
undefined
):
IStringDictionary
<
any
>
|
undefined
{
const
merged
:
IStringDictionary
<
any
>
=
deepClone
(
local
);
if
(
remote
)
{
const
baseToRemote
=
base
?
compareExtensionState
(
base
,
remote
)
:
{
added
:
Object
.
keys
(
remote
).
reduce
((
r
,
k
)
=>
{
r
.
add
(
k
);
return
r
;
},
new
Set
<
string
>
()),
removed
:
new
Set
<
string
>
(),
updated
:
new
Set
<
string
>
()
};
...
...
src/vs/platform/userDataSync/common/extensionsSync.ts
浏览文件 @
1eb2a37e
...
...
@@ -450,14 +450,14 @@ export class ExtensionsSynchroniser extends AbstractSynchroniser implements IUse
syncExntesion
.
installed
=
true
;
}
const
keys
=
this
.
storageKeysSyncRegistryService
.
getExtensioStorageKeys
({
id
:
identifier
.
id
,
version
:
manifest
.
version
});
if
(
keys
)
{
const
extensionStorageValue
=
this
.
storageService
.
get
(
identifier
.
id
,
StorageScope
.
GLOBAL
)
||
'
{}
'
;
try
{
const
extensionStorageValue
=
this
.
storageService
.
get
(
identifier
.
id
,
StorageScope
.
GLOBAL
);
syncExntesion
.
state
=
keys
.
length
&&
extensionStorageValue
?
JSON
.
parse
(
extensionStorageValue
,
(
key
,
value
)
=>
!
key
||
keys
.
includes
(
key
)
?
value
:
undefined
)
:
undefined
;
syncExntesion
.
state
=
JSON
.
parse
(
extensionStorageValue
,
(
key
,
value
)
=>
!
key
||
keys
.
includes
(
key
)
?
value
:
undefined
);
}
catch
(
error
)
{
this
.
logService
.
info
(
`
${
this
.
syncResourceLogLabel
}
: Error while parsing extension state`
,
getErrorMessage
(
error
));
}
}
return
syncExntesion
;
});
}
...
...
src/vs/platform/userDataSync/common/storageKeys.ts
浏览文件 @
1eb2a37e
...
...
@@ -76,7 +76,7 @@ export interface IStorageKeysSyncRegistryService {
/**
* Returns storage keys of the given extension that has to be synchronized.
*/
getExtensioStorageKeys
(
extension
:
IExtensionIdWithVersion
):
ReadonlyArray
<
string
>
;
getExtensioStorageKeys
(
extension
:
IExtensionIdWithVersion
):
ReadonlyArray
<
string
>
|
undefined
;
}
export
abstract
class
AbstractStorageKeysSyncRegistryService
extends
Disposable
implements
IStorageKeysSyncRegistryService
{
...
...
@@ -103,8 +103,8 @@ export abstract class AbstractStorageKeysSyncRegistryService extends Disposable
this
.
_register
(
toDisposable
(()
=>
this
.
_storageKeys
.
clear
()));
}
getExtensioStorageKeys
(
extension
:
IExtensionIdWithVersion
):
ReadonlyArray
<
string
>
{
return
this
.
_extensionsStorageKeys
.
get
(
ExtensionIdWithVersion
.
toKey
(
extension
))
||
[]
;
getExtensioStorageKeys
(
extension
:
IExtensionIdWithVersion
):
ReadonlyArray
<
string
>
|
undefined
{
return
this
.
_extensionsStorageKeys
.
get
(
ExtensionIdWithVersion
.
toKey
(
extension
));
}
protected
updateExtensionStorageKeys
(
extension
:
IExtensionIdWithVersion
,
keys
:
string
[]):
void
{
...
...
src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts
浏览文件 @
1eb2a37e
...
...
@@ -731,7 +731,7 @@ class SimpleIStorageKeysSyncRegistryService implements IStorageKeysSyncRegistryS
extensionsStorageKeys
=
[];
getExtensioStorageKeys
()
:
[]
{
return
[]
;
}
getExtensioStorageKeys
()
{
return
undefined
;
}
registerExtensionStorageKeys
():
void
{
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录