Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
54def407
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,发现更多精彩内容 >>
提交
54def407
编写于
3月 30, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#91545 do not reuse the preview
上级
9552105b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
19 addition
and
15 deletion
+19
-15
src/vs/platform/userDataSync/common/abstractSynchronizer.ts
src/vs/platform/userDataSync/common/abstractSynchronizer.ts
+2
-2
src/vs/platform/userDataSync/common/extensionsSync.ts
src/vs/platform/userDataSync/common/extensionsSync.ts
+2
-2
src/vs/platform/userDataSync/common/globalStateSync.ts
src/vs/platform/userDataSync/common/globalStateSync.ts
+2
-2
src/vs/platform/userDataSync/common/keybindingsSync.ts
src/vs/platform/userDataSync/common/keybindingsSync.ts
+2
-2
src/vs/platform/userDataSync/common/settingsSync.ts
src/vs/platform/userDataSync/common/settingsSync.ts
+2
-2
src/vs/platform/userDataSync/common/snippetsSync.ts
src/vs/platform/userDataSync/common/snippetsSync.ts
+8
-4
src/vs/platform/userDataSync/test/common/synchronizer.test.ts
...vs/platform/userDataSync/test/common/synchronizer.test.ts
+1
-1
未找到文件。
src/vs/platform/userDataSync/common/abstractSynchronizer.ts
浏览文件 @
54def407
...
@@ -151,7 +151,7 @@ export abstract class AbstractSynchroniser extends Disposable {
...
@@ -151,7 +151,7 @@ export abstract class AbstractSynchroniser extends Disposable {
const
lastSyncUserData
=
await
this
.
getLastSyncUserData
();
const
lastSyncUserData
=
await
this
.
getLastSyncUserData
();
const
remoteUserData
=
await
this
.
getRemoteUserData
(
lastSyncUserData
);
const
remoteUserData
=
await
this
.
getRemoteUserData
(
lastSyncUserData
);
return
this
.
ge
t
Preview
(
remoteUserData
,
lastSyncUserData
);
return
this
.
ge
nerate
Preview
(
remoteUserData
,
lastSyncUserData
);
}
}
protected
async
doSync
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
SyncStatus
>
{
protected
async
doSync
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
SyncStatus
>
{
...
@@ -295,7 +295,7 @@ export abstract class AbstractSynchroniser extends Disposable {
...
@@ -295,7 +295,7 @@ export abstract class AbstractSynchroniser extends Disposable {
protected
abstract
readonly
version
:
number
;
protected
abstract
readonly
version
:
number
;
protected
abstract
performSync
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
SyncStatus
>
;
protected
abstract
performSync
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
SyncStatus
>
;
protected
abstract
ge
t
Preview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
ISyncPreviewResult
>
;
protected
abstract
ge
nerate
Preview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
ISyncPreviewResult
>
;
}
}
export
interface
IFileSyncPreviewResult
extends
ISyncPreviewResult
{
export
interface
IFileSyncPreviewResult
extends
ISyncPreviewResult
{
...
...
src/vs/platform/userDataSync/common/extensionsSync.ts
浏览文件 @
54def407
...
@@ -171,12 +171,12 @@ export class ExtensionsSynchroniser extends AbstractSynchroniser implements IUse
...
@@ -171,12 +171,12 @@ export class ExtensionsSynchroniser extends AbstractSynchroniser implements IUse
}
}
protected
async
performSync
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
ILastSyncUserData
|
null
):
Promise
<
SyncStatus
>
{
protected
async
performSync
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
ILastSyncUserData
|
null
):
Promise
<
SyncStatus
>
{
const
previewResult
=
await
this
.
ge
t
Preview
(
remoteUserData
,
lastSyncUserData
);
const
previewResult
=
await
this
.
ge
nerate
Preview
(
remoteUserData
,
lastSyncUserData
);
await
this
.
apply
(
previewResult
);
await
this
.
apply
(
previewResult
);
return
SyncStatus
.
Idle
;
return
SyncStatus
.
Idle
;
}
}
protected
async
ge
t
Preview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
ILastSyncUserData
|
null
):
Promise
<
IExtensionsSyncPreviewResult
>
{
protected
async
ge
nerate
Preview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
ILastSyncUserData
|
null
):
Promise
<
IExtensionsSyncPreviewResult
>
{
const
remoteExtensions
:
ISyncExtension
[]
|
null
=
remoteUserData
.
syncData
?
this
.
parseExtensions
(
remoteUserData
.
syncData
)
:
null
;
const
remoteExtensions
:
ISyncExtension
[]
|
null
=
remoteUserData
.
syncData
?
this
.
parseExtensions
(
remoteUserData
.
syncData
)
:
null
;
const
lastSyncExtensions
:
ISyncExtension
[]
|
null
=
lastSyncUserData
?
this
.
parseExtensions
(
lastSyncUserData
.
syncData
!
)
:
null
;
const
lastSyncExtensions
:
ISyncExtension
[]
|
null
=
lastSyncUserData
?
this
.
parseExtensions
(
lastSyncUserData
.
syncData
!
)
:
null
;
const
skippedExtensions
:
ISyncExtension
[]
=
lastSyncUserData
?
lastSyncUserData
.
skippedExtensions
||
[]
:
[];
const
skippedExtensions
:
ISyncExtension
[]
=
lastSyncUserData
?
lastSyncUserData
.
skippedExtensions
||
[]
:
[];
...
...
src/vs/platform/userDataSync/common/globalStateSync.ts
浏览文件 @
54def407
...
@@ -162,12 +162,12 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs
...
@@ -162,12 +162,12 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs
}
}
protected
async
performSync
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
SyncStatus
>
{
protected
async
performSync
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
SyncStatus
>
{
const
result
=
await
this
.
ge
t
Preview
(
remoteUserData
,
lastSyncUserData
);
const
result
=
await
this
.
ge
nerate
Preview
(
remoteUserData
,
lastSyncUserData
);
await
this
.
apply
(
result
);
await
this
.
apply
(
result
);
return
SyncStatus
.
Idle
;
return
SyncStatus
.
Idle
;
}
}
protected
async
ge
t
Preview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
IGlobalSyncPreviewResult
>
{
protected
async
ge
nerate
Preview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
IGlobalSyncPreviewResult
>
{
const
remoteGlobalState
:
IGlobalState
=
remoteUserData
.
syncData
?
JSON
.
parse
(
remoteUserData
.
syncData
.
content
)
:
null
;
const
remoteGlobalState
:
IGlobalState
=
remoteUserData
.
syncData
?
JSON
.
parse
(
remoteUserData
.
syncData
.
content
)
:
null
;
const
lastSyncGlobalState
:
IGlobalState
=
lastSyncUserData
&&
lastSyncUserData
.
syncData
?
JSON
.
parse
(
lastSyncUserData
.
syncData
.
content
)
:
null
;
const
lastSyncGlobalState
:
IGlobalState
=
lastSyncUserData
&&
lastSyncUserData
.
syncData
?
JSON
.
parse
(
lastSyncUserData
.
syncData
.
content
)
:
null
;
...
...
src/vs/platform/userDataSync/common/keybindingsSync.ts
浏览文件 @
54def407
...
@@ -258,14 +258,14 @@ export class KeybindingsSynchroniser extends AbstractJsonFileSynchroniser implem
...
@@ -258,14 +258,14 @@ export class KeybindingsSynchroniser extends AbstractJsonFileSynchroniser implem
this
.
syncPreviewResultPromise
=
null
;
this
.
syncPreviewResultPromise
=
null
;
}
}
pr
otected
getPreview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
IFileSyncPreviewResult
>
{
pr
ivate
getPreview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
IFileSyncPreviewResult
>
{
if
(
!
this
.
syncPreviewResultPromise
)
{
if
(
!
this
.
syncPreviewResultPromise
)
{
this
.
syncPreviewResultPromise
=
createCancelablePromise
(
token
=>
this
.
generatePreview
(
remoteUserData
,
lastSyncUserData
,
token
));
this
.
syncPreviewResultPromise
=
createCancelablePromise
(
token
=>
this
.
generatePreview
(
remoteUserData
,
lastSyncUserData
,
token
));
}
}
return
this
.
syncPreviewResultPromise
;
return
this
.
syncPreviewResultPromise
;
}
}
pr
ivate
async
generatePreview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
,
token
:
CancellationToken
):
Promise
<
IFileSyncPreviewResult
>
{
pr
otected
async
generatePreview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
,
token
:
CancellationToken
=
CancellationToken
.
None
):
Promise
<
IFileSyncPreviewResult
>
{
const
remoteContent
=
remoteUserData
.
syncData
?
this
.
getKeybindingsContentFromSyncContent
(
remoteUserData
.
syncData
.
content
)
:
null
;
const
remoteContent
=
remoteUserData
.
syncData
?
this
.
getKeybindingsContentFromSyncContent
(
remoteUserData
.
syncData
.
content
)
:
null
;
const
lastSyncContent
=
lastSyncUserData
&&
lastSyncUserData
.
syncData
?
this
.
getKeybindingsContentFromSyncContent
(
lastSyncUserData
.
syncData
.
content
)
:
null
;
const
lastSyncContent
=
lastSyncUserData
&&
lastSyncUserData
.
syncData
?
this
.
getKeybindingsContentFromSyncContent
(
lastSyncUserData
.
syncData
.
content
)
:
null
;
// Get file content last to get the latest
// Get file content last to get the latest
...
...
src/vs/platform/userDataSync/common/settingsSync.ts
浏览文件 @
54def407
...
@@ -309,14 +309,14 @@ export class SettingsSynchroniser extends AbstractJsonFileSynchroniser {
...
@@ -309,14 +309,14 @@ export class SettingsSynchroniser extends AbstractJsonFileSynchroniser {
this
.
syncPreviewResultPromise
=
null
;
this
.
syncPreviewResultPromise
=
null
;
}
}
pr
otected
getPreview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
,
resolvedConflicts
:
{
key
:
string
,
value
:
any
}[]
=
[]):
Promise
<
IFileSyncPreviewResult
>
{
pr
ivate
getPreview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
,
resolvedConflicts
:
{
key
:
string
,
value
:
any
}[]
=
[]):
Promise
<
IFileSyncPreviewResult
>
{
if
(
!
this
.
syncPreviewResultPromise
)
{
if
(
!
this
.
syncPreviewResultPromise
)
{
this
.
syncPreviewResultPromise
=
createCancelablePromise
(
token
=>
this
.
generatePreview
(
remoteUserData
,
lastSyncUserData
,
resolvedConflicts
,
token
));
this
.
syncPreviewResultPromise
=
createCancelablePromise
(
token
=>
this
.
generatePreview
(
remoteUserData
,
lastSyncUserData
,
resolvedConflicts
,
token
));
}
}
return
this
.
syncPreviewResultPromise
;
return
this
.
syncPreviewResultPromise
;
}
}
protected
async
generatePreview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
,
resolvedConflicts
:
{
key
:
string
,
value
:
any
}[]
,
token
:
CancellationToken
):
Promise
<
IFileSyncPreviewResult
>
{
protected
async
generatePreview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
,
resolvedConflicts
:
{
key
:
string
,
value
:
any
}[]
=
[],
token
:
CancellationToken
=
CancellationToken
.
None
):
Promise
<
IFileSyncPreviewResult
>
{
const
fileContent
=
await
this
.
getLocalFileContent
();
const
fileContent
=
await
this
.
getLocalFileContent
();
const
formattingOptions
=
await
this
.
getFormattingOptions
();
const
formattingOptions
=
await
this
.
getFormattingOptions
();
const
remoteSettingsSyncContent
=
this
.
getSettingsSyncContent
(
remoteUserData
);
const
remoteSettingsSyncContent
=
this
.
getSettingsSyncContent
(
remoteUserData
);
...
...
src/vs/platform/userDataSync/common/snippetsSync.ts
浏览文件 @
54def407
...
@@ -211,7 +211,7 @@ export class SnippetsSynchroniser extends AbstractSynchroniser implements IUserD
...
@@ -211,7 +211,7 @@ export class SnippetsSynchroniser extends AbstractSynchroniser implements IUserD
let
previewResult
=
await
this
.
syncPreviewResultPromise
!
;
let
previewResult
=
await
this
.
syncPreviewResultPromise
!
;
this
.
cancel
();
this
.
cancel
();
previewResult
.
resolvedConflicts
[
key
]
=
content
||
null
;
previewResult
.
resolvedConflicts
[
key
]
=
content
||
null
;
this
.
syncPreviewResultPromise
=
createCancelablePromise
(
token
=>
this
.
g
eneratePreview
(
previewResult
.
local
,
previewResult
.
remoteUserData
,
previewResult
.
lastSyncUserData
,
previewResult
.
resolvedConflicts
,
token
));
this
.
syncPreviewResultPromise
=
createCancelablePromise
(
token
=>
this
.
doG
eneratePreview
(
previewResult
.
local
,
previewResult
.
remoteUserData
,
previewResult
.
lastSyncUserData
,
previewResult
.
resolvedConflicts
,
token
));
previewResult
=
await
this
.
syncPreviewResultPromise
;
previewResult
=
await
this
.
syncPreviewResultPromise
;
this
.
setConflicts
(
previewResult
.
conflicts
);
this
.
setConflicts
(
previewResult
.
conflicts
);
if
(
!
this
.
conflicts
.
length
)
{
if
(
!
this
.
conflicts
.
length
)
{
...
@@ -258,8 +258,7 @@ export class SnippetsSynchroniser extends AbstractSynchroniser implements IUserD
...
@@ -258,8 +258,7 @@ export class SnippetsSynchroniser extends AbstractSynchroniser implements IUserD
protected
getPreview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
ISinppetsSyncPreviewResult
>
{
protected
getPreview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
ISinppetsSyncPreviewResult
>
{
if
(
!
this
.
syncPreviewResultPromise
)
{
if
(
!
this
.
syncPreviewResultPromise
)
{
this
.
syncPreviewResultPromise
=
createCancelablePromise
(
token
=>
this
.
getSnippetsFileContents
()
this
.
syncPreviewResultPromise
=
createCancelablePromise
(
token
=>
this
.
generatePreview
(
remoteUserData
,
lastSyncUserData
,
token
));
.
then
(
local
=>
this
.
generatePreview
(
local
,
remoteUserData
,
lastSyncUserData
,
{},
token
)));
}
}
return
this
.
syncPreviewResultPromise
;
return
this
.
syncPreviewResultPromise
;
}
}
...
@@ -278,7 +277,12 @@ export class SnippetsSynchroniser extends AbstractSynchroniser implements IUserD
...
@@ -278,7 +277,12 @@ export class SnippetsSynchroniser extends AbstractSynchroniser implements IUserD
}
}
}
}
private
async
generatePreview
(
local
:
IStringDictionary
<
IFileContent
>
,
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
,
resolvedConflicts
:
IStringDictionary
<
string
|
null
>
,
token
:
CancellationToken
):
Promise
<
ISinppetsSyncPreviewResult
>
{
protected
async
generatePreview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
,
token
:
CancellationToken
=
CancellationToken
.
None
):
Promise
<
ISinppetsSyncPreviewResult
>
{
return
this
.
getSnippetsFileContents
()
.
then
(
local
=>
this
.
doGeneratePreview
(
local
,
remoteUserData
,
lastSyncUserData
,
{},
token
));
}
private
async
doGeneratePreview
(
local
:
IStringDictionary
<
IFileContent
>
,
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
,
resolvedConflicts
:
IStringDictionary
<
string
|
null
>
=
{},
token
:
CancellationToken
=
CancellationToken
.
None
):
Promise
<
ISinppetsSyncPreviewResult
>
{
const
localSnippets
=
this
.
toSnippetsContents
(
local
);
const
localSnippets
=
this
.
toSnippetsContents
(
local
);
const
remoteSnippets
:
IStringDictionary
<
string
>
|
null
=
remoteUserData
.
syncData
?
this
.
parseSnippets
(
remoteUserData
.
syncData
)
:
null
;
const
remoteSnippets
:
IStringDictionary
<
string
>
|
null
=
remoteUserData
.
syncData
?
this
.
parseSnippets
(
remoteUserData
.
syncData
)
:
null
;
const
lastSyncSnippets
:
IStringDictionary
<
string
>
|
null
=
lastSyncUserData
?
this
.
parseSnippets
(
lastSyncUserData
.
syncData
!
)
:
null
;
const
lastSyncSnippets
:
IStringDictionary
<
string
>
|
null
=
lastSyncUserData
?
this
.
parseSnippets
(
lastSyncUserData
.
syncData
!
)
:
null
;
...
...
src/vs/platform/userDataSync/test/common/synchronizer.test.ts
浏览文件 @
54def407
...
@@ -49,7 +49,7 @@ class TestSynchroniser extends AbstractSynchroniser {
...
@@ -49,7 +49,7 @@ class TestSynchroniser extends AbstractSynchroniser {
this
.
syncBarrier
.
open
();
this
.
syncBarrier
.
open
();
}
}
protected
async
ge
t
Preview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
ISyncPreviewResult
>
{
protected
async
ge
nerate
Preview
(
remoteUserData
:
IRemoteUserData
,
lastSyncUserData
:
IRemoteUserData
|
null
):
Promise
<
ISyncPreviewResult
>
{
return
{
hasLocalChanged
:
false
,
hasRemoteChanged
:
false
};
return
{
hasLocalChanged
:
false
,
hasRemoteChanged
:
false
};
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录