Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e8da35fe
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,发现更多精彩内容 >>
提交
e8da35fe
编写于
1月 06, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Configure syncing ui state
上级
bdc7a291
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
12 deletion
+31
-12
src/vs/platform/userDataSync/common/globalStateSync.ts
src/vs/platform/userDataSync/common/globalStateSync.ts
+14
-7
src/vs/platform/userDataSync/common/userDataSync.ts
src/vs/platform/userDataSync/common/userDataSync.ts
+10
-4
src/vs/platform/userDataSync/common/userDataSyncService.ts
src/vs/platform/userDataSync/common/userDataSyncService.ts
+4
-1
src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts
...vs/workbench/contrib/userDataSync/browser/userDataSync.ts
+3
-0
未找到文件。
src/vs/platform/userDataSync/common/globalStateSync.ts
浏览文件 @
e8da35fe
...
...
@@ -14,6 +14,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import
{
IStringDictionary
}
from
'
vs/base/common/collections
'
;
import
{
edit
}
from
'
vs/platform/userDataSync/common/content
'
;
import
{
merge
}
from
'
vs/platform/userDataSync/common/globalStateMerge
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
const
argvProperties
:
string
[]
=
[
'
locale
'
];
...
...
@@ -36,6 +37,7 @@ export class GlobalStateSynchroniser extends Disposable implements ISynchroniser
@
IUserDataSyncStoreService
private
readonly
userDataSyncStoreService
:
IUserDataSyncStoreService
,
@
IUserDataSyncLogService
private
readonly
logService
:
IUserDataSyncLogService
,
@
IEnvironmentService
private
readonly
environmentService
:
IEnvironmentService
,
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
,
)
{
super
();
this
.
lastSyncGlobalStateResource
=
joinPath
(
environmentService
.
userRoamingDataHome
,
'
.lastSyncGlobalState
'
);
...
...
@@ -51,24 +53,29 @@ export class GlobalStateSynchroniser extends Disposable implements ISynchroniser
}
async
sync
():
Promise
<
boolean
>
{
if
(
!
this
.
configurationService
.
getValue
<
boolean
>
(
'
sync.enableUIState
'
))
{
this
.
logService
.
trace
(
'
UI State: Skipping synchronizing UI state as it is disabled.
'
);
return
false
;
}
if
(
this
.
status
!==
SyncStatus
.
Idle
)
{
this
.
logService
.
trace
(
'
Global State: Skipping synchronizing global
state as it is running already.
'
);
this
.
logService
.
trace
(
'
UI State: Skipping synchronizing ui
state as it is running already.
'
);
return
false
;
}
this
.
logService
.
trace
(
'
Global State: Started synchronizing global
state...
'
);
this
.
logService
.
trace
(
'
UI State: Started synchronizing ui
state...
'
);
this
.
setStatus
(
SyncStatus
.
Syncing
);
try
{
await
this
.
doSync
();
this
.
logService
.
trace
(
'
Global State: Finised synchronizing global
state.
'
);
this
.
logService
.
trace
(
'
UI State: Finised synchronizing ui
state.
'
);
this
.
setStatus
(
SyncStatus
.
Idle
);
return
true
;
}
catch
(
e
)
{
this
.
setStatus
(
SyncStatus
.
Idle
);
if
(
e
instanceof
UserDataSyncStoreError
&&
e
.
code
===
UserDataSyncStoreErrorCode
.
Rejected
)
{
// Rejected as there is a new remote version. Syncing again,
this
.
logService
.
info
(
'
Global State: Failed to synchronise global
state as there is a new remote version available. Synchronizing again...
'
);
this
.
logService
.
info
(
'
UI State: Failed to synchronise ui
state as there is a new remote version available. Synchronizing again...
'
);
return
this
.
sync
();
}
throw
e
;
...
...
@@ -90,13 +97,13 @@ export class GlobalStateSynchroniser extends Disposable implements ISynchroniser
if
(
local
)
{
// update local
this
.
logService
.
info
(
'
Global State: Updating local global
state...
'
);
this
.
logService
.
info
(
'
UI State: Updating local ui
state...
'
);
await
this
.
writeLocalGlobalState
(
local
);
}
if
(
remote
)
{
// update remote
this
.
logService
.
info
(
'
Global State: Updating remote global
state...
'
);
this
.
logService
.
info
(
'
UI State: Updating remote ui
state...
'
);
remoteData
=
await
this
.
writeToRemote
(
remote
,
remoteData
.
ref
);
}
...
...
@@ -104,7 +111,7 @@ export class GlobalStateSynchroniser extends Disposable implements ISynchroniser
&&
(
!
lastSyncData
||
lastSyncData
.
ref
!==
remoteData
.
ref
)
)
{
// update last sync
this
.
logService
.
info
(
'
Global State: Updating last synchronised global
state...
'
);
this
.
logService
.
info
(
'
UI State: Updating last synchronised ui
state...
'
);
await
this
.
updateLastSyncValue
(
remoteData
);
}
}
...
...
src/vs/platform/userDataSync/common/userDataSync.ts
浏览文件 @
e8da35fe
...
...
@@ -49,15 +49,21 @@ export function registerConfiguration(): IDisposable {
default
:
true
,
scope
:
ConfigurationScope
.
APPLICATION
,
},
'
sync.enable
Extension
s
'
:
{
'
sync.enable
Keybinding
s
'
:
{
type
:
'
boolean
'
,
description
:
localize
(
'
sync.enable
Extensions
'
,
"
Enable synchronizing extension
s.
"
),
description
:
localize
(
'
sync.enable
Keybindings
'
,
"
Enable synchronizing keybinding
s.
"
),
default
:
true
,
scope
:
ConfigurationScope
.
APPLICATION
,
},
'
sync.enable
Keybindings
'
:
{
'
sync.enable
UIState
'
:
{
type
:
'
boolean
'
,
description
:
localize
(
'
sync.enableKeybindings
'
,
"
Enable synchronizing keybindings.
"
),
description
:
localize
(
'
sync.enableUIState
'
,
"
Enable synchronizing UI state.
"
),
default
:
true
,
scope
:
ConfigurationScope
.
APPLICATION
,
},
'
sync.enableExtensions
'
:
{
type
:
'
boolean
'
,
description
:
localize
(
'
sync.enableExtensions
'
,
"
Enable synchronizing extensions.
"
),
default
:
true
,
scope
:
ConfigurationScope
.
APPLICATION
,
},
...
...
src/vs/platform/userDataSync/common/userDataSyncService.ts
浏览文件 @
e8da35fe
...
...
@@ -12,6 +12,7 @@ import { ExtensionsSynchroniser } from 'vs/platform/userDataSync/common/extensio
import
{
IExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IAuthTokenService
,
AuthTokenStatus
}
from
'
vs/platform/auth/common/auth
'
;
import
{
KeybindingsSynchroniser
}
from
'
vs/platform/userDataSync/common/keybindingsSync
'
;
import
{
GlobalStateSynchroniser
}
from
'
vs/platform/userDataSync/common/globalStateSync
'
;
export
class
UserDataSyncService
extends
Disposable
implements
IUserDataSyncService
{
...
...
@@ -32,6 +33,7 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
private
readonly
settingsSynchroniser
:
SettingsSynchroniser
;
private
readonly
keybindingsSynchroniser
:
KeybindingsSynchroniser
;
private
readonly
extensionsSynchroniser
:
ExtensionsSynchroniser
;
private
readonly
globalStateSynchroniser
:
GlobalStateSynchroniser
;
constructor
(
@
IUserDataSyncStoreService
private
readonly
userDataSyncStoreService
:
IUserDataSyncStoreService
,
...
...
@@ -41,8 +43,9 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
super
();
this
.
settingsSynchroniser
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
SettingsSynchroniser
));
this
.
keybindingsSynchroniser
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
KeybindingsSynchroniser
));
this
.
globalStateSynchroniser
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
GlobalStateSynchroniser
));
this
.
extensionsSynchroniser
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
ExtensionsSynchroniser
));
this
.
synchronisers
=
[
this
.
settingsSynchroniser
,
this
.
keybindingsSynchroniser
,
this
.
extensionsSynchroniser
];
this
.
synchronisers
=
[
this
.
settingsSynchroniser
,
this
.
keybindingsSynchroniser
,
this
.
globalStateSynchroniser
,
this
.
extensionsSynchroniser
];
this
.
updateStatus
();
if
(
this
.
userDataSyncStoreService
.
userDataSyncStore
)
{
...
...
src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts
浏览文件 @
e8da35fe
...
...
@@ -212,6 +212,9 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
},
{
id
:
'
sync.enableKeybindings
'
,
label
:
localize
(
'
user keybindings
'
,
"
User Keybindings
"
)
},
{
id
:
'
sync.enableUIState
'
,
label
:
localize
(
'
ui state
'
,
"
UI State
"
)
},
{
id
:
'
sync.enableExtensions
'
,
label
:
localize
(
'
extensions
'
,
"
Extensions
"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录