Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
062d9393
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 搜索 >>
提交
062d9393
编写于
5月 25, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sandboy - more adoption of IPC API from preload script
上级
41461768
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
81 addition
and
64 deletion
+81
-64
src/vs/base/electron-sandbox/globals.ts
src/vs/base/electron-sandbox/globals.ts
+3
-3
src/vs/base/parts/contextmenu/electron-sandbox/contextmenu.ts
...vs/base/parts/contextmenu/electron-sandbox/contextmenu.ts
+2
-2
src/vs/code/electron-browser/issue/issueReporterMain.ts
src/vs/code/electron-browser/issue/issueReporterMain.ts
+2
-1
src/vs/code/electron-browser/processExplorer/processExplorerMain.ts
...e/electron-browser/processExplorer/processExplorerMain.ts
+6
-5
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
.../code/electron-browser/sharedProcess/sharedProcessMain.ts
+6
-6
src/vs/code/electron-main/sharedProcess.ts
src/vs/code/electron-main/sharedProcess.ts
+7
-5
src/vs/platform/issue/electron-main/issueMainService.ts
src/vs/platform/issue/electron-main/issueMainService.ts
+2
-3
src/vs/workbench/contrib/codeEditor/electron-browser/codeEditor.contribution.ts
...ib/codeEditor/electron-browser/codeEditor.contribution.ts
+0
-1
src/vs/workbench/contrib/codeEditor/electron-sandbox/codeEditor.contribution.ts
...ib/codeEditor/electron-sandbox/codeEditor.contribution.ts
+6
-0
src/vs/workbench/contrib/codeEditor/electron-sandbox/sleepResumeRepaintMinimap.ts
.../codeEditor/electron-sandbox/sleepResumeRepaintMinimap.ts
+2
-2
src/vs/workbench/contrib/files/browser/views/explorerViewer.ts
...s/workbench/contrib/files/browser/views/explorerViewer.ts
+2
-0
src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts
...ch/contrib/remote/electron-browser/remote.contribution.ts
+5
-5
src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts
...ntrib/splash/electron-browser/partsSplash.contribution.ts
+2
-2
src/vs/workbench/contrib/terminal/electron-browser/terminalNativeService.ts
...ontrib/terminal/electron-browser/terminalNativeService.ts
+3
-3
src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts
...kbench/contrib/webview/electron-browser/webviewElement.ts
+2
-1
src/vs/workbench/electron-browser/window.ts
src/vs/workbench/electron-browser/window.ts
+16
-15
src/vs/workbench/services/editor/browser/editorService.ts
src/vs/workbench/services/editor/browser/editorService.ts
+3
-1
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
.../services/extensions/electron-browser/extensionService.ts
+2
-2
src/vs/workbench/services/lifecycle/electron-browser/lifecycleService.ts
...h/services/lifecycle/electron-browser/lifecycleService.ts
+7
-7
src/vs/workbench/workbench.sandbox.main.ts
src/vs/workbench/workbench.sandbox.main.ts
+3
-0
未找到文件。
src/vs/base/electron-sandbox/globals.ts
浏览文件 @
062d9393
...
...
@@ -9,19 +9,19 @@ export const ipcRenderer = (window as any).vscode.ipcRenderer as {
* Listens to `channel`, when a new message arrives `listener` would be called with
* `listener(event, args...)`.
*/
on
(
channel
:
string
,
listener
:
Function
):
void
;
on
(
channel
:
string
,
listener
:
(
event
:
unknown
,
...
args
:
any
[])
=>
void
):
void
;
/**
* Adds a one time `listener` function for the event. This `listener` is invoked
* only the next time a message is sent to `channel`, after which it is removed.
*/
once
(
channel
:
string
,
listener
:
Function
):
void
;
once
(
channel
:
string
,
listener
:
(
event
:
unknown
,
...
args
:
any
[])
=>
void
):
void
;
/**
* Removes the specified `listener` from the listener array for the specified
* `channel`.
*/
removeListener
(
channel
:
string
,
listener
:
Function
):
void
;
removeListener
(
channel
:
string
,
listener
:
(
event
:
unknown
,
...
args
:
any
[])
=>
void
):
void
;
/**
* Send an asynchronous message to the main process via `channel`, along with
...
...
src/vs/base/parts/contextmenu/electron-sandbox/contextmenu.ts
浏览文件 @
062d9393
...
...
@@ -13,7 +13,7 @@ export function popup(items: IContextMenuItem[], options?: IPopupOptions): void
const
contextMenuId
=
contextMenuIdPool
++
;
const
onClickChannel
=
`vscode:onContextMenu
${
contextMenuId
}
`
;
const
onClickChannelHandler
=
(
_event
:
Event
,
itemId
:
number
,
context
:
IContextMenuEvent
)
=>
{
const
onClickChannelHandler
=
(
event
:
unknown
,
itemId
:
number
,
context
:
IContextMenuEvent
)
=>
{
const
item
=
processedItems
[
itemId
];
if
(
item
.
click
)
{
item
.
click
(
context
);
...
...
@@ -21,7 +21,7 @@ export function popup(items: IContextMenuItem[], options?: IPopupOptions): void
};
ipcRenderer
.
once
(
onClickChannel
,
onClickChannelHandler
);
ipcRenderer
.
once
(
CONTEXT_MENU_CLOSE_CHANNEL
,
(
_event
:
Event
,
closedContextMenuId
:
number
)
=>
{
ipcRenderer
.
once
(
CONTEXT_MENU_CLOSE_CHANNEL
,
(
event
:
unknown
,
closedContextMenuId
:
number
)
=>
{
if
(
closedContextMenuId
!==
contextMenuId
)
{
return
;
}
...
...
src/vs/code/electron-browser/issue/issueReporterMain.ts
浏览文件 @
062d9393
...
...
@@ -4,7 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import
'
vs/css!./media/issueReporter
'
;
import
{
clipboard
,
ipcRenderer
,
shell
,
webFrame
}
from
'
electron
'
;
import
{
clipboard
,
shell
,
webFrame
}
from
'
electron
'
;
import
{
ipcRenderer
}
from
'
vs/base/electron-sandbox/globals
'
;
import
*
as
os
from
'
os
'
;
import
*
as
browser
from
'
vs/base/browser/browser
'
;
import
{
$
}
from
'
vs/base/browser/dom
'
;
...
...
src/vs/code/electron-browser/processExplorer/processExplorerMain.ts
浏览文件 @
062d9393
...
...
@@ -4,7 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import
'
vs/css!./media/processExplorer
'
;
import
{
webFrame
,
ipcRenderer
,
clipboard
}
from
'
electron
'
;
import
{
webFrame
,
clipboard
}
from
'
electron
'
;
import
{
ipcRenderer
}
from
'
vs/base/electron-sandbox/globals
'
;
import
{
repeat
}
from
'
vs/base/common/strings
'
;
import
{
totalmem
}
from
'
os
'
;
import
product
from
'
vs/platform/product/common/product
'
;
...
...
@@ -369,7 +370,7 @@ function requestProcessList(totalWaitTime: number): void {
// Wait at least a second between requests.
if
(
waited
>
1000
)
{
ipcRenderer
.
send
(
'
windowsInfoRequest
'
);
ipcRenderer
.
send
(
'
vscode:
windowsInfoRequest
'
);
ipcRenderer
.
send
(
'
vscode:listProcesses
'
);
}
else
{
requestProcessList
(
waited
);
...
...
@@ -393,18 +394,18 @@ export function startup(data: ProcessExplorerData): void {
createCloseListener
();
// Map window process pids to titles, annotate process names with this when rendering to distinguish between them
ipcRenderer
.
on
(
'
vscode:windowsInfoResponse
'
,
(
_
event
:
unknown
,
windows
:
any
[])
=>
{
ipcRenderer
.
on
(
'
vscode:windowsInfoResponse
'
,
(
event
:
unknown
,
windows
:
any
[])
=>
{
mapPidToWindowTitle
=
new
Map
<
number
,
string
>
();
windows
.
forEach
(
window
=>
mapPidToWindowTitle
.
set
(
window
.
pid
,
window
.
title
));
});
ipcRenderer
.
on
(
'
vscode:listProcessesResponse
'
,
(
_event
:
Event
,
processRoots
:
[{
name
:
string
,
rootProcess
:
ProcessItem
|
IRemoteDiagnosticError
}])
=>
{
ipcRenderer
.
on
(
'
vscode:listProcessesResponse
'
,
(
event
:
unknown
,
processRoots
:
[{
name
:
string
,
rootProcess
:
ProcessItem
|
IRemoteDiagnosticError
}])
=>
{
updateProcessInfo
(
processRoots
);
requestProcessList
(
0
);
});
lastRequestTime
=
Date
.
now
();
ipcRenderer
.
send
(
'
windowsInfoRequest
'
);
ipcRenderer
.
send
(
'
vscode:
windowsInfoRequest
'
);
ipcRenderer
.
send
(
'
vscode:listProcesses
'
);
document
.
onkeydown
=
(
e
:
KeyboardEvent
)
=>
{
...
...
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
浏览文件 @
062d9393
...
...
@@ -27,7 +27,7 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProper
import
{
TelemetryAppenderChannel
}
from
'
vs/platform/telemetry/node/telemetryIpc
'
;
import
{
TelemetryService
,
ITelemetryServiceConfig
}
from
'
vs/platform/telemetry/common/telemetryService
'
;
import
{
AppInsightsAppender
}
from
'
vs/platform/telemetry/node/appInsightsAppender
'
;
import
{
ipcRenderer
}
from
'
electron
'
;
import
{
ipcRenderer
}
from
'
vs/base/electron-sandbox/globals
'
;
import
{
ILogService
,
LogLevel
,
ILoggerService
}
from
'
vs/platform/log/common/log
'
;
import
{
LoggerChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
LocalizationsService
}
from
'
vs/platform/localizations/node/localizations
'
;
...
...
@@ -114,7 +114,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
const
onExit
=
()
=>
disposables
.
dispose
();
process
.
once
(
'
exit
'
,
onExit
);
ipcRenderer
.
once
(
'
electron-main->shared-process:
exit
'
,
onExit
);
ipcRenderer
.
once
(
'
vscode:electron-main->shared-process=
exit
'
,
onExit
);
disposables
.
add
(
server
);
...
...
@@ -302,17 +302,17 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise<vo
// receive payload from electron-main to start things
const
data
=
await
new
Promise
<
ISharedProcessInitData
>
(
c
=>
{
ipcRenderer
.
once
(
'
electron-main->shared-process: payload
'
,
(
_
:
any
,
r
:
ISharedProcessInitData
)
=>
c
(
r
));
ipcRenderer
.
once
(
'
vscode:electron-main->shared-process=payload
'
,
(
event
:
unknown
,
r
:
ISharedProcessInitData
)
=>
c
(
r
));
// tell electron-main we are ready to receive payload
ipcRenderer
.
send
(
'
shared-process->electron-main:
ready-for-payload
'
);
ipcRenderer
.
send
(
'
vscode:shared-process->electron-main=
ready-for-payload
'
);
});
// await IPC connection and signal this back to electron-main
const
server
=
await
setupIPC
(
data
.
sharedIPCHandle
);
ipcRenderer
.
send
(
'
shared-process->electron-main:
ipc-ready
'
);
ipcRenderer
.
send
(
'
vscode:shared-process->electron-main=
ipc-ready
'
);
// await initialization and signal this back to electron-main
await
main
(
server
,
data
,
configuration
);
ipcRenderer
.
send
(
'
shared-process->electron-main:
init-done
'
);
ipcRenderer
.
send
(
'
vscode:shared-process->electron-main=
init-done
'
);
}
src/vs/code/electron-main/sharedProcess.ts
浏览文件 @
062d9393
...
...
@@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
BrowserWindow
,
ipcMain
,
WebContents
,
Event
as
ElectronEvent
}
from
'
electron
'
;
...
...
@@ -32,7 +33,7 @@ export class SharedProcess implements ISharedProcess {
@
IThemeMainService
private
readonly
themeMainService
:
IThemeMainService
)
{
// overall ready promise when shared process signals initialization is done
this
.
_whenReady
=
new
Promise
<
void
>
(
c
=>
ipcMain
.
once
(
'
shared-process->electron-main:
init-done
'
,
()
=>
c
(
undefined
)));
this
.
_whenReady
=
new
Promise
<
void
>
(
c
=>
ipcMain
.
once
(
'
vscode:shared-process->electron-main=
init-done
'
,
()
=>
c
(
undefined
)));
}
@
memoize
...
...
@@ -41,6 +42,7 @@ export class SharedProcess implements ISharedProcess {
show
:
false
,
backgroundColor
:
this
.
themeMainService
.
getBackgroundColor
(),
webPreferences
:
{
preload
:
URI
.
parse
(
require
.
toUrl
(
'
vs/code/electron-browser/preload.js
'
)).
fsPath
,
images
:
false
,
nodeIntegration
:
true
,
webgl
:
false
,
...
...
@@ -105,18 +107,18 @@ export class SharedProcess implements ISharedProcess {
return
new
Promise
<
void
>
(
c
=>
{
// send payload once shared process is ready to receive it
disposables
.
add
(
Event
.
once
(
Event
.
fromNodeEventEmitter
(
ipcMain
,
'
shared-process->electron-main:
ready-for-payload
'
,
({
sender
}:
{
sender
:
WebContents
})
=>
sender
))(
sender
=>
{
sender
.
send
(
'
electron-main->shared-process:
payload
'
,
{
disposables
.
add
(
Event
.
once
(
Event
.
fromNodeEventEmitter
(
ipcMain
,
'
vscode:shared-process->electron-main=
ready-for-payload
'
,
({
sender
}:
{
sender
:
WebContents
})
=>
sender
))(
sender
=>
{
sender
.
send
(
'
vscode:electron-main->shared-process=
payload
'
,
{
sharedIPCHandle
:
this
.
environmentService
.
sharedIPCHandle
,
args
:
this
.
environmentService
.
args
,
logLevel
:
this
.
logService
.
getLevel
()
});
// signal exit to shared process when we get disposed
disposables
.
add
(
toDisposable
(()
=>
sender
.
send
(
'
electron-main->shared-process:
exit
'
)));
disposables
.
add
(
toDisposable
(()
=>
sender
.
send
(
'
vscode:electron-main->shared-process=
exit
'
)));
// complete IPC-ready promise when shared process signals this to us
ipcMain
.
once
(
'
shared-process->electron-main:
ipc-ready
'
,
()
=>
c
(
undefined
));
ipcMain
.
once
(
'
vscode:shared-process->electron-main=
ipc-ready
'
,
()
=>
c
(
undefined
));
}));
});
}
...
...
src/vs/platform/issue/electron-main/issueMainService.ts
浏览文件 @
062d9393
...
...
@@ -164,12 +164,11 @@ export class IssueMainService implements IIssueService {
}
});
ipcMain
.
on
(
'
windowsInfoRequest
'
,
(
event
:
IpcMainEvent
)
=>
{
ipcMain
.
on
(
'
vscode:
windowsInfoRequest
'
,
(
event
:
IpcMainEvent
)
=>
{
this
.
launchMainService
.
getMainProcessInfo
().
then
(
info
=>
{
event
.
sender
.
send
(
'
vscode:windowsInfoResponse
'
,
info
.
windows
);
});
});
}
openReporter
(
data
:
IssueReporterData
):
Promise
<
void
>
{
...
...
@@ -227,7 +226,7 @@ export class IssueMainService implements IIssueService {
if
(
!
this
.
_processExplorerWindow
)
{
this
.
_processExplorerParentWindow
=
BrowserWindow
.
getFocusedWindow
();
if
(
this
.
_processExplorerParentWindow
)
{
const
position
=
this
.
getWindowPosition
(
this
.
_processExplorerParentWindow
,
800
,
3
00
);
const
position
=
this
.
getWindowPosition
(
this
.
_processExplorerParentWindow
,
800
,
5
00
);
this
.
_processExplorerWindow
=
new
BrowserWindow
({
skipTaskbar
:
true
,
resizable
:
true
,
...
...
src/vs/workbench/contrib/codeEditor/electron-browser/codeEditor.contribution.ts
浏览文件 @
062d9393
...
...
@@ -4,6 +4,5 @@
*--------------------------------------------------------------------------------------------*/
import
'
./inputClipboardActions
'
;
import
'
./sleepResumeRepaintMinimap
'
;
import
'
./selectionClipboard
'
;
import
'
./startDebugTextMate
'
;
src/vs/workbench/contrib/codeEditor/electron-sandbox/codeEditor.contribution.ts
0 → 100644
浏览文件 @
062d9393
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
'
./sleepResumeRepaintMinimap
'
;
src/vs/workbench/contrib/codeEditor/electron-
browser
/sleepResumeRepaintMinimap.ts
→
src/vs/workbench/contrib/codeEditor/electron-
sandbox
/sleepResumeRepaintMinimap.ts
浏览文件 @
062d9393
...
...
@@ -6,7 +6,7 @@
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Extensions
as
WorkbenchExtensions
,
IWorkbenchContribution
,
IWorkbenchContributionsRegistry
}
from
'
vs/workbench/common/contributions
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
{
ipcRenderer
}
from
'
vs/base/electron-sandbox/globals
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
class
SleepResumeRepaintMinimap
implements
IWorkbenchContribution
{
...
...
@@ -14,7 +14,7 @@ class SleepResumeRepaintMinimap implements IWorkbenchContribution {
constructor
(
@
ICodeEditorService
codeEditorService
:
ICodeEditorService
)
{
ipc
.
on
(
'
vscode:osResume
'
,
()
=>
{
ipc
Renderer
.
on
(
'
vscode:osResume
'
,
()
=>
{
codeEditorService
.
listCodeEditors
().
forEach
(
editor
=>
editor
.
render
(
true
));
});
}
...
...
src/vs/workbench/contrib/files/browser/views/explorerViewer.ts
浏览文件 @
062d9393
...
...
@@ -1028,6 +1028,8 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
// Handle folder upload
else
{
// Create target folder
await
this
.
fileService
.
createFolder
(
resource
);
// Recursive upload files in this directory
...
...
src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts
浏览文件 @
062d9393
...
...
@@ -21,7 +21,7 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import
{
DialogChannel
}
from
'
vs/platform/dialogs/electron-browser/dialogIpc
'
;
import
{
DownloadServiceChannel
}
from
'
vs/platform/download/common/downloadIpc
'
;
import
{
LoggerChannel
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
{
ipcRenderer
}
from
'
vs/base/electron-sandbox/globals
'
;
import
{
IDiagnosticInfoOptions
,
IRemoteDiagnosticInfo
}
from
'
vs/platform/diagnostics/common/diagnostics
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
PersistentConnectionEventType
}
from
'
vs/platform/remote/common/remoteAgentConnection
'
;
...
...
@@ -55,7 +55,7 @@ class RemoteAgentDiagnosticListener implements IWorkbenchContribution {
@
IRemoteAgentService
remoteAgentService
:
IRemoteAgentService
,
@
ILabelService
labelService
:
ILabelService
)
{
ipc
.
on
(
'
vscode:getDiagnosticInfo
'
,
(
event
:
Event
,
request
:
{
replyChannel
:
string
,
args
:
IDiagnosticInfoOptions
}):
void
=>
{
ipc
Renderer
.
on
(
'
vscode:getDiagnosticInfo
'
,
(
event
:
unknown
,
request
:
{
replyChannel
:
string
,
args
:
IDiagnosticInfoOptions
}):
void
=>
{
const
connection
=
remoteAgentService
.
getConnection
();
if
(
connection
)
{
const
hostName
=
labelService
.
getHostLabel
(
REMOTE_HOST_SCHEME
,
connection
.
remoteAuthority
);
...
...
@@ -65,14 +65,14 @@ class RemoteAgentDiagnosticListener implements IWorkbenchContribution {
(
info
as
IRemoteDiagnosticInfo
).
hostName
=
hostName
;
}
ipc
.
send
(
request
.
replyChannel
,
info
);
ipc
Renderer
.
send
(
request
.
replyChannel
,
info
);
})
.
catch
(
e
=>
{
const
errorMessage
=
e
&&
e
.
message
?
`Fetching remote diagnostics for '
${
hostName
}
' failed:
${
e
.
message
}
`
:
`Fetching remote diagnostics for '
${
hostName
}
' failed.`
;
ipc
.
send
(
request
.
replyChannel
,
{
hostName
,
errorMessage
});
ipc
Renderer
.
send
(
request
.
replyChannel
,
{
hostName
,
errorMessage
});
});
}
else
{
ipc
.
send
(
request
.
replyChannel
);
ipc
Renderer
.
send
(
request
.
replyChannel
);
}
});
}
...
...
src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts
浏览文件 @
062d9393
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
{
ipcRenderer
}
from
'
vs/base/electron-sandbox/globals
'
;
import
{
join
}
from
'
vs/base/common/path
'
;
import
{
onDidChangeFullscreen
,
isFullscreen
}
from
'
vs/base/browser/browser
'
;
import
{
getTotalHeight
,
getTotalWidth
}
from
'
vs/base/browser/dom
'
;
...
...
@@ -112,7 +112,7 @@ class PartsSplash {
// the color needs to be in hex
const
backgroundColor
=
this
.
_themeService
.
getColorTheme
().
getColor
(
editorBackground
)
||
themes
.
WORKBENCH_BACKGROUND
(
this
.
_themeService
.
getColorTheme
());
const
payload
=
JSON
.
stringify
({
baseTheme
,
background
:
Color
.
Format
.
CSS
.
formatHex
(
backgroundColor
)
});
ipc
.
send
(
'
vscode:changeColorTheme
'
,
this
.
_envService
.
configuration
.
windowId
,
payload
);
ipc
Renderer
.
send
(
'
vscode:changeColorTheme
'
,
this
.
_envService
.
configuration
.
windowId
,
payload
);
}
}
...
...
src/vs/workbench/contrib/terminal/electron-browser/terminalNativeService.ts
浏览文件 @
062d9393
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
{
ipcRenderer
}
from
'
vs/base/electron-sandbox/globals
'
;
import
{
IOpenFileRequest
}
from
'
vs/platform/windows/common/windows
'
;
import
{
ITerminalNativeService
,
LinuxDistro
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
...
...
@@ -31,8 +31,8 @@ export class TerminalNativeService implements ITerminalNativeService {
@
IInstantiationService
readonly
instantiationService
:
IInstantiationService
,
@
IRemoteAgentService
remoteAgentService
:
IRemoteAgentService
)
{
ipc
.
on
(
'
vscode:openFiles
'
,
(
_event
:
any
,
request
:
IOpenFileRequest
)
=>
this
.
_onOpenFileRequest
.
fire
(
request
));
ipc
.
on
(
'
vscode:osResume
'
,
()
=>
this
.
_onOsResume
.
fire
());
ipc
Renderer
.
on
(
'
vscode:openFiles
'
,
(
event
:
unknown
,
request
:
IOpenFileRequest
)
=>
this
.
_onOpenFileRequest
.
fire
(
request
));
ipc
Renderer
.
on
(
'
vscode:osResume
'
,
()
=>
this
.
_onOsResume
.
fire
());
const
connection
=
remoteAgentService
.
getConnection
();
if
(
connection
&&
connection
.
remoteAuthority
)
{
...
...
src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts
浏览文件 @
062d9393
...
...
@@ -3,7 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
FindInPageOptions
,
OnBeforeRequestListenerDetails
,
OnHeadersReceivedListenerDetails
,
Response
,
WebContents
,
WebviewTag
,
ipcRenderer
}
from
'
electron
'
;
import
{
FindInPageOptions
,
OnBeforeRequestListenerDetails
,
OnHeadersReceivedListenerDetails
,
Response
,
WebContents
,
WebviewTag
}
from
'
electron
'
;
import
{
ipcRenderer
}
from
'
vs/base/electron-sandbox/globals
'
;
import
{
addDisposableListener
}
from
'
vs/base/browser/dom
'
;
import
{
ThrottledDelayer
}
from
'
vs/base/common/async
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
...
...
src/vs/workbench/electron-browser/window.ts
浏览文件 @
062d9393
...
...
@@ -22,7 +22,8 @@ import * as browser from 'vs/base/browser/browser';
import
{
ICommandService
,
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IResourceEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
KeyboardMapperFactory
}
from
'
vs/workbench/services/keybinding/electron-browser/nativeKeymapService
'
;
import
{
ipcRenderer
as
ipc
,
webFrame
,
crashReporter
,
CrashReporterStartOptions
,
Event
as
IpcEvent
}
from
'
electron
'
;
import
{
webFrame
,
crashReporter
,
CrashReporterStartOptions
}
from
'
electron
'
;
import
{
ipcRenderer
}
from
'
vs/base/electron-sandbox/globals
'
;
import
{
IWorkspaceEditingService
}
from
'
vs/workbench/services/workspaces/common/workspaceEditing
'
;
import
{
IMenuService
,
MenuId
,
IMenu
,
MenuItemAction
,
ICommandAction
,
SubmenuItemAction
,
MenuRegistry
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -127,7 +128,7 @@ export class NativeWindow extends Disposable {
});
// Support runAction event
ipc
.
on
(
'
vscode:runAction
'
,
async
(
event
:
IpcEvent
,
request
:
IRunActionInWindowRequest
)
=>
{
ipc
Renderer
.
on
(
'
vscode:runAction
'
,
async
(
event
:
unknown
,
request
:
IRunActionInWindowRequest
)
=>
{
const
args
:
unknown
[]
=
request
.
args
||
[];
// If we run an action from the touchbar, we fill in the currently active resource
...
...
@@ -158,47 +159,47 @@ export class NativeWindow extends Disposable {
});
// Support runKeybinding event
ipc
.
on
(
'
vscode:runKeybinding
'
,
(
event
:
IpcEvent
,
request
:
IRunKeybindingInWindowRequest
)
=>
{
ipc
Renderer
.
on
(
'
vscode:runKeybinding
'
,
(
event
:
unknown
,
request
:
IRunKeybindingInWindowRequest
)
=>
{
if
(
document
.
activeElement
)
{
this
.
keybindingService
.
dispatchByUserSettingsLabel
(
request
.
userSettingsLabel
,
document
.
activeElement
);
}
});
// Error reporting from main
ipc
.
on
(
'
vscode:reportError
'
,
(
event
:
IpcEvent
,
error
:
string
)
=>
{
ipc
Renderer
.
on
(
'
vscode:reportError
'
,
(
event
:
unknown
,
error
:
string
)
=>
{
if
(
error
)
{
errors
.
onUnexpectedError
(
JSON
.
parse
(
error
));
}
});
// Support openFiles event for existing and new files
ipc
.
on
(
'
vscode:openFiles
'
,
(
event
:
IpcEvent
,
request
:
IOpenFileRequest
)
=>
this
.
onOpenFiles
(
request
));
ipc
Renderer
.
on
(
'
vscode:openFiles
'
,
(
event
:
unknown
,
request
:
IOpenFileRequest
)
=>
this
.
onOpenFiles
(
request
));
// Support addFolders event if we have a workspace opened
ipc
.
on
(
'
vscode:addFolders
'
,
(
event
:
IpcEvent
,
request
:
IAddFoldersRequest
)
=>
this
.
onAddFoldersRequest
(
request
));
ipc
Renderer
.
on
(
'
vscode:addFolders
'
,
(
event
:
unknown
,
request
:
IAddFoldersRequest
)
=>
this
.
onAddFoldersRequest
(
request
));
// Message support
ipc
.
on
(
'
vscode:showInfoMessage
'
,
(
event
:
IpcEvent
,
message
:
string
)
=>
{
ipc
Renderer
.
on
(
'
vscode:showInfoMessage
'
,
(
event
:
unknown
,
message
:
string
)
=>
{
this
.
notificationService
.
info
(
message
);
});
ipc
.
on
(
'
vscode:displayChanged
'
,
(
event
:
IpcEvent
)
=>
{
ipc
Renderer
.
on
(
'
vscode:displayChanged
'
,
(
)
=>
{
clearAllFontInfos
();
});
// Fullscreen Events
ipc
.
on
(
'
vscode:enterFullScreen
'
,
async
()
=>
{
ipc
Renderer
.
on
(
'
vscode:enterFullScreen
'
,
async
()
=>
{
await
this
.
lifecycleService
.
when
(
LifecyclePhase
.
Ready
);
browser
.
setFullscreen
(
true
);
});
ipc
.
on
(
'
vscode:leaveFullScreen
'
,
async
()
=>
{
ipc
Renderer
.
on
(
'
vscode:leaveFullScreen
'
,
async
()
=>
{
await
this
.
lifecycleService
.
when
(
LifecyclePhase
.
Ready
);
browser
.
setFullscreen
(
false
);
});
// High Contrast Events
ipc
.
on
(
'
vscode:enterHighContrast
'
,
async
()
=>
{
ipc
Renderer
.
on
(
'
vscode:enterHighContrast
'
,
async
()
=>
{
const
windowConfig
=
this
.
configurationService
.
getValue
<
IWindowSettings
>
(
'
window
'
);
if
(
windowConfig
?.
autoDetectHighContrast
)
{
await
this
.
lifecycleService
.
when
(
LifecyclePhase
.
Ready
);
...
...
@@ -206,7 +207,7 @@ export class NativeWindow extends Disposable {
}
});
ipc
.
on
(
'
vscode:leaveHighContrast
'
,
async
()
=>
{
ipc
Renderer
.
on
(
'
vscode:leaveHighContrast
'
,
async
()
=>
{
const
windowConfig
=
this
.
configurationService
.
getValue
<
IWindowSettings
>
(
'
window
'
);
if
(
windowConfig
?.
autoDetectHighContrast
)
{
await
this
.
lifecycleService
.
when
(
LifecyclePhase
.
Ready
);
...
...
@@ -215,12 +216,12 @@ export class NativeWindow extends Disposable {
});
// keyboard layout changed event
ipc
.
on
(
'
vscode:keyboardLayoutChanged
'
,
()
=>
{
ipc
Renderer
.
on
(
'
vscode:keyboardLayoutChanged
'
,
()
=>
{
KeyboardMapperFactory
.
INSTANCE
.
_onKeyboardLayoutChanged
();
});
// accessibility support changed event
ipc
.
on
(
'
vscode:accessibilitySupportChanged
'
,
(
event
:
IpcEvent
,
accessibilitySupportEnabled
:
boolean
)
=>
{
ipc
Renderer
.
on
(
'
vscode:accessibilitySupportChanged
'
,
(
event
:
unknown
,
accessibilitySupportEnabled
:
boolean
)
=>
{
this
.
accessibilityService
.
setAccessibilitySupport
(
accessibilitySupportEnabled
?
AccessibilitySupport
.
Enabled
:
AccessibilitySupport
.
Disabled
);
});
...
...
@@ -399,7 +400,7 @@ export class NativeWindow extends Disposable {
this
.
setupOpenHandlers
();
// Emit event when vscode is ready
this
.
lifecycleService
.
when
(
LifecyclePhase
.
Ready
).
then
(()
=>
ipc
.
send
(
'
vscode:workbenchReady
'
,
this
.
environmentService
.
configuration
.
windowId
));
this
.
lifecycleService
.
when
(
LifecyclePhase
.
Ready
).
then
(()
=>
ipc
Renderer
.
send
(
'
vscode:workbenchReady
'
,
this
.
environmentService
.
configuration
.
windowId
));
// Integrity warning
this
.
integrityService
.
isPure
().
then
(
res
=>
this
.
titleService
.
updateProperties
({
isPure
:
res
.
isPure
}));
...
...
src/vs/workbench/services/editor/browser/editorService.ts
浏览文件 @
062d9393
...
...
@@ -63,6 +63,8 @@ export class EditorService extends Disposable implements EditorServiceImpl {
//#endregion
private
readonly
fileEditorInputFactory
=
Registry
.
as
<
IEditorInputFactoryRegistry
>
(
EditorExtensions
.
EditorInputFactories
).
getFileEditorInputFactory
();
constructor
(
@
IEditorGroupsService
private
readonly
editorGroupService
:
IEditorGroupsService
,
@
IUntitledTextEditorService
private
readonly
untitledTextEditorService
:
IUntitledTextEditorService
,
...
...
@@ -295,7 +297,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
}
private
closeOnFileDelete
:
boolean
=
false
;
private
fileEditorInputFactory
=
Registry
.
as
<
IEditorInputFactoryRegistry
>
(
EditorExtensions
.
EditorInputFactories
).
getFileEditorInputFactory
();
private
onConfigurationUpdated
(
configuration
:
IWorkbenchEditorConfiguration
):
void
{
if
(
typeof
configuration
.
workbench
?.
editor
?.
closeOnFileDelete
===
'
boolean
'
)
{
this
.
closeOnFileDelete
=
configuration
.
workbench
.
editor
.
closeOnFileDelete
;
...
...
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
浏览文件 @
062d9393
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
{
ipcRenderer
}
from
'
vs/base/electron-sandbox/globals
'
;
import
{
ExtensionHostProcessWorker
}
from
'
vs/workbench/services/extensions/electron-browser/extensionHost
'
;
import
{
CachedExtensionScanner
}
from
'
vs/workbench/services/extensions/electron-browser/cachedExtensionScanner
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
...
...
@@ -573,7 +573,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten
public
_onExtensionHostExit
(
code
:
number
):
void
{
if
(
this
.
_isExtensionDevTestFromCli
)
{
// When CLI testing make sure to exit with proper exit code
ipc
.
send
(
'
vscode:exit
'
,
code
);
ipc
Renderer
.
send
(
'
vscode:exit
'
,
code
);
}
else
{
// Expected development extension termination: When the extension host goes down we also shutdown the window
this
.
_electronService
.
closeWindow
();
...
...
src/vs/workbench/services/lifecycle/electron-browser/lifecycleService.ts
浏览文件 @
062d9393
...
...
@@ -3,17 +3,17 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
localize
}
from
'
vs/nls
'
;
import
{
toErrorMessage
}
from
'
vs/base/common/errorMessage
'
;
import
{
ShutdownReason
,
StartupKind
,
handleVetos
,
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IStorageService
,
StorageScope
,
WillSaveStateReason
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
{
ipcRenderer
}
from
'
vs/base/electron-sandbox/globals
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
AbstractLifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycleService
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
INativeWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/electron-browser/environmentService
'
;
...
...
@@ -60,7 +60,7 @@ export class NativeLifecycleService extends AbstractLifecycleService {
const
windowId
=
this
.
environmentService
.
configuration
.
windowId
;
// Main side indicates that window is about to unload, check for vetos
ipc
.
on
(
'
vscode:onBeforeUnload
'
,
(
_
event
:
unknown
,
reply
:
{
okChannel
:
string
,
cancelChannel
:
string
,
reason
:
ShutdownReason
})
=>
{
ipc
Renderer
.
on
(
'
vscode:onBeforeUnload
'
,
(
event
:
unknown
,
reply
:
{
okChannel
:
string
,
cancelChannel
:
string
,
reason
:
ShutdownReason
})
=>
{
this
.
logService
.
trace
(
`lifecycle: onBeforeUnload (reason:
${
reply
.
reason
}
)`
);
// trigger onBeforeShutdown events and veto collecting
...
...
@@ -68,18 +68,18 @@ export class NativeLifecycleService extends AbstractLifecycleService {
if
(
veto
)
{
this
.
logService
.
trace
(
'
lifecycle: onBeforeUnload prevented via veto
'
);
ipc
.
send
(
reply
.
cancelChannel
,
windowId
);
ipc
Renderer
.
send
(
reply
.
cancelChannel
,
windowId
);
}
else
{
this
.
logService
.
trace
(
'
lifecycle: onBeforeUnload continues without veto
'
);
this
.
shutdownReason
=
reply
.
reason
;
ipc
.
send
(
reply
.
okChannel
,
windowId
);
ipc
Renderer
.
send
(
reply
.
okChannel
,
windowId
);
}
});
});
// Main side indicates that we will indeed shutdown
ipc
.
on
(
'
vscode:onWillUnload
'
,
async
(
_
event
:
unknown
,
reply
:
{
replyChannel
:
string
,
reason
:
ShutdownReason
})
=>
{
ipc
Renderer
.
on
(
'
vscode:onWillUnload
'
,
async
(
event
:
unknown
,
reply
:
{
replyChannel
:
string
,
reason
:
ShutdownReason
})
=>
{
this
.
logService
.
trace
(
`lifecycle: onWillUnload (reason:
${
reply
.
reason
}
)`
);
// trigger onWillShutdown events and joining
...
...
@@ -89,7 +89,7 @@ export class NativeLifecycleService extends AbstractLifecycleService {
this
.
_onShutdown
.
fire
();
// acknowledge to main side
ipc
.
send
(
reply
.
replyChannel
,
windowId
);
ipc
Renderer
.
send
(
reply
.
replyChannel
,
windowId
);
});
// Save shutdown reason to retrieve on next startup
...
...
src/vs/workbench/workbench.sandbox.main.ts
浏览文件 @
062d9393
...
...
@@ -24,6 +24,9 @@ import 'vs/workbench/services/update/electron-sandbox/updateService';
//#region --- workbench contributions
// CodeEditor Contributions
import
'
vs/workbench/contrib/codeEditor/electron-sandbox/codeEditor.contribution
'
;
// Debug
import
'
vs/workbench/contrib/debug/electron-sandbox/extensionHostDebugService
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录