Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
48854cd4
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
48854cd4
编写于
7月 12, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
IWorkspace => IWorkspaceIdentifier
上级
7a35ef4b
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
54 addition
and
57 deletion
+54
-57
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+2
-2
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+6
-6
src/vs/code/node/windowsFinder.ts
src/vs/code/node/windowsFinder.ts
+3
-3
src/vs/platform/backup/common/backup.ts
src/vs/platform/backup/common/backup.ts
+4
-4
src/vs/platform/backup/electron-main/backupMainService.ts
src/vs/platform/backup/electron-main/backupMainService.ts
+9
-9
src/vs/platform/backup/test/electron-main/backupMainService.test.ts
...tform/backup/test/electron-main/backupMainService.test.ts
+4
-5
src/vs/platform/windows/common/windows.ts
src/vs/platform/windows/common/windows.ts
+3
-3
src/vs/platform/windows/common/windowsIpc.ts
src/vs/platform/windows/common/windowsIpc.ts
+3
-3
src/vs/platform/windows/electron-main/windows.ts
src/vs/platform/windows/electron-main/windows.ts
+2
-2
src/vs/platform/windows/electron-main/windowsService.ts
src/vs/platform/windows/electron-main/windowsService.ts
+2
-2
src/vs/platform/workspaces/common/workspaces.ts
src/vs/platform/workspaces/common/workspaces.ts
+4
-3
src/vs/platform/workspaces/common/workspacesIpc.ts
src/vs/platform/workspaces/common/workspacesIpc.ts
+2
-2
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
...latform/workspaces/electron-main/workspacesMainService.ts
+3
-4
src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts
...rkspaces/test/electron-main/workspacesMainService.test.ts
+5
-7
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+2
-2
未找到文件。
src/vs/code/electron-main/window.ts
浏览文件 @
48854cd4
...
...
@@ -24,7 +24,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import
{
KeyboardLayoutMonitor
}
from
'
vs/code/electron-main/keyboard
'
;
import
{
isLinux
,
isMacintosh
,
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
ICodeWindow
}
from
"
vs/platform/windows/electron-main/windows
"
;
import
{
IWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IWorkspace
Identifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
export
interface
IWindowState
{
width
?:
number
;
...
...
@@ -265,7 +265,7 @@ export class CodeWindow implements ICodeWindow {
return
this
.
currentConfig
?
this
.
currentConfig
.
backupPath
:
void
0
;
}
public
get
openedWorkspace
():
IWorkspace
{
public
get
openedWorkspace
():
IWorkspace
Identifier
{
return
this
.
currentConfig
?
this
.
currentConfig
.
workspace
:
void
0
;
}
...
...
src/vs/code/electron-main/windows.ts
浏览文件 @
48854cd4
...
...
@@ -29,7 +29,7 @@ import { IWindowsMainService, IOpenConfiguration } from "vs/platform/windows/ele
import
{
IHistoryMainService
}
from
"
vs/platform/history/electron-main/historyMainService
"
;
import
{
IProcessEnvironment
,
isLinux
,
isMacintosh
,
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
TPromise
}
from
"
vs/base/common/winjs.base
"
;
import
{
IWorkspacesMainService
,
IWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IWorkspacesMainService
,
IWorkspace
Identifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
enum
WindowError
{
UNRESPONSIVE
,
...
...
@@ -45,7 +45,7 @@ interface ILegacyWindowState extends IWindowState {
}
interface
IWindowState
{
workspace
?:
IWorkspace
;
workspace
?:
IWorkspace
Identifier
;
folderPath
?:
string
;
backupPath
:
string
;
uiState
:
ISingleWindowState
;
...
...
@@ -67,7 +67,7 @@ interface IOpenBrowserWindowOptions {
userEnv
?:
IProcessEnvironment
;
cli
?:
ParsedArgs
;
workspace
?:
IWorkspace
;
workspace
?:
IWorkspace
Identifier
;
folderPath
?:
string
;
initialStartup
?:
boolean
;
...
...
@@ -85,7 +85,7 @@ interface IOpenBrowserWindowOptions {
interface
IWindowToOpen
extends
IPath
{
// the workspace for a Code instance to open
workspace
?:
IWorkspace
;
workspace
?:
IWorkspace
Identifier
;
// the folder path for a Code instance to open
folderPath
?:
string
;
...
...
@@ -373,8 +373,8 @@ export class WindowsManager implements IWindowsMainService {
private
doOpen
(
openConfig
:
IOpenConfiguration
,
workspacesToOpen
:
IWorkspace
[],
workspacesToRestore
:
IWorkspace
[],
workspacesToOpen
:
IWorkspace
Identifier
[],
workspacesToRestore
:
IWorkspace
Identifier
[],
foldersToOpen
:
string
[],
foldersToRestore
:
string
[],
emptyToRestore
:
string
[],
...
...
src/vs/code/node/windowsFinder.ts
浏览文件 @
48854cd4
...
...
@@ -10,10 +10,10 @@ import * as fs from 'fs';
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
paths
from
'
vs/base/common/paths
'
;
import
{
OpenContext
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IWorkspace
Identifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
export
interface
ISimpleWindow
{
openedWorkspace
?:
IWorkspace
;
openedWorkspace
?:
IWorkspace
Identifier
;
openedFolderPath
?:
string
;
openedFilePath
?:
string
;
extensionDevelopmentPath
?:
string
;
...
...
@@ -127,7 +127,7 @@ export function findWindowOnFolder<W extends ISimpleWindow>(windows: W[], folder
return
null
;
}
export
function
findWindowOnWorkspace
<
W
extends
ISimpleWindow
>
(
windows
:
W
[],
workspace
:
IWorkspace
):
W
{
export
function
findWindowOnWorkspace
<
W
extends
ISimpleWindow
>
(
windows
:
W
[],
workspace
:
IWorkspace
Identifier
):
W
{
if
(
windows
.
length
)
{
const
res
=
windows
.
filter
(
w
=>
{
...
...
src/vs/platform/backup/common/backup.ts
浏览文件 @
48854cd4
...
...
@@ -4,10 +4,10 @@
*--------------------------------------------------------------------------------------------*/
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IWorkspace
Identifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
export
interface
IBackupWorkspacesFormat
{
rootWorkspaces
:
IWorkspace
[];
rootWorkspaces
:
IWorkspace
Identifier
[];
folderWorkspaces
:
string
[];
emptyWorkspaces
:
string
[];
}
...
...
@@ -17,11 +17,11 @@ export const IBackupMainService = createDecorator<IBackupMainService>('backupMai
export
interface
IBackupMainService
{
_serviceBrand
:
any
;
getWorkspaceBackups
():
IWorkspace
[];
getWorkspaceBackups
():
IWorkspace
Identifier
[];
getFolderBackupPaths
():
string
[];
getEmptyWindowBackupPaths
():
string
[];
registerWorkspaceBackupSync
(
workspace
:
IWorkspace
):
string
;
registerWorkspaceBackupSync
(
workspace
:
IWorkspace
Identifier
):
string
;
registerFolderBackupSync
(
folderPath
:
string
):
string
;
registerEmptyWindowBackupSync
(
backupFolder
?:
string
):
string
;
}
\ No newline at end of file
src/vs/platform/backup/electron-main/backupMainService.ts
浏览文件 @
48854cd4
...
...
@@ -14,7 +14,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IFilesConfiguration
,
HotExitConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
ILogService
}
from
"
vs/platform/log/common/log
"
;
import
{
IWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IWorkspace
Identifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
export
class
BackupMainService
implements
IBackupMainService
{
...
...
@@ -36,7 +36,7 @@ export class BackupMainService implements IBackupMainService {
this
.
loadSync
();
}
public
getWorkspaceBackups
():
IWorkspace
[]
{
public
getWorkspaceBackups
():
IWorkspace
Identifier
[]
{
if
(
this
.
isHotExitOnExitAndWindowClose
())
{
// Only non-folder windows are restored on main process launch when
// hot exit is configured as onExitAndWindowClose.
...
...
@@ -64,7 +64,7 @@ export class BackupMainService implements IBackupMainService {
return
this
.
backups
.
emptyWorkspaces
.
slice
(
0
);
// return a copy
}
public
registerWorkspaceBackupSync
(
workspace
:
IWorkspace
):
string
{
public
registerWorkspaceBackupSync
(
workspace
:
IWorkspace
Identifier
):
string
{
this
.
pushBackupPathsSync
(
workspace
,
this
.
backups
.
rootWorkspaces
);
return
path
.
join
(
this
.
backupHome
,
workspace
.
id
);
...
...
@@ -88,14 +88,14 @@ export class BackupMainService implements IBackupMainService {
return
path
.
join
(
this
.
backupHome
,
backupFolder
);
}
private
pushBackupPathsSync
(
workspaceIdentifier
:
string
|
IWorkspace
,
target
:
(
string
|
IWorkspace
)[]):
void
{
private
pushBackupPathsSync
(
workspaceIdentifier
:
string
|
IWorkspace
Identifier
,
target
:
(
string
|
IWorkspaceIdentifier
)[]):
void
{
if
(
this
.
indexOf
(
workspaceIdentifier
,
target
)
===
-
1
)
{
target
.
push
(
workspaceIdentifier
);
this
.
saveSync
();
}
}
protected
removeBackupPathSync
(
workspaceIdentifier
:
string
|
IWorkspace
,
target
:
(
string
|
IWorkspace
)[]):
void
{
protected
removeBackupPathSync
(
workspaceIdentifier
:
string
|
IWorkspace
Identifier
,
target
:
(
string
|
IWorkspaceIdentifier
)[]):
void
{
if
(
!
target
)
{
return
;
}
...
...
@@ -107,7 +107,7 @@ export class BackupMainService implements IBackupMainService {
this
.
saveSync
();
}
private
indexOf
(
workspaceIdentifier
:
string
|
IWorkspace
,
target
:
(
string
|
IWorkspace
)[]):
number
{
private
indexOf
(
workspaceIdentifier
:
string
|
IWorkspace
Identifier
,
target
:
(
string
|
IWorkspaceIdentifier
)[]):
number
{
if
(
!
target
)
{
return
-
1
;
}
...
...
@@ -117,7 +117,7 @@ export class BackupMainService implements IBackupMainService {
return
arrays
.
firstIndex
(
target
,
id
=>
this
.
sanitizeId
(
id
)
===
sanitizedWorkspaceIdentifier
);
}
private
sanitizeId
(
workspaceIdentifier
:
string
|
IWorkspace
):
string
{
private
sanitizeId
(
workspaceIdentifier
:
string
|
IWorkspace
Identifier
):
string
{
if
(
typeof
workspaceIdentifier
===
'
string
'
)
{
return
this
.
sanitizePath
(
workspaceIdentifier
);
}
...
...
@@ -180,9 +180,9 @@ export class BackupMainService implements IBackupMainService {
}
private
validateBackupWorkspaces
(
backups
:
IBackupWorkspacesFormat
):
void
{
const
staleBackupWorkspaces
:
{
workspaceIdentifier
:
string
|
IWorkspace
;
backupPath
:
string
;
target
:
(
string
|
IWorkspace
)[]
}[]
=
[];
const
staleBackupWorkspaces
:
{
workspaceIdentifier
:
string
|
IWorkspace
Identifier
;
backupPath
:
string
;
target
:
(
string
|
IWorkspaceIdentifier
)[]
}[]
=
[];
const
workspaceAndFolders
:
{
workspaceIdentifier
:
string
|
IWorkspace
,
target
:
(
string
|
IWorkspace
)[]
}[]
=
[];
const
workspaceAndFolders
:
{
workspaceIdentifier
:
string
|
IWorkspace
Identifier
,
target
:
(
string
|
IWorkspaceIdentifier
)[]
}[]
=
[];
workspaceAndFolders
.
push
(...
backups
.
rootWorkspaces
.
map
(
r
=>
({
workspaceIdentifier
:
r
,
target
:
backups
.
rootWorkspaces
})));
workspaceAndFolders
.
push
(...
backups
.
folderWorkspaces
.
map
(
f
=>
({
workspaceIdentifier
:
f
,
target
:
backups
.
folderWorkspaces
})));
...
...
src/vs/platform/backup/test/electron-main/backupMainService.test.ts
浏览文件 @
48854cd4
...
...
@@ -20,7 +20,7 @@ import { IBackupWorkspacesFormat } from 'vs/platform/backup/common/backup';
import
{
HotExitConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
LogMainService
}
from
"
vs/platform/log/common/log
"
;
import
{
IWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IWorkspace
Identifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
createHash
}
from
"
crypto
"
;
class
TestBackupMainService
extends
BackupMainService
{
...
...
@@ -39,7 +39,7 @@ class TestBackupMainService extends BackupMainService {
return
this
.
backups
;
}
public
removeBackupPathSync
(
workspaceIdentifier
:
string
|
IWorkspace
,
target
:
(
string
|
IWorkspace
)[]):
void
{
public
removeBackupPathSync
(
workspaceIdentifier
:
string
|
IWorkspace
Identifier
,
target
:
(
string
|
IWorkspaceIdentifier
)[]):
void
{
return
super
.
removeBackupPathSync
(
workspaceIdentifier
,
target
);
}
...
...
@@ -60,11 +60,10 @@ class TestBackupMainService extends BackupMainService {
}
}
function
toWorkspace
(
path
:
string
):
IWorkspace
{
function
toWorkspace
(
path
:
string
):
IWorkspace
Identifier
{
return
{
id
:
createHash
(
'
md5
'
).
update
(
sanitizePath
(
path
)).
digest
(
'
hex
'
),
configPath
:
path
,
folders
:
[]
configPath
:
path
};
}
...
...
src/vs/platform/windows/common/windows.ts
浏览文件 @
48854cd4
...
...
@@ -11,7 +11,7 @@ import Event from 'vs/base/common/event';
import
{
ITelemetryData
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IProcessEnvironment
}
from
'
vs/base/common/platform
'
;
import
{
ParsedArgs
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IWorkspace
Identifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
export
const
IWindowsService
=
createDecorator
<
IWindowsService
>
(
'
windowsService
'
);
...
...
@@ -47,7 +47,7 @@ export interface IWindowsService {
quit
():
TPromise
<
void
>
;
relaunch
(
options
:
{
addArgs
?:
string
[],
removeArgs
?:
string
[]
}):
TPromise
<
void
>
;
openWorkspace
(
windowId
:
number
,
workspace
:
IWorkspace
):
TPromise
<
void
>
;
openWorkspace
(
windowId
:
number
,
workspace
:
IWorkspace
Identifier
):
TPromise
<
void
>
;
// Shared process
whenSharedProcessReady
():
TPromise
<
void
>
;
...
...
@@ -207,7 +207,7 @@ export interface IWindowConfiguration extends ParsedArgs, IOpenFileRequest {
perfAppReady
?:
number
;
perfWindowLoadTime
?:
number
;
workspace
?:
IWorkspace
;
workspace
?:
IWorkspace
Identifier
;
folderPath
?:
string
;
backupPath
?:
string
;
...
...
src/vs/platform/windows/common/windowsIpc.ts
浏览文件 @
48854cd4
...
...
@@ -10,7 +10,7 @@ import Event, { buffer } from 'vs/base/common/event';
import
{
IChannel
,
eventToCall
,
eventFromCall
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
IWindowsService
}
from
'
./windows
'
;
import
{
ITelemetryData
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IWorkspace
Identifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
export
interface
IWindowsChannel
extends
IChannel
{
call
(
command
:
'
event:onWindowOpen
'
):
TPromise
<
number
>
;
...
...
@@ -43,7 +43,7 @@ export interface IWindowsChannel extends IChannel {
call
(
command
:
'
getWindows
'
):
TPromise
<
{
id
:
number
;
path
:
string
;
title
:
string
;
}[]
>
;
call
(
command
:
'
getWindowCount
'
):
TPromise
<
number
>
;
call
(
command
:
'
relaunch
'
,
arg
:
{
addArgs
?:
string
[],
removeArgs
?:
string
[]
}):
TPromise
<
number
>
;
call
(
command
:
'
openWorkspace
'
,
arg
:
[
number
,
IWorkspace
]):
TPromise
<
void
>
;
call
(
command
:
'
openWorkspace
'
,
arg
:
[
number
,
IWorkspace
Identifier
]):
TPromise
<
void
>
;
call
(
command
:
'
whenSharedProcessReady
'
):
TPromise
<
void
>
;
call
(
command
:
'
toggleSharedProcess
'
):
TPromise
<
void
>
;
call
(
command
:
'
log
'
,
arg
:
[
string
,
string
[]]):
TPromise
<
void
>
;
...
...
@@ -218,7 +218,7 @@ export class WindowsChannelClient implements IWindowsService {
return
this
.
channel
.
call
(
'
relaunch
'
,
[
options
]);
}
openWorkspace
(
windowId
:
number
,
workspace
:
IWorkspace
):
TPromise
<
void
>
{
openWorkspace
(
windowId
:
number
,
workspace
:
IWorkspace
Identifier
):
TPromise
<
void
>
{
return
this
.
channel
.
call
(
'
openWorkspace
'
,
[
windowId
,
workspace
]);
}
...
...
src/vs/platform/windows/electron-main/windows.ts
浏览文件 @
48854cd4
...
...
@@ -12,7 +12,7 @@ import Event from 'vs/base/common/event';
import
{
ITelemetryData
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IProcessEnvironment
}
from
'
vs/base/common/platform
'
;
import
{
IWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IWorkspace
Identifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
export
interface
ICodeWindow
{
id
:
number
;
...
...
@@ -20,7 +20,7 @@ export interface ICodeWindow {
config
:
IWindowConfiguration
;
openedFolderPath
:
string
;
openedWorkspace
:
IWorkspace
;
openedWorkspace
:
IWorkspace
Identifier
;
lastFocusTime
:
number
;
...
...
src/vs/platform/windows/electron-main/windowsService.ts
浏览文件 @
48854cd4
...
...
@@ -20,7 +20,7 @@ import { ILifecycleService } from "vs/platform/lifecycle/electron-main/lifecycle
import
{
IWindowsMainService
,
ISharedProcess
}
from
"
vs/platform/windows/electron-main/windows
"
;
import
{
IHistoryMainService
}
from
"
vs/platform/history/electron-main/historyMainService
"
;
import
{
findExtensionDevelopmentWindow
}
from
"
vs/code/node/windowsFinder
"
;
import
{
IWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IWorkspace
Identifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
export
class
WindowsService
implements
IWindowsService
,
IDisposable
{
...
...
@@ -323,7 +323,7 @@ export class WindowsService implements IWindowsService, IDisposable {
return
TPromise
.
as
(
null
);
}
openWorkspace
(
windowId
:
number
,
workspace
:
IWorkspace
):
TPromise
<
void
>
{
openWorkspace
(
windowId
:
number
,
workspace
:
IWorkspace
Identifier
):
TPromise
<
void
>
{
const
codeWindow
=
this
.
windowsMainService
.
getWindowById
(
windowId
);
if
(
codeWindow
)
{
...
...
src/vs/platform/workspaces/common/workspaces.ts
浏览文件 @
48854cd4
...
...
@@ -11,7 +11,8 @@ import { TPromise } from 'vs/base/common/winjs.base';
export
const
IWorkspacesMainService
=
createDecorator
<
IWorkspacesMainService
>
(
'
workspacesMainService
'
);
export
const
IWorkspacesService
=
createDecorator
<
IWorkspacesService
>
(
'
workspacesService
'
);
export
interface
IWorkspace
extends
IStoredWorkspace
{
export
interface
IWorkspaceIdentifier
{
id
:
string
;
configPath
:
string
;
}
...
...
@@ -23,11 +24,11 @@ export interface IStoredWorkspace {
export
interface
IWorkspacesMainService
extends
IWorkspacesService
{
_serviceBrand
:
any
;
resolveWorkspaceSync
(
path
:
string
):
IWorkspace
;
resolveWorkspaceSync
(
path
:
string
):
IWorkspace
Identifier
;
}
export
interface
IWorkspacesService
{
_serviceBrand
:
any
;
createWorkspace
(
folders
?:
string
[]):
TPromise
<
IWorkspace
>
;
createWorkspace
(
folders
?:
string
[]):
TPromise
<
IWorkspace
Identifier
>
;
}
\ No newline at end of file
src/vs/platform/workspaces/common/workspacesIpc.ts
浏览文件 @
48854cd4
...
...
@@ -7,7 +7,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IChannel
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
IWorkspacesService
,
IWorkspace
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspacesService
,
IWorkspace
Identifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
export
interface
IWorkspacesChannel
extends
IChannel
{
call
(
command
:
'
createWorkspace
'
,
arg
:
[
string
[]]):
TPromise
<
string
>
;
...
...
@@ -33,7 +33,7 @@ export class WorkspacesChannelClient implements IWorkspacesService {
constructor
(
private
channel
:
IWorkspacesChannel
)
{
}
createWorkspace
(
folders
?:
string
[]):
TPromise
<
IWorkspace
>
{
createWorkspace
(
folders
?:
string
[]):
TPromise
<
IWorkspace
Identifier
>
{
return
this
.
channel
.
call
(
'
createWorkspace
'
,
folders
);
}
}
\ No newline at end of file
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
浏览文件 @
48854cd4
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
IWorkspacesMainService
,
IWorkspace
,
IStoredWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IWorkspacesMainService
,
IWorkspace
Identifier
,
IStoredWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
TPromise
}
from
"
vs/base/common/winjs.base
"
;
import
{
isParent
}
from
"
vs/platform/files/common/files
"
;
import
{
IEnvironmentService
}
from
"
vs/platform/environment/common/environment
"
;
...
...
@@ -24,7 +24,7 @@ export class WorkspacesMainService implements IWorkspacesMainService {
this
.
workspacesHome
=
environmentService
.
workspacesHome
;
}
public
resolveWorkspaceSync
(
path
:
string
):
IWorkspace
{
public
resolveWorkspaceSync
(
path
:
string
):
IWorkspace
Identifier
{
const
isWorkspace
=
isParent
(
path
,
this
.
environmentService
.
workspacesHome
,
!
isLinux
/* ignore case */
)
||
extname
(
path
)
===
'
.code
'
;
if
(
!
isWorkspace
)
{
return
null
;
// does not look like a valid workspace config file
...
...
@@ -38,7 +38,6 @@ export class WorkspacesMainService implements IWorkspacesMainService {
return
{
id
:
workspace
.
id
,
folders
:
workspace
.
folders
,
configPath
:
path
};
}
catch
(
error
)
{
...
...
@@ -46,7 +45,7 @@ export class WorkspacesMainService implements IWorkspacesMainService {
}
}
public
createWorkspace
(
folders
:
string
[]
=
[]):
TPromise
<
IWorkspace
>
{
public
createWorkspace
(
folders
:
string
[]
=
[]):
TPromise
<
IWorkspace
Identifier
>
{
const
workspaceId
=
this
.
nextWorkspaceId
();
const
workspaceConfigFolder
=
join
(
this
.
workspacesHome
,
workspaceId
);
const
workspaceConfigPath
=
join
(
workspaceConfigFolder
,
'
workspace.json
'
);
...
...
src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts
浏览文件 @
48854cd4
...
...
@@ -49,11 +49,10 @@ suite('WorkspacesMainService', () => {
return
service
.
createWorkspace
().
then
(
workspace
=>
{
assert
.
ok
(
workspace
);
assert
.
ok
(
fs
.
existsSync
(
workspace
.
configPath
));
assert
.
equal
(
workspace
.
folders
.
length
,
0
);
const
ws
=
JSON
.
parse
(
fs
.
readFileSync
(
workspace
.
configPath
).
toString
())
as
IStoredWorkspace
;
assert
.
equal
(
ws
.
id
,
workspace
.
id
);
assert
.
deepEqual
(
ws
.
folders
,
workspace
.
folders
);
assert
.
deepEqual
(
ws
.
folders
.
length
,
0
);
done
();
});
...
...
@@ -63,13 +62,12 @@ suite('WorkspacesMainService', () => {
return
service
.
createWorkspace
([
process
.
cwd
(),
os
.
tmpdir
()]).
then
(
workspace
=>
{
assert
.
ok
(
workspace
);
assert
.
ok
(
fs
.
existsSync
(
workspace
.
configPath
));
assert
.
equal
(
workspace
.
folders
.
length
,
2
);
assert
.
equal
(
workspace
.
folders
[
0
],
process
.
cwd
());
assert
.
equal
(
workspace
.
folders
[
1
],
os
.
tmpdir
());
const
ws
=
JSON
.
parse
(
fs
.
readFileSync
(
workspace
.
configPath
).
toString
())
as
IStoredWorkspace
;
assert
.
equal
(
ws
.
id
,
workspace
.
id
);
assert
.
deepEqual
(
ws
.
folders
,
workspace
.
folders
);
assert
.
equal
(
ws
.
folders
.
length
,
2
);
assert
.
equal
(
ws
.
folders
[
0
],
process
.
cwd
());
assert
.
equal
(
ws
.
folders
[
1
],
os
.
tmpdir
());
done
();
});
...
...
@@ -87,7 +85,7 @@ suite('WorkspacesMainService', () => {
workspace
.
configPath
=
newPath
;
const
resolved
=
service
.
resolveWorkspaceSync
(
workspace
.
configPath
);
assert
.
deepEqual
(
resolved
,
workspace
);
assert
.
deepEqual
(
resolved
,
{
id
:
workspace
.
id
,
configPath
:
workspace
.
configPath
}
);
done
();
});
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
48854cd4
...
...
@@ -54,7 +54,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
TestThemeService
}
from
'
vs/platform/theme/test/common/testThemeService
'
;
import
{
IWorkspace
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IWorkspace
Identifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
export
function
createFileInput
(
instantiationService
:
IInstantiationService
,
resource
:
URI
):
FileEditorInput
{
return
instantiationService
.
createInstance
(
FileEditorInput
,
resource
,
void
0
);
...
...
@@ -1062,7 +1062,7 @@ export class TestWindowsService implements IWindowsService {
return
TPromise
.
as
(
void
0
);
}
openWorkspace
(
windowId
:
number
,
workspace
:
IWorkspace
):
TPromise
<
void
>
{
openWorkspace
(
windowId
:
number
,
workspace
:
IWorkspace
Identifier
):
TPromise
<
void
>
{
return
TPromise
.
as
(
void
0
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录