Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2da2634c
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,发现更多精彩内容 >>
提交
2da2634c
编写于
6月 17, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remember current machine name
上级
476e179d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
50 deletion
+47
-50
src/vs/platform/userDataSync/common/userDataAutoSyncService.ts
...s/platform/userDataSync/common/userDataAutoSyncService.ts
+7
-27
src/vs/platform/userDataSync/common/userDataSyncIpc.ts
src/vs/platform/userDataSync/common/userDataSyncIpc.ts
+1
-1
src/vs/platform/userDataSync/common/userDataSyncMachines.ts
src/vs/platform/userDataSync/common/userDataSyncMachines.ts
+35
-14
src/vs/platform/userDataSync/electron-browser/userDataAutoSyncService.ts
.../userDataSync/electron-browser/userDataAutoSyncService.ts
+1
-3
src/vs/workbench/contrib/userDataSync/browser/userDataAutoSyncService.ts
...h/contrib/userDataSync/browser/userDataAutoSyncService.ts
+1
-3
src/vs/workbench/services/userDataSync/electron-browser/userDataSyncMachinesService.ts
...rDataSync/electron-browser/userDataSyncMachinesService.ts
+2
-2
未找到文件。
src/vs/platform/userDataSync/common/userDataAutoSyncService.ts
浏览文件 @
2da2634c
...
@@ -13,10 +13,7 @@ import { isPromiseCanceledError } from 'vs/base/common/errors';
...
@@ -13,10 +13,7 @@ import { isPromiseCanceledError } from 'vs/base/common/errors';
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
IStorageService
,
StorageScope
,
IWorkspaceStorageChangeEvent
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IStorageService
,
StorageScope
,
IWorkspaceStorageChangeEvent
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IUserDataSyncMachine
,
IUserDataSyncMachinesService
}
from
'
vs/platform/userDataSync/common/userDataSyncMachines
'
;
import
{
IUserDataSyncMachinesService
}
from
'
vs/platform/userDataSync/common/userDataSyncMachines
'
;
import
{
PlatformToString
,
isWeb
,
Platform
,
platform
}
from
'
vs/base/common/platform
'
;
import
{
escapeRegExpCharacters
}
from
'
vs/base/common/strings
'
;
import
{
IProductService
}
from
'
vs/platform/product/common/productService
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
localize
}
from
'
vs/nls
'
;
type
AutoSyncClassification
=
{
type
AutoSyncClassification
=
{
...
@@ -33,7 +30,7 @@ type AutoSyncErrorClassification = {
...
@@ -33,7 +30,7 @@ type AutoSyncErrorClassification = {
const
enablementKey
=
'
sync.enable
'
;
const
enablementKey
=
'
sync.enable
'
;
const
disableMachineEventuallyKey
=
'
sync.disableMachineEventually
'
;
const
disableMachineEventuallyKey
=
'
sync.disableMachineEventually
'
;
const
SESSION_ID_KEY
=
'
sync.sessionId
'
;
const
sessionIdKey
=
'
sync.sessionId
'
;
export
class
UserDataAutoSyncEnablementService
extends
Disposable
{
export
class
UserDataAutoSyncEnablementService
extends
Disposable
{
...
@@ -92,7 +89,6 @@ export class UserDataAutoSyncService extends UserDataAutoSyncEnablementService i
...
@@ -92,7 +89,6 @@ export class UserDataAutoSyncService extends UserDataAutoSyncEnablementService i
@
IUserDataSyncAccountService
private
readonly
userDataSyncAccountService
:
IUserDataSyncAccountService
,
@
IUserDataSyncAccountService
private
readonly
userDataSyncAccountService
:
IUserDataSyncAccountService
,
@
ITelemetryService
private
readonly
telemetryService
:
ITelemetryService
,
@
ITelemetryService
private
readonly
telemetryService
:
ITelemetryService
,
@
IUserDataSyncMachinesService
private
readonly
userDataSyncMachinesService
:
IUserDataSyncMachinesService
,
@
IUserDataSyncMachinesService
private
readonly
userDataSyncMachinesService
:
IUserDataSyncMachinesService
,
@
IProductService
private
readonly
productService
:
IProductService
,
@
IStorageService
storageService
:
IStorageService
,
@
IStorageService
storageService
:
IStorageService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
@
IEnvironmentService
environmentService
:
IEnvironmentService
)
{
)
{
...
@@ -114,7 +110,7 @@ export class UserDataAutoSyncService extends UserDataAutoSyncEnablementService i
...
@@ -114,7 +110,7 @@ export class UserDataAutoSyncService extends UserDataAutoSyncEnablementService i
const
{
enabled
,
reason
}
=
this
.
isAutoSyncEnabled
();
const
{
enabled
,
reason
}
=
this
.
isAutoSyncEnabled
();
if
(
enabled
)
{
if
(
enabled
)
{
if
(
this
.
autoSync
.
value
===
undefined
)
{
if
(
this
.
autoSync
.
value
===
undefined
)
{
this
.
autoSync
.
value
=
new
AutoSync
(
1000
*
60
*
5
/* 5 miutes */
,
this
.
userDataSyncStoreService
,
this
.
userDataSyncService
,
this
.
userDataSyncMachinesService
,
this
.
logService
,
this
.
storageService
,
this
.
productService
);
this
.
autoSync
.
value
=
new
AutoSync
(
1000
*
60
*
5
/* 5 miutes */
,
this
.
userDataSyncStoreService
,
this
.
userDataSyncService
,
this
.
userDataSyncMachinesService
,
this
.
logService
,
this
.
storageService
);
this
.
autoSync
.
value
.
register
(
this
.
autoSync
.
value
.
onDidStartSync
(()
=>
this
.
lastSyncTriggerTime
=
new
Date
().
getTime
()));
this
.
autoSync
.
value
.
register
(
this
.
autoSync
.
value
.
onDidStartSync
(()
=>
this
.
lastSyncTriggerTime
=
new
Date
().
getTime
()));
this
.
autoSync
.
value
.
register
(
this
.
autoSync
.
value
.
onDidFinishSync
(
e
=>
this
.
onDidFinishSync
(
e
)));
this
.
autoSync
.
value
.
register
(
this
.
autoSync
.
value
.
onDidFinishSync
(
e
=>
this
.
onDidFinishSync
(
e
)));
if
(
this
.
startAutoSync
())
{
if
(
this
.
startAutoSync
())
{
...
@@ -167,7 +163,7 @@ export class UserDataAutoSyncService extends UserDataAutoSyncEnablementService i
...
@@ -167,7 +163,7 @@ export class UserDataAutoSyncService extends UserDataAutoSyncEnablementService i
this
.
setEnablement
(
false
);
this
.
setEnablement
(
false
);
// Reset Session
// Reset Session
this
.
storageService
.
remove
(
SESSION_ID_KEY
,
StorageScope
.
GLOBAL
);
this
.
storageService
.
remove
(
sessionIdKey
,
StorageScope
.
GLOBAL
);
// Reset
// Reset
if
(
everywhere
)
{
if
(
everywhere
)
{
...
@@ -309,7 +305,6 @@ class AutoSync extends Disposable {
...
@@ -309,7 +305,6 @@ class AutoSync extends Disposable {
private
readonly
userDataSyncMachinesService
:
IUserDataSyncMachinesService
,
private
readonly
userDataSyncMachinesService
:
IUserDataSyncMachinesService
,
private
readonly
logService
:
IUserDataSyncLogService
,
private
readonly
logService
:
IUserDataSyncLogService
,
private
readonly
storageService
:
IStorageService
,
private
readonly
storageService
:
IStorageService
,
private
readonly
productService
:
IProductService
,
)
{
)
{
super
();
super
();
}
}
...
@@ -368,7 +363,7 @@ class AutoSync extends Disposable {
...
@@ -368,7 +363,7 @@ class AutoSync extends Disposable {
throw
new
UserDataAutoSyncError
(
localize
(
'
turned off
'
,
"
Cannot sync because syncing is turned off in the cloud
"
),
UserDataSyncErrorCode
.
TurnedOff
);
throw
new
UserDataAutoSyncError
(
localize
(
'
turned off
'
,
"
Cannot sync because syncing is turned off in the cloud
"
),
UserDataSyncErrorCode
.
TurnedOff
);
}
}
const
sessionId
=
this
.
storageService
.
get
(
SESSION_ID_KEY
,
StorageScope
.
GLOBAL
);
const
sessionId
=
this
.
storageService
.
get
(
sessionIdKey
,
StorageScope
.
GLOBAL
);
// Server session is different from client session
// Server session is different from client session
if
(
sessionId
&&
manifest
&&
sessionId
!==
manifest
.
session
)
{
if
(
sessionId
&&
manifest
&&
sessionId
!==
manifest
.
session
)
{
throw
new
UserDataAutoSyncError
(
localize
(
'
session expired
'
,
"
Cannot sync because current session is expired
"
),
UserDataSyncErrorCode
.
SessionExpired
);
throw
new
UserDataAutoSyncError
(
localize
(
'
session expired
'
,
"
Cannot sync because current session is expired
"
),
UserDataSyncErrorCode
.
SessionExpired
);
...
@@ -396,7 +391,7 @@ class AutoSync extends Disposable {
...
@@ -396,7 +391,7 @@ class AutoSync extends Disposable {
// Update local session id
// Update local session id
if
(
manifest
&&
manifest
.
session
!==
sessionId
)
{
if
(
manifest
&&
manifest
.
session
!==
sessionId
)
{
this
.
storageService
.
store
(
SESSION_ID_KEY
,
manifest
.
session
,
StorageScope
.
GLOBAL
);
this
.
storageService
.
store
(
sessionIdKey
,
manifest
.
session
,
StorageScope
.
GLOBAL
);
}
}
// Return if cancellation is requested
// Return if cancellation is requested
...
@@ -406,8 +401,7 @@ class AutoSync extends Disposable {
...
@@ -406,8 +401,7 @@ class AutoSync extends Disposable {
// Add current machine
// Add current machine
if
(
!
currentMachine
)
{
if
(
!
currentMachine
)
{
const
name
=
this
.
computeDefaultMachineName
(
machines
);
await
this
.
userDataSyncMachinesService
.
addCurrentMachine
(
manifest
||
undefined
);
await
this
.
userDataSyncMachinesService
.
addCurrentMachine
(
name
,
manifest
||
undefined
);
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -418,20 +412,6 @@ class AutoSync extends Disposable {
...
@@ -418,20 +412,6 @@ class AutoSync extends Disposable {
this
.
_onDidFinishSync
.
fire
(
error
);
this
.
_onDidFinishSync
.
fire
(
error
);
}
}
private
computeDefaultMachineName
(
machines
:
IUserDataSyncMachine
[]):
string
{
const
namePrefix
=
`
${
this
.
productService
.
nameLong
}
(
${
PlatformToString
(
isWeb
?
Platform
.
Web
:
platform
)}
)`
;
const
nameRegEx
=
new
RegExp
(
`
${
escapeRegExpCharacters
(
namePrefix
)}
\\s#(\\d)`
);
let
nameIndex
=
0
;
for
(
const
machine
of
machines
)
{
const
matches
=
nameRegEx
.
exec
(
machine
.
name
);
const
index
=
matches
?
parseInt
(
matches
[
1
])
:
0
;
nameIndex
=
index
>
nameIndex
?
index
:
nameIndex
;
}
return
`
${
namePrefix
}
#
${
nameIndex
+
1
}
`
;
}
register
<
T
extends
IDisposable
>
(
t
:
T
):
T
{
register
<
T
extends
IDisposable
>
(
t
:
T
):
T
{
return
super
.
_register
(
t
);
return
super
.
_register
(
t
);
}
}
...
...
src/vs/platform/userDataSync/common/userDataSyncIpc.ts
浏览文件 @
2da2634c
...
@@ -181,7 +181,7 @@ export class UserDataSyncMachinesServiceChannel implements IServerChannel {
...
@@ -181,7 +181,7 @@ export class UserDataSyncMachinesServiceChannel implements IServerChannel {
async
call
(
context
:
any
,
command
:
string
,
args
?:
any
):
Promise
<
any
>
{
async
call
(
context
:
any
,
command
:
string
,
args
?:
any
):
Promise
<
any
>
{
switch
(
command
)
{
switch
(
command
)
{
case
'
getMachines
'
:
return
this
.
service
.
getMachines
();
case
'
getMachines
'
:
return
this
.
service
.
getMachines
();
case
'
addCurrentMachine
'
:
return
this
.
service
.
addCurrentMachine
(
args
[
0
]
);
case
'
addCurrentMachine
'
:
return
this
.
service
.
addCurrentMachine
();
case
'
removeCurrentMachine
'
:
return
this
.
service
.
removeCurrentMachine
();
case
'
removeCurrentMachine
'
:
return
this
.
service
.
removeCurrentMachine
();
case
'
renameMachine
'
:
return
this
.
service
.
renameMachine
(
args
[
0
],
args
[
1
]);
case
'
renameMachine
'
:
return
this
.
service
.
renameMachine
(
args
[
0
],
args
[
1
]);
case
'
setEnablement
'
:
return
this
.
service
.
setEnablement
(
args
[
0
],
args
[
1
]);
case
'
setEnablement
'
:
return
this
.
service
.
setEnablement
(
args
[
0
],
args
[
1
]);
...
...
src/vs/platform/userDataSync/common/userDataSyncMachines.ts
浏览文件 @
2da2634c
...
@@ -8,10 +8,12 @@ import { Disposable } from 'vs/base/common/lifecycle';
...
@@ -8,10 +8,12 @@ import { Disposable } from 'vs/base/common/lifecycle';
import
{
getServiceMachineId
}
from
'
vs/platform/serviceMachineId/common/serviceMachineId
'
;
import
{
getServiceMachineId
}
from
'
vs/platform/serviceMachineId/common/serviceMachineId
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IUserDataSyncStoreService
,
IUserData
,
IUserDataSyncLogService
,
IUserDataManifest
}
from
'
vs/platform/userDataSync/common/userDataSync
'
;
import
{
IUserDataSyncStoreService
,
IUserData
,
IUserDataSyncLogService
,
IUserDataManifest
}
from
'
vs/platform/userDataSync/common/userDataSync
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
IProductService
}
from
'
vs/platform/product/common/productService
'
;
import
{
IProductService
}
from
'
vs/platform/product/common/productService
'
;
import
{
PlatformToString
,
isWeb
,
Platform
,
platform
}
from
'
vs/base/common/platform
'
;
import
{
escapeRegExpCharacters
}
from
'
vs/base/common/strings
'
;
interface
IMachineData
{
interface
IMachineData
{
id
:
string
;
id
:
string
;
...
@@ -26,19 +28,20 @@ interface IMachinesData {
...
@@ -26,19 +28,20 @@ interface IMachinesData {
export
type
IUserDataSyncMachine
=
Readonly
<
IMachineData
>
&
{
readonly
isCurrent
:
boolean
};
export
type
IUserDataSyncMachine
=
Readonly
<
IMachineData
>
&
{
readonly
isCurrent
:
boolean
};
export
const
IUserDataSyncMachinesService
=
createDecorator
<
IUserDataSyncMachinesService
>
(
'
IUserDataSyncMachinesService
'
);
export
const
IUserDataSyncMachinesService
=
createDecorator
<
IUserDataSyncMachinesService
>
(
'
IUserDataSyncMachinesService
'
);
export
interface
IUserDataSyncMachinesService
{
export
interface
IUserDataSyncMachinesService
{
_serviceBrand
:
any
;
_serviceBrand
:
any
;
getMachines
(
manifest
?:
IUserDataManifest
):
Promise
<
IUserDataSyncMachine
[]
>
;
getMachines
(
manifest
?:
IUserDataManifest
):
Promise
<
IUserDataSyncMachine
[]
>
;
addCurrentMachine
(
name
:
string
,
manifest
?:
IUserDataManifest
):
Promise
<
void
>
;
addCurrentMachine
(
manifest
?:
IUserDataManifest
):
Promise
<
void
>
;
removeCurrentMachine
(
manifest
?:
IUserDataManifest
):
Promise
<
void
>
;
removeCurrentMachine
(
manifest
?:
IUserDataManifest
):
Promise
<
void
>
;
renameMachine
(
machineId
:
string
,
name
:
string
):
Promise
<
void
>
;
renameMachine
(
machineId
:
string
,
name
:
string
):
Promise
<
void
>
;
setEnablement
(
machineId
:
string
,
enabled
:
boolean
):
Promise
<
void
>
;
setEnablement
(
machineId
:
string
,
enabled
:
boolean
):
Promise
<
void
>
;
}
}
const
currentMachineNameKey
=
'
sync.currentMachineName
'
;
export
class
UserDataSyncMachinesService
extends
Disposable
implements
IUserDataSyncMachinesService
{
export
class
UserDataSyncMachinesService
extends
Disposable
implements
IUserDataSyncMachinesService
{
private
static
readonly
VERSION
=
1
;
private
static
readonly
VERSION
=
1
;
...
@@ -52,7 +55,7 @@ export class UserDataSyncMachinesService extends Disposable implements IUserData
...
@@ -52,7 +55,7 @@ export class UserDataSyncMachinesService extends Disposable implements IUserData
constructor
(
constructor
(
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IFileService
fileService
:
IFileService
,
@
IFileService
fileService
:
IFileService
,
@
IStorageService
storageService
:
IStorageService
,
@
IStorageService
private
readonly
storageService
:
IStorageService
,
@
IUserDataSyncStoreService
private
readonly
userDataSyncStoreService
:
IUserDataSyncStoreService
,
@
IUserDataSyncStoreService
private
readonly
userDataSyncStoreService
:
IUserDataSyncStoreService
,
@
IUserDataSyncLogService
private
readonly
logService
:
IUserDataSyncLogService
,
@
IUserDataSyncLogService
private
readonly
logService
:
IUserDataSyncLogService
,
@
IProductService
private
readonly
productService
:
IProductService
,
@
IProductService
private
readonly
productService
:
IProductService
,
...
@@ -67,16 +70,13 @@ export class UserDataSyncMachinesService extends Disposable implements IUserData
...
@@ -67,16 +70,13 @@ export class UserDataSyncMachinesService extends Disposable implements IUserData
return
machineData
.
machines
.
map
<
IUserDataSyncMachine
>
(
machine
=>
({
...
machine
,
...{
isCurrent
:
machine
.
id
===
currentMachineId
}
}));
return
machineData
.
machines
.
map
<
IUserDataSyncMachine
>
(
machine
=>
({
...
machine
,
...{
isCurrent
:
machine
.
id
===
currentMachineId
}
}));
}
}
async
addCurrentMachine
(
name
:
string
,
manifest
?:
IUserDataManifest
):
Promise
<
void
>
{
async
addCurrentMachine
(
manifest
?:
IUserDataManifest
):
Promise
<
void
>
{
const
currentMachineId
=
await
this
.
currentMachineIdPromise
;
const
currentMachineId
=
await
this
.
currentMachineIdPromise
;
const
machineData
=
await
this
.
readMachinesData
(
manifest
);
const
machineData
=
await
this
.
readMachinesData
(
manifest
);
let
currentMachine
=
machineData
.
machines
.
find
(({
id
})
=>
id
===
currentMachineId
);
if
(
!
machineData
.
machines
.
some
(({
id
})
=>
id
===
currentMachineId
))
{
if
(
currentMachine
)
{
machineData
.
machines
.
push
({
id
:
currentMachineId
,
name
:
this
.
computeCurrentMachineName
(
machineData
.
machines
)
});
currentMachine
.
name
=
name
;
await
this
.
writeMachinesData
(
machineData
);
}
else
{
machineData
.
machines
.
push
({
id
:
currentMachineId
,
name
});
}
}
await
this
.
writeMachinesData
(
machineData
);
}
}
async
removeCurrentMachine
(
manifest
?:
IUserDataManifest
):
Promise
<
void
>
{
async
removeCurrentMachine
(
manifest
?:
IUserDataManifest
):
Promise
<
void
>
{
...
@@ -90,11 +90,15 @@ export class UserDataSyncMachinesService extends Disposable implements IUserData
...
@@ -90,11 +90,15 @@ export class UserDataSyncMachinesService extends Disposable implements IUserData
}
}
async
renameMachine
(
machineId
:
string
,
name
:
string
,
manifest
?:
IUserDataManifest
):
Promise
<
void
>
{
async
renameMachine
(
machineId
:
string
,
name
:
string
,
manifest
?:
IUserDataManifest
):
Promise
<
void
>
{
const
currentMachineId
=
await
this
.
currentMachineIdPromise
;
const
machineData
=
await
this
.
readMachinesData
(
manifest
);
const
machineData
=
await
this
.
readMachinesData
(
manifest
);
const
currentM
achine
=
machineData
.
machines
.
find
(({
id
})
=>
id
===
machineId
);
const
m
achine
=
machineData
.
machines
.
find
(({
id
})
=>
id
===
machineId
);
if
(
currentM
achine
)
{
if
(
m
achine
)
{
currentM
achine
.
name
=
name
;
m
achine
.
name
=
name
;
await
this
.
writeMachinesData
(
machineData
);
await
this
.
writeMachinesData
(
machineData
);
if
(
machineData
.
machines
.
some
(({
id
})
=>
id
===
currentMachineId
))
{
this
.
storageService
.
store
(
currentMachineNameKey
,
name
,
StorageScope
.
GLOBAL
);
}
}
}
}
}
...
@@ -107,6 +111,23 @@ export class UserDataSyncMachinesService extends Disposable implements IUserData
...
@@ -107,6 +111,23 @@ export class UserDataSyncMachinesService extends Disposable implements IUserData
}
}
}
}
private
computeCurrentMachineName
(
machines
:
IMachineData
[]):
string
{
const
previousName
=
this
.
storageService
.
get
(
currentMachineNameKey
,
StorageScope
.
GLOBAL
);
if
(
previousName
)
{
return
previousName
;
}
const
namePrefix
=
`
${
this
.
productService
.
nameLong
}
(
${
PlatformToString
(
isWeb
?
Platform
.
Web
:
platform
)}
)`
;
const
nameRegEx
=
new
RegExp
(
`
${
escapeRegExpCharacters
(
namePrefix
)}
\\s#(\\d)`
);
let
nameIndex
=
0
;
for
(
const
machine
of
machines
)
{
const
matches
=
nameRegEx
.
exec
(
machine
.
name
);
const
index
=
matches
?
parseInt
(
matches
[
1
])
:
0
;
nameIndex
=
index
>
nameIndex
?
index
:
nameIndex
;
}
return
`
${
namePrefix
}
#
${
nameIndex
+
1
}
`
;
}
private
async
readMachinesData
(
manifest
?:
IUserDataManifest
):
Promise
<
IMachinesData
>
{
private
async
readMachinesData
(
manifest
?:
IUserDataManifest
):
Promise
<
IMachinesData
>
{
this
.
userData
=
await
this
.
readUserData
(
manifest
);
this
.
userData
=
await
this
.
readUserData
(
manifest
);
const
machinesData
=
this
.
parse
(
this
.
userData
);
const
machinesData
=
this
.
parse
(
this
.
userData
);
...
...
src/vs/platform/userDataSync/electron-browser/userDataAutoSyncService.ts
浏览文件 @
2da2634c
...
@@ -12,7 +12,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
...
@@ -12,7 +12,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IUserDataSyncMachinesService
}
from
'
vs/platform/userDataSync/common/userDataSyncMachines
'
;
import
{
IUserDataSyncMachinesService
}
from
'
vs/platform/userDataSync/common/userDataSyncMachines
'
;
import
{
IProductService
}
from
'
vs/platform/product/common/productService
'
;
export
class
UserDataAutoSyncService
extends
BaseUserDataAutoSyncService
{
export
class
UserDataAutoSyncService
extends
BaseUserDataAutoSyncService
{
...
@@ -25,11 +24,10 @@ export class UserDataAutoSyncService extends BaseUserDataAutoSyncService {
...
@@ -25,11 +24,10 @@ export class UserDataAutoSyncService extends BaseUserDataAutoSyncService {
@
IUserDataSyncAccountService
authTokenService
:
IUserDataSyncAccountService
,
@
IUserDataSyncAccountService
authTokenService
:
IUserDataSyncAccountService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IUserDataSyncMachinesService
userDataSyncMachinesService
:
IUserDataSyncMachinesService
,
@
IUserDataSyncMachinesService
userDataSyncMachinesService
:
IUserDataSyncMachinesService
,
@
IProductService
productService
:
IProductService
,
@
IStorageService
storageService
:
IStorageService
,
@
IStorageService
storageService
:
IStorageService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
)
{
)
{
super
(
userDataSyncStoreService
,
userDataSyncResourceEnablementService
,
userDataSyncService
,
logService
,
authTokenService
,
telemetryService
,
userDataSyncMachinesService
,
productService
,
storageService
,
environmentService
);
super
(
userDataSyncStoreService
,
userDataSyncResourceEnablementService
,
userDataSyncService
,
logService
,
authTokenService
,
telemetryService
,
userDataSyncMachinesService
,
storageService
,
environmentService
);
this
.
_register
(
Event
.
debounce
<
string
,
string
[]
>
(
Event
.
any
<
string
>
(
this
.
_register
(
Event
.
debounce
<
string
,
string
[]
>
(
Event
.
any
<
string
>
(
Event
.
map
(
electronService
.
onWindowFocus
,
()
=>
'
windowFocus
'
),
Event
.
map
(
electronService
.
onWindowFocus
,
()
=>
'
windowFocus
'
),
...
...
src/vs/workbench/contrib/userDataSync/browser/userDataAutoSyncService.ts
浏览文件 @
2da2634c
...
@@ -14,7 +14,6 @@ import { UserDataSyncTrigger } from 'vs/workbench/contrib/userDataSync/browser/u
...
@@ -14,7 +14,6 @@ import { UserDataSyncTrigger } from 'vs/workbench/contrib/userDataSync/browser/u
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IUserDataSyncMachinesService
}
from
'
vs/platform/userDataSync/common/userDataSyncMachines
'
;
import
{
IUserDataSyncMachinesService
}
from
'
vs/platform/userDataSync/common/userDataSyncMachines
'
;
import
{
IProductService
}
from
'
vs/platform/product/common/productService
'
;
export
class
UserDataAutoSyncService
extends
BaseUserDataAutoSyncService
{
export
class
UserDataAutoSyncService
extends
BaseUserDataAutoSyncService
{
...
@@ -28,11 +27,10 @@ export class UserDataAutoSyncService extends BaseUserDataAutoSyncService {
...
@@ -28,11 +27,10 @@ export class UserDataAutoSyncService extends BaseUserDataAutoSyncService {
@
IHostService
hostService
:
IHostService
,
@
IHostService
hostService
:
IHostService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IUserDataSyncMachinesService
userDataSyncMachinesService
:
IUserDataSyncMachinesService
,
@
IUserDataSyncMachinesService
userDataSyncMachinesService
:
IUserDataSyncMachinesService
,
@
IProductService
productService
:
IProductService
,
@
IStorageService
storageService
:
IStorageService
,
@
IStorageService
storageService
:
IStorageService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
)
{
)
{
super
(
userDataSyncStoreService
,
userDataSyncResourceEnablementService
,
userDataSyncService
,
logService
,
authTokenService
,
telemetryService
,
userDataSyncMachinesService
,
productService
,
storageService
,
environmentService
);
super
(
userDataSyncStoreService
,
userDataSyncResourceEnablementService
,
userDataSyncService
,
logService
,
authTokenService
,
telemetryService
,
userDataSyncMachinesService
,
storageService
,
environmentService
);
this
.
_register
(
Event
.
debounce
<
string
,
string
[]
>
(
Event
.
any
<
string
>
(
this
.
_register
(
Event
.
debounce
<
string
,
string
[]
>
(
Event
.
any
<
string
>
(
Event
.
map
(
hostService
.
onDidChangeFocus
,
()
=>
'
windowFocus
'
),
Event
.
map
(
hostService
.
onDidChangeFocus
,
()
=>
'
windowFocus
'
),
...
...
src/vs/workbench/services/userDataSync/electron-browser/userDataSyncMachinesService.ts
浏览文件 @
2da2634c
...
@@ -26,8 +26,8 @@ class UserDataSyncMachinesService extends Disposable implements IUserDataSyncMac
...
@@ -26,8 +26,8 @@ class UserDataSyncMachinesService extends Disposable implements IUserDataSyncMac
return
this
.
channel
.
call
<
IUserDataSyncMachine
[]
>
(
'
getMachines
'
);
return
this
.
channel
.
call
<
IUserDataSyncMachine
[]
>
(
'
getMachines
'
);
}
}
addCurrentMachine
(
name
:
string
):
Promise
<
void
>
{
addCurrentMachine
():
Promise
<
void
>
{
return
this
.
channel
.
call
(
'
addCurrentMachine
'
,
[
name
]
);
return
this
.
channel
.
call
(
'
addCurrentMachine
'
);
}
}
removeCurrentMachine
():
Promise
<
void
>
{
removeCurrentMachine
():
Promise
<
void
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录