Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e78e63fc
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,发现更多精彩内容 >>
未验证
提交
e78e63fc
编写于
10月 23, 2021
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Window crash: "Reopen" does not work on macOS (fix #135572)
上级
b3d14424
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
54 addition
and
25 deletion
+54
-25
src/vs/platform/native/electron-main/nativeHostMainService.ts
...vs/platform/native/electron-main/nativeHostMainService.ts
+7
-1
src/vs/platform/windows/electron-main/window.ts
src/vs/platform/windows/electron-main/window.ts
+47
-24
未找到文件。
src/vs/platform/native/electron-main/nativeHostMainService.ts
浏览文件 @
e78e63fc
...
...
@@ -653,7 +653,13 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
//#region macOS Touchbar
async
newWindowTab
():
Promise
<
void
>
{
this
.
windowsMainService
.
open
({
context
:
OpenContext
.
API
,
cli
:
this
.
environmentMainService
.
args
,
forceNewTabbedWindow
:
true
,
forceEmpty
:
true
,
remoteAuthority
:
this
.
environmentMainService
.
args
.
remote
||
undefined
});
this
.
windowsMainService
.
open
({
context
:
OpenContext
.
API
,
cli
:
this
.
environmentMainService
.
args
,
forceNewTabbedWindow
:
true
,
forceEmpty
:
true
,
remoteAuthority
:
this
.
environmentMainService
.
args
.
remote
||
undefined
});
}
async
showPreviousWindowTab
():
Promise
<
void
>
{
...
...
src/vs/platform/windows/electron-main/window.ts
浏览文件 @
e78e63fc
...
...
@@ -32,8 +32,8 @@ import { IStorageMainService } from 'vs/platform/storage/electron-main/storageMa
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ThemeIcon
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IThemeMainService
}
from
'
vs/platform/theme/electron-main/themeMainService
'
;
import
{
getMenuBarVisibility
,
getTitleBarStyle
,
I
NativeWindowConfiguration
,
IWindowSettings
,
MenuBarVisibility
,
WindowMinimumSize
,
zoomLevelToZoomFactor
}
from
'
vs/platform/windows/common/windows
'
;
import
{
defaultWindowState
,
ICodeWindow
,
ILoadEvent
,
IWindow
State
,
LoadReason
,
WindowError
,
WindowMode
}
from
'
vs/platform/windows/electron-main/windows
'
;
import
{
getMenuBarVisibility
,
getTitleBarStyle
,
I
FolderToOpen
,
INativeWindowConfiguration
,
IWindowSettings
,
IWorkspaceToOpen
,
MenuBarVisibility
,
WindowMinimumSize
,
zoomLevelToZoomFactor
}
from
'
vs/platform/windows/common/windows
'
;
import
{
defaultWindowState
,
ICodeWindow
,
ILoadEvent
,
IWindow
sMainService
,
IWindowState
,
LoadReason
,
OpenContext
,
WindowError
,
WindowMode
}
from
'
vs/platform/windows/electron-main/windows
'
;
import
{
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
,
IWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspacesManagementMainService
}
from
'
vs/platform/workspaces/electron-main/workspacesManagementMainService
'
;
...
...
@@ -158,7 +158,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
@
IDialogMainService
private
readonly
dialogMainService
:
IDialogMainService
,
@
ILifecycleMainService
private
readonly
lifecycleMainService
:
ILifecycleMainService
,
@
IProductService
private
readonly
productService
:
IProductService
,
@
IProtocolMainService
private
readonly
protocolMainService
:
IProtocolMainService
@
IProtocolMainService
private
readonly
protocolMainService
:
IProtocolMainService
,
@
IWindowsMainService
private
readonly
windowsMainService
:
IWindowsMainService
)
{
super
();
...
...
@@ -617,15 +618,10 @@ export class CodeWindow extends Disposable implements ICodeWindow {
cancelId
:
1
},
this
.
_win
);
if
(
!
this
.
_win
)
{
return
;
// Return early if the window has been going down already
}
if
(
result
.
response
===
0
)
{
this
.
_win
.
webContents
.
forcefullyCrashRenderer
();
// Calling reload() immediately after calling this method will force the reload to occur in a new process
this
.
reload
();
}
else
if
(
result
.
response
===
2
)
{
this
.
destroyWindow
();
// Handle choice
if
(
result
.
response
!==
1
/* keep waiting */
)
{
const
reopen
=
result
.
response
===
0
;
this
.
destroyWindow
(
reopen
);
}
}
...
...
@@ -638,6 +634,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
message
=
localize
(
'
appCrashedDetails
'
,
"
The window has crashed (reason: '{0}', code: '{1}')
"
,
details
.
reason
,
details
.
exitCode
??
'
<unknown>
'
);
}
// Show Dialog
const
result
=
await
this
.
dialogMainService
.
showMessageBox
({
title
:
this
.
productService
.
nameLong
,
type
:
'
warning
'
,
...
...
@@ -651,23 +648,49 @@ export class CodeWindow extends Disposable implements ICodeWindow {
defaultId
:
0
},
this
.
_win
);
if
(
!
this
.
_win
)
{
return
;
// Return early if the window has been going down already
}
if
(
result
.
response
===
0
)
{
this
.
reload
();
}
else
if
(
result
.
response
===
1
)
{
this
.
destroyWindow
();
}
// Handle choice
const
reopen
=
result
.
response
===
0
;
this
.
destroyWindow
(
reopen
);
}
break
;
}
}
private
destroyWindow
():
void
{
this
.
_onDidDestroy
.
fire
();
// 'close' event will not be fired on destroy(), so signal crash via explicit event
this
.
_win
.
destroy
();
// make sure to destroy the window as it has crashed
private
destroyWindow
(
reopen
:
boolean
):
void
{
// 'close' event will not be fired on destroy(), so signal crash via explicit event
this
.
_onDidDestroy
.
fire
();
// make sure to destroy the window as it has crashed
this
.
_win
?.
destroy
();
// ask the windows service to open a new fresh window if specified
if
(
reopen
&&
this
.
config
)
{
// We have to reconstruct a openable from the current workspace
let
workspace
:
IWorkspaceToOpen
|
IFolderToOpen
|
undefined
=
undefined
;
let
forceEmpty
=
undefined
;
if
(
isSingleFolderWorkspaceIdentifier
(
this
.
openedWorkspace
))
{
workspace
=
{
folderUri
:
this
.
openedWorkspace
.
uri
};
}
else
if
(
isWorkspaceIdentifier
(
this
.
openedWorkspace
))
{
workspace
=
{
workspaceUri
:
this
.
openedWorkspace
.
configPath
};
}
else
{
forceEmpty
=
true
;
}
// Delegate to windows service
const
[
window
]
=
this
.
windowsMainService
.
open
({
context
:
OpenContext
.
API
,
userEnv
:
this
.
config
.
userEnv
,
cli
:
{
...
this
.
environmentMainService
.
args
,
_
:
[]
// we pass in the workspace to open explicitly via `urisToOpen`
},
urisToOpen
:
workspace
?
[
workspace
]
:
undefined
,
forceEmpty
});
window
.
focus
();
}
}
private
onDidDeleteUntitledWorkspace
(
workspace
:
IWorkspaceIdentifier
):
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录