Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
b2176de8
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
b2176de8
编写于
9月 18, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wire in changes to transition workspaces without window reload (for #32945)
上级
269ae60a
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
77 addition
and
57 deletion
+77
-57
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+15
-23
src/vs/platform/windows/common/windows.ts
src/vs/platform/windows/common/windows.ts
+4
-4
src/vs/platform/windows/common/windowsIpc.ts
src/vs/platform/windows/common/windowsIpc.ts
+4
-4
src/vs/platform/windows/electron-browser/windowService.ts
src/vs/platform/windows/electron-browser/windowService.ts
+3
-2
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
+4
-4
src/vs/workbench/browser/actions/workspaceActions.ts
src/vs/workbench/browser/actions/workspaceActions.ts
+11
-10
src/vs/workbench/electron-browser/window.ts
src/vs/workbench/electron-browser/window.ts
+1
-1
src/vs/workbench/parts/files/browser/views/explorerViewer.ts
src/vs/workbench/parts/files/browser/views/explorerViewer.ts
+2
-1
src/vs/workbench/services/workspace/common/workspaceEditing.ts
...s/workbench/services/workspace/common/workspaceEditing.ts
+11
-0
src/vs/workbench/services/workspace/node/workspaceEditingService.ts
...kbench/services/workspace/node/workspaceEditingService.ts
+16
-2
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+4
-4
未找到文件。
src/vs/code/electron-main/windows.ts
浏览文件 @
b2176de8
...
...
@@ -1294,11 +1294,11 @@ export class WindowsManager implements IWindowsMainService {
});
}
public
saveAndOpenWorkspace
(
win
:
CodeWindow
,
path
:
string
):
TPromise
<
void
>
{
public
saveAndOpenWorkspace
(
win
:
CodeWindow
,
path
:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
return
this
.
workspacesManager
.
saveAndOpenWorkspace
(
win
,
path
);
}
public
createAndOpenWorkspace
(
win
:
CodeWindow
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
void
>
{
public
createAndOpenWorkspace
(
win
:
CodeWindow
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
return
this
.
workspacesManager
.
createAndOpenWorkspace
(
win
,
folders
,
path
);
}
...
...
@@ -1637,7 +1637,7 @@ class WorkspacesManager {
)
{
}
public
saveAndOpenWorkspace
(
window
:
CodeWindow
,
path
:
string
):
TPromise
<
void
>
{
public
saveAndOpenWorkspace
(
window
:
CodeWindow
,
path
:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
if
(
!
window
||
!
window
.
win
||
window
.
readyState
!==
ReadyState
.
READY
||
!
window
.
openedWorkspace
||
!
path
||
!
this
.
isValidTargetWorkspacePath
(
window
,
path
))
{
return
TPromise
.
as
(
null
);
// return early if the window is not ready or disposed or does not have a workspace
}
...
...
@@ -1645,7 +1645,7 @@ class WorkspacesManager {
return
this
.
doSaveAndOpenWorkspace
(
window
,
window
.
openedWorkspace
,
path
);
}
public
createAndOpenWorkspace
(
window
:
CodeWindow
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
void
>
{
public
createAndOpenWorkspace
(
window
:
CodeWindow
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
if
(
!
window
||
!
window
.
win
||
window
.
readyState
!==
ReadyState
.
READY
||
!
this
.
isValidTargetWorkspacePath
(
window
,
path
))
{
return
TPromise
.
as
(
null
);
// return early if the window is not ready or disposed
}
...
...
@@ -1688,7 +1688,7 @@ class WorkspacesManager {
return
true
;
// OK
}
private
doSaveAndOpenWorkspace
(
window
:
CodeWindow
,
workspace
:
IWorkspaceIdentifier
,
path
?:
string
):
TPromise
<
void
>
{
private
doSaveAndOpenWorkspace
(
window
:
CodeWindow
,
workspace
:
IWorkspaceIdentifier
,
path
?:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
let
savePromise
:
TPromise
<
IWorkspaceIdentifier
>
;
if
(
path
)
{
savePromise
=
this
.
workspacesService
.
saveWorkspace
(
workspace
,
path
);
...
...
@@ -1699,26 +1699,18 @@ class WorkspacesManager {
return
savePromise
.
then
(
workspace
=>
{
window
.
focus
();
// Only open workspace when the window has not vetoed this
return
this
.
lifecycleService
.
unload
(
window
,
UnloadReason
.
RELOAD
,
workspace
).
done
(
veto
=>
{
if
(
!
veto
)
{
// Register window for backups and migrate current backups over
let
backupPath
:
string
;
if
(
window
.
config
&&
!
window
.
config
.
extensionDevelopmentPath
)
{
backupPath
=
this
.
backupService
.
registerWorkspaceBackupSync
(
workspace
,
window
.
config
.
backupPath
);
}
// Register window for backups and migrate current backups over
let
backupPath
:
string
;
if
(
!
window
.
config
.
extensionDevelopmentPath
)
{
backupPath
=
this
.
backupService
.
registerWorkspaceBackupSync
(
workspace
,
window
.
config
.
backupPath
);
}
// Craft a new window configuration to use for the transition
const
configuration
:
IWindowConfiguration
=
mixin
({},
window
.
config
);
configuration
.
folderPath
=
void
0
;
configuration
.
workspace
=
workspace
;
configuration
.
backupPath
=
backupPath
;
// Update window configuration properly based on transition to workspace
window
.
config
.
folderPath
=
void
0
;
window
.
config
.
workspace
=
workspace
;
window
.
config
.
backupPath
=
backupPath
;
// Reload
window
.
reload
(
configuration
);
}
});
return
workspace
;
});
}
...
...
src/vs/platform/windows/common/windows.ts
浏览文件 @
b2176de8
...
...
@@ -43,8 +43,8 @@ export interface IWindowsService {
toggleDevTools
(
windowId
:
number
):
TPromise
<
void
>
;
closeWorkspace
(
windowId
:
number
):
TPromise
<
void
>
;
openWorkspace
(
windowId
:
number
):
TPromise
<
void
>
;
createAndOpenWorkspace
(
windowId
:
number
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
void
>
;
saveAndOpenWorkspace
(
windowId
:
number
,
path
:
string
):
TPromise
<
void
>
;
createAndOpenWorkspace
(
windowId
:
number
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
IWorkspaceIdentifier
>
;
saveAndOpenWorkspace
(
windowId
:
number
,
path
:
string
):
TPromise
<
IWorkspaceIdentifier
>
;
toggleFullScreen
(
windowId
:
number
):
TPromise
<
void
>
;
setRepresentedFilename
(
windowId
:
number
,
fileName
:
string
):
TPromise
<
void
>
;
addRecentlyOpened
(
files
:
string
[]):
TPromise
<
void
>
;
...
...
@@ -111,8 +111,8 @@ export interface IWindowService {
closeWorkspace
():
TPromise
<
void
>
;
openWorkspace
():
TPromise
<
void
>
;
updateTouchBar
(
items
:
ICommandAction
[][]):
TPromise
<
void
>
;
createAndOpenWorkspace
(
folders
?:
string
[],
path
?:
string
):
TPromise
<
void
>
;
saveAndOpenWorkspace
(
path
:
string
):
TPromise
<
void
>
;
createAndOpenWorkspace
(
folders
?:
string
[],
path
?:
string
):
TPromise
<
IWorkspaceIdentifier
>
;
saveAndOpenWorkspace
(
path
:
string
):
TPromise
<
IWorkspaceIdentifier
>
;
toggleFullScreen
():
TPromise
<
void
>
;
setRepresentedFilename
(
fileName
:
string
):
TPromise
<
void
>
;
getRecentlyOpened
():
TPromise
<
IRecentlyOpened
>
;
...
...
src/vs/platform/windows/common/windowsIpc.ts
浏览文件 @
b2176de8
...
...
@@ -24,8 +24,8 @@ export interface IWindowsChannel extends IChannel {
call
(
command
:
'
toggleDevTools
'
,
arg
:
number
):
TPromise
<
void
>
;
call
(
command
:
'
closeWorkspace
'
,
arg
:
number
):
TPromise
<
void
>
;
call
(
command
:
'
openWorkspace
'
,
arg
:
number
):
TPromise
<
void
>
;
call
(
command
:
'
createAndOpenWorkspace
'
,
arg
:
[
number
,
string
[],
string
]):
TPromise
<
void
>
;
call
(
command
:
'
saveAndOpenWorkspace
'
,
arg
:
[
number
,
string
]):
TPromise
<
void
>
;
call
(
command
:
'
createAndOpenWorkspace
'
,
arg
:
[
number
,
string
[],
string
]):
TPromise
<
IWorkspaceIdentifier
>
;
call
(
command
:
'
saveAndOpenWorkspace
'
,
arg
:
[
number
,
string
]):
TPromise
<
IWorkspaceIdentifier
>
;
call
(
command
:
'
toggleFullScreen
'
,
arg
:
number
):
TPromise
<
void
>
;
call
(
command
:
'
setRepresentedFilename
'
,
arg
:
[
number
,
string
]):
TPromise
<
void
>
;
call
(
command
:
'
addRecentlyOpened
'
,
arg
:
string
[]):
TPromise
<
void
>
;
...
...
@@ -174,11 +174,11 @@ export class WindowsChannelClient implements IWindowsService {
return
this
.
channel
.
call
(
'
openWorkspace
'
,
windowId
);
}
createAndOpenWorkspace
(
windowId
:
number
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
void
>
{
createAndOpenWorkspace
(
windowId
:
number
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
return
this
.
channel
.
call
(
'
createAndOpenWorkspace
'
,
[
windowId
,
folders
,
path
]);
}
saveAndOpenWorkspace
(
windowId
:
number
,
path
:
string
):
TPromise
<
void
>
{
saveAndOpenWorkspace
(
windowId
:
number
,
path
:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
return
this
.
channel
.
call
(
'
saveAndOpenWorkspace
'
,
[
windowId
,
path
]);
}
...
...
src/vs/platform/windows/electron-browser/windowService.ts
浏览文件 @
b2176de8
...
...
@@ -11,6 +11,7 @@ import { IWindowService, IWindowsService, INativeOpenDialogOptions } from 'vs/pl
import
{
remote
}
from
'
electron
'
;
import
{
IRecentlyOpened
}
from
'
vs/platform/history/common/history
'
;
import
{
ICommandAction
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
export
class
WindowService
implements
IWindowService
{
...
...
@@ -69,11 +70,11 @@ export class WindowService implements IWindowService {
return
this
.
windowsService
.
openWorkspace
(
this
.
windowId
);
}
createAndOpenWorkspace
(
folders
?:
string
[],
path
?:
string
):
TPromise
<
void
>
{
createAndOpenWorkspace
(
folders
?:
string
[],
path
?:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
return
this
.
windowsService
.
createAndOpenWorkspace
(
this
.
windowId
,
folders
,
path
);
}
saveAndOpenWorkspace
(
path
:
string
):
TPromise
<
void
>
{
saveAndOpenWorkspace
(
path
:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
return
this
.
windowsService
.
saveAndOpenWorkspace
(
this
.
windowId
,
path
);
}
...
...
src/vs/platform/windows/electron-main/windows.ts
浏览文件 @
b2176de8
...
...
@@ -61,8 +61,8 @@ export interface IWindowsMainService {
ready
(
initialUserEnv
:
IProcessEnvironment
):
void
;
reload
(
win
:
ICodeWindow
,
cli
?:
ParsedArgs
):
void
;
openWorkspace
(
win
?:
ICodeWindow
):
void
;
createAndOpenWorkspace
(
win
:
ICodeWindow
,
folders
?:
string
[],
path
?:
string
):
void
;
saveAndOpenWorkspace
(
win
:
ICodeWindow
,
path
:
string
):
void
;
createAndOpenWorkspace
(
win
:
ICodeWindow
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
IWorkspaceIdentifier
>
;
saveAndOpenWorkspace
(
win
:
ICodeWindow
,
path
:
string
):
TPromise
<
IWorkspaceIdentifier
>
;
closeWorkspace
(
win
:
ICodeWindow
):
void
;
open
(
openConfig
:
IOpenConfiguration
):
ICodeWindow
[];
openExtensionDevelopmentHostWindow
(
openConfig
:
IOpenConfiguration
):
void
;
...
...
src/vs/platform/windows/electron-main/windowsService.ts
浏览文件 @
b2176de8
...
...
@@ -135,21 +135,21 @@ export class WindowsService implements IWindowsService, IDisposable {
return
TPromise
.
as
(
null
);
}
createAndOpenWorkspace
(
windowId
:
number
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
void
>
{
createAndOpenWorkspace
(
windowId
:
number
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
const
codeWindow
=
this
.
windowsMainService
.
getWindowById
(
windowId
);
if
(
codeWindow
)
{
this
.
windowsMainService
.
createAndOpenWorkspace
(
codeWindow
,
folders
,
path
);
return
this
.
windowsMainService
.
createAndOpenWorkspace
(
codeWindow
,
folders
,
path
);
}
return
TPromise
.
as
(
null
);
}
saveAndOpenWorkspace
(
windowId
:
number
,
path
:
string
):
TPromise
<
void
>
{
saveAndOpenWorkspace
(
windowId
:
number
,
path
:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
const
codeWindow
=
this
.
windowsMainService
.
getWindowById
(
windowId
);
if
(
codeWindow
)
{
this
.
windowsMainService
.
saveAndOpenWorkspace
(
codeWindow
,
path
);
return
this
.
windowsMainService
.
saveAndOpenWorkspace
(
codeWindow
,
path
);
}
return
TPromise
.
as
(
null
);
...
...
src/vs/workbench/browser/actions/workspaceActions.ts
浏览文件 @
b2176de8
...
...
@@ -9,14 +9,14 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
IWindowService
,
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
ITelemetryData
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceEditingService
}
from
'
vs/workbench/services/workspace/common/workspaceEditing
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IWorkspacesService
,
WORKSPACE_FILTER
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
WORKSPACE_FILTER
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
...
...
@@ -113,10 +113,12 @@ export class AddRootFolderAction extends BaseWorkspacesAction {
if
(
!
folders
||
!
folders
.
length
)
{
return
TPromise
.
as
(
null
);
}
return
this
.
workspaceEditingService
.
addFolders
(
folders
.
map
(
folder
=>
URI
.
file
(
folder
))).
then
(()
=>
{
return
this
.
viewletService
.
openViewlet
(
this
.
viewletService
.
getDefaultViewletId
(),
true
);
});
}
return
this
.
instantiationService
.
createInstance
(
NewWorkspaceAction
,
NewWorkspaceAction
.
ID
,
NewWorkspaceAction
.
LABEL
,
this
.
contextService
.
getWorkspace
().
folders
.
map
(
folder
=>
folder
.
uri
)).
run
();
}
}
...
...
@@ -133,8 +135,7 @@ class NewWorkspaceAction extends BaseWorkspacesAction {
@
IWindowService
windowService
:
IWindowService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IWorkspacesService
protected
workspacesService
:
IWorkspacesService
,
@
IWindowsService
protected
windowsService
:
IWindowsService
,
@
IWorkspaceEditingService
private
workspaceEditingService
:
IWorkspaceEditingService
)
{
super
(
id
,
label
,
windowService
,
environmentService
,
contextService
);
}
...
...
@@ -151,7 +152,7 @@ class NewWorkspaceAction extends BaseWorkspacesAction {
private
createWorkspace
(
folders
:
URI
[]):
TPromise
<
void
>
{
const
workspaceFolders
=
distinct
(
folders
.
map
(
folder
=>
folder
.
fsPath
),
folder
=>
isLinux
?
folder
:
folder
.
toLowerCase
());
return
this
.
w
indow
Service
.
createAndOpenWorkspace
(
workspaceFolders
);
return
this
.
w
orkspaceEditing
Service
.
createAndOpenWorkspace
(
workspaceFolders
);
}
}
...
...
@@ -185,9 +186,8 @@ export class SaveWorkspaceAsAction extends BaseWorkspacesAction {
@
IWindowService
windowService
:
IWindowService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IWorkspacesService
protected
workspacesService
:
IWorkspacesService
,
@
IWindowsService
private
windowsService
:
IWindowsService
,
@
IMessageService
private
messageService
:
IMessageService
@
IMessageService
private
messageService
:
IMessageService
,
@
IWorkspaceEditingService
private
workspaceEditingService
:
IWorkspaceEditingService
)
{
super
(
id
,
label
,
windowService
,
environmentService
,
contextService
);
}
...
...
@@ -196,6 +196,7 @@ export class SaveWorkspaceAsAction extends BaseWorkspacesAction {
const
workspaceState
=
this
.
contextService
.
getWorkbenchState
();
if
(
workspaceState
===
WorkbenchState
.
EMPTY
)
{
this
.
messageService
.
show
(
Severity
.
Info
,
nls
.
localize
(
'
saveEmptyWorkspaceNotSupported
'
,
"
Please open a workspace first to save.
"
));
return
TPromise
.
as
(
null
);
}
...
...
@@ -205,10 +206,10 @@ export class SaveWorkspaceAsAction extends BaseWorkspacesAction {
case
WorkbenchState
.
FOLDER
:
const
workspaceFolders
=
this
.
contextService
.
getWorkspace
().
folders
.
map
(
root
=>
root
.
uri
.
fsPath
);
return
this
.
w
indow
Service
.
createAndOpenWorkspace
(
workspaceFolders
,
configPath
);
return
this
.
w
orkspaceEditing
Service
.
createAndOpenWorkspace
(
workspaceFolders
,
configPath
);
case
WorkbenchState
.
WORKSPACE
:
return
this
.
w
indow
Service
.
saveAndOpenWorkspace
(
configPath
);
return
this
.
w
orkspaceEditing
Service
.
saveAndOpenWorkspace
(
configPath
);
}
}
...
...
src/vs/workbench/electron-browser/window.ts
浏览文件 @
b2176de8
...
...
@@ -390,7 +390,7 @@ export class ElectronWindow extends Themable {
workspaceFolders
.
push
(...
request
.
foldersToAdd
.
map
(
folderToAdd
=>
URI
.
file
(
folderToAdd
.
filePath
)));
// Create workspace and open (ensure no duplicates)
this
.
w
indow
Service
.
createAndOpenWorkspace
(
arrays
.
distinct
(
workspaceFolders
.
map
(
folder
=>
folder
.
fsPath
),
folder
=>
platform
.
isLinux
?
folder
:
folder
.
toLowerCase
()));
this
.
w
orkspaceEditing
Service
.
createAndOpenWorkspace
(
arrays
.
distinct
(
workspaceFolders
.
map
(
folder
=>
folder
.
fsPath
),
folder
=>
platform
.
isLinux
?
folder
:
folder
.
toLowerCase
()));
}
}
...
...
src/vs/workbench/parts/files/browser/views/explorerViewer.ts
浏览文件 @
b2176de8
...
...
@@ -906,7 +906,8 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
const
currentFolders
=
this
.
contextService
.
getWorkspace
().
folders
.
map
(
folder
=>
folder
.
uri
);
const
newRoots
=
[...
currentFolders
,
...
folders
];
return
this
.
windowService
.
createAndOpenWorkspace
(
distinct
(
newRoots
.
map
(
root
=>
root
.
fsPath
)));
// Create and open workspace
return
this
.
workspaceEditingService
.
createAndOpenWorkspace
(
distinct
(
newRoots
.
map
(
root
=>
root
.
fsPath
)));
}
}
...
...
src/vs/workbench/services/workspace/common/workspaceEditing.ts
浏览文件 @
b2176de8
...
...
@@ -24,6 +24,17 @@ export interface IWorkspaceEditingService {
* remove folders from the existing workspace
*/
removeFolders
(
folders
:
URI
[]):
TPromise
<
void
>
;
/**
* creates a new workspace with the provided folders and opens it. if path is provided
* the workspace will be saved into that location.
*/
createAndOpenWorkspace
(
folders
?:
string
[],
path
?:
string
):
TPromise
<
void
>
;
/**
* saves the workspace to the provided path and opens it. requires a workspace to be opened.
*/
saveAndOpenWorkspace
(
path
:
string
):
TPromise
<
void
>
;
}
export
const
IWorkspaceMigrationService
=
createDecorator
<
IWorkspaceMigrationService
>
(
'
workspaceMigrationService
'
);
...
...
src/vs/workbench/services/workspace/node/workspaceEditingService.ts
浏览文件 @
b2176de8
...
...
@@ -9,14 +9,15 @@ import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowsService
,
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IJSONEditingService
}
from
'
vs/workbench/services/configuration/common/jsonEditing
'
;
import
{
IWorkspacesService
,
IStoredWorkspaceFolder
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspacesService
,
IStoredWorkspaceFolder
,
IWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
dirname
}
from
'
path
'
;
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
massageFolderPathForWorkspace
}
from
'
vs/platform/workspaces/node/workspaces
'
;
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
WorkspaceServiceImpl
}
from
'
vs/workbench/services/configuration/node/configuration
'
;
export
class
WorkspaceEditingService
implements
IWorkspaceEditingService
{
...
...
@@ -27,6 +28,7 @@ export class WorkspaceEditingService implements IWorkspaceEditingService {
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IWindowsService
private
windowsService
:
IWindowsService
,
@
IWindowService
private
windowService
:
IWindowService
,
@
IWorkspacesService
private
workspacesService
:
IWorkspacesService
,
@
IWorkspaceConfigurationService
private
workspaceConfigurationService
:
IWorkspaceConfigurationService
)
{
...
...
@@ -114,4 +116,16 @@ export class WorkspaceEditingService implements IWorkspaceEditingService {
return
resource
.
toString
().
toLowerCase
()
===
toCheck
.
toString
().
toLowerCase
();
});
}
public
createAndOpenWorkspace
(
folders
?:
string
[],
path
?:
string
):
TPromise
<
void
>
{
return
this
.
windowService
.
createAndOpenWorkspace
(
folders
).
then
(
workspace
=>
this
.
openWorkspace
(
workspace
));
}
public
saveAndOpenWorkspace
(
path
:
string
):
TPromise
<
void
>
{
return
this
.
windowService
.
saveAndOpenWorkspace
(
path
).
then
(
workspace
=>
this
.
openWorkspace
(
workspace
));
}
private
openWorkspace
(
workspace
:
IWorkspaceIdentifier
):
TPromise
<
void
>
{
return
(
this
.
contextService
as
WorkspaceServiceImpl
).
initialize
(
workspace
);
// TODO@Ben ugly cast
}
}
\ No newline at end of file
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
b2176de8
...
...
@@ -903,11 +903,11 @@ export class TestWindowService implements IWindowService {
return
TPromise
.
as
(
void
0
);
}
createAndOpenWorkspace
(
folders
?:
string
[],
path
?:
string
):
TPromise
<
void
>
{
createAndOpenWorkspace
(
folders
?:
string
[],
path
?:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
return
TPromise
.
as
(
void
0
);
}
saveAndOpenWorkspace
(
path
:
string
):
TPromise
<
void
>
{
saveAndOpenWorkspace
(
path
:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
return
TPromise
.
as
(
void
0
);
}
...
...
@@ -1051,11 +1051,11 @@ export class TestWindowsService implements IWindowsService {
return
TPromise
.
as
(
void
0
);
}
createAndOpenWorkspace
(
windowId
:
number
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
void
>
{
createAndOpenWorkspace
(
windowId
:
number
,
folders
?:
string
[],
path
?:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
return
TPromise
.
as
(
void
0
);
}
saveAndOpenWorkspace
(
windowId
:
number
,
path
:
string
):
TPromise
<
void
>
{
saveAndOpenWorkspace
(
windowId
:
number
,
path
:
string
):
TPromise
<
IWorkspaceIdentifier
>
{
return
TPromise
.
as
(
void
0
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录