Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
98bac768
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,发现更多精彩内容 >>
提交
98bac768
编写于
7月 03, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - more cleanup of window services
上级
c7253643
变更
14
显示空白变更内容
内联
并排
Showing
14 changed file
with
71 addition
and
108 deletion
+71
-108
src/vs/platform/broadcast/electron-browser/broadcastService.ts
...s/platform/broadcast/electron-browser/broadcastService.ts
+6
-38
src/vs/platform/windows/common/windows.ts
src/vs/platform/windows/common/windows.ts
+2
-0
src/vs/platform/windows/electron-browser/windowService.ts
src/vs/platform/windows/electron-browser/windowService.ts
+12
-0
src/vs/workbench/electron-browser/commands.ts
src/vs/workbench/electron-browser/commands.ts
+3
-4
src/vs/workbench/electron-browser/extensionHost.ts
src/vs/workbench/electron-browser/extensionHost.ts
+7
-7
src/vs/workbench/electron-browser/shell.ts
src/vs/workbench/electron-browser/shell.ts
+8
-10
src/vs/workbench/electron-browser/window.ts
src/vs/workbench/electron-browser/window.ts
+3
-27
src/vs/workbench/parts/debug/electron-browser/debugService.ts
...vs/workbench/parts/debug/electron-browser/debugService.ts
+6
-5
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
...kbench/parts/terminal/electron-browser/terminalService.ts
+3
-3
src/vs/workbench/services/lifecycle/electron-browser/lifecycleService.ts
...h/services/lifecycle/electron-browser/lifecycleService.ts
+3
-3
src/vs/workbench/services/message/electron-browser/messageService.ts
...bench/services/message/electron-browser/messageService.ts
+3
-3
src/vs/workbench/services/textfile/electron-browser/textFileService.ts
...nch/services/textfile/electron-browser/textFileService.ts
+4
-5
src/vs/workbench/services/themes/electron-browser/workbenchThemeService.ts
...services/themes/electron-browser/workbenchThemeService.ts
+3
-3
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+8
-0
未找到文件。
src/vs/
workbench/services/window/electron-browser/window
Service.ts
→
src/vs/
platform/broadcast/electron-browser/broadcast
Service.ts
浏览文件 @
98bac768
...
@@ -5,53 +5,33 @@
...
@@ -5,53 +5,33 @@
'
use strict
'
;
'
use strict
'
;
import
{
ElectronWindow
}
from
'
vs/workbench/electron-browser/window
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ipcRenderer
as
ipc
,
remote
}
from
'
electron
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
const
windowId
=
remote
.
getCurrentWindow
().
id
;
export
const
IBroadcastService
=
createDecorator
<
IBroadcastService
>
(
'
broadcastService
'
);
export
const
IWindowIPCService
=
createDecorator
<
IWindowIPCService
>
(
'
windowIPCService
'
);
export
interface
IWindowServices
{
windowService
?:
IWindowIPCService
;
}
export
interface
IBroadcast
{
export
interface
IBroadcast
{
channel
:
string
;
channel
:
string
;
payload
:
any
;
payload
:
any
;
}
}
export
interface
I
WindowIPC
Service
{
export
interface
I
Broadcast
Service
{
_serviceBrand
:
any
;
_serviceBrand
:
any
;
getWindowId
():
number
;
getWindow
():
ElectronWindow
;
registerWindow
(
win
:
ElectronWindow
):
void
;
broadcast
(
b
:
IBroadcast
,
target
?:
string
):
void
;
broadcast
(
b
:
IBroadcast
,
target
?:
string
):
void
;
onBroadcast
:
Event
<
IBroadcast
>
;
onBroadcast
:
Event
<
IBroadcast
>
;
}
}
/**
export
class
BroadcastService
implements
IBroadcastService
{
* TODO@Joao: remove this service
* @deprecated
*/
export
class
WindowIPCService
implements
IWindowIPCService
{
public
_serviceBrand
:
any
;
public
_serviceBrand
:
any
;
private
win
:
ElectronWindow
;
private
windowId
:
number
;
private
_onBroadcast
:
Emitter
<
IBroadcast
>
;
private
_onBroadcast
:
Emitter
<
IBroadcast
>
;
constructor
()
{
constructor
(
private
windowId
:
number
)
{
this
.
_onBroadcast
=
new
Emitter
<
IBroadcast
>
();
this
.
_onBroadcast
=
new
Emitter
<
IBroadcast
>
();
this
.
windowId
=
windowId
;
this
.
registerListeners
();
this
.
registerListeners
();
}
}
...
@@ -66,20 +46,8 @@ export class WindowIPCService implements IWindowIPCService {
...
@@ -66,20 +46,8 @@ export class WindowIPCService implements IWindowIPCService {
return
this
.
_onBroadcast
.
event
;
return
this
.
_onBroadcast
.
event
;
}
}
public
getWindowId
():
number
{
return
this
.
windowId
;
}
public
getWindow
():
ElectronWindow
{
return
this
.
win
;
}
public
registerWindow
(
win
:
ElectronWindow
):
void
{
this
.
win
=
win
;
}
public
broadcast
(
b
:
IBroadcast
,
target
?:
string
):
void
{
public
broadcast
(
b
:
IBroadcast
,
target
?:
string
):
void
{
ipc
.
send
(
'
vscode:broadcast
'
,
this
.
getWindowId
()
,
target
,
{
ipc
.
send
(
'
vscode:broadcast
'
,
this
.
windowId
,
target
,
{
channel
:
b
.
channel
,
channel
:
b
.
channel
,
payload
:
b
.
payload
payload
:
b
.
payload
});
});
...
...
src/vs/platform/windows/common/windows.ts
浏览文件 @
98bac768
...
@@ -95,6 +95,8 @@ export interface IWindowService {
...
@@ -95,6 +95,8 @@ export interface IWindowService {
maximizeWindow
():
TPromise
<
void
>
;
maximizeWindow
():
TPromise
<
void
>
;
unmaximizeWindow
():
TPromise
<
void
>
;
unmaximizeWindow
():
TPromise
<
void
>
;
onWindowTitleDoubleClick
():
TPromise
<
void
>
;
onWindowTitleDoubleClick
():
TPromise
<
void
>
;
showMessageBox
(
options
:
Electron
.
ShowMessageBoxOptions
):
number
;
showSaveDialog
(
options
:
Electron
.
SaveDialogOptions
,
callback
?:
(
fileName
:
string
)
=>
void
):
string
;
}
}
export
type
MenuBarVisibility
=
'
default
'
|
'
visible
'
|
'
toggle
'
|
'
hidden
'
;
export
type
MenuBarVisibility
=
'
default
'
|
'
visible
'
|
'
toggle
'
|
'
hidden
'
;
...
...
src/vs/platform/windows/electron-browser/windowService.ts
浏览文件 @
98bac768
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IWindowService
,
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowService
,
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
ITelemetryData
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITelemetryData
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
remote
}
from
'
electron
'
;
export
class
WindowService
implements
IWindowService
{
export
class
WindowService
implements
IWindowService
{
...
@@ -98,4 +99,15 @@ export class WindowService implements IWindowService {
...
@@ -98,4 +99,15 @@ export class WindowService implements IWindowService {
return
this
.
windowsService
.
setDocumentEdited
(
this
.
windowId
,
flag
);
return
this
.
windowsService
.
setDocumentEdited
(
this
.
windowId
,
flag
);
}
}
showMessageBox
(
options
:
Electron
.
ShowMessageBoxOptions
):
number
{
return
remote
.
dialog
.
showMessageBox
(
remote
.
getCurrentWindow
(),
options
);
}
showSaveDialog
(
options
:
Electron
.
SaveDialogOptions
,
callback
?:
(
fileName
:
string
)
=>
void
):
string
{
if
(
callback
)
{
return
remote
.
dialog
.
showSaveDialog
(
remote
.
getCurrentWindow
(),
options
,
callback
);
}
return
remote
.
dialog
.
showSaveDialog
(
remote
.
getCurrentWindow
(),
options
);
// https://github.com/electron/electron/issues/4936
}
}
}
src/vs/workbench/electron-browser/commands.ts
浏览文件 @
98bac768
...
@@ -11,9 +11,8 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
...
@@ -11,9 +11,8 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IWindowIPCService
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
{
NoEditorsVisibleContext
,
InZenModeContext
}
from
'
vs/workbench/electron-browser/workbench
'
;
import
{
NoEditorsVisibleContext
,
InZenModeContext
}
from
'
vs/workbench/electron-browser/workbench
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowsService
,
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IListService
,
ListFocusContext
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IListService
,
ListFocusContext
}
from
'
vs/platform/list/browser/listService
'
;
import
{
List
}
from
'
vs/base/browser/ui/list/listWidget
'
;
import
{
List
}
from
'
vs/base/browser/ui/list/listWidget
'
;
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
errors
=
require
(
'
vs/base/common/errors
'
);
...
@@ -366,8 +365,8 @@ export function registerCommands(): void {
...
@@ -366,8 +365,8 @@ export function registerCommands(): void {
when
:
NoEditorsVisibleContext
,
when
:
NoEditorsVisibleContext
,
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_W
,
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_W
,
handler
:
accessor
=>
{
handler
:
accessor
=>
{
const
windowService
=
accessor
.
get
(
IWindow
IPC
Service
);
const
windowService
=
accessor
.
get
(
IWindowService
);
windowService
.
getWindow
().
close
();
windowService
.
closeWindow
();
}
}
});
});
...
...
src/vs/workbench/electron-browser/extensionHost.ts
浏览文件 @
98bac768
...
@@ -19,7 +19,6 @@ import { ILifecycleService, ShutdownEvent } from 'vs/platform/lifecycle/common/l
...
@@ -19,7 +19,6 @@ import { ILifecycleService, ShutdownEvent } from 'vs/platform/lifecycle/common/l
import
{
IWindowsService
,
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowsService
,
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWindowIPCService
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
{
ChildProcess
,
fork
}
from
'
child_process
'
;
import
{
ChildProcess
,
fork
}
from
'
child_process
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
product
from
'
vs/platform/node/product
'
;
import
product
from
'
vs/platform/node/product
'
;
...
@@ -35,6 +34,7 @@ import { IInitData, IWorkspaceData } from 'vs/workbench/api/node/extHost.protoco
...
@@ -35,6 +34,7 @@ import { IInitData, IWorkspaceData } from 'vs/workbench/api/node/extHost.protoco
import
{
MainProcessExtensionService
}
from
'
vs/workbench/api/electron-browser/mainThreadExtensionService
'
;
import
{
MainProcessExtensionService
}
from
'
vs/workbench/api/electron-browser/mainThreadExtensionService
'
;
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
ICrashReporterService
}
from
'
vs/workbench/services/crashReporter/common/crashReporterService
'
;
import
{
ICrashReporterService
}
from
'
vs/workbench/services/crashReporter/common/crashReporterService
'
;
import
{
IBroadcastService
}
from
"
vs/platform/broadcast/electron-browser/broadcastService
"
;
export
const
EXTENSION_LOG_BROADCAST_CHANNEL
=
'
vscode:extensionLog
'
;
export
const
EXTENSION_LOG_BROADCAST_CHANNEL
=
'
vscode:extensionLog
'
;
export
const
EXTENSION_ATTACH_BROADCAST_CHANNEL
=
'
vscode:extensionAttach
'
;
export
const
EXTENSION_ATTACH_BROADCAST_CHANNEL
=
'
vscode:extensionAttach
'
;
...
@@ -91,7 +91,7 @@ export class ExtensionHostProcessWorker {
...
@@ -91,7 +91,7 @@ export class ExtensionHostProcessWorker {
@
IMessageService
private
messageService
:
IMessageService
,
@
IMessageService
private
messageService
:
IMessageService
,
@
IWindowsService
private
windowsService
:
IWindowsService
,
@
IWindowsService
private
windowsService
:
IWindowsService
,
@
IWindowService
private
windowService
:
IWindowService
,
@
IWindowService
private
windowService
:
IWindowService
,
@
I
WindowIPCService
private
windowIpcService
:
IWindowIPC
Service
,
@
I
BroadcastService
private
broadcastService
:
IBroadcast
Service
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
...
@@ -122,7 +122,7 @@ export class ExtensionHostProcessWorker {
...
@@ -122,7 +122,7 @@ export class ExtensionHostProcessWorker {
AMD_ENTRYPOINT
:
'
vs/workbench/node/extensionHostProcess
'
,
AMD_ENTRYPOINT
:
'
vs/workbench/node/extensionHostProcess
'
,
PIPE_LOGGING
:
'
true
'
,
PIPE_LOGGING
:
'
true
'
,
VERBOSE_LOGGING
:
true
,
VERBOSE_LOGGING
:
true
,
VSCODE_WINDOW_ID
:
String
(
this
.
window
IpcService
.
ge
tWindowId
()),
VSCODE_WINDOW_ID
:
String
(
this
.
window
Service
.
getCurren
tWindowId
()),
VSCODE_IPC_HOOK_EXTHOST
:
hook
,
VSCODE_IPC_HOOK_EXTHOST
:
hook
,
ELECTRON_NO_ASAR
:
'
1
'
ELECTRON_NO_ASAR
:
'
1
'
}),
}),
...
@@ -185,7 +185,7 @@ export class ExtensionHostProcessWorker {
...
@@ -185,7 +185,7 @@ export class ExtensionHostProcessWorker {
// Notify debugger that we are ready to attach to the process if we run a development extension
// Notify debugger that we are ready to attach to the process if we run a development extension
if
(
this
.
isExtensionDevelopmentHost
&&
port
)
{
if
(
this
.
isExtensionDevelopmentHost
&&
port
)
{
this
.
windowIpc
Service
.
broadcast
({
this
.
broadcast
Service
.
broadcast
({
channel
:
EXTENSION_ATTACH_BROADCAST_CHANNEL
,
channel
:
EXTENSION_ATTACH_BROADCAST_CHANNEL
,
payload
:
{
port
}
payload
:
{
port
}
},
this
.
environmentService
.
extensionDevelopmentPath
/* target */
);
},
this
.
environmentService
.
extensionDevelopmentPath
/* target */
);
...
@@ -327,7 +327,7 @@ export class ExtensionHostProcessWorker {
...
@@ -327,7 +327,7 @@ export class ExtensionHostProcessWorker {
// Broadcast to other windows if we are in development mode
// Broadcast to other windows if we are in development mode
else
if
(
!
this
.
environmentService
.
isBuilt
||
this
.
isExtensionDevelopmentHost
)
{
else
if
(
!
this
.
environmentService
.
isBuilt
||
this
.
isExtensionDevelopmentHost
)
{
this
.
windowIpc
Service
.
broadcast
({
this
.
broadcast
Service
.
broadcast
({
channel
:
EXTENSION_LOG_BROADCAST_CHANNEL
,
channel
:
EXTENSION_LOG_BROADCAST_CHANNEL
,
payload
:
logEntry
payload
:
logEntry
},
this
.
environmentService
.
extensionDevelopmentPath
/* target */
);
},
this
.
environmentService
.
extensionDevelopmentPath
/* target */
);
...
@@ -370,7 +370,7 @@ export class ExtensionHostProcessWorker {
...
@@ -370,7 +370,7 @@ export class ExtensionHostProcessWorker {
// Expected development extension termination: When the extension host goes down we also shutdown the window
// Expected development extension termination: When the extension host goes down we also shutdown the window
else
if
(
!
this
.
isExtensionDevelopmentTestFromCli
)
{
else
if
(
!
this
.
isExtensionDevelopmentTestFromCli
)
{
this
.
window
IpcService
.
getWindow
().
close
();
this
.
window
Service
.
closeWindow
();
}
}
// When CLI testing make sure to exit with proper exit code
// When CLI testing make sure to exit with proper exit code
...
@@ -394,7 +394,7 @@ export class ExtensionHostProcessWorker {
...
@@ -394,7 +394,7 @@ export class ExtensionHostProcessWorker {
// If the extension development host was started without debugger attached we need
// If the extension development host was started without debugger attached we need
// to communicate this back to the main side to terminate the debug session
// to communicate this back to the main side to terminate the debug session
if
(
this
.
isExtensionDevelopmentHost
&&
!
this
.
isExtensionDevelopmentTestFromCli
&&
!
this
.
isExtensionDevelopmentDebug
)
{
if
(
this
.
isExtensionDevelopmentHost
&&
!
this
.
isExtensionDevelopmentTestFromCli
&&
!
this
.
isExtensionDevelopmentDebug
)
{
this
.
windowIpc
Service
.
broadcast
({
this
.
broadcast
Service
.
broadcast
({
channel
:
EXTENSION_TERMINATE_BROADCAST_CHANNEL
,
channel
:
EXTENSION_TERMINATE_BROADCAST_CHANNEL
,
payload
:
true
payload
:
true
},
this
.
environmentService
.
extensionDevelopmentPath
/* target */
);
},
this
.
environmentService
.
extensionDevelopmentPath
/* target */
);
...
...
src/vs/workbench/electron-browser/shell.ts
浏览文件 @
98bac768
...
@@ -31,7 +31,6 @@ import { ElectronWindow } from 'vs/workbench/electron-browser/window';
...
@@ -31,7 +31,6 @@ import { ElectronWindow } from 'vs/workbench/electron-browser/window';
import
{
resolveWorkbenchCommonProperties
,
getOrCreateMachineId
}
from
'
vs/platform/telemetry/node/workbenchCommonProperties
'
;
import
{
resolveWorkbenchCommonProperties
,
getOrCreateMachineId
}
from
'
vs/platform/telemetry/node/workbenchCommonProperties
'
;
import
{
machineIdIpcChannel
}
from
'
vs/platform/telemetry/node/commonProperties
'
;
import
{
machineIdIpcChannel
}
from
'
vs/platform/telemetry/node/commonProperties
'
;
import
{
WorkspaceStats
}
from
'
vs/workbench/services/telemetry/common/workspaceStats
'
;
import
{
WorkspaceStats
}
from
'
vs/workbench/services/telemetry/common/workspaceStats
'
;
import
{
IWindowIPCService
,
WindowIPCService
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
{
IWindowsService
,
IWindowService
,
IWindowConfiguration
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowsService
,
IWindowService
,
IWindowConfiguration
}
from
'
vs/platform/windows/common/windows
'
;
import
{
WindowsChannelClient
}
from
'
vs/platform/windows/common/windowsIpc
'
;
import
{
WindowsChannelClient
}
from
'
vs/platform/windows/common/windowsIpc
'
;
import
{
WindowService
}
from
'
vs/platform/windows/electron-browser/windowService
'
;
import
{
WindowService
}
from
'
vs/platform/windows/electron-browser/windowService
'
;
...
@@ -100,6 +99,7 @@ import { registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platf
...
@@ -100,6 +99,7 @@ import { registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platf
import
{
foreground
,
selectionBackground
,
focusBorder
,
scrollbarShadow
,
scrollbarSliderActiveBackground
,
scrollbarSliderBackground
,
scrollbarSliderHoverBackground
,
listHighlightForeground
,
inputPlaceholderForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
foreground
,
selectionBackground
,
focusBorder
,
scrollbarShadow
,
scrollbarSliderActiveBackground
,
scrollbarSliderBackground
,
scrollbarSliderHoverBackground
,
listHighlightForeground
,
inputPlaceholderForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
TextMateService
}
from
'
vs/workbench/services/textMate/electron-browser/TMSyntax
'
;
import
{
TextMateService
}
from
'
vs/workbench/services/textMate/electron-browser/TMSyntax
'
;
import
{
ITextMateService
}
from
'
vs/workbench/services/textMate/electron-browser/textMateService
'
;
import
{
ITextMateService
}
from
'
vs/workbench/services/textMate/electron-browser/textMateService
'
;
import
{
IBroadcastService
,
BroadcastService
}
from
"
vs/platform/broadcast/electron-browser/broadcastService
"
;
/**
/**
* Services that we require for the Shell
* Services that we require for the Shell
...
@@ -129,7 +129,7 @@ export class WorkbenchShell {
...
@@ -129,7 +129,7 @@ export class WorkbenchShell {
private
telemetryService
:
ITelemetryService
;
private
telemetryService
:
ITelemetryService
;
private
extensionService
:
MainProcessExtensionService
;
private
extensionService
:
MainProcessExtensionService
;
private
windowsService
:
IWindowsService
;
private
windowsService
:
IWindowsService
;
private
windowIPCService
:
IWindowIPC
Service
;
private
broadcastService
:
IBroadcast
Service
;
private
timerService
:
ITimerService
;
private
timerService
:
ITimerService
;
private
themeService
:
WorkbenchThemeService
;
private
themeService
:
WorkbenchThemeService
;
private
lifecycleService
:
LifecycleService
;
private
lifecycleService
:
LifecycleService
;
...
@@ -190,8 +190,7 @@ export class WorkbenchShell {
...
@@ -190,8 +190,7 @@ export class WorkbenchShell {
});
});
// Window
// Window
const
activeWindow
=
this
.
workbench
.
getInstantiationService
().
createInstance
(
ElectronWindow
,
currentWindow
,
this
.
container
);
this
.
workbench
.
getInstantiationService
().
createInstance
(
ElectronWindow
,
currentWindow
,
this
.
container
);
this
.
windowIPCService
.
registerWindow
(
activeWindow
);
// Handle case where workbench is not starting up properly
// Handle case where workbench is not starting up properly
const
timeoutHandle
=
setTimeout
(()
=>
{
const
timeoutHandle
=
setTimeout
(()
=>
{
...
@@ -256,9 +255,8 @@ export class WorkbenchShell {
...
@@ -256,9 +255,8 @@ export class WorkbenchShell {
const
instantiationService
:
IInstantiationService
=
new
InstantiationService
(
serviceCollection
,
true
);
const
instantiationService
:
IInstantiationService
=
new
InstantiationService
(
serviceCollection
,
true
);
// TODO@joao remove this
this
.
broadcastService
=
new
BroadcastService
(
currentWindow
.
id
);
this
.
windowIPCService
=
instantiationService
.
createInstance
<
IWindowIPCService
>
(
WindowIPCService
);
serviceCollection
.
set
(
IBroadcastService
,
this
.
broadcastService
);
serviceCollection
.
set
(
IWindowIPCService
,
this
.
windowIPCService
);
const
mainProcessClient
=
new
ElectronIPCClient
(
String
(
`window
${
currentWindow
.
id
}
`
));
const
mainProcessClient
=
new
ElectronIPCClient
(
String
(
`window
${
currentWindow
.
id
}
`
));
disposables
.
push
(
mainProcessClient
);
disposables
.
push
(
mainProcessClient
);
...
@@ -267,10 +265,10 @@ export class WorkbenchShell {
...
@@ -267,10 +265,10 @@ export class WorkbenchShell {
this
.
windowsService
=
new
WindowsChannelClient
(
windowsChannel
);
this
.
windowsService
=
new
WindowsChannelClient
(
windowsChannel
);
serviceCollection
.
set
(
IWindowsService
,
this
.
windowsService
);
serviceCollection
.
set
(
IWindowsService
,
this
.
windowsService
);
serviceCollection
.
set
(
IWindowService
,
new
SyncDescriptor
(
WindowService
,
this
.
windowIPCService
.
getWindowId
()
));
serviceCollection
.
set
(
IWindowService
,
new
SyncDescriptor
(
WindowService
,
currentWindow
.
id
));
const
sharedProcess
=
this
.
windowsService
.
whenSharedProcessReady
()
const
sharedProcess
=
this
.
windowsService
.
whenSharedProcessReady
()
.
then
(()
=>
connectNet
(
this
.
environmentService
.
sharedIPCHandle
,
`window:
${
this
.
windowIPCService
.
getWindowId
()
}
`
));
.
then
(()
=>
connectNet
(
this
.
environmentService
.
sharedIPCHandle
,
`window:
${
currentWindow
.
id
}
`
));
sharedProcess
sharedProcess
.
done
(
client
=>
client
.
registerChannel
(
'
choice
'
,
instantiationService
.
createInstance
(
ChoiceChannel
)));
.
done
(
client
=>
client
.
registerChannel
(
'
choice
'
,
instantiationService
.
createInstance
(
ChoiceChannel
)));
...
@@ -385,7 +383,7 @@ export class WorkbenchShell {
...
@@ -385,7 +383,7 @@ export class WorkbenchShell {
serviceCollection
.
set
(
IUpdateService
,
new
SyncDescriptor
(
UpdateChannelClient
,
updateChannel
));
serviceCollection
.
set
(
IUpdateService
,
new
SyncDescriptor
(
UpdateChannelClient
,
updateChannel
));
const
urlChannel
=
mainProcessClient
.
getChannel
(
'
url
'
);
const
urlChannel
=
mainProcessClient
.
getChannel
(
'
url
'
);
serviceCollection
.
set
(
IURLService
,
new
SyncDescriptor
(
URLChannelClient
,
urlChannel
,
this
.
windowIPCService
.
getWindowId
()
));
serviceCollection
.
set
(
IURLService
,
new
SyncDescriptor
(
URLChannelClient
,
urlChannel
,
currentWindow
.
id
));
return
[
instantiationService
,
serviceCollection
];
return
[
instantiationService
,
serviceCollection
];
}
}
...
...
src/vs/workbench/electron-browser/window.ts
浏览文件 @
98bac768
...
@@ -29,7 +29,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
...
@@ -29,7 +29,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
IWindowsService
,
IWindowService
,
IWindowSettings
,
IWindowConfiguration
,
IPath
,
IOpenFileRequest
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowsService
,
IWindowService
,
IWindowSettings
,
IWindowConfiguration
,
IPath
,
IOpenFileRequest
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IWindowIPCService
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IConfigurationEditingService
,
ConfigurationTarget
}
from
'
vs/workbench/services/configuration/common/configurationEditing
'
;
import
{
IConfigurationEditingService
,
ConfigurationTarget
}
from
'
vs/workbench/services/configuration/common/configurationEditing
'
;
...
@@ -43,11 +42,9 @@ import { IExtensionService } from 'vs/platform/extensions/common/extensions';
...
@@ -43,11 +42,9 @@ import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import
{
KeyboardMapperFactory
}
from
'
vs/workbench/services/keybinding/electron-browser/keybindingService
'
;
import
{
KeyboardMapperFactory
}
from
'
vs/workbench/services/keybinding/electron-browser/keybindingService
'
;
import
{
Themable
,
EDITOR_DRAG_AND_DROP_BACKGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
Themable
,
EDITOR_DRAG_AND_DROP_BACKGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
remote
,
ipcRenderer
as
ipc
,
webFrame
}
from
'
electron
'
;
import
{
ipcRenderer
as
ipc
,
webFrame
}
from
'
electron
'
;
import
{
activeContrastBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
activeContrastBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
const
dialog
=
remote
.
dialog
;
const
TextInputActions
:
IAction
[]
=
[
const
TextInputActions
:
IAction
[]
=
[
new
Action
(
'
undo
'
,
nls
.
localize
(
'
undo
'
,
"
Undo
"
),
null
,
true
,
()
=>
document
.
execCommand
(
'
undo
'
)
&&
TPromise
.
as
(
true
)),
new
Action
(
'
undo
'
,
nls
.
localize
(
'
undo
'
,
"
Undo
"
),
null
,
true
,
()
=>
document
.
execCommand
(
'
undo
'
)
&&
TPromise
.
as
(
true
)),
new
Action
(
'
redo
'
,
nls
.
localize
(
'
redo
'
,
"
Redo
"
),
null
,
true
,
()
=>
document
.
execCommand
(
'
redo
'
)
&&
TPromise
.
as
(
true
)),
new
Action
(
'
redo
'
,
nls
.
localize
(
'
redo
'
,
"
Redo
"
),
null
,
true
,
()
=>
document
.
execCommand
(
'
redo
'
)
&&
TPromise
.
as
(
true
)),
...
@@ -69,7 +66,6 @@ export class ElectronWindow extends Themable {
...
@@ -69,7 +66,6 @@ export class ElectronWindow extends Themable {
constructor
(
constructor
(
win
:
Electron
.
BrowserWindow
,
win
:
Electron
.
BrowserWindow
,
shellContainer
:
HTMLElement
,
shellContainer
:
HTMLElement
,
@
IWindowIPCService
private
windowIPCService
:
IWindowIPCService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
,
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
,
@
IPartService
private
partService
:
IPartService
,
@
IPartService
private
partService
:
IPartService
,
...
@@ -143,7 +139,7 @@ export class ElectronWindow extends Themable {
...
@@ -143,7 +139,7 @@ export class ElectronWindow extends Themable {
.
on
(
DOM
.
EventType
.
DROP
,
(
e
:
DragEvent
)
=>
{
.
on
(
DOM
.
EventType
.
DROP
,
(
e
:
DragEvent
)
=>
{
DOM
.
EventHelper
.
stop
(
e
,
true
);
DOM
.
EventHelper
.
stop
(
e
,
true
);
this
.
focus
();
// make sure this window has focus so that the open call reaches the right window!
this
.
windowService
.
focusWindow
();
// make sure this window has focus so that the open call reaches the right window!
// Ask the user when opening a potential large number of folders
// Ask the user when opening a potential large number of folders
let
doOpen
=
true
;
let
doOpen
=
true
;
...
@@ -250,7 +246,7 @@ export class ElectronWindow extends Themable {
...
@@ -250,7 +246,7 @@ export class ElectronWindow extends Themable {
// Emit event when vscode has loaded
// Emit event when vscode has loaded
this
.
partService
.
joinCreation
().
then
(()
=>
{
this
.
partService
.
joinCreation
().
then
(()
=>
{
ipc
.
send
(
'
vscode:workbenchLoaded
'
,
this
.
window
IPCService
.
ge
tWindowId
());
ipc
.
send
(
'
vscode:workbenchLoaded
'
,
this
.
window
Service
.
getCurren
tWindowId
());
});
});
// Message support
// Message support
...
@@ -463,24 +459,4 @@ export class ElectronWindow extends Themable {
...
@@ -463,24 +459,4 @@ export class ElectronWindow extends Themable {
return
stat
(
resource
.
fsPath
).
then
(
stats
=>
stats
.
isDirectory
()
?
true
:
false
,
error
=>
false
);
return
stat
(
resource
.
fsPath
).
then
(
stats
=>
stats
.
isDirectory
()
?
true
:
false
,
error
=>
false
);
})).
then
(
res
=>
res
.
some
(
res
=>
!!
res
));
})).
then
(
res
=>
res
.
some
(
res
=>
!!
res
));
}
}
public
close
():
void
{
this
.
win
.
close
();
}
public
showMessageBox
(
options
:
Electron
.
ShowMessageBoxOptions
):
number
{
return
dialog
.
showMessageBox
(
this
.
win
,
options
);
}
public
showSaveDialog
(
options
:
Electron
.
SaveDialogOptions
,
callback
?:
(
fileName
:
string
)
=>
void
):
string
{
if
(
callback
)
{
return
dialog
.
showSaveDialog
(
this
.
win
,
options
,
callback
);
}
return
dialog
.
showSaveDialog
(
this
.
win
,
options
);
// https://github.com/electron/electron/issues/4936
}
public
focus
():
TPromise
<
void
>
{
return
this
.
windowService
.
focusWindow
();
}
}
}
src/vs/workbench/parts/debug/electron-browser/debugService.ts
浏览文件 @
98bac768
...
@@ -25,7 +25,7 @@ import { IExtensionService } from 'vs/platform/extensions/common/extensions';
...
@@ -25,7 +25,7 @@ import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
FileChangesEvent
,
FileChangeType
,
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
FileChangesEvent
,
FileChangeType
,
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IMessageService
,
CloseAction
}
from
'
vs/platform/message/common/message
'
;
import
{
IMessageService
,
CloseAction
}
from
'
vs/platform/message/common/message
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowsService
,
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
TelemetryService
}
from
'
vs/platform/telemetry/common/telemetryService
'
;
import
{
TelemetryService
}
from
'
vs/platform/telemetry/common/telemetryService
'
;
import
{
TelemetryAppenderClient
}
from
'
vs/platform/telemetry/common/telemetryIpc
'
;
import
{
TelemetryAppenderClient
}
from
'
vs/platform/telemetry/common/telemetryIpc
'
;
...
@@ -48,8 +48,8 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
...
@@ -48,8 +48,8 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IWindowIPCService
,
IBroadcast
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
{
ILogEntry
,
EXTENSION_LOG_BROADCAST_CHANNEL
,
EXTENSION_ATTACH_BROADCAST_CHANNEL
,
EXTENSION_TERMINATE_BROADCAST_CHANNEL
}
from
'
vs/workbench/electron-browser/extensionHost
'
;
import
{
ILogEntry
,
EXTENSION_LOG_BROADCAST_CHANNEL
,
EXTENSION_ATTACH_BROADCAST_CHANNEL
,
EXTENSION_TERMINATE_BROADCAST_CHANNEL
}
from
'
vs/workbench/electron-browser/extensionHost
'
;
import
{
IBroadcastService
,
IBroadcast
}
from
"
vs/platform/broadcast/electron-browser/broadcastService
"
;
const
DEBUG_BREAKPOINTS_KEY
=
'
debug.breakpoint
'
;
const
DEBUG_BREAKPOINTS_KEY
=
'
debug.breakpoint
'
;
const
DEBUG_BREAKPOINTS_ACTIVATED_KEY
=
'
debug.breakpointactivated
'
;
const
DEBUG_BREAKPOINTS_ACTIVATED_KEY
=
'
debug.breakpointactivated
'
;
...
@@ -91,7 +91,8 @@ export class DebugService implements debug.IDebugService {
...
@@ -91,7 +91,8 @@ export class DebugService implements debug.IDebugService {
@
IMessageService
private
messageService
:
IMessageService
,
@
IMessageService
private
messageService
:
IMessageService
,
@
IPartService
private
partService
:
IPartService
,
@
IPartService
private
partService
:
IPartService
,
@
IWindowsService
private
windowsService
:
IWindowsService
,
@
IWindowsService
private
windowsService
:
IWindowsService
,
@
IWindowIPCService
private
windowService
:
IWindowIPCService
,
@
IWindowService
private
windowService
:
IWindowService
,
@
IBroadcastService
private
broadcastService
:
IBroadcastService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
...
@@ -144,7 +145,7 @@ export class DebugService implements debug.IDebugService {
...
@@ -144,7 +145,7 @@ export class DebugService implements debug.IDebugService {
lifecycleService
.
onShutdown
(
this
.
store
,
this
);
lifecycleService
.
onShutdown
(
this
.
store
,
this
);
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
);
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
);
this
.
toDispose
.
push
(
this
.
window
Service
.
onBroadcast
(
this
.
onBroadcast
,
this
));
this
.
toDispose
.
push
(
this
.
broadcast
Service
.
onBroadcast
(
this
.
onBroadcast
,
this
));
this
.
toDispose
.
push
(
this
.
configurationService
.
onDidUpdateConfiguration
((
event
)
=>
{
this
.
toDispose
.
push
(
this
.
configurationService
.
onDidUpdateConfiguration
((
event
)
=>
{
if
(
event
.
sourceConfig
)
{
if
(
event
.
sourceConfig
)
{
const
names
=
this
.
configurationManager
.
getConfigurationNames
();
const
names
=
this
.
configurationManager
.
getConfigurationNames
();
...
@@ -276,7 +277,7 @@ export class DebugService implements debug.IDebugService {
...
@@ -276,7 +277,7 @@ export class DebugService implements debug.IDebugService {
this
.
focusStackFrameAndEvaluate
(
stackFrameToFocus
).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
focusStackFrameAndEvaluate
(
stackFrameToFocus
).
done
(
null
,
errors
.
onUnexpectedError
);
if
(
thread
.
stoppedDetails
)
{
if
(
thread
.
stoppedDetails
)
{
this
.
windowService
.
getWindow
().
focus
();
this
.
windowService
.
focusWindow
();
aria
.
alert
(
nls
.
localize
(
'
debuggingPaused
'
,
"
Debugging paused, reason {0}, {1} {2}
"
,
thread
.
stoppedDetails
.
reason
,
stackFrameToFocus
.
source
?
stackFrameToFocus
.
source
.
name
:
''
,
stackFrameToFocus
.
range
.
startLineNumber
));
aria
.
alert
(
nls
.
localize
(
'
debuggingPaused
'
,
"
Debugging paused, reason {0}, {1} {2}
"
,
thread
.
stoppedDetails
.
reason
,
stackFrameToFocus
.
source
?
stackFrameToFocus
.
source
.
name
:
''
,
stackFrameToFocus
.
range
.
startLineNumber
));
}
}
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
浏览文件 @
98bac768
...
@@ -12,7 +12,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
...
@@ -12,7 +12,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IWindowIPCService
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationEditingService
,
ConfigurationTarget
}
from
'
vs/workbench/services/configuration/common/configurationEditing
'
;
import
{
IConfigurationEditingService
,
ConfigurationTarget
}
from
'
vs/workbench/services/configuration/common/configurationEditing
'
;
import
{
IQuickOpenService
,
IPickOpenEntry
,
IPickOptions
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
{
IQuickOpenService
,
IPickOpenEntry
,
IPickOptions
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
...
@@ -26,6 +25,7 @@ import Severity from 'vs/base/common/severity';
...
@@ -26,6 +25,7 @@ import Severity from 'vs/base/common/severity';
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
TERMINAL_DEFAULT_SHELL_WINDOWS
}
from
"
vs/workbench/parts/terminal/electron-browser/terminal
"
;
import
{
TERMINAL_DEFAULT_SHELL_WINDOWS
}
from
"
vs/workbench/parts/terminal/electron-browser/terminal
"
;
import
{
TerminalPanel
}
from
"
vs/workbench/parts/terminal/electron-browser/terminalPanel
"
;
import
{
TerminalPanel
}
from
"
vs/workbench/parts/terminal/electron-browser/terminalPanel
"
;
import
{
IWindowService
}
from
"
vs/platform/windows/common/windows
"
;
export
class
TerminalService
extends
AbstractTerminalService
implements
ITerminalService
{
export
class
TerminalService
extends
AbstractTerminalService
implements
ITerminalService
{
private
_configHelper
:
TerminalConfigHelper
;
private
_configHelper
:
TerminalConfigHelper
;
...
@@ -38,7 +38,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
...
@@ -38,7 +38,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
@
IPartService
_partService
:
IPartService
,
@
IPartService
_partService
:
IPartService
,
@
ILifecycleService
_lifecycleService
:
ILifecycleService
,
@
ILifecycleService
_lifecycleService
:
ILifecycleService
,
@
IInstantiationService
private
_instantiationService
:
IInstantiationService
,
@
IInstantiationService
private
_instantiationService
:
IInstantiationService
,
@
IWindow
IPCService
private
_windowService
:
IWindowIPC
Service
,
@
IWindow
Service
private
_windowService
:
IWindow
Service
,
@
IQuickOpenService
private
_quickOpenService
:
IQuickOpenService
,
@
IQuickOpenService
private
_quickOpenService
:
IQuickOpenService
,
@
IConfigurationEditingService
private
_configurationEditingService
:
IConfigurationEditingService
,
@
IConfigurationEditingService
private
_configurationEditingService
:
IConfigurationEditingService
,
@
IChoiceService
private
_choiceService
:
IChoiceService
,
@
IChoiceService
private
_choiceService
:
IChoiceService
,
...
@@ -220,7 +220,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
...
@@ -220,7 +220,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
noLink
:
true
,
noLink
:
true
,
cancelId
cancelId
};
};
return
this
.
_windowService
.
getWindow
().
showMessageBox
(
opts
)
===
cancelId
;
return
this
.
_windowService
.
showMessageBox
(
opts
)
===
cancelId
;
}
}
public
setContainers
(
panelContainer
:
HTMLElement
,
terminalContainer
:
HTMLElement
):
void
{
public
setContainers
(
panelContainer
:
HTMLElement
,
terminalContainer
:
HTMLElement
):
void
{
...
...
src/vs/workbench/services/lifecycle/electron-browser/lifecycleService.ts
浏览文件 @
98bac768
...
@@ -10,9 +10,9 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
...
@@ -10,9 +10,9 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
import
{
ILifecycleService
,
ShutdownEvent
,
ShutdownReason
,
StartupKind
,
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
ILifecycleService
,
ShutdownEvent
,
ShutdownReason
,
StartupKind
,
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IWindowIPCService
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IWindowService
}
from
"
vs/platform/windows/common/windows
"
;
export
class
LifecycleService
implements
ILifecycleService
{
export
class
LifecycleService
implements
ILifecycleService
{
...
@@ -29,7 +29,7 @@ export class LifecycleService implements ILifecycleService {
...
@@ -29,7 +29,7 @@ export class LifecycleService implements ILifecycleService {
constructor
(
constructor
(
@
IMessageService
private
_messageService
:
IMessageService
,
@
IMessageService
private
_messageService
:
IMessageService
,
@
IWindow
IPCService
private
_windowService
:
IWindowIPC
Service
,
@
IWindow
Service
private
_windowService
:
IWindow
Service
,
@
IStorageService
private
_storageService
:
IStorageService
@
IStorageService
private
_storageService
:
IStorageService
)
{
)
{
this
.
_registerListeners
();
this
.
_registerListeners
();
...
@@ -73,7 +73,7 @@ export class LifecycleService implements ILifecycleService {
...
@@ -73,7 +73,7 @@ export class LifecycleService implements ILifecycleService {
}
}
private
_registerListeners
():
void
{
private
_registerListeners
():
void
{
const
windowId
=
this
.
_windowService
.
getWindowId
();
const
windowId
=
this
.
_windowService
.
get
Current
WindowId
();
// Main side indicates that window is about to unload, check for vetos
// Main side indicates that window is about to unload, check for vetos
ipc
.
on
(
'
vscode:beforeUnload
'
,
(
event
,
reply
:
{
okChannel
:
string
,
cancelChannel
:
string
,
reason
:
ShutdownReason
})
=>
{
ipc
.
on
(
'
vscode:beforeUnload
'
,
(
event
,
reply
:
{
okChannel
:
string
,
cancelChannel
:
string
,
reason
:
ShutdownReason
})
=>
{
...
...
src/vs/workbench/services/message/electron-browser/messageService.ts
浏览文件 @
98bac768
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
'
use strict
'
;
'
use strict
'
;
import
{
IWindowIPCService
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
nls
=
require
(
'
vs/nls
'
);
import
product
from
'
vs/platform/node/product
'
;
import
product
from
'
vs/platform/node/product
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
...
@@ -14,12 +13,13 @@ import { IConfirmation, Severity, IChoiceService } from 'vs/platform/message/com
...
@@ -14,12 +13,13 @@ import { IConfirmation, Severity, IChoiceService } from 'vs/platform/message/com
import
{
isWindows
,
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
isWindows
,
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
IWindowService
}
from
"
vs/platform/windows/common/windows
"
;
export
class
MessageService
extends
WorkbenchMessageService
implements
IChoiceService
{
export
class
MessageService
extends
WorkbenchMessageService
implements
IChoiceService
{
constructor
(
constructor
(
container
:
HTMLElement
,
container
:
HTMLElement
,
@
IWindow
IPCService
private
windowService
:
IWindowIPC
Service
,
@
IWindow
Service
private
windowService
:
IWindow
Service
,
@
ITelemetryService
telemetryService
:
ITelemetryService
@
ITelemetryService
telemetryService
:
ITelemetryService
)
{
)
{
super
(
container
,
telemetryService
);
super
(
container
,
telemetryService
);
...
@@ -98,7 +98,7 @@ export class MessageService extends WorkbenchMessageService implements IChoiceSe
...
@@ -98,7 +98,7 @@ export class MessageService extends WorkbenchMessageService implements IChoiceSe
opts
.
noLink
=
true
;
opts
.
noLink
=
true
;
opts
.
title
=
opts
.
title
||
product
.
nameLong
;
opts
.
title
=
opts
.
title
||
product
.
nameLong
;
const
result
=
this
.
windowService
.
getWindow
().
showMessageBox
(
opts
);
const
result
=
this
.
windowService
.
showMessageBox
(
opts
);
return
isLinux
?
opts
.
buttons
.
length
-
result
-
1
:
result
;
return
isLinux
?
opts
.
buttons
.
length
-
result
-
1
:
result
;
}
}
...
...
src/vs/workbench/services/textfile/electron-browser/textFileService.ts
浏览文件 @
98bac768
...
@@ -21,14 +21,13 @@ import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
...
@@ -21,14 +21,13 @@ import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IWindowIPCService
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
{
ModelBuilder
}
from
'
vs/workbench/services/textfile/electron-browser/modelBuilder
'
;
import
{
ModelBuilder
}
from
'
vs/workbench/services/textfile/electron-browser/modelBuilder
'
;
import
product
from
'
vs/platform/node/product
'
;
import
product
from
'
vs/platform/node/product
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
IBackupFileService
}
from
'
vs/workbench/services/backup/common/backup
'
;
import
{
IBackupFileService
}
from
'
vs/workbench/services/backup/common/backup
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowsService
,
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
export
class
TextFileService
extends
AbstractTextFileService
{
export
class
TextFileService
extends
AbstractTextFileService
{
...
@@ -44,7 +43,7 @@ export class TextFileService extends AbstractTextFileService {
...
@@ -44,7 +43,7 @@ export class TextFileService extends AbstractTextFileService {
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IModeService
private
modeService
:
IModeService
,
@
IModeService
private
modeService
:
IModeService
,
@
IWindow
IPCService
private
windowService
:
IWindowIPC
Service
,
@
IWindow
Service
private
windowService
:
IWindow
Service
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IMessageService
messageService
:
IMessageService
,
@
IMessageService
messageService
:
IMessageService
,
@
IBackupFileService
backupFileService
:
IBackupFileService
,
@
IBackupFileService
backupFileService
:
IBackupFileService
,
...
@@ -132,7 +131,7 @@ export class TextFileService extends AbstractTextFileService {
...
@@ -132,7 +131,7 @@ export class TextFileService extends AbstractTextFileService {
opts
.
defaultId
=
2
;
opts
.
defaultId
=
2
;
}
}
const
choice
=
this
.
windowService
.
getWindow
().
showMessageBox
(
opts
);
const
choice
=
this
.
windowService
.
showMessageBox
(
opts
);
return
buttons
[
choice
].
result
;
return
buttons
[
choice
].
result
;
}
}
...
@@ -146,7 +145,7 @@ export class TextFileService extends AbstractTextFileService {
...
@@ -146,7 +145,7 @@ export class TextFileService extends AbstractTextFileService {
}
}
public
promptForPath
(
defaultPath
?:
string
):
string
{
public
promptForPath
(
defaultPath
?:
string
):
string
{
return
this
.
windowService
.
getWindow
().
showSaveDialog
(
this
.
getSaveDialogOptions
(
defaultPath
?
paths
.
normalize
(
defaultPath
,
true
)
:
void
0
));
return
this
.
windowService
.
showSaveDialog
(
this
.
getSaveDialogOptions
(
defaultPath
?
paths
.
normalize
(
defaultPath
,
true
)
:
void
0
));
}
}
private
getSaveDialogOptions
(
defaultPath
?:
string
):
Electron
.
SaveDialogOptions
{
private
getSaveDialogOptions
(
defaultPath
?:
string
):
Electron
.
SaveDialogOptions
{
...
...
src/vs/workbench/services/themes/electron-browser/workbenchThemeService.ts
浏览文件 @
98bac768
...
@@ -14,7 +14,6 @@ import * as objects from 'vs/base/common/objects';
...
@@ -14,7 +14,6 @@ import * as objects from 'vs/base/common/objects';
import
{
IExtensionService
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IExtensionService
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
ExtensionsRegistry
,
ExtensionMessageCollector
}
from
'
vs/platform/extensions/common/extensionsRegistry
'
;
import
{
ExtensionsRegistry
,
ExtensionMessageCollector
}
from
'
vs/platform/extensions/common/extensionsRegistry
'
;
import
{
IWorkbenchThemeService
,
IColorTheme
,
IFileIconTheme
,
ExtensionData
,
IThemeExtensionPoint
,
VS_LIGHT_THEME
,
VS_DARK_THEME
,
VS_HC_THEME
,
COLOR_THEME_SETTING
,
ICON_THEME_SETTING
,
CUSTOM_COLORS_SETTING
,
DEPRECATED_CUSTOM_COLORS_SETTING
}
from
'
vs/workbench/services/themes/common/workbenchThemeService
'
;
import
{
IWorkbenchThemeService
,
IColorTheme
,
IFileIconTheme
,
ExtensionData
,
IThemeExtensionPoint
,
VS_LIGHT_THEME
,
VS_DARK_THEME
,
VS_HC_THEME
,
COLOR_THEME_SETTING
,
ICON_THEME_SETTING
,
CUSTOM_COLORS_SETTING
,
DEPRECATED_CUSTOM_COLORS_SETTING
}
from
'
vs/workbench/services/themes/common/workbenchThemeService
'
;
import
{
IWindowIPCService
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
...
@@ -40,6 +39,7 @@ import colorThemeSchema = require('vs/workbench/services/themes/common/colorThem
...
@@ -40,6 +39,7 @@ import colorThemeSchema = require('vs/workbench/services/themes/common/colorThem
import
fileIconThemeSchema
=
require
(
'
vs/workbench/services/themes/common/fileIconThemeSchema
'
);
import
fileIconThemeSchema
=
require
(
'
vs/workbench/services/themes/common/fileIconThemeSchema
'
);
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
getParseErrorMessage
}
from
'
vs/base/common/jsonErrorMessages
'
;
import
{
getParseErrorMessage
}
from
'
vs/base/common/jsonErrorMessages
'
;
import
{
IBroadcastService
}
from
"
vs/platform/broadcast/electron-browser/broadcastService
"
;
// implementation
// implementation
...
@@ -202,7 +202,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
...
@@ -202,7 +202,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
container
:
HTMLElement
,
container
:
HTMLElement
,
@
IExtensionService
private
extensionService
:
IExtensionService
,
@
IExtensionService
private
extensionService
:
IExtensionService
,
@
IStorageService
private
storageService
:
IStorageService
,
@
IStorageService
private
storageService
:
IStorageService
,
@
I
WindowIPCService
private
windowService
:
IWindowIPC
Service
,
@
I
BroadcastService
private
broadcastService
:
IBroadcast
Service
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IMessageService
private
messageService
:
IMessageService
,
@
IMessageService
private
messageService
:
IMessageService
,
...
@@ -449,7 +449,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
...
@@ -449,7 +449,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
if
(
settingsTarget
!==
ConfigurationTarget
.
WORKSPACE
)
{
if
(
settingsTarget
!==
ConfigurationTarget
.
WORKSPACE
)
{
let
background
=
newTheme
.
getColor
(
editorBackground
).
toRGBHex
();
// only take RGB, its what is used in the initial CSS
let
background
=
newTheme
.
getColor
(
editorBackground
).
toRGBHex
();
// only take RGB, its what is used in the initial CSS
let
data
=
{
id
:
newTheme
.
id
,
background
:
background
};
let
data
=
{
id
:
newTheme
.
id
,
background
:
background
};
this
.
window
Service
.
broadcast
({
channel
:
'
vscode:changeColorTheme
'
,
payload
:
JSON
.
stringify
(
data
)
});
this
.
broadcast
Service
.
broadcast
({
channel
:
'
vscode:changeColorTheme
'
,
payload
:
JSON
.
stringify
(
data
)
});
}
}
// remember theme data for a quick restore
// remember theme data for a quick restore
this
.
storageService
.
store
(
PERSISTED_THEME_STORAGE_KEY
,
newTheme
.
toStorageData
());
this
.
storageService
.
store
(
PERSISTED_THEME_STORAGE_KEY
,
newTheme
.
toStorageData
());
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
98bac768
...
@@ -912,6 +912,14 @@ export class TestWindowService implements IWindowService {
...
@@ -912,6 +912,14 @@ export class TestWindowService implements IWindowService {
onWindowTitleDoubleClick
():
TPromise
<
void
>
{
onWindowTitleDoubleClick
():
TPromise
<
void
>
{
return
TPromise
.
as
(
void
0
);
return
TPromise
.
as
(
void
0
);
}
}
showMessageBox
(
options
:
Electron
.
ShowMessageBoxOptions
):
number
{
return
0
;
}
showSaveDialog
(
options
:
Electron
.
SaveDialogOptions
,
callback
?:
(
fileName
:
string
)
=>
void
):
string
{
return
void
0
;
}
}
}
export
class
TestLifecycleService
implements
ILifecycleService
{
export
class
TestLifecycleService
implements
ILifecycleService
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录