Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c56f0686
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,体验更适合开发者的 AI 搜索 >>
提交
c56f0686
编写于
3月 15, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
`-w` doesn't work when there are no windows open (fixes #4150)
上级
373426f1
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
26 addition
and
22 deletion
+26
-22
src/vs/workbench/electron-main/main.ts
src/vs/workbench/electron-main/main.ts
+19
-17
src/vs/workbench/electron-main/windows.ts
src/vs/workbench/electron-main/windows.ts
+7
-5
未找到文件。
src/vs/workbench/electron-main/main.ts
浏览文件 @
c56f0686
...
@@ -12,6 +12,7 @@ import {assign} from 'vs/base/common/objects';
...
@@ -12,6 +12,7 @@ import {assign} from 'vs/base/common/objects';
import
platform
=
require
(
'
vs/base/common/platform
'
);
import
platform
=
require
(
'
vs/base/common/platform
'
);
import
env
=
require
(
'
vs/workbench/electron-main/env
'
);
import
env
=
require
(
'
vs/workbench/electron-main/env
'
);
import
windows
=
require
(
'
vs/workbench/electron-main/windows
'
);
import
windows
=
require
(
'
vs/workbench/electron-main/windows
'
);
import
window
=
require
(
'
vs/workbench/electron-main/window
'
);
import
lifecycle
=
require
(
'
vs/workbench/electron-main/lifecycle
'
);
import
lifecycle
=
require
(
'
vs/workbench/electron-main/lifecycle
'
);
import
menu
=
require
(
'
vs/workbench/electron-main/menus
'
);
import
menu
=
require
(
'
vs/workbench/electron-main/menus
'
);
import
settings
=
require
(
'
vs/workbench/electron-main/settings
'
);
import
settings
=
require
(
'
vs/workbench/electron-main/settings
'
);
...
@@ -28,20 +29,22 @@ export class LaunchService {
...
@@ -28,20 +29,22 @@ export class LaunchService {
env
.
log
(
'
Received data from other instance
'
,
args
);
env
.
log
(
'
Received data from other instance
'
,
args
);
let
killOtherInstance
=
args
.
waitForWindowClose
;
let
killOtherInstance
=
args
.
waitForWindowClose
;
let
usedWindows
:
window
.
VSCodeWindow
[];
// Otherwise handle in windows manager
// Otherwise handle in windows manager
if
(
!!
args
.
extensionDevelopmentPath
)
{
if
(
!!
args
.
extensionDevelopmentPath
)
{
windows
.
manager
.
openPluginDevelopmentHostWindow
({
cli
:
args
,
userEnv
:
userEnv
});
windows
.
manager
.
openPluginDevelopmentHostWindow
({
cli
:
args
,
userEnv
:
userEnv
});
}
else
if
(
args
.
pathArguments
.
length
===
0
&&
args
.
openNewWindow
)
{
}
else
if
(
args
.
pathArguments
.
length
===
0
&&
args
.
openNewWindow
)
{
windows
.
manager
.
open
({
cli
:
args
,
userEnv
:
userEnv
,
forceNewWindow
:
true
,
forceEmpty
:
true
});
usedWindows
=
windows
.
manager
.
open
({
cli
:
args
,
userEnv
:
userEnv
,
forceNewWindow
:
true
,
forceEmpty
:
true
});
}
else
if
(
args
.
pathArguments
.
length
===
0
)
{
}
else
if
(
args
.
pathArguments
.
length
===
0
)
{
windows
.
manager
.
focusLastActive
(
args
)
;
usedWindows
=
[
windows
.
manager
.
focusLastActive
(
args
)]
;
}
else
{
}
else
{
let
usedWindows
=
windows
.
manager
.
open
({
cli
:
args
,
userEnv
:
userEnv
,
forceNewWindow
:
args
.
waitForWindowClose
||
args
.
openNewWindow
,
preferNewWindow
:
!
args
.
openInSameWindow
});
usedWindows
=
windows
.
manager
.
open
({
cli
:
args
,
userEnv
:
userEnv
,
forceNewWindow
:
args
.
waitForWindowClose
||
args
.
openNewWindow
,
preferNewWindow
:
!
args
.
openInSameWindow
});
}
// If the other instance is waiting to be killed, we hook up a window listener if one window
// If the other instance is waiting to be killed, we hook up a window listener if one window
// is being used and kill the other instance when that window is being closed
// is being used and kill the other instance when that window is being closed
if
(
args
.
waitForWindowClose
&&
usedWindows
&&
usedWindows
.
length
===
1
)
{
if
(
args
.
waitForWindowClose
&&
usedWindows
&&
usedWindows
.
length
===
1
&&
usedWindows
[
0
]
)
{
let
windowToObserve
=
usedWindows
[
0
];
let
windowToObserve
=
usedWindows
[
0
];
killOtherInstance
=
false
;
// only scenario where the "-w" switch is supported and makes sense
killOtherInstance
=
false
;
// only scenario where the "-w" switch is supported and makes sense
...
@@ -52,7 +55,6 @@ export class LaunchService {
...
@@ -52,7 +55,6 @@ export class LaunchService {
}
}
});
});
}
}
}
if
(
killOtherInstance
)
{
if
(
killOtherInstance
)
{
process
.
kill
(
otherInstancePid
);
process
.
kill
(
otherInstancePid
);
...
...
src/vs/workbench/electron-main/windows.ts
浏览文件 @
c56f0686
...
@@ -964,17 +964,19 @@ export class WindowsManager {
...
@@ -964,17 +964,19 @@ export class WindowsManager {
});
});
}
}
public
focusLastActive
(
cli
:
env
.
ICommandLineArguments
):
void
{
public
focusLastActive
(
cli
:
env
.
ICommandLineArguments
):
window
.
VSCodeWindow
{
let
lastActive
=
this
.
getLastActiveWindow
();
let
lastActive
=
this
.
getLastActiveWindow
();
if
(
lastActive
)
{
if
(
lastActive
)
{
lastActive
.
focus
();
lastActive
.
focus
();
return
lastActive
;
}
}
// No window - open new one
// No window - open new one
else
{
this
.
windowsState
.
openedFolders
=
[];
// make sure we do not open too much
this
.
windowsState
.
openedFolders
=
[];
// make sure we do not open too much
this
.
open
({
cli
:
cli
});
const
res
=
this
.
open
({
cli
:
cli
});
}
return
res
&&
res
[
0
];
}
}
public
getLastActiveWindow
():
window
.
VSCodeWindow
{
public
getLastActiveWindow
():
window
.
VSCodeWindow
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录