Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
b106857f
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,发现更多精彩内容 >>
提交
b106857f
编写于
7月 20, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
multi root: allow target extension development window to be a workspace too
上级
4f074abe
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
57 addition
and
51 deletion
+57
-51
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+3
-9
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+13
-15
src/vs/code/node/windowsFinder.ts
src/vs/code/node/windowsFinder.ts
+41
-27
未找到文件。
src/vs/code/electron-main/window.ts
浏览文件 @
b106857f
...
...
@@ -72,15 +72,12 @@ export class CodeWindow implements ICodeWindow {
private
static
MIN_WIDTH
=
200
;
private
static
MIN_HEIGHT
=
120
;
private
options
:
IWindowCreationOptions
;
private
hiddenTitleBarStyle
:
boolean
;
private
showTimeoutHandle
:
any
;
private
_id
:
number
;
private
_win
:
Electron
.
BrowserWindow
;
private
_lastFocusTime
:
number
;
private
_readyState
:
ReadyState
;
private
_extensionDevelopmentPath
:
string
;
private
_isExtensionTestHost
:
boolean
;
private
windowState
:
IWindowState
;
private
currentMenuBarVisibility
:
MenuBarVisibility
;
private
toDispose
:
IDisposable
[];
...
...
@@ -99,11 +96,8 @@ export class CodeWindow implements ICodeWindow {
@
IStorageService
private
storageService
:
IStorageService
,
@
IWorkspacesMainService
private
workspaceService
:
IWorkspacesMainService
)
{
this
.
options
=
config
;
this
.
_lastFocusTime
=
-
1
;
this
.
_readyState
=
ReadyState
.
NONE
;
this
.
_extensionDevelopmentPath
=
config
.
extensionDevelopmentPath
;
this
.
_isExtensionTestHost
=
config
.
isExtensionTestHost
;
this
.
whenReadyCallbacks
=
[];
this
.
toDispose
=
[];
...
...
@@ -207,15 +201,15 @@ export class CodeWindow implements ICodeWindow {
}
public
get
isExtensionDevelopmentHost
():
boolean
{
return
!!
this
.
_
extensionDevelopmentPath
;
return
!!
this
.
config
.
extensionDevelopmentPath
;
}
public
get
isExtensionTestHost
():
boolean
{
return
this
.
_isExtensionTestHost
;
return
!!
this
.
config
.
extensionTestsPath
;
}
public
get
extensionDevelopmentPath
():
string
{
return
this
.
_
extensionDevelopmentPath
;
return
this
.
config
.
extensionDevelopmentPath
;
}
public
get
config
():
IWindowConfiguration
{
...
...
src/vs/code/electron-main/windows.ts
浏览文件 @
b106857f
...
...
@@ -20,7 +20,7 @@ import { ILifecycleService, UnloadReason, IWindowUnloadEvent } from 'vs/platform
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IWindowSettings
,
OpenContext
,
IPath
,
IWindowConfiguration
,
INativeOpenDialogOptions
}
from
'
vs/platform/windows/common/windows
'
;
import
{
getLastActiveWindow
,
findBestWindowOrFolderForFile
,
findWindowOnWorkspace
}
from
'
vs/code/node/windowsFinder
'
;
import
{
getLastActiveWindow
,
findBestWindowOrFolderForFile
,
findWindowOnWorkspace
,
findWindowOnExtensionDevelopmentPath
,
findWindowOnWorkspaceOrFolderPath
}
from
'
vs/code/node/windowsFinder
'
;
import
CommonEvent
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
product
from
'
vs/platform/node/product
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
...
...
@@ -888,28 +888,26 @@ export class WindowsManager implements IWindowsMainService {
// Reload an existing extension development host window on the same path
// We currently do not allow more than one extension development window
// on the same extension path.
let
res
=
WindowsManager
.
WINDOWS
.
filter
(
w
=>
w
.
config
&&
isEqual
(
w
.
config
.
extensionDevelopmentPath
,
openConfig
.
cli
.
extensionDevelopmentPath
,
!
isLinux
/* ignorecase */
)
);
if
(
res
&&
res
.
length
===
1
)
{
this
.
reload
(
res
[
0
]
,
openConfig
.
cli
);
res
[
0
]
.
focus
();
// make sure it gets focus and is restored
const
existingWindow
=
findWindowOnExtensionDevelopmentPath
(
WindowsManager
.
WINDOWS
,
openConfig
.
cli
.
extensionDevelopmentPath
);
if
(
existingWindow
)
{
this
.
reload
(
existingWindow
,
openConfig
.
cli
);
existingWindow
.
focus
();
// make sure it gets focus and is restored
return
;
}
// Fill in previously opened
folder
unless an explicit path is provided and we are not unit testing
// Fill in previously opened
workspace
unless an explicit path is provided and we are not unit testing
if
(
openConfig
.
cli
.
_
.
length
===
0
&&
!
openConfig
.
cli
.
extensionTestsPath
)
{
const
folderToOpen
=
this
.
windowsState
.
lastPluginDevelopmentHostWindow
&&
this
.
windowsState
.
lastPluginDevelopmentHostWindow
.
folderPath
;
if
(
folderToOpen
)
{
openConfig
.
cli
.
_
=
[
folderToOpen
];
const
extensionDevelopmentWindowState
=
this
.
windowsState
.
lastPluginDevelopmentHostWindow
;
const
workspaceToOpen
=
extensionDevelopmentWindowState
&&
(
extensionDevelopmentWindowState
.
workspace
||
extensionDevelopmentWindowState
.
folderPath
);
if
(
workspaceToOpen
)
{
openConfig
.
cli
.
_
=
[
isSingleFolderWorkspaceIdentifier
(
workspaceToOpen
)
?
workspaceToOpen
:
workspaceToOpen
.
configPath
];
}
}
// Make sure we are not asked to open a path that is already opened
if
(
openConfig
.
cli
.
_
.
length
>
0
)
{
res
=
WindowsManager
.
WINDOWS
.
filter
(
w
=>
w
.
openedFolderPath
&&
openConfig
.
cli
.
_
.
indexOf
(
w
.
openedFolderPath
)
>=
0
);
if
(
res
.
length
)
{
openConfig
.
cli
.
_
=
[];
}
// Make sure we are not asked to open a workspace or folder that is already opened
if
(
openConfig
.
cli
.
_
.
some
(
path
=>
!!
findWindowOnWorkspaceOrFolderPath
(
WindowsManager
.
WINDOWS
,
path
)))
{
openConfig
.
cli
.
_
=
[];
}
// Open it
...
...
src/vs/code/node/windowsFinder.ts
浏览文件 @
b106857f
...
...
@@ -112,43 +112,57 @@ function hasCodeSettings(folder: string, normalizedUserHome?: string, codeSettin
}
export
function
getLastActiveWindow
<
W
extends
ISimpleWindow
>
(
windows
:
W
[]):
W
{
if
(
windows
.
length
)
{
const
lastFocussedDate
=
Math
.
max
.
apply
(
Math
,
windows
.
map
(
w
=>
w
.
lastFocusTime
));
const
res
=
windows
.
filter
(
w
=>
w
.
lastFocusTime
===
lastFocussedDate
);
if
(
res
&&
res
.
length
)
{
return
res
[
0
];
}
}
const
lastFocussedDate
=
Math
.
max
.
apply
(
Math
,
windows
.
map
(
window
=>
window
.
lastFocusTime
));
return
null
;
return
windows
.
filter
(
window
=>
window
.
lastFocusTime
===
lastFocussedDate
)[
0
]
;
}
export
function
findWindowOnWorkspace
<
W
extends
ISimpleWindow
>
(
windows
:
W
[],
workspace
:
(
IWorkspaceIdentifier
|
ISingleFolderWorkspaceIdentifier
)):
W
{
if
(
windows
.
length
)
{
const
res
=
windows
.
filter
(
w
=>
{
// match on folder
if
(
isSingleFolderWorkspaceIdentifier
(
workspace
))
{
if
(
typeof
w
.
openedFolderPath
===
'
string
'
&&
(
paths
.
isEqual
(
w
.
openedFolderPath
,
workspace
,
!
platform
.
isLinux
/* ignorecase */
)))
{
return
true
;
}
return
windows
.
filter
(
window
=>
{
// match on folder
if
(
isSingleFolderWorkspaceIdentifier
(
workspace
))
{
if
(
typeof
window
.
openedFolderPath
===
'
string
'
&&
(
paths
.
isEqual
(
window
.
openedFolderPath
,
workspace
,
!
platform
.
isLinux
/* ignorecase */
)))
{
return
true
;
}
}
// match on workspace
else
{
if
(
w
.
openedWorkspace
&&
w
.
openedWorkspace
.
id
===
workspace
.
id
)
{
return
true
;
}
// match on workspace
else
{
if
(
window
.
openedWorkspace
&&
window
.
openedWorkspace
.
id
===
workspace
.
id
)
{
return
true
;
}
}
return
false
;
})[
0
];
}
return
false
;
});
export
function
findWindowOnExtensionDevelopmentPath
<
W
extends
ISimpleWindow
>
(
windows
:
W
[],
extensionDevelopmentPath
:
string
):
W
{
return
windows
.
filter
(
window
=>
{
if
(
res
&&
res
.
length
)
{
return
res
[
0
];
// match on extension development path
if
(
paths
.
isEqual
(
window
.
extensionDevelopmentPath
,
extensionDevelopmentPath
,
!
platform
.
isLinux
/* ignorecase */
))
{
return
true
;
}
}
return
null
;
return
false
;
})[
0
];
}
export
function
findWindowOnWorkspaceOrFolderPath
<
W
extends
ISimpleWindow
>
(
windows
:
W
[],
path
:
string
):
W
{
return
windows
.
filter
(
window
=>
{
// check for workspace config path
if
(
window
.
openedWorkspace
&&
paths
.
isEqual
(
window
.
openedWorkspace
.
configPath
,
path
,
!
platform
.
isLinux
/* ignorecase */
))
{
return
true
;
}
// check for folder path
if
(
window
.
openedFolderPath
&&
paths
.
isEqual
(
window
.
openedFolderPath
,
path
,
!
platform
.
isLinux
/* ignorecase */
))
{
return
true
;
}
return
false
;
})[
0
];
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录