Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
60ebcd16
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,发现更多精彩内容 >>
提交
60ebcd16
编写于
2月 27, 2019
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
duplicate workspace forgets window authority
上级
2015bca4
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
23 addition
and
18 deletion
+23
-18
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+1
-1
src/vs/platform/workspaces/common/workspaces.ts
src/vs/platform/workspaces/common/workspaces.ts
+2
-1
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
...latform/workspaces/electron-main/workspacesMainService.ts
+10
-10
src/vs/platform/workspaces/node/workspacesIpc.ts
src/vs/platform/workspaces/node/workspacesIpc.ts
+5
-4
src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts
...rkspaces/test/electron-main/workspacesMainService.test.ts
+3
-1
src/vs/workbench/browser/actions/workspaceActions.ts
src/vs/workbench/browser/actions/workspaceActions.ts
+2
-1
未找到文件。
src/vs/code/electron-main/windows.ts
浏览文件 @
60ebcd16
...
...
@@ -1075,7 +1075,7 @@ export class WindowsManager implements IWindowsMainService {
if
(
!
options
.
forceOpenWorkspaceAsFile
)
{
const
workspace
=
this
.
workspacesMainService
.
resolveLocalWorkspaceSync
(
URI
.
file
(
candidate
));
if
(
workspace
)
{
return
{
workspace
:
{
id
:
workspace
.
id
,
configPath
:
workspace
.
configPath
},
remoteAuthority
};
return
{
workspace
:
{
id
:
workspace
.
id
,
configPath
:
workspace
.
configPath
},
remoteAuthority
:
workspace
.
remoteAuthority
};
}
}
...
...
src/vs/platform/workspaces/common/workspaces.ts
浏览文件 @
60ebcd16
...
...
@@ -70,6 +70,7 @@ export type IStoredWorkspaceFolder = IRawFileWorkspaceFolder | IRawUriWorkspaceF
export
interface
IResolvedWorkspace
extends
IWorkspaceIdentifier
{
folders
:
IWorkspaceFolder
[];
remoteAuthority
?:
string
;
}
export
interface
IStoredWorkspace
{
...
...
@@ -114,7 +115,7 @@ export interface IWorkspacesMainService extends IWorkspacesService {
export
interface
IWorkspacesService
{
_serviceBrand
:
any
;
createUntitledWorkspace
(
folders
?:
IWorkspaceFolderCreationData
[]):
Promise
<
IWorkspaceIdentifier
>
;
createUntitledWorkspace
(
folders
?:
IWorkspaceFolderCreationData
[]
,
remoteAuthority
?:
string
):
Promise
<
IWorkspaceIdentifier
>
;
}
export
function
isSingleFolderWorkspaceIdentifier
(
obj
:
any
):
obj
is
ISingleFolderWorkspaceIdentifier
{
...
...
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
浏览文件 @
60ebcd16
...
...
@@ -20,10 +20,10 @@ import { URI } from 'vs/base/common/uri';
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
originalFSPath
,
dirname
as
resourcesDirname
,
isEqualOrParent
,
joinPath
}
from
'
vs/base/common/resources
'
;
import
{
getRemoteAuthority
}
from
'
vs/platform/remote/common/remoteHosts
'
;
export
interface
IStoredWorkspace
{
folders
:
IStoredWorkspaceFolder
[];
remoteAuthority
?:
string
;
}
export
class
WorkspacesMainService
extends
Disposable
implements
IWorkspacesMainService
{
...
...
@@ -73,7 +73,8 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
return
{
id
:
workspaceIdentifier
.
id
,
configPath
:
workspaceIdentifier
.
configPath
,
folders
:
toWorkspaceFolders
(
workspace
.
folders
,
resourcesDirname
(
path
))
folders
:
toWorkspaceFolders
(
workspace
.
folders
,
resourcesDirname
(
path
)),
remoteAuthority
:
workspace
.
remoteAuthority
};
}
catch
(
error
)
{
this
.
logService
.
warn
(
error
.
toString
());
...
...
@@ -104,8 +105,8 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
return
isEqualOrParent
(
path
,
this
.
environmentService
.
untitledWorkspacesHome
);
}
createUntitledWorkspace
(
folders
?:
IWorkspaceFolderCreationData
[]):
Promise
<
IWorkspaceIdentifier
>
{
const
{
workspace
,
storedWorkspace
}
=
this
.
newUntitledWorkspace
(
folders
);
createUntitledWorkspace
(
folders
?:
IWorkspaceFolderCreationData
[]
,
remoteAuthority
?:
string
):
Promise
<
IWorkspaceIdentifier
>
{
const
{
workspace
,
storedWorkspace
}
=
this
.
newUntitledWorkspace
(
folders
,
remoteAuthority
);
const
configPath
=
workspace
.
configPath
.
fsPath
;
return
mkdirp
(
dirname
(
configPath
)).
then
(()
=>
{
...
...
@@ -113,8 +114,8 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
});
}
createUntitledWorkspaceSync
(
folders
?:
IWorkspaceFolderCreationData
[]):
IWorkspaceIdentifier
{
const
{
workspace
,
storedWorkspace
}
=
this
.
newUntitledWorkspace
(
folders
);
createUntitledWorkspaceSync
(
folders
?:
IWorkspaceFolderCreationData
[]
,
remoteAuthority
?:
string
):
IWorkspaceIdentifier
{
const
{
workspace
,
storedWorkspace
}
=
this
.
newUntitledWorkspace
(
folders
,
remoteAuthority
);
const
configPath
=
workspace
.
configPath
.
fsPath
;
const
configPathDir
=
dirname
(
configPath
);
...
...
@@ -131,7 +132,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
return
workspace
;
}
private
newUntitledWorkspace
(
folders
:
IWorkspaceFolderCreationData
[]
=
[]):
{
workspace
:
IWorkspaceIdentifier
,
storedWorkspace
:
IStoredWorkspace
}
{
private
newUntitledWorkspace
(
folders
:
IWorkspaceFolderCreationData
[]
=
[]
,
remoteAuthority
?:
string
):
{
workspace
:
IWorkspaceIdentifier
,
storedWorkspace
:
IStoredWorkspace
}
{
const
randomId
=
(
Date
.
now
()
+
Math
.
round
(
Math
.
random
()
*
1000
)).
toString
();
const
untitledWorkspaceConfigFolder
=
joinPath
(
this
.
untitledWorkspacesHome
,
randomId
);
const
untitledWorkspaceConfigPath
=
joinPath
(
untitledWorkspaceConfigFolder
,
UNTITLED_WORKSPACE_NAME
);
...
...
@@ -144,7 +145,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
return
{
workspace
:
this
.
getWorkspaceIdentifier
(
untitledWorkspaceConfigPath
),
storedWorkspace
:
{
folders
:
storedWorkspaceFolder
}
storedWorkspace
:
{
folders
:
storedWorkspaceFolder
,
remoteAuthority
}
};
}
...
...
@@ -230,8 +231,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
if
(
!
resolvedWorkspace
)
{
this
.
doDeleteUntitledWorkspaceSync
(
workspace
);
}
else
{
const
remoteAuthority
=
resolvedWorkspace
.
folders
.
length
?
getRemoteAuthority
(
resolvedWorkspace
.
folders
[
0
].
uri
)
:
undefined
;
untitledWorkspaces
.
push
({
workspace
,
remoteAuthority
});
untitledWorkspaces
.
push
({
workspace
,
remoteAuthority
:
resolvedWorkspace
.
remoteAuthority
});
}
}
}
catch
(
error
)
{
...
...
src/vs/platform/workspaces/node/workspacesIpc.ts
浏览文件 @
60ebcd16
...
...
@@ -19,7 +19,8 @@ export class WorkspacesChannel implements IServerChannel {
call
(
_
,
command
:
string
,
arg
?:
any
):
Promise
<
any
>
{
switch
(
command
)
{
case
'
createUntitledWorkspace
'
:
{
const
rawFolders
:
IWorkspaceFolderCreationData
[]
=
arg
;
const
rawFolders
:
IWorkspaceFolderCreationData
[]
=
arg
[
0
];
const
remoteAuthority
:
string
=
arg
[
1
];
let
folders
:
IWorkspaceFolderCreationData
[]
|
undefined
=
undefined
;
if
(
Array
.
isArray
(
rawFolders
))
{
folders
=
rawFolders
.
map
(
rawFolder
=>
{
...
...
@@ -30,7 +31,7 @@ export class WorkspacesChannel implements IServerChannel {
});
}
return
this
.
service
.
createUntitledWorkspace
(
folders
);
return
this
.
service
.
createUntitledWorkspace
(
folders
,
remoteAuthority
);
}
}
...
...
@@ -44,7 +45,7 @@ export class WorkspacesChannelClient implements IWorkspacesService {
constructor
(
private
channel
:
IChannel
)
{
}
createUntitledWorkspace
(
folders
?:
IWorkspaceFolderCreationData
[]):
Promise
<
IWorkspaceIdentifier
>
{
return
this
.
channel
.
call
(
'
createUntitledWorkspace
'
,
folders
).
then
(
reviveWorkspaceIdentifier
);
createUntitledWorkspace
(
folders
?:
IWorkspaceFolderCreationData
[]
,
remoteAuthority
?:
string
):
Promise
<
IWorkspaceIdentifier
>
{
return
this
.
channel
.
call
(
'
createUntitledWorkspace
'
,
[
folders
,
remoteAuthority
]
).
then
(
reviveWorkspaceIdentifier
);
}
}
src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts
浏览文件 @
60ebcd16
...
...
@@ -114,7 +114,7 @@ suite('WorkspacesMainService', () => {
const
folder1URI
=
URI
.
parse
(
'
myscheme://server/work/p/f1
'
);
const
folder2URI
=
URI
.
parse
(
'
myscheme://server/work/o/f3
'
);
return
service
.
createUntitledWorkspace
([{
uri
:
folder1URI
},
{
uri
:
folder2URI
}]).
then
(
workspace
=>
{
return
service
.
createUntitledWorkspace
([{
uri
:
folder1URI
},
{
uri
:
folder2URI
}]
,
'
server
'
).
then
(
workspace
=>
{
assert
.
ok
(
workspace
);
assert
.
ok
(
fs
.
existsSync
(
workspace
.
configPath
.
fsPath
));
assert
.
ok
(
service
.
isUntitledWorkspace
(
workspace
));
...
...
@@ -126,6 +126,8 @@ suite('WorkspacesMainService', () => {
assert
.
ok
(
!
(
<
IRawFileWorkspaceFolder
>
ws
.
folders
[
0
]).
name
);
assert
.
ok
(
!
(
<
IRawFileWorkspaceFolder
>
ws
.
folders
[
1
]).
name
);
assert
.
equal
(
ws
.
remoteAuthority
,
'
server
'
);
});
});
...
...
src/vs/workbench/browser/actions/workspaceActions.ts
浏览文件 @
60ebcd16
...
...
@@ -252,8 +252,9 @@ export class DuplicateWorkspaceInNewWindowAction extends Action {
run
():
Promise
<
any
>
{
const
folders
=
this
.
workspaceContextService
.
getWorkspace
().
folders
;
const
remoteAuthority
=
this
.
windowService
.
getConfiguration
().
remoteAuthority
;
return
this
.
workspacesService
.
createUntitledWorkspace
(
folders
).
then
(
newWorkspace
=>
{
return
this
.
workspacesService
.
createUntitledWorkspace
(
folders
,
remoteAuthority
).
then
(
newWorkspace
=>
{
return
this
.
workspaceEditingService
.
copyWorkspaceSettings
(
newWorkspace
).
then
(()
=>
{
return
this
.
windowService
.
openWindow
([{
uri
:
newWorkspace
.
configPath
,
typeHint
:
'
file
'
}],
{
forceNewWindow
:
true
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录