Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7f8efdf5
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(gitcode.net)2024年7月9日维护升级公告
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7f8efdf5
编写于
2月 11, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
上级
02aa3e75
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
43 addition
and
41 deletion
+43
-41
src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts
...vs/workbench/contrib/userDataSync/browser/userDataSync.ts
+43
-41
未找到文件。
src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts
浏览文件 @
7f8efdf5
...
...
@@ -67,6 +67,11 @@ function getSyncAreaLabel(source: SyncSource): string {
}
}
type
SyncConflictsClassification
=
{
source
:
{
classification
:
'
SystemMetaData
'
,
purpose
:
'
FeatureInsight
'
,
isMeasurement
:
true
};
action
?:
{
classification
:
'
SystemMetaData
'
,
purpose
:
'
FeatureInsight
'
,
isMeasurement
:
true
};
};
type
FirstTimeSyncClassification
=
{
action
:
{
classification
:
'
SystemMetaData
'
,
purpose
:
'
FeatureInsight
'
,
isMeasurement
:
true
};
};
...
...
@@ -260,16 +265,22 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
[
{
label
:
localize
(
'
accept remote
'
,
"
Accept Remote
"
),
run
:
()
=>
this
.
acceptConflicts
(
'
remote
'
,
conflictsSource
)
run
:
()
=>
{
this
.
telemetryService
.
publicLog2
<
{
source
:
string
,
action
:
string
},
SyncConflictsClassification
>
(
'
sync/handleConflicts
'
,
{
source
:
conflictsSource
,
action
:
'
acceptRemote
'
});
this
.
acceptRemote
(
conflictsSource
);
}
},
{
label
:
localize
(
'
accept local
'
,
"
Accept Local
"
),
run
:
()
=>
this
.
acceptConflicts
(
'
local
'
,
conflictsSource
)
run
:
()
=>
{
this
.
telemetryService
.
publicLog2
<
{
source
:
string
,
action
:
string
},
SyncConflictsClassification
>
(
'
sync/handleConflicts
'
,
{
source
:
conflictsSource
,
action
:
'
acceptLocal
'
});
this
.
acceptLocal
(
conflictsSource
);
}
},
{
label
:
localize
(
'
show conflicts
'
,
"
Show Conflicts
"
),
run
:
()
=>
{
this
.
telemetryService
.
publicLog2
(
'
sync/showConflicts
'
);
this
.
telemetryService
.
publicLog2
<
{
source
:
string
,
action
?:
string
},
SyncConflictsClassification
>
(
'
sync/showConflicts
'
,
{
source
:
conflictsSource
}
);
this
.
handleConflicts
(
conflictsSource
);
}
}
...
...
@@ -301,6 +312,35 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
}
}
private
async
acceptRemote
(
syncSource
:
SyncSource
)
{
try
{
const
contents
=
await
this
.
userDataSyncService
.
getRemoteContent
(
syncSource
,
false
);
if
(
contents
)
{
await
this
.
userDataSyncService
.
accept
(
syncSource
,
contents
);
}
}
catch
(
e
)
{
this
.
notificationService
.
error
(
e
);
}
}
private
async
acceptLocal
(
syncSource
:
SyncSource
):
Promise
<
void
>
{
try
{
const
previewResource
=
syncSource
===
SyncSource
.
Settings
?
this
.
workbenchEnvironmentService
.
settingsSyncPreviewResource
:
syncSource
===
SyncSource
.
Keybindings
?
this
.
workbenchEnvironmentService
.
keybindingsSyncPreviewResource
:
null
;
if
(
previewResource
)
{
const
fileContent
=
await
this
.
fileService
.
readFile
(
previewResource
);
if
(
fileContent
)
{
this
.
userDataSyncService
.
accept
(
syncSource
,
fileContent
.
value
.
toString
());
}
}
}
catch
(
e
)
{
this
.
notificationService
.
error
(
e
);
}
}
private
onDidChangeEnablement
(
enabled
:
boolean
)
{
this
.
syncEnablementContext
.
set
(
enabled
);
this
.
updateBadge
();
...
...
@@ -553,39 +593,6 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
});
}
private
async
acceptConflicts
(
resolutionSource
:
'
local
'
|
'
remote
'
,
syncSource
:
SyncSource
)
{
return
syncSource
===
SyncSource
.
Settings
?
this
.
acceptSettingConflicts
(
resolutionSource
)
:
syncSource
===
SyncSource
.
Keybindings
?
this
.
acceptKeybindingConflicts
(
resolutionSource
)
:
undefined
;
}
private
async
acceptSettingConflicts
(
resolutionSource
:
'
local
'
|
'
remote
'
):
Promise
<
void
>
{
let
contents
:
string
|
undefined
;
if
(
resolutionSource
===
'
local
'
)
{
const
fileContent
=
await
this
.
fileService
.
readFile
(
this
.
workbenchEnvironmentService
.
settingsResource
);
contents
=
fileContent
.
value
.
toString
();
}
else
{
contents
=
await
this
.
userDataSyncService
.
getRemoteContent
(
SyncSource
.
Settings
,
false
)
||
undefined
;
}
if
(
contents
)
{
this
.
userDataSyncService
.
accept
(
SyncSource
.
Settings
,
contents
);
}
}
private
async
acceptKeybindingConflicts
(
resolutionSource
:
'
local
'
|
'
remote
'
):
Promise
<
void
>
{
let
contents
:
string
|
undefined
;
if
(
resolutionSource
===
'
local
'
)
{
const
fileContent
=
await
this
.
fileService
.
readFile
(
this
.
workbenchEnvironmentService
.
keybindingsResource
);
contents
=
fileContent
.
value
.
toString
();
}
else
{
contents
=
await
this
.
userDataSyncService
.
getRemoteContent
(
SyncSource
.
Keybindings
,
false
)
||
undefined
;
}
if
(
contents
)
{
this
.
userDataSyncService
.
accept
(
SyncSource
.
Keybindings
,
contents
);
}
}
private
async
handleConflicts
(
source
:
SyncSource
):
Promise
<
void
>
{
let
previewResource
:
URI
|
undefined
=
undefined
;
let
label
:
string
=
''
;
...
...
@@ -786,11 +793,6 @@ class UserDataRemoteContentProvider implements ITextModelContentProvider {
}
}
type
SyncConflictsClassification
=
{
source
:
{
classification
:
'
SystemMetaData
'
,
purpose
:
'
FeatureInsight
'
,
isMeasurement
:
true
};
action
:
{
classification
:
'
SystemMetaData
'
,
purpose
:
'
FeatureInsight
'
,
isMeasurement
:
true
};
};
class
AcceptChangesContribution
extends
Disposable
implements
IEditorContribution
{
static
get
(
editor
:
ICodeEditor
):
AcceptChangesContribution
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录