Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c338a515
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,发现更多精彩内容 >>
提交
c338a515
编写于
7月 14, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
re order sync views
上级
599f3b60
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
39 addition
and
39 deletion
+39
-39
src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts
...vs/workbench/contrib/userDataSync/browser/userDataSync.ts
+11
-30
src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts
...rkbench/contrib/userDataSync/browser/userDataSyncViews.ts
+5
-4
src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts
...ices/userDataSync/browser/userDataSyncWorkbenchService.ts
+20
-4
src/vs/workbench/services/userDataSync/common/userDataSync.ts
...vs/workbench/services/userDataSync/common/userDataSync.ts
+3
-1
未找到文件。
src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts
浏览文件 @
c338a515
...
...
@@ -51,9 +51,9 @@ import { IAuthenticationService } from 'vs/workbench/services/authentication/bro
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
Codicon
}
from
'
vs/base/common/codicons
'
;
import
{
ViewContainerLocation
,
IViewContainersRegistry
,
Extensions
,
ViewContainer
,
IViewDescriptorService
,
IViewsService
}
from
'
vs/workbench/common/views
'
;
import
{
ViewContainerLocation
,
IViewContainersRegistry
,
Extensions
,
ViewContainer
}
from
'
vs/workbench/common/views
'
;
import
{
UserDataSyncViewPaneContainer
,
UserDataSyncDataViews
}
from
'
vs/workbench/contrib/userDataSync/browser/userDataSyncViews
'
;
import
{
IUserDataSyncWorkbenchService
,
CONTEXT_ENABLE_VIEWS
,
getSyncAreaLabel
,
AccountStatus
,
CONTEXT_SYNC_STATE
,
CONTEXT_SYNC_ENABLEMENT
,
CONTEXT_ACCOUNT_STATE
,
CONFIGURE_SYNC_COMMAND_ID
,
SHOW_SYNC_LOG_COMMAND_ID
,
SHOW_SYNCED_DATA_COMMAND
_ID
}
from
'
vs/workbench/services/userDataSync/common/userDataSync
'
;
import
{
IUserDataSyncWorkbenchService
,
getSyncAreaLabel
,
AccountStatus
,
CONTEXT_SYNC_STATE
,
CONTEXT_SYNC_ENABLEMENT
,
CONTEXT_ACCOUNT_STATE
,
CONFIGURE_SYNC_COMMAND_ID
,
SHOW_SYNC_LOG_COMMAND_ID
,
SYNC_VIEW_CONTAINER
_ID
}
from
'
vs/workbench/services/userDataSync/common/userDataSync
'
;
const
CONTEXT_CONFLICTS_SOURCES
=
new
RawContextKey
<
string
>
(
'
conflictsSources
'
,
''
);
...
...
@@ -64,7 +64,6 @@ type SyncConflictsClassification = {
action
?:
{
classification
:
'
SystemMetaData
'
,
purpose
:
'
FeatureInsight
'
,
isMeasurement
:
true
};
};
const
viewContainerId
=
'
workbench.view.sync
'
;
const
turnOnSyncCommand
=
{
id
:
'
workbench.userDataSync.actions.turnOn
'
,
title
:
localize
(
'
turn on sync with category
'
,
"
Preferences Sync: Turn On...
"
)
};
const
turnOffSyncCommand
=
{
id
:
'
workbench.userDataSync.actions.turnOff
'
,
title
:
localize
(
'
stop sync
'
,
"
Preferences Sync: Turn Off
"
)
};
const
configureSyncCommand
=
{
id
:
CONFIGURE_SYNC_COMMAND_ID
,
title
:
localize
(
'
configure sync
'
,
"
Preferences Sync: Configure...
"
)
};
...
...
@@ -85,6 +84,7 @@ const syncNowCommand = {
}
};
const
showSyncSettingsCommand
=
{
id
:
'
workbench.userDataSync.actions.settings
'
,
title
:
localize
(
'
sync settings
'
,
"
Preferences Sync: Show Settings
"
),
};
const
showSyncedDataCommand
=
{
id
:
'
workbench.userDataSync.actions.showSyncedData
'
,
title
:
localize
(
'
show synced data
'
,
"
Preferences Sync: Show Synced Data
"
),
};
const
CONTEXT_TURNING_ON_STATE
=
new
RawContextKey
<
false
>
(
'
userDataSyncTurningOn
'
,
false
);
...
...
@@ -92,7 +92,6 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
private
readonly
turningOnSyncContext
:
IContextKey
<
boolean
>
;
private
readonly
conflictsSources
:
IContextKey
<
string
>
;
private
readonly
viewsEnablementContext
:
IContextKey
<
boolean
>
;
private
readonly
globalActivityBadgeDisposable
=
this
.
_register
(
new
MutableDisposable
());
private
readonly
accountBadgeDisposable
=
this
.
_register
(
new
MutableDisposable
());
...
...
@@ -119,13 +118,11 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
@
IStorageService
private
readonly
storageService
:
IStorageService
,
@
IOpenerService
private
readonly
openerService
:
IOpenerService
,
@
IAuthenticationService
private
readonly
authenticationService
:
IAuthenticationService
,
@
ICommandService
private
readonly
commandService
:
ICommandService
,
)
{
super
();
this
.
turningOnSyncContext
=
CONTEXT_TURNING_ON_STATE
.
bindTo
(
contextKeyService
);
this
.
conflictsSources
=
CONTEXT_CONFLICTS_SOURCES
.
bindTo
(
contextKeyService
);
this
.
viewsEnablementContext
=
CONTEXT_ENABLE_VIEWS
.
bindTo
(
contextKeyService
);
if
(
this
.
userDataSyncWorkbenchService
.
authenticationProviders
.
length
)
{
registerConfiguration
();
...
...
@@ -312,7 +309,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
actions
:
{
primary
:
[
new
Action
(
'
reset
'
,
localize
(
'
reset
'
,
"
Reset Synced Data
"
),
undefined
,
true
,
()
=>
this
.
userDataSyncWorkbenchService
.
resetSyncedData
()),
new
Action
(
'
show synced data
'
,
localize
(
'
show synced data action
'
,
"
Show Synced Data
"
),
undefined
,
true
,
()
=>
this
.
commandService
.
executeCommand
(
SHOW_SYNCED_DATA_COMMAND_ID
))
new
Action
(
'
show synced data
'
,
localize
(
'
show synced data action
'
,
"
Show Synced Data
"
),
undefined
,
true
,
()
=>
this
.
userDataSyncWorkbenchService
.
showSyncActivity
(
))
]
}
});
...
...
@@ -468,7 +465,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
actions
:
{
primary
:
[
new
Action
(
'
reset
'
,
localize
(
'
reset
'
,
"
Reset Synced Data
"
),
undefined
,
true
,
()
=>
this
.
userDataSyncWorkbenchService
.
resetSyncedData
()),
new
Action
(
'
show synced data
'
,
localize
(
'
show synced data action
'
,
"
Show Synced Data
"
),
undefined
,
true
,
()
=>
this
.
commandService
.
executeCommand
(
SHOW_SYNCED_DATA_COMMAND_ID
))
new
Action
(
'
show synced data
'
,
localize
(
'
show synced data action
'
,
"
Show Synced Data
"
),
undefined
,
true
,
()
=>
this
.
userDataSyncWorkbenchService
.
showSyncActivity
(
))
]
}
});
...
...
@@ -926,7 +923,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
}
items
.
push
({
id
:
configureSyncCommand
.
id
,
label
:
configureSyncCommand
.
title
});
items
.
push
({
id
:
showSyncSettingsCommand
.
id
,
label
:
showSyncSettingsCommand
.
title
});
items
.
push
({
id
:
SHOW_SYNCED_DATA_COMMAND_ID
,
label
:
localize
(
'
show synced data
'
,
"
Preferences Sync: Show Synced Data
"
)
});
items
.
push
({
id
:
showSyncedDataCommand
.
id
,
label
:
showSyncedDataCommand
.
title
});
items
.
push
({
type
:
'
separator
'
});
items
.
push
({
id
:
syncNowCommand
.
id
,
label
:
syncNowCommand
.
title
,
description
:
syncNowCommand
.
description
(
that
.
userDataSyncService
)
});
if
(
that
.
userDataAutoSyncService
.
canToggleEnablement
())
{
...
...
@@ -956,7 +953,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
this
.
_register
(
registerAction2
(
class
SyncStatusAction
extends
Action2
{
constructor
()
{
super
({
id
:
SHOW_SYNCED_DATA_COMMAND_ID
,
id
:
showSyncedDataCommand
.
id
,
title
:
{
value
:
localize
(
'
workbench.action.showSyncRemoteBackup
'
,
"
Show Synced Data
"
),
original
:
`Show Synced Data`
},
category
:
{
value
:
localize
(
'
sync preferences
'
,
"
Preferences Sync
"
),
original
:
`Preferences Sync`
},
precondition
:
when
,
...
...
@@ -966,24 +963,8 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
}
});
}
async
run
(
accessor
:
ServicesAccessor
):
Promise
<
void
>
{
that
.
viewsEnablementContext
.
set
(
true
);
const
viewDescriptorService
=
accessor
.
get
(
IViewDescriptorService
);
const
viewsService
=
accessor
.
get
(
IViewsService
);
const
viewContainer
=
viewDescriptorService
.
getViewContainerById
(
viewContainerId
);
if
(
viewContainer
)
{
const
model
=
viewDescriptorService
.
getViewContainerModel
(
viewContainer
);
if
(
model
.
activeViewDescriptors
.
length
)
{
viewsService
.
openViewContainer
(
viewContainerId
);
}
else
{
const
disposable
=
model
.
onDidChangeActiveViewDescriptors
(
e
=>
{
if
(
e
.
added
.
length
)
{
disposable
.
dispose
();
viewsService
.
openViewContainer
(
viewContainerId
);
}
});
}
}
run
(
accessor
:
ServicesAccessor
):
Promise
<
void
>
{
return
that
.
userDataSyncWorkbenchService
.
showSyncActivity
();
}
}));
}
...
...
@@ -1093,11 +1074,11 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
private
registerViewContainer
():
ViewContainer
{
return
Registry
.
as
<
IViewContainersRegistry
>
(
Extensions
.
ViewContainersRegistry
).
registerViewContainer
(
{
id
:
viewContainerId
,
id
:
SYNC_VIEW_CONTAINER_ID
,
name
:
localize
(
'
sync preferences
'
,
"
Preferences Sync
"
),
ctorDescriptor
:
new
SyncDescriptor
(
UserDataSyncViewPaneContainer
,
[
viewContainerId
]
[
SYNC_VIEW_CONTAINER_ID
]
),
icon
:
Codicon
.
sync
.
classNames
,
hideIfEmpty
:
true
,
...
...
src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts
浏览文件 @
c338a515
...
...
@@ -87,9 +87,10 @@ export class UserDataSyncDataViews extends Disposable {
private
registerViews
(
container
:
ViewContainer
):
void
{
this
.
registerManualSyncView
(
container
);
this
.
registerMachinesView
(
container
);
this
.
registerActivityView
(
container
,
true
);
this
.
registerMachinesView
(
container
);
this
.
registerActivityView
(
container
,
false
);
}
...
...
@@ -359,7 +360,7 @@ export class UserDataSyncDataViews extends Disposable {
canMoveView
:
false
,
treeView
,
collapsed
:
false
,
order
:
2
00
,
order
:
3
00
,
}],
container
);
registerAction2
(
class
extends
Action2
{
...
...
@@ -426,8 +427,8 @@ export class UserDataSyncDataViews extends Disposable {
canToggleVisibility
:
true
,
canMoveView
:
false
,
treeView
,
collapsed
:
tru
e
,
order
:
3
00
,
collapsed
:
fals
e
,
order
:
remote
?
200
:
4
00
,
hideByDefault
:
!
remote
,
}],
container
);
...
...
src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts
浏览文件 @
c338a515
...
...
@@ -6,7 +6,7 @@
import
{
IUserDataSyncService
,
IAuthenticationProvider
,
getUserDataSyncStore
,
isAuthenticationProvider
,
IUserDataAutoSyncService
,
SyncResource
,
IResourcePreview
,
ISyncResourcePreview
,
Change
,
IManualSyncTask
}
from
'
vs/platform/userDataSync/common/userDataSync
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IUserDataSyncWorkbenchService
,
IUserDataSyncAccount
,
AccountStatus
,
CONTEXT_SYNC_ENABLEMENT
,
CONTEXT_SYNC_STATE
,
CONTEXT_ACCOUNT_STATE
,
SHOW_SYNC_LOG_COMMAND_ID
,
getSyncAreaLabel
,
IUserDataSyncPreview
,
IUserDataSyncResourceGroup
,
CONTEXT_SHOW_MANUAL_SYNC_VIEW
,
SHOW_SYNCED_DATA_COMMAND_ID
,
MANUAL_SYNC_VIEW
_ID
}
from
'
vs/workbench/services/userDataSync/common/userDataSync
'
;
import
{
IUserDataSyncWorkbenchService
,
IUserDataSyncAccount
,
AccountStatus
,
CONTEXT_SYNC_ENABLEMENT
,
CONTEXT_SYNC_STATE
,
CONTEXT_ACCOUNT_STATE
,
SHOW_SYNC_LOG_COMMAND_ID
,
getSyncAreaLabel
,
IUserDataSyncPreview
,
IUserDataSyncResourceGroup
,
CONTEXT_SHOW_MANUAL_SYNC_VIEW
,
MANUAL_SYNC_VIEW_ID
,
CONTEXT_ENABLE_VIEWS
,
SYNC_VIEW_CONTAINER
_ID
}
from
'
vs/workbench/services/userDataSync/common/userDataSync
'
;
import
{
AuthenticationSession
,
AuthenticationSessionsChangeEvent
}
from
'
vs/editor/common/modes
'
;
import
{
Disposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
...
...
@@ -25,7 +25,6 @@ import { canceled } from 'vs/base/common/errors';
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
IContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
IProgressService
,
ProgressLocation
}
from
'
vs/platform/progress/common/progress
'
;
import
{
isEqual
}
from
'
vs/base/common/resources
'
;
...
...
@@ -82,6 +81,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
private
readonly
syncStatusContext
:
IContextKey
<
string
>
;
private
readonly
accountStatusContext
:
IContextKey
<
string
>
;
private
readonly
showManualSyncViewContext
:
IContextKey
<
boolean
>
;
private
readonly
viewsEnablementContext
:
IContextKey
<
boolean
>
;
readonly
userDataSyncPreview
:
UserDataSyncPreview
=
this
.
_register
(
new
UserDataSyncPreview
(
this
.
userDataSyncService
));
...
...
@@ -101,7 +101,6 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
@
INotificationService
private
readonly
notificationService
:
INotificationService
,
@
IProgressService
private
readonly
progressService
:
IProgressService
,
@
IDialogService
private
readonly
dialogService
:
IDialogService
,
@
ICommandService
private
readonly
commandService
:
ICommandService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IViewsService
private
readonly
viewsService
:
IViewsService
,
@
IViewDescriptorService
private
readonly
viewDescriptorService
:
IViewDescriptorService
,
...
...
@@ -112,6 +111,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
this
.
syncEnablementContext
=
CONTEXT_SYNC_ENABLEMENT
.
bindTo
(
contextKeyService
);
this
.
syncStatusContext
=
CONTEXT_SYNC_STATE
.
bindTo
(
contextKeyService
);
this
.
accountStatusContext
=
CONTEXT_ACCOUNT_STATE
.
bindTo
(
contextKeyService
);
this
.
viewsEnablementContext
=
CONTEXT_ENABLE_VIEWS
.
bindTo
(
contextKeyService
);
this
.
showManualSyncViewContext
=
CONTEXT_SHOW_MANUAL_SYNC_VIEW
.
bindTo
(
contextKeyService
);
decorationsService
.
registerDecorationsProvider
(
this
.
userDataSyncPreview
);
...
...
@@ -338,7 +338,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
this
.
userDataSyncPreview
.
setManualSyncPreview
(
task
,
preview
);
this
.
showManualSyncViewContext
.
set
(
true
);
await
this
.
commandService
.
executeCommand
(
SHOW_SYNCED_DATA_COMMAND_ID
);
await
this
.
enableSyncViews
(
);
await
this
.
viewsService
.
openView
(
MANUAL_SYNC_VIEW_ID
);
await
Event
.
toPromise
(
Event
.
filter
(
this
.
userDataSyncPreview
.
onDidChangeChanges
,
e
=>
e
.
length
===
0
));
...
...
@@ -369,6 +369,22 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
}
}
async
showSyncActivity
():
Promise
<
void
>
{
await
this
.
enableSyncViews
();
await
this
.
viewsService
.
openViewContainer
(
SYNC_VIEW_CONTAINER_ID
);
}
private
async
enableSyncViews
():
Promise
<
void
>
{
this
.
viewsEnablementContext
.
set
(
true
);
const
viewContainer
=
this
.
viewDescriptorService
.
getViewContainerById
(
SYNC_VIEW_CONTAINER_ID
);
if
(
viewContainer
)
{
const
model
=
this
.
viewDescriptorService
.
getViewContainerModel
(
viewContainer
);
if
(
!
model
.
activeViewDescriptors
.
length
)
{
await
Event
.
toPromise
(
Event
.
filter
(
model
.
onDidChangeActiveViewDescriptors
,
e
=>
model
.
activeViewDescriptors
.
length
>
0
));
}
}
}
private
isSupportedAuthenticationProviderId
(
authenticationProviderId
:
string
):
boolean
{
return
this
.
authenticationProviders
.
some
(({
id
})
=>
id
===
authenticationProviderId
);
}
...
...
src/vs/workbench/services/userDataSync/common/userDataSync.ts
浏览文件 @
c338a515
...
...
@@ -54,7 +54,9 @@ export interface IUserDataSyncWorkbenchService {
turnOn
():
Promise
<
void
>
;
turnoff
(
everyWhere
:
boolean
):
Promise
<
void
>
;
signIn
():
Promise
<
void
>
;
resetSyncedData
():
Promise
<
void
>
;
showSyncActivity
():
Promise
<
void
>
;
}
export
function
getSyncAreaLabel
(
source
:
SyncResource
):
string
{
...
...
@@ -83,7 +85,7 @@ export const CONTEXT_SHOW_MANUAL_SYNC_VIEW = new RawContextKey<boolean>(`showMan
// Commands
export
const
CONFIGURE_SYNC_COMMAND_ID
=
'
workbench.userDataSync.actions.configure
'
;
export
const
SHOW_SYNC_LOG_COMMAND_ID
=
'
workbench.userDataSync.actions.showLog
'
;
export
const
SHOW_SYNCED_DATA_COMMAND_ID
=
'
workbench.userDataSync.actions.showSyncedData
'
;
// VIEWS
export
const
SYNC_VIEW_CONTAINER_ID
=
'
workbench.view.sync
'
;
export
const
MANUAL_SYNC_VIEW_ID
=
'
workbench.views.manualSyncView
'
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录