Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
01b5fe02
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 搜索 >>
提交
01b5fe02
编写于
9月 26, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - remove windowId from window service
上级
42855090
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
105 addition
and
116 deletion
+105
-116
src/vs/platform/instantiation/common/instantiationService.ts
src/vs/platform/instantiation/common/instantiationService.ts
+1
-1
src/vs/platform/ipc/electron-browser/sharedProcessService.ts
src/vs/platform/ipc/electron-browser/sharedProcessService.ts
+1
-41
src/vs/platform/windows/common/windows.ts
src/vs/platform/windows/common/windows.ts
+0
-2
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
+6
-6
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
+4
-4
src/vs/workbench/browser/web.simpleservices.ts
src/vs/workbench/browser/web.simpleservices.ts
+0
-2
src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts
...ntrib/splash/electron-browser/partsSplash.contribution.ts
+3
-5
src/vs/workbench/electron-browser/actions/windowActions.ts
src/vs/workbench/electron-browser/actions/windowActions.ts
+7
-7
src/vs/workbench/electron-browser/desktop.main.ts
src/vs/workbench/electron-browser/desktop.main.ts
+1
-1
src/vs/workbench/electron-browser/driver.ts
src/vs/workbench/electron-browser/driver.ts
+4
-4
src/vs/workbench/electron-browser/window.ts
src/vs/workbench/electron-browser/window.ts
+3
-5
src/vs/workbench/services/electron/electron-browser/electronService.ts
...nch/services/electron/electron-browser/electronService.ts
+6
-3
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
.../services/extensions/electron-browser/extensionService.ts
+1
-3
src/vs/workbench/services/lifecycle/electron-browser/lifecycleService.ts
...h/services/lifecycle/electron-browser/lifecycleService.ts
+7
-4
src/vs/workbench/services/sharedProcess/electron-browser/sharedProcessService.ts
...es/sharedProcess/electron-browser/sharedProcessService.ts
+48
-0
src/vs/workbench/services/url/electron-browser/urlService.ts
src/vs/workbench/services/url/electron-browser/urlService.ts
+4
-4
src/vs/workbench/services/window/electron-browser/windowService.ts
...rkbench/services/window/electron-browser/windowService.ts
+2
-10
src/vs/workbench/services/workspace/electron-browser/workspacesService.ts
.../services/workspace/electron-browser/workspacesService.ts
+3
-3
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+0
-2
src/vs/workbench/workbench.desktop.main.ts
src/vs/workbench/workbench.desktop.main.ts
+3
-8
src/vs/workbench/workbench.web.main.ts
src/vs/workbench/workbench.web.main.ts
+1
-1
未找到文件。
src/vs/platform/instantiation/common/instantiationService.ts
浏览文件 @
01b5fe02
...
...
@@ -206,7 +206,7 @@ export class InstantiationService implements IInstantiationService {
}
else
if
(
this
.
_parent
)
{
return
this
.
_parent
.
_createServiceInstanceWithOwner
(
id
,
ctor
,
args
,
supportsDelayedInstantiation
,
_trace
);
}
else
{
throw
new
Error
(
'
illegalState - creating UNKNOWN service instance
'
);
throw
new
Error
(
`illegalState - creating UNKNOWN service instance
${
ctor
.
name
}
`
);
}
}
...
...
src/vs/platform/ipc/electron-browser/sharedProcessService.ts
浏览文件 @
01b5fe02
...
...
@@ -4,12 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Client
}
from
'
vs/base/parts/ipc/common/ipc.net
'
;
import
{
connect
}
from
'
vs/base/parts/ipc/node/ipc.net
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IChannel
,
IServerChannel
,
getDelayedChannel
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
IMainProcessService
}
from
'
vs/platform/ipc/electron-browser/mainProcessService
'
;
import
{
IChannel
,
IServerChannel
}
from
'
vs/base/parts/ipc/common/ipc
'
;
export
const
ISharedProcessService
=
createDecorator
<
ISharedProcessService
>
(
'
sharedProcessService
'
);
...
...
@@ -23,38 +18,3 @@ export interface ISharedProcessService {
whenSharedProcessReady
():
Promise
<
void
>
;
toggleSharedProcessWindow
():
Promise
<
void
>
;
}
export
class
SharedProcessService
implements
ISharedProcessService
{
_serviceBrand
:
undefined
;
private
withSharedProcessConnection
:
Promise
<
Client
<
string
>>
;
private
sharedProcessMainChannel
:
IChannel
;
constructor
(
@
IMainProcessService
mainProcessService
:
IMainProcessService
,
@
IWindowService
windowService
:
IWindowService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
)
{
this
.
sharedProcessMainChannel
=
mainProcessService
.
getChannel
(
'
sharedProcess
'
);
this
.
withSharedProcessConnection
=
this
.
whenSharedProcessReady
()
.
then
(()
=>
connect
(
environmentService
.
sharedIPCHandle
,
`window:
${
windowService
.
windowId
}
`
));
}
whenSharedProcessReady
():
Promise
<
void
>
{
return
this
.
sharedProcessMainChannel
.
call
(
'
whenSharedProcessReady
'
);
}
getChannel
(
channelName
:
string
):
IChannel
{
return
getDelayedChannel
(
this
.
withSharedProcessConnection
.
then
(
connection
=>
connection
.
getChannel
(
channelName
)));
}
registerChannel
(
channelName
:
string
,
channel
:
IServerChannel
<
string
>
):
void
{
this
.
withSharedProcessConnection
.
then
(
connection
=>
connection
.
registerChannel
(
channelName
,
channel
));
}
toggleSharedProcessWindow
():
Promise
<
void
>
{
return
this
.
sharedProcessMainChannel
.
call
(
'
toggleSharedProcessWindow
'
);
}
}
src/vs/platform/windows/common/windows.ts
浏览文件 @
01b5fe02
...
...
@@ -97,8 +97,6 @@ export interface IWindowService {
_serviceBrand
:
undefined
;
readonly
windowId
:
number
;
getRecentlyOpened
():
Promise
<
IRecentlyOpened
>
;
addRecentlyOpened
(
recents
:
IRecent
[]):
Promise
<
void
>
;
removeFromRecentlyOpened
(
paths
:
URI
[]):
Promise
<
void
>
;
...
...
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
浏览文件 @
01b5fe02
...
...
@@ -25,7 +25,7 @@ import { IUpdateService, StateType } from 'vs/platform/update/common/update';
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IPreferencesService
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
I
EnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
I
WorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
MenuBar
}
from
'
vs/base/browser/ui/menu/menubar
'
;
import
{
SubmenuAction
,
Direction
}
from
'
vs/base/browser/ui/menu/menu
'
;
import
{
attachMenuStyler
}
from
'
vs/platform/theme/common/styler
'
;
...
...
@@ -93,7 +93,7 @@ export abstract class MenubarControl extends Disposable {
protected
readonly
storageService
:
IStorageService
,
protected
readonly
notificationService
:
INotificationService
,
protected
readonly
preferencesService
:
IPreferencesService
,
protected
readonly
environmentService
:
IEnvironmentService
,
protected
readonly
environmentService
:
I
Workbench
EnvironmentService
,
protected
readonly
accessibilityService
:
IAccessibilityService
,
protected
readonly
hostService
:
IHostService
)
{
...
...
@@ -278,7 +278,7 @@ export class CustomMenubarControl extends MenubarControl {
@
IStorageService
storageService
:
IStorageService
,
@
INotificationService
notificationService
:
INotificationService
,
@
IPreferencesService
preferencesService
:
IPreferencesService
,
@
I
EnvironmentService
environmentService
:
I
EnvironmentService
,
@
I
WorkbenchEnvironmentService
environmentService
:
IWorkbench
EnvironmentService
,
@
IAccessibilityService
accessibilityService
:
IAccessibilityService
,
@
IThemeService
private
readonly
themeService
:
IThemeService
,
@
IWorkbenchLayoutService
private
readonly
layoutService
:
IWorkbenchLayoutService
,
...
...
@@ -434,7 +434,7 @@ export class CustomMenubarControl extends MenubarControl {
return
null
;
case
StateType
.
Idle
:
const
windowId
=
this
.
windowService
.
windowId
;
const
windowId
=
this
.
environmentService
.
configuration
.
windowId
;
return
new
Action
(
'
update.check
'
,
nls
.
localize
({
key
:
'
checkForUpdates
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
Check for &&Updates...
"
),
undefined
,
true
,
()
=>
this
.
updateService
.
checkForUpdates
({
windowId
}));
...
...
@@ -643,8 +643,8 @@ export class CustomMenubarControl extends MenubarControl {
// Listen for maximize/unmaximize
if
(
!
isWeb
)
{
this
.
_register
(
Event
.
any
(
Event
.
map
(
Event
.
filter
(
this
.
electronService
.
onWindowMaximize
,
id
=>
id
===
this
.
windowService
.
windowId
),
_
=>
true
),
Event
.
map
(
Event
.
filter
(
this
.
electronService
.
onWindowUnmaximize
,
id
=>
id
===
this
.
windowService
.
windowId
),
_
=>
false
)
Event
.
map
(
Event
.
filter
(
this
.
electronService
.
onWindowMaximize
,
id
=>
id
===
this
.
environmentService
.
configuration
.
windowId
),
_
=>
true
),
Event
.
map
(
Event
.
filter
(
this
.
electronService
.
onWindowUnmaximize
,
id
=>
id
===
this
.
environmentService
.
configuration
.
windowId
),
_
=>
false
)
)(
e
=>
this
.
updateMenubar
()));
}
...
...
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
浏览文件 @
01b5fe02
...
...
@@ -8,7 +8,7 @@ import * as resources from 'vs/base/common/resources';
import
{
Part
}
from
'
vs/workbench/browser/part
'
;
import
{
ITitleService
,
ITitleProperties
}
from
'
vs/workbench/services/title/common/titleService
'
;
import
{
getZoomFactor
}
from
'
vs/base/browser/browser
'
;
import
{
IWindowService
,
MenuBarVisibility
,
getTitleBarStyl
e
}
from
'
vs/platform/windows/common/windows
'
;
import
{
MenuBarVisibility
,
getTitleBarStyle
,
IWindowServic
e
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
StandardMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
IAction
}
from
'
vs/base/common/actions
'
;
...
...
@@ -89,7 +89,6 @@ export class TitlebarPart extends Part implements ITitleService {
constructor
(
@
IContextMenuService
private
readonly
contextMenuService
:
IContextMenuService
,
@
IWindowService
private
readonly
windowService
:
IWindowService
,
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
,
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
...
...
@@ -102,6 +101,7 @@ export class TitlebarPart extends Part implements ITitleService {
@
IMenuService
menuService
:
IMenuService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IHostService
private
readonly
hostService
:
IHostService
,
@
IWindowService
windowService
:
IWindowService
,
@
optional
(
IElectronService
)
private
electronService
:
IElectronService
)
{
super
(
Parts
.
TITLEBAR_PART
,
{
hasTitle
:
false
},
themeService
,
storageService
,
layoutService
);
...
...
@@ -434,8 +434,8 @@ export class TitlebarPart extends Part implements ITitleService {
this
.
onDidChangeMaximized
(
isMaximized
);
this
.
_register
(
Event
.
any
(
Event
.
map
(
Event
.
filter
(
this
.
electronService
.
onWindowMaximize
,
id
=>
id
===
this
.
windowService
.
windowId
),
_
=>
true
),
Event
.
map
(
Event
.
filter
(
this
.
electronService
.
onWindowUnmaximize
,
id
=>
id
===
this
.
windowService
.
windowId
),
_
=>
false
)
Event
.
map
(
Event
.
filter
(
this
.
electronService
.
onWindowMaximize
,
id
=>
id
===
this
.
environmentService
.
configuration
.
windowId
),
_
=>
true
),
Event
.
map
(
Event
.
filter
(
this
.
electronService
.
onWindowUnmaximize
,
id
=>
id
===
this
.
environmentService
.
configuration
.
windowId
),
_
=>
false
)
)(
e
=>
this
.
onDidChangeMaximized
(
e
)));
}
...
...
src/vs/workbench/browser/web.simpleservices.ts
浏览文件 @
01b5fe02
...
...
@@ -20,8 +20,6 @@ export class SimpleWindowService extends Disposable implements IWindowService {
_serviceBrand
:
undefined
;
readonly
windowId
=
0
;
static
readonly
RECENTLY_OPENED_KEY
=
'
recently.opened
'
;
constructor
(
...
...
src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts
浏览文件 @
01b5fe02
...
...
@@ -18,12 +18,11 @@ import { DEFAULT_EDITOR_MIN_DIMENSIONS } from 'vs/workbench/browser/parts/editor
import
{
Extensions
,
IWorkbenchContributionsRegistry
}
from
'
vs/workbench/common/contributions
'
;
import
*
as
themes
from
'
vs/workbench/common/theme
'
;
import
{
IWorkbenchLayoutService
,
Parts
,
Position
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
I
EnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
I
WorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
*
as
perf
from
'
vs/base/common/performance
'
;
class
PartsSplash
{
...
...
@@ -40,8 +39,7 @@ class PartsSplash {
@
IThemeService
private
readonly
_themeService
:
IThemeService
,
@
IWorkbenchLayoutService
private
readonly
_layoutService
:
IWorkbenchLayoutService
,
@
ITextFileService
private
readonly
_textFileService
:
ITextFileService
,
@
IEnvironmentService
private
readonly
_envService
:
IEnvironmentService
,
@
IWindowService
private
readonly
windowService
:
IWindowService
,
@
IWorkbenchEnvironmentService
private
readonly
_envService
:
IWorkbenchEnvironmentService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IEditorGroupsService
editorGroupsService
:
IEditorGroupsService
,
@
IConfigurationService
configService
:
IConfigurationService
,
...
...
@@ -105,7 +103,7 @@ class PartsSplash {
// the color needs to be in hex
const
backgroundColor
=
this
.
_themeService
.
getTheme
().
getColor
(
editorBackground
)
||
themes
.
WORKBENCH_BACKGROUND
(
this
.
_themeService
.
getTheme
());
const
payload
=
JSON
.
stringify
({
baseTheme
,
background
:
Color
.
Format
.
CSS
.
formatHex
(
backgroundColor
)
});
ipc
.
send
(
'
vscode:changeColorTheme
'
,
this
.
windowService
.
windowId
,
payload
);
ipc
.
send
(
'
vscode:changeColorTheme
'
,
this
.
_envService
.
configuration
.
windowId
,
payload
);
}
}
...
...
src/vs/workbench/electron-browser/actions/windowActions.ts
浏览文件 @
01b5fe02
...
...
@@ -5,7 +5,7 @@
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
IW
indowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IW
orkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
browser
from
'
vs/base/browser/browser
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
...
...
@@ -167,7 +167,7 @@ export abstract class BaseSwitchWindow extends Action {
constructor
(
id
:
string
,
label
:
string
,
private
windowService
:
IWindow
Service
,
private
environmentService
:
IWorkbenchEnvironment
Service
,
private
quickInputService
:
IQuickInputService
,
private
keybindingService
:
IKeybindingService
,
private
modelService
:
IModelService
,
...
...
@@ -180,7 +180,7 @@ export abstract class BaseSwitchWindow extends Action {
protected
abstract
isQuickNavigate
():
boolean
;
async
run
():
Promise
<
void
>
{
const
currentWindowId
=
this
.
windowService
.
windowId
;
const
currentWindowId
=
this
.
environmentService
.
configuration
.
windowId
;
const
windows
=
await
this
.
electronService
.
getWindows
();
const
placeHolder
=
nls
.
localize
(
'
switchWindowPlaceHolder
'
,
"
Select a window to switch to
"
);
...
...
@@ -222,14 +222,14 @@ export class SwitchWindow extends BaseSwitchWindow {
constructor
(
id
:
string
,
label
:
string
,
@
IW
indowService
windowService
:
IWindow
Service
,
@
IW
orkbenchEnvironmentService
environmentService
:
IWorkbenchEnvironment
Service
,
@
IQuickInputService
quickInputService
:
IQuickInputService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IModelService
modelService
:
IModelService
,
@
IModeService
modeService
:
IModeService
,
@
IElectronService
electronService
:
IElectronService
)
{
super
(
id
,
label
,
window
Service
,
quickInputService
,
keybindingService
,
modelService
,
modeService
,
electronService
);
super
(
id
,
label
,
environment
Service
,
quickInputService
,
keybindingService
,
modelService
,
modeService
,
electronService
);
}
protected
isQuickNavigate
():
boolean
{
...
...
@@ -245,14 +245,14 @@ export class QuickSwitchWindow extends BaseSwitchWindow {
constructor
(
id
:
string
,
label
:
string
,
@
IW
indowService
windowService
:
IWindow
Service
,
@
IW
orkbenchEnvironmentService
environmentService
:
IWorkbenchEnvironment
Service
,
@
IQuickInputService
quickInputService
:
IQuickInputService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IModelService
modelService
:
IModelService
,
@
IModeService
modeService
:
IModeService
,
@
IElectronService
electronService
:
IElectronService
)
{
super
(
id
,
label
,
window
Service
,
quickInputService
,
keybindingService
,
modelService
,
modeService
,
electronService
);
super
(
id
,
label
,
environment
Service
,
quickInputService
,
keybindingService
,
modelService
,
modeService
,
electronService
);
}
protected
isQuickNavigate
():
boolean
{
...
...
src/vs/workbench/electron-browser/desktop.main.ts
浏览文件 @
01b5fe02
...
...
@@ -33,7 +33,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
registerWindowDriver
}
from
'
vs/
platform/driver
/electron-browser/driver
'
;
import
{
registerWindowDriver
}
from
'
vs/
workbench
/electron-browser/driver
'
;
import
{
IMainProcessService
,
MainProcessService
}
from
'
vs/platform/ipc/electron-browser/mainProcessService
'
;
import
{
RemoteAuthorityResolverService
}
from
'
vs/platform/remote/electron-browser/remoteAuthorityResolverService
'
;
import
{
IRemoteAuthorityResolverService
}
from
'
vs/platform/remote/common/remoteAuthorityResolver
'
;
...
...
src/vs/
platform/driver
/electron-browser/driver.ts
→
src/vs/
workbench
/electron-browser/driver.ts
浏览文件 @
01b5fe02
...
...
@@ -8,10 +8,10 @@ import { WindowDriverChannel, WindowDriverRegistryChannelClient } from 'vs/platf
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IMainProcessService
}
from
'
vs/platform/ipc/electron-browser/mainProcessService
'
;
import
*
as
electron
from
'
electron
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
import
{
BaseWindowDriver
}
from
'
vs/platform/driver/browser/baseDriver
'
;
import
{
IElectronService
}
from
'
vs/platform/electron/node/electron
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
class
WindowDriver
extends
BaseWindowDriver
{
...
...
@@ -49,7 +49,7 @@ class WindowDriver extends BaseWindowDriver {
export
async
function
registerWindowDriver
(
accessor
:
ServicesAccessor
):
Promise
<
IDisposable
>
{
const
instantiationService
=
accessor
.
get
(
IInstantiationService
);
const
mainProcessService
=
accessor
.
get
(
IMainProcessService
);
const
windowService
=
accessor
.
get
(
IWindow
Service
);
const
environmentService
=
accessor
.
get
(
IWorkbenchEnvironment
Service
);
const
windowDriver
=
instantiationService
.
createInstance
(
WindowDriver
);
const
windowDriverChannel
=
new
WindowDriverChannel
(
windowDriver
);
...
...
@@ -58,12 +58,12 @@ export async function registerWindowDriver(accessor: ServicesAccessor): Promise<
const
windowDriverRegistryChannel
=
mainProcessService
.
getChannel
(
'
windowDriverRegistry
'
);
const
windowDriverRegistry
=
new
WindowDriverRegistryChannelClient
(
windowDriverRegistryChannel
);
await
windowDriverRegistry
.
registerWindowDriver
(
windowService
.
windowId
);
await
windowDriverRegistry
.
registerWindowDriver
(
environmentService
.
configuration
.
windowId
);
// const options = await windowDriverRegistry.registerWindowDriver(windowId);
// if (options.verbose) {
// windowDriver.openDevTools();
// }
return
toDisposable
(()
=>
windowDriverRegistry
.
reloadWindowDriver
(
windowService
.
windowId
));
return
toDisposable
(()
=>
windowDriverRegistry
.
reloadWindowDriver
(
environmentService
.
configuration
.
windowId
));
}
src/vs/workbench/electron-browser/window.ts
浏览文件 @
01b5fe02
...
...
@@ -50,7 +50,6 @@ import { ILabelService } from 'vs/platform/label/common/label';
import
{
IUpdateService
}
from
'
vs/platform/update/common/update
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IPreferencesService
}
from
'
../services/preferences/common/preferences
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IMenubarService
,
IMenubarData
,
IMenubarMenu
,
IMenubarKeybinding
,
IMenubarMenuItemSubmenu
,
IMenubarMenuItemAction
,
MenubarMenuItem
}
from
'
vs/platform/menubar/node/menubar
'
;
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
import
{
IOpenerService
,
OpenOptions
}
from
'
vs/platform/opener/common/opener
'
;
...
...
@@ -90,7 +89,6 @@ export class ElectronWindow extends Disposable {
constructor
(
@
IEditorService
private
readonly
editorService
:
EditorServiceImpl
,
@
IWindowService
private
readonly
windowService
:
IWindowService
,
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
,
@
ITitleService
private
readonly
titleService
:
ITitleService
,
@
IWorkbenchThemeService
protected
themeService
:
IWorkbenchThemeService
,
...
...
@@ -390,7 +388,7 @@ export class ElectronWindow extends Disposable {
this
.
setupOpenHandlers
();
// Emit event when vscode is ready
this
.
lifecycleService
.
when
(
LifecyclePhase
.
Ready
).
then
(()
=>
ipc
.
send
(
'
vscode:workbenchReady
'
,
this
.
windowService
.
windowId
));
this
.
lifecycleService
.
when
(
LifecyclePhase
.
Ready
).
then
(()
=>
ipc
.
send
(
'
vscode:workbenchReady
'
,
this
.
environmentService
.
configuration
.
windowId
));
// Integrity warning
this
.
integrityService
.
isPure
().
then
(
res
=>
this
.
titleService
.
updateProperties
({
isPure
:
res
.
isPure
}));
...
...
@@ -690,7 +688,7 @@ class NativeMenubarControl extends MenubarControl {
@
IStorageService
storageService
:
IStorageService
,
@
INotificationService
notificationService
:
INotificationService
,
@
IPreferencesService
preferencesService
:
IPreferencesService
,
@
I
EnvironmentService
environmentService
:
I
EnvironmentService
,
@
I
WorkbenchEnvironmentService
environmentService
:
IWorkbench
EnvironmentService
,
@
IAccessibilityService
accessibilityService
:
IAccessibilityService
,
@
IMenubarService
private
readonly
menubarService
:
IMenubarService
,
@
IHostService
hostService
:
IHostService
...
...
@@ -738,7 +736,7 @@ class NativeMenubarControl extends MenubarControl {
// Send menus to main process to be rendered by Electron
const
menubarData
=
{
menus
:
{},
keybindings
:
{}
};
if
(
this
.
getMenubarMenus
(
menubarData
))
{
this
.
menubarService
.
updateMenubar
(
this
.
windowService
.
windowId
,
menubarData
);
this
.
menubarService
.
updateMenubar
(
this
.
environmentService
.
configuration
.
windowId
,
menubarData
);
}
}
...
...
src/vs/
platform
/electron/electron-browser/electronService.ts
→
src/vs/
workbench/services
/electron/electron-browser/electronService.ts
浏览文件 @
01b5fe02
...
...
@@ -6,7 +6,8 @@
import
{
IElectronService
}
from
'
vs/platform/electron/node/electron
'
;
import
{
IMainProcessService
}
from
'
vs/platform/ipc/electron-browser/mainProcessService
'
;
import
{
createChannelSender
}
from
'
vs/platform/ipc/node/ipcChannelCreator
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
export
class
ElectronService
{
...
...
@@ -14,8 +15,10 @@ export class ElectronService {
constructor
(
@
IMainProcessService
mainProcessService
:
IMainProcessService
,
@
IW
indowService
windowService
:
IWindow
Service
@
IW
orkbenchEnvironmentService
environmentService
:
IWorkbenchEnvironment
Service
)
{
return
createChannelSender
<
IElectronService
>
(
mainProcessService
.
getChannel
(
'
electron
'
),
{
context
:
windowService
.
windowId
});
return
createChannelSender
<
IElectronService
>
(
mainProcessService
.
getChannel
(
'
electron
'
),
{
context
:
environmentService
.
configuration
.
windowId
});
}
}
registerSingleton
(
IElectronService
,
ElectronService
,
true
);
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
浏览文件 @
01b5fe02
...
...
@@ -25,7 +25,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
ILifecycleService
,
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IHostService
}
from
'
vs/workbench/services/host/browser/host
'
;
import
{
IExtensionService
,
toExtension
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ExtensionHostProcessManager
}
from
'
vs/workbench/services/extensions/common/extensionHostProcessManager
'
;
...
...
@@ -67,7 +66,6 @@ export class ExtensionService extends AbstractExtensionService implements IExten
@
IRemoteAuthorityResolverService
private
readonly
_remoteAuthorityResolverService
:
IRemoteAuthorityResolverService
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
,
@
ILifecycleService
private
readonly
_lifecycleService
:
ILifecycleService
,
@
IWindowService
protected
readonly
_windowService
:
IWindowService
,
@
IStaticExtensionsService
private
readonly
_staticExtensions
:
IStaticExtensionsService
,
@
IElectronService
private
readonly
_electronService
:
IElectronService
,
@
IHostService
private
readonly
_hostService
:
IHostService
...
...
@@ -93,7 +91,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten
this
.
_remoteExtensionsEnvironmentData
=
new
Map
<
string
,
IRemoteAgentEnvironment
>
();
this
.
_extensionHostLogsLocation
=
URI
.
file
(
path
.
join
(
this
.
_environmentService
.
logsPath
,
`exthost
${
this
.
_
windowService
.
windowId
}
`
));
this
.
_extensionHostLogsLocation
=
URI
.
file
(
path
.
join
(
this
.
_environmentService
.
logsPath
,
`exthost
${
this
.
_
environmentService
.
configuration
.
windowId
}
`
));
this
.
_extensionScanner
=
instantiationService
.
createInstance
(
CachedExtensionScanner
);
this
.
_deltaExtensionsQueue
=
[];
...
...
src/vs/
platform
/lifecycle/electron-browser/lifecycleService.ts
→
src/vs/
workbench/services
/lifecycle/electron-browser/lifecycleService.ts
浏览文件 @
01b5fe02
...
...
@@ -4,14 +4,15 @@
*--------------------------------------------------------------------------------------------*/
import
{
toErrorMessage
}
from
'
vs/base/common/errorMessage
'
;
import
{
ShutdownReason
,
StartupKind
,
handleVetos
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
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
{
IW
indowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IW
orkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
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
'
;
export
class
LifecycleService
extends
AbstractLifecycleService
{
...
...
@@ -23,7 +24,7 @@ export class LifecycleService extends AbstractLifecycleService {
constructor
(
@
INotificationService
private
readonly
notificationService
:
INotificationService
,
@
IW
indowService
private
readonly
windowService
:
IWindow
Service
,
@
IW
orkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironment
Service
,
@
IStorageService
readonly
storageService
:
IStorageService
,
@
ILogService
readonly
logService
:
ILogService
)
{
...
...
@@ -53,7 +54,7 @@ export class LifecycleService extends AbstractLifecycleService {
}
private
registerListeners
():
void
{
const
windowId
=
this
.
windowService
.
windowId
;
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
})
=>
{
...
...
@@ -132,3 +133,5 @@ export class LifecycleService extends AbstractLifecycleService {
}
}
}
registerSingleton
(
ILifecycleService
,
LifecycleService
);
src/vs/workbench/services/sharedProcess/electron-browser/sharedProcessService.ts
0 → 100644
浏览文件 @
01b5fe02
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Client
}
from
'
vs/base/parts/ipc/common/ipc.net
'
;
import
{
connect
}
from
'
vs/base/parts/ipc/node/ipc.net
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
IChannel
,
IServerChannel
,
getDelayedChannel
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
IMainProcessService
}
from
'
vs/platform/ipc/electron-browser/mainProcessService
'
;
import
{
ISharedProcessService
}
from
'
vs/platform/ipc/electron-browser/sharedProcessService
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
export
class
SharedProcessService
implements
ISharedProcessService
{
_serviceBrand
:
undefined
;
private
withSharedProcessConnection
:
Promise
<
Client
<
string
>>
;
private
sharedProcessMainChannel
:
IChannel
;
constructor
(
@
IMainProcessService
mainProcessService
:
IMainProcessService
,
@
IWorkbenchEnvironmentService
environmentService
:
IWorkbenchEnvironmentService
)
{
this
.
sharedProcessMainChannel
=
mainProcessService
.
getChannel
(
'
sharedProcess
'
);
this
.
withSharedProcessConnection
=
this
.
whenSharedProcessReady
()
.
then
(()
=>
connect
(
environmentService
.
sharedIPCHandle
,
`window:
${
environmentService
.
configuration
.
windowId
}
`
));
}
whenSharedProcessReady
():
Promise
<
void
>
{
return
this
.
sharedProcessMainChannel
.
call
(
'
whenSharedProcessReady
'
);
}
getChannel
(
channelName
:
string
):
IChannel
{
return
getDelayedChannel
(
this
.
withSharedProcessConnection
.
then
(
connection
=>
connection
.
getChannel
(
channelName
)));
}
registerChannel
(
channelName
:
string
,
channel
:
IServerChannel
<
string
>
):
void
{
this
.
withSharedProcessConnection
.
then
(
connection
=>
connection
.
registerChannel
(
channelName
,
channel
));
}
toggleSharedProcessWindow
():
Promise
<
void
>
{
return
this
.
sharedProcessMainChannel
.
call
(
'
toggleSharedProcessWindow
'
);
}
}
registerSingleton
(
ISharedProcessService
,
SharedProcessService
,
true
);
src/vs/workbench/services/url/electron-browser/urlService.ts
浏览文件 @
01b5fe02
...
...
@@ -11,7 +11,7 @@ import { URLService } from 'vs/platform/url/node/urlService';
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
product
from
'
vs/platform/product/common/product
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IW
indowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IW
orkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
export
class
RelayURLService
extends
URLService
implements
IURLHandler
{
...
...
@@ -20,7 +20,7 @@ export class RelayURLService extends URLService implements IURLHandler {
constructor
(
@
IMainProcessService
mainProcessService
:
IMainProcessService
,
@
IOpenerService
openerService
:
IOpenerService
,
@
IW
indowService
private
windowService
:
IWindow
Service
@
IW
orkbenchEnvironmentService
private
environmentService
:
IWorkbenchEnvironment
Service
)
{
super
();
...
...
@@ -35,9 +35,9 @@ export class RelayURLService extends URLService implements IURLHandler {
let
query
=
uri
.
query
;
if
(
!
query
)
{
query
=
`windowId=
${
encodeURIComponent
(
this
.
windowService
.
windowId
)}
`
;
query
=
`windowId=
${
encodeURIComponent
(
this
.
environmentService
.
configuration
.
windowId
)}
`
;
}
else
{
query
+=
`&windowId=
${
encodeURIComponent
(
this
.
windowService
.
windowId
)}
`
;
query
+=
`&windowId=
${
encodeURIComponent
(
this
.
environmentService
.
configuration
.
windowId
)}
`
;
}
return
uri
.
with
({
query
});
...
...
src/vs/workbench/services/window/electron-browser/windowService.ts
浏览文件 @
01b5fe02
...
...
@@ -14,23 +14,15 @@ export class WindowService extends Disposable implements IWindowService {
_serviceBrand
:
undefined
;
private
_windowId
:
number
;
constructor
(
@
IWorkbenchEnvironmentService
environmentService
:
IWorkbenchEnvironmentService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
@
IWindowsService
private
readonly
windowsService
:
IWindowsService
)
{
super
();
this
.
_windowId
=
environmentService
.
configuration
.
windowId
;
}
get
windowId
():
number
{
return
this
.
_windowId
;
}
getRecentlyOpened
():
Promise
<
IRecentlyOpened
>
{
return
this
.
windowsService
.
getRecentlyOpened
(
this
.
windowId
);
return
this
.
windowsService
.
getRecentlyOpened
(
this
.
environmentService
.
configuration
.
windowId
);
}
addRecentlyOpened
(
recents
:
IRecent
[]):
Promise
<
void
>
{
...
...
src/vs/workbench/services/workspace/electron-browser/workspacesService.ts
浏览文件 @
01b5fe02
...
...
@@ -8,7 +8,7 @@ import { IWorkspacesService, IWorkspaceIdentifier, IWorkspaceFolderCreationData,
import
{
IMainProcessService
}
from
'
vs/platform/ipc/electron-browser/mainProcessService
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IW
indowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IW
orkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
export
class
WorkspacesService
implements
IWorkspacesService
{
...
...
@@ -18,13 +18,13 @@ export class WorkspacesService implements IWorkspacesService {
constructor
(
@
IMainProcessService
mainProcessService
:
IMainProcessService
,
@
IW
indowService
private
readonly
windowService
:
IWindow
Service
@
IW
orkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironment
Service
)
{
this
.
channel
=
mainProcessService
.
getChannel
(
'
workspaces
'
);
}
async
enterWorkspace
(
path
:
URI
):
Promise
<
IEnterWorkspaceResult
|
undefined
>
{
const
result
:
IEnterWorkspaceResult
=
await
this
.
channel
.
call
(
'
enterWorkspace
'
,
[
this
.
windowService
.
windowId
,
path
]);
const
result
:
IEnterWorkspaceResult
=
await
this
.
channel
.
call
(
'
enterWorkspace
'
,
[
this
.
environmentService
.
configuration
.
windowId
,
path
]);
if
(
result
)
{
result
.
workspace
=
reviveWorkspaceIdentifier
(
result
.
workspace
);
}
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
01b5fe02
...
...
@@ -1181,8 +1181,6 @@ export class TestWindowService implements IWindowService {
public
_serviceBrand
:
undefined
;
readonly
windowId
=
0
;
getRecentlyOpened
():
Promise
<
IRecentlyOpened
>
{
return
Promise
.
resolve
({
workspaces
:
[],
...
...
src/vs/workbench/workbench.desktop.main.ts
浏览文件 @
01b5fe02
...
...
@@ -53,15 +53,15 @@ import 'vs/workbench/services/workspace/electron-browser/workspacesService';
import
'
vs/workbench/services/userDataSync/electron-browser/userDataSyncService
'
;
import
'
vs/workbench/services/host/electron-browser/desktopHostService
'
;
import
'
vs/workbench/services/request/electron-browser/requestService
'
;
import
'
vs/workbench/services/lifecycle/electron-browser/lifecycleService
'
;
import
'
vs/workbench/services/sharedProcess/electron-browser/sharedProcessService
'
;
import
'
vs/workbench/services/electron/electron-browser/electronService
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
ClipboardService
}
from
'
vs/platform/clipboard/electron-browser/clipboardService
'
;
import
{
LifecycleService
}
from
'
vs/platform/lifecycle/electron-browser/lifecycleService
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
ILocalizationsService
}
from
'
vs/platform/localizations/common/localizations
'
;
import
{
LocalizationsService
}
from
'
vs/platform/localizations/electron-browser/localizationsService
'
;
import
{
ISharedProcessService
,
SharedProcessService
}
from
'
vs/platform/ipc/electron-browser/sharedProcessService
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
WindowsService
}
from
'
vs/platform/windows/electron-browser/windowsService
'
;
import
{
IUpdateService
}
from
'
vs/platform/update/common/update
'
;
...
...
@@ -70,20 +70,15 @@ import { IIssueService } from 'vs/platform/issue/node/issue';
import
{
IssueService
}
from
'
vs/platform/issue/electron-browser/issueService
'
;
import
{
IMenubarService
}
from
'
vs/platform/menubar/node/menubar
'
;
import
{
MenubarService
}
from
'
vs/platform/menubar/electron-browser/menubarService
'
;
import
{
IElectronService
}
from
'
vs/platform/electron/node/electron
'
;
import
{
ElectronService
}
from
'
vs/platform/electron/electron-browser/electronService
'
;
import
{
IWorkspaceEditingService
}
from
'
vs/workbench/services/workspace/common/workspaceEditing
'
;
import
{
NativeWorkspaceEditingService
}
from
'
vs/workbench/services/workspace/electron-browser/workspaceEditingService
'
;
registerSingleton
(
IClipboardService
,
ClipboardService
,
true
);
registerSingleton
(
ILifecycleService
,
LifecycleService
);
registerSingleton
(
ILocalizationsService
,
LocalizationsService
);
registerSingleton
(
ISharedProcessService
,
SharedProcessService
,
true
);
registerSingleton
(
IWindowsService
,
WindowsService
);
registerSingleton
(
IUpdateService
,
UpdateService
);
registerSingleton
(
IIssueService
,
IssueService
);
registerSingleton
(
IMenubarService
,
MenubarService
);
registerSingleton
(
IElectronService
,
ElectronService
,
true
);
registerSingleton
(
IWorkspaceEditingService
,
NativeWorkspaceEditingService
,
true
);
//#endregion
...
...
src/vs/workbench/workbench.web.main.ts
浏览文件 @
01b5fe02
...
...
@@ -52,13 +52,13 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
import
{
BrowserClipboardService
}
from
'
vs/platform/clipboard/browser/clipboardService
'
;
import
{
IAccessibilityService
}
from
'
vs/platform/accessibility/common/accessibility
'
;
import
{
BrowserAccessibilityService
}
from
'
vs/platform/accessibility/common/accessibilityService
'
;
import
{
IExtensionManagementService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
BrowserLifecycleService
}
from
'
vs/platform/lifecycle/browser/lifecycleService
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
ContextMenuService
}
from
'
vs/platform/contextview/browser/contextMenuService
'
;
import
{
IBackupFileService
}
from
'
vs/workbench/services/backup/common/backup
'
;
import
{
BackupFileService
}
from
'
vs/workbench/services/backup/common/backupFileService
'
;
import
{
IExtensionManagementService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
ExtensionManagementService
}
from
'
vs/workbench/services/extensionManagement/common/extensionManagementService
'
;
import
{
ITunnelService
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
NoOpTunnelService
}
from
'
vs/platform/remote/common/tunnelService
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录