Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
ac0ba660
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ac0ba660
编写于
11月 23, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
main - some renames of services
上级
18f4237d
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
116 addition
and
116 deletion
+116
-116
src/vs/code/electron-main/app.ts
src/vs/code/electron-main/app.ts
+10
-10
src/vs/code/electron-main/auth.ts
src/vs/code/electron-main/auth.ts
+2
-2
src/vs/code/electron-main/keyboard.ts
src/vs/code/electron-main/keyboard.ts
+7
-7
src/vs/code/electron-main/launch.ts
src/vs/code/electron-main/launch.ts
+6
-6
src/vs/code/electron-main/menus.ts
src/vs/code/electron-main/menus.ts
+45
-45
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+7
-7
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+25
-25
src/vs/platform/history/electron-main/historyMainService.ts
src/vs/platform/history/electron-main/historyMainService.ts
+7
-7
src/vs/platform/lifecycle/electron-main/lifecycleMain.ts
src/vs/platform/lifecycle/electron-main/lifecycleMain.ts
+5
-5
src/vs/platform/workspaces/common/workspacesIpc.ts
src/vs/platform/workspaces/common/workspacesIpc.ts
+2
-2
未找到文件。
src/vs/code/electron-main/app.ts
浏览文件 @
ac0ba660
...
...
@@ -74,8 +74,8 @@ export class CodeApplication {
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
,
@
IConfigurationService
configurationService
:
ConfigurationService
,
@
IStorageMainService
private
storageService
:
IStorageMainService
,
@
IHistoryMainService
private
historyService
:
IHistoryMainService
@
IStorageMainService
private
storage
Main
Service
:
IStorageMainService
,
@
IHistoryMainService
private
history
Main
Service
:
IHistoryMainService
)
{
this
.
toDispose
=
[
mainIpcServer
,
configurationService
];
...
...
@@ -194,7 +194,7 @@ export class CodeApplication {
ipc
.
on
(
machineIdIpcChannel
,
(
_event
:
any
,
machineId
:
string
)
=>
{
this
.
logService
.
log
(
'
IPC#vscode-machineId
'
);
this
.
storageService
.
setItem
(
machineIdStorageKey
,
machineId
);
this
.
storage
Main
Service
.
setItem
(
machineIdStorageKey
,
machineId
);
});
ipc
.
on
(
'
vscode:fetchShellEnv
'
,
(
_event
:
any
,
windowId
:
number
)
=>
{
...
...
@@ -238,8 +238,8 @@ export class CodeApplication {
if
(
event
===
'
vscode:changeColorTheme
'
&&
typeof
payload
===
'
string
'
)
{
let
data
=
JSON
.
parse
(
payload
);
this
.
storageService
.
setItem
(
CodeWindow
.
themeStorageKey
,
data
.
id
);
this
.
storageService
.
setItem
(
CodeWindow
.
themeBackgroundStorageKey
,
data
.
background
);
this
.
storage
Main
Service
.
setItem
(
CodeWindow
.
themeStorageKey
,
data
.
id
);
this
.
storage
Main
Service
.
setItem
(
CodeWindow
.
themeBackgroundStorageKey
,
data
.
background
);
}
}
...
...
@@ -293,7 +293,7 @@ export class CodeApplication {
const
commonProperties
=
resolveCommonProperties
(
product
.
commit
,
pkg
.
version
,
this
.
environmentService
.
installSource
)
// __GDPR__COMMON__ "common.machineId" : { "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
.
then
(
result
=>
Object
.
defineProperty
(
result
,
'
common.machineId
'
,
{
get
:
()
=>
this
.
storageService
.
getItem
(
machineIdStorageKey
),
get
:
()
=>
this
.
storage
Main
Service
.
getItem
(
machineIdStorageKey
),
enumerable
:
true
}));
const
piiPaths
=
[
this
.
environmentService
.
appRoot
,
this
.
environmentService
.
extensionsPath
];
...
...
@@ -405,8 +405,8 @@ export class CodeApplication {
appInstantiationService
.
createInstance
(
CodeMenu
);
// Jump List
this
.
historyService
.
updateWindowsJumpList
();
this
.
history
Service
.
onRecentlyOpenedChange
(()
=>
this
.
history
Service
.
updateWindowsJumpList
());
this
.
history
Main
Service
.
updateWindowsJumpList
();
this
.
history
MainService
.
onRecentlyOpenedChange
(()
=>
this
.
historyMain
Service
.
updateWindowsJumpList
());
// Start shared process here
this
.
sharedProcess
.
spawn
();
...
...
@@ -414,8 +414,8 @@ export class CodeApplication {
// Helps application icon refresh after an update with new icon is installed (macOS)
// TODO@Ben remove after a couple of releases
if
(
platform
.
isMacintosh
)
{
if
(
!
this
.
storageService
.
getItem
(
CodeApplication
.
APP_ICON_REFRESH_KEY
))
{
this
.
storageService
.
setItem
(
CodeApplication
.
APP_ICON_REFRESH_KEY
,
true
);
if
(
!
this
.
storage
Main
Service
.
getItem
(
CodeApplication
.
APP_ICON_REFRESH_KEY
))
{
this
.
storage
Main
Service
.
setItem
(
CodeApplication
.
APP_ICON_REFRESH_KEY
,
true
);
// 'exe' => /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron
const
appPath
=
dirname
(
dirname
(
dirname
(
app
.
getPath
(
'
exe
'
))));
...
...
src/vs/code/electron-main/auth.ts
浏览文件 @
ac0ba660
...
...
@@ -32,7 +32,7 @@ export class ProxyAuthHandler {
private
disposables
:
IDisposable
[]
=
[];
constructor
(
@
IWindowsMainService
private
windowsService
:
IWindowsMainService
@
IWindowsMainService
private
windows
Main
Service
:
IWindowsMainService
)
{
const
onLogin
=
fromNodeEventEmitter
<
LoginEvent
>
(
app
,
'
login
'
,
(
event
,
webContents
,
req
,
authInfo
,
cb
)
=>
({
event
,
webContents
,
req
,
authInfo
,
cb
}));
onLogin
(
this
.
onLogin
,
this
,
this
.
disposables
);
...
...
@@ -59,7 +59,7 @@ export class ProxyAuthHandler {
title
:
'
VS Code
'
};
const
focusedWindow
=
this
.
windowsService
.
getFocusedWindow
();
const
focusedWindow
=
this
.
windows
Main
Service
.
getFocusedWindow
();
if
(
focusedWindow
)
{
opts
.
parent
=
focusedWindow
.
win
;
...
...
src/vs/code/electron-main/keyboard.ts
浏览文件 @
ac0ba660
...
...
@@ -58,13 +58,13 @@ export class KeybindingsResolver {
onKeybindingsChanged
:
Event
<
void
>
=
this
.
_onKeybindingsChanged
.
event
;
constructor
(
@
IStorageMainService
private
storageService
:
IStorageMainService
,
@
IStorageMainService
private
storage
Main
Service
:
IStorageMainService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IWindowsMainService
private
windowsService
:
IWindowsMainService
,
@
IWindowsMainService
private
windows
Main
Service
:
IWindowsMainService
,
@
ILogService
private
logService
:
ILogService
)
{
this
.
commandIds
=
new
Set
<
string
>
();
this
.
keybindings
=
this
.
storageService
.
getItem
<
{
[
id
:
string
]:
string
;
}
>
(
KeybindingsResolver
.
lastKnownKeybindingsMapStorageKey
)
||
Object
.
create
(
null
);
this
.
keybindings
=
this
.
storage
Main
Service
.
getItem
<
{
[
id
:
string
]:
string
;
}
>
(
KeybindingsResolver
.
lastKnownKeybindingsMapStorageKey
)
||
Object
.
create
(
null
);
this
.
keybindingsWatcher
=
new
ConfigWatcher
<
IUserFriendlyKeybinding
[]
>
(
environmentService
.
appKeybindingsPath
,
{
changeBufferDelay
:
100
,
onError
:
error
=>
this
.
logService
.
error
(
error
)
});
this
.
registerListeners
();
...
...
@@ -102,24 +102,24 @@ export class KeybindingsResolver {
if
(
keybindingsChanged
)
{
this
.
keybindings
=
resolvedKeybindings
;
this
.
storageService
.
setItem
(
KeybindingsResolver
.
lastKnownKeybindingsMapStorageKey
,
this
.
keybindings
);
// keep to restore instantly after restart
this
.
storage
Main
Service
.
setItem
(
KeybindingsResolver
.
lastKnownKeybindingsMapStorageKey
,
this
.
keybindings
);
// keep to restore instantly after restart
this
.
_onKeybindingsChanged
.
fire
();
}
});
// Resolve keybindings when any first window is loaded
const
onceOnWindowReady
=
once
(
this
.
windowsService
.
onWindowReady
);
const
onceOnWindowReady
=
once
(
this
.
windows
Main
Service
.
onWindowReady
);
onceOnWindowReady
(
win
=>
this
.
resolveKeybindings
(
win
));
// Resolve keybindings again when keybindings.json changes
this
.
keybindingsWatcher
.
onDidUpdateConfiguration
(()
=>
this
.
resolveKeybindings
());
// Resolve keybindings when window reloads because an installed extension could have an impact
this
.
windowsService
.
onWindowReload
(()
=>
this
.
resolveKeybindings
());
this
.
windows
Main
Service
.
onWindowReload
(()
=>
this
.
resolveKeybindings
());
}
private
resolveKeybindings
(
win
=
this
.
windowsService
.
getLastActiveWindow
()):
void
{
private
resolveKeybindings
(
win
=
this
.
windows
Main
Service
.
getLastActiveWindow
()):
void
{
if
(
this
.
commandIds
.
size
&&
win
)
{
const
commandIds
:
string
[]
=
[];
this
.
commandIds
.
forEach
(
id
=>
commandIds
.
push
(
id
));
...
...
src/vs/code/electron-main/launch.ts
浏览文件 @
ac0ba660
...
...
@@ -75,7 +75,7 @@ export class LaunchService implements ILaunchService {
constructor
(
@
ILogService
private
logService
:
ILogService
,
@
IWindowsMainService
private
windowsService
:
IWindowsMainService
,
@
IWindowsMainService
private
windows
Main
Service
:
IWindowsMainService
,
@
IURLService
private
urlService
:
IURLService
)
{
}
...
...
@@ -95,13 +95,13 @@ export class LaunchService implements ILaunchService {
const
context
=
!!
userEnv
[
'
VSCODE_CLI
'
]
?
OpenContext
.
CLI
:
OpenContext
.
DESKTOP
;
let
usedWindows
:
ICodeWindow
[];
if
(
!!
args
.
extensionDevelopmentPath
)
{
this
.
windowsService
.
openExtensionDevelopmentHostWindow
({
context
,
cli
:
args
,
userEnv
});
this
.
windows
Main
Service
.
openExtensionDevelopmentHostWindow
({
context
,
cli
:
args
,
userEnv
});
}
else
if
(
args
.
_
.
length
===
0
&&
(
args
[
'
new-window
'
]
||
args
[
'
unity-launch
'
]))
{
usedWindows
=
this
.
windowsService
.
open
({
context
,
cli
:
args
,
userEnv
,
forceNewWindow
:
true
,
forceEmpty
:
true
});
usedWindows
=
this
.
windows
Main
Service
.
open
({
context
,
cli
:
args
,
userEnv
,
forceNewWindow
:
true
,
forceEmpty
:
true
});
}
else
if
(
args
.
_
.
length
===
0
)
{
usedWindows
=
[
this
.
windowsService
.
focusLastActive
(
args
,
context
)];
usedWindows
=
[
this
.
windows
Main
Service
.
focusLastActive
(
args
,
context
)];
}
else
{
usedWindows
=
this
.
windowsService
.
open
({
usedWindows
=
this
.
windows
Main
Service
.
open
({
context
,
cli
:
args
,
userEnv
,
...
...
@@ -118,7 +118,7 @@ export class LaunchService implements ILaunchService {
// In addition, we poll for the wait marker file to be deleted to return.
if
(
args
.
wait
&&
usedWindows
.
length
===
1
&&
usedWindows
[
0
])
{
return
TPromise
.
any
([
this
.
windowsService
.
waitForWindowCloseOrLoad
(
usedWindows
[
0
].
id
),
this
.
windows
Main
Service
.
waitForWindowCloseOrLoad
(
usedWindows
[
0
].
id
),
whenDeleted
(
args
.
waitMarkerFilePath
)
]).
then
(()
=>
void
0
,
()
=>
void
0
);
}
...
...
src/vs/code/electron-main/menus.ts
浏览文件 @
ac0ba660
此差异已折叠。
点击以展开。
src/vs/code/electron-main/window.ts
浏览文件 @
ac0ba660
...
...
@@ -104,9 +104,9 @@ export class CodeWindow implements ICodeWindow {
@
ILogService
private
logService
:
ILogService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IStorageMainService
private
storageService
:
IStorageMainService
,
@
IWorkspacesMainService
private
workspaceService
:
IWorkspacesMainService
,
@
IBackupMainService
private
backupService
:
IBackupMainService
@
IStorageMainService
private
storage
Main
Service
:
IStorageMainService
,
@
IWorkspacesMainService
private
workspace
sMain
Service
:
IWorkspacesMainService
,
@
IBackupMainService
private
backup
Main
Service
:
IBackupMainService
)
{
this
.
touchBarGroups
=
[];
this
.
_lastFocusTime
=
-
1
;
...
...
@@ -429,7 +429,7 @@ export class CodeWindow implements ICodeWindow {
this
.
toDispose
.
push
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
()));
// Handle Workspace events
this
.
toDispose
.
push
(
this
.
workspaceService
.
onUntitledWorkspaceDeleted
(
e
=>
this
.
onUntitledWorkspaceDeleted
(
e
)));
this
.
toDispose
.
push
(
this
.
workspace
sMain
Service
.
onUntitledWorkspaceDeleted
(
e
=>
this
.
onUntitledWorkspaceDeleted
(
e
)));
}
private
onUntitledWorkspaceDeleted
(
workspace
:
IWorkspaceIdentifier
):
void
{
...
...
@@ -492,7 +492,7 @@ export class CodeWindow implements ICodeWindow {
// Clear Document Edited if needed
if
(
isMacintosh
&&
this
.
_win
.
isDocumentEdited
())
{
if
(
!
isReload
||
!
this
.
backupService
.
isHotExitEnabled
())
{
if
(
!
isReload
||
!
this
.
backup
Main
Service
.
isHotExitEnabled
())
{
this
.
_win
.
setDocumentEdited
(
false
);
}
}
...
...
@@ -595,7 +595,7 @@ export class CodeWindow implements ICodeWindow {
return
'
hc-black
'
;
}
const
theme
=
this
.
storageService
.
getItem
<
string
>
(
CodeWindow
.
themeStorageKey
,
'
vs-dark
'
);
const
theme
=
this
.
storage
Main
Service
.
getItem
<
string
>
(
CodeWindow
.
themeStorageKey
,
'
vs-dark
'
);
return
theme
.
split
(
'
'
)[
0
];
}
...
...
@@ -605,7 +605,7 @@ export class CodeWindow implements ICodeWindow {
return
CodeWindow
.
DEFAULT_BG_HC_BLACK
;
}
const
background
=
this
.
storageService
.
getItem
<
string
>
(
CodeWindow
.
themeBackgroundStorageKey
,
null
);
const
background
=
this
.
storage
Main
Service
.
getItem
<
string
>
(
CodeWindow
.
themeBackgroundStorageKey
,
null
);
if
(
!
background
)
{
const
baseTheme
=
this
.
getBaseTheme
();
...
...
src/vs/code/electron-main/windows.ts
浏览文件 @
ac0ba660
...
...
@@ -139,20 +139,20 @@ export class WindowsManager implements IWindowsMainService {
constructor
(
@
ILogService
private
logService
:
ILogService
,
@
IStorageMainService
private
storageService
:
IStorageMainService
,
@
IStorageMainService
private
storage
Main
Service
:
IStorageMainService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
,
@
IBackupMainService
private
backupService
:
IBackupMainService
,
@
IBackupMainService
private
backup
Main
Service
:
IBackupMainService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IHistoryMainService
private
historyService
:
IHistoryMainService
,
@
IWorkspacesMainService
private
workspacesService
:
IWorkspacesMainService
,
@
IHistoryMainService
private
history
Main
Service
:
IHistoryMainService
,
@
IWorkspacesMainService
private
workspaces
Main
Service
:
IWorkspacesMainService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
this
.
windowsState
=
this
.
storageService
.
getItem
<
IWindowsState
>
(
WindowsManager
.
windowsStateStorageKey
)
||
{
openedWindows
:
[]
};
this
.
windowsState
=
this
.
storage
Main
Service
.
getItem
<
IWindowsState
>
(
WindowsManager
.
windowsStateStorageKey
)
||
{
openedWindows
:
[]
};
this
.
fileDialog
=
new
FileDialog
(
environmentService
,
telemetryService
,
storageService
,
this
);
this
.
workspacesManager
=
new
WorkspacesManager
(
workspaces
Service
,
backup
Service
,
environmentService
,
this
);
this
.
fileDialog
=
new
FileDialog
(
environmentService
,
telemetryService
,
storage
Main
Service
,
this
);
this
.
workspacesManager
=
new
WorkspacesManager
(
workspaces
MainService
,
backupMain
Service
,
environmentService
,
this
);
this
.
migrateLegacyWindowState
();
}
...
...
@@ -310,7 +310,7 @@ export class WindowsManager implements IWindowsMainService {
}
// Persist
this
.
storageService
.
setItem
(
WindowsManager
.
windowsStateStorageKey
,
currentWindowsState
);
this
.
storage
Main
Service
.
setItem
(
WindowsManager
.
windowsStateStorageKey
,
currentWindowsState
);
}
// See note on #onBeforeQuit() for details how these events are flowing
...
...
@@ -403,12 +403,12 @@ export class WindowsManager implements IWindowsMainService {
let
workspacesToRestore
:
IWorkspaceIdentifier
[]
=
[];
let
emptyToRestore
:
string
[]
=
[];
if
(
openConfig
.
initialStartup
&&
!
openConfig
.
cli
.
extensionDevelopmentPath
)
{
foldersToRestore
=
this
.
backupService
.
getFolderBackupPaths
();
foldersToRestore
=
this
.
backup
Main
Service
.
getFolderBackupPaths
();
workspacesToRestore
=
this
.
backupService
.
getWorkspaceBackups
();
// collect from workspaces with hot-exit backups
workspacesToRestore
.
push
(...
this
.
workspacesService
.
getUntitledWorkspacesSync
());
// collect from previous window session
workspacesToRestore
=
this
.
backup
Main
Service
.
getWorkspaceBackups
();
// collect from workspaces with hot-exit backups
workspacesToRestore
.
push
(...
this
.
workspaces
Main
Service
.
getUntitledWorkspacesSync
());
// collect from previous window session
emptyToRestore
=
this
.
backupService
.
getEmptyWindowBackupPaths
();
emptyToRestore
=
this
.
backup
Main
Service
.
getEmptyWindowBackupPaths
();
emptyToRestore
.
push
(...
pathsToOpen
.
filter
(
w
=>
!
w
.
workspace
&&
!
w
.
folderPath
&&
w
.
backupPath
).
map
(
w
=>
basename
(
w
.
backupPath
)));
// add empty windows with backupPath
emptyToRestore
=
arrays
.
distinct
(
emptyToRestore
);
// prevent duplicates
}
...
...
@@ -475,7 +475,7 @@ export class WindowsManager implements IWindowsMainService {
}
});
this
.
historyService
.
addRecentlyOpened
(
recentlyOpenedWorkspaces
,
recentlyOpenedFiles
);
this
.
history
Main
Service
.
addRecentlyOpened
(
recentlyOpenedWorkspaces
,
recentlyOpenedFiles
);
}
// If we got started with --wait from the CLI, we need to signal to the outside when the window
...
...
@@ -541,7 +541,7 @@ export class WindowsManager implements IWindowsMainService {
context
:
openConfig
.
context
,
filePath
:
fileToCheck
&&
fileToCheck
.
filePath
,
userHome
:
this
.
environmentService
.
userHome
,
workspaceResolver
:
workspace
=>
this
.
workspacesService
.
resolveWorkspaceSync
(
workspace
.
configPath
)
workspaceResolver
:
workspace
=>
this
.
workspaces
Main
Service
.
resolveWorkspaceSync
(
workspace
.
configPath
)
});
// Special case: we started with --wait and we got back a folder to open. In this case
...
...
@@ -796,7 +796,7 @@ export class WindowsManager implements IWindowsMainService {
if
(
!
openConfig
.
addMode
&&
isCommandLineOrAPICall
)
{
const
foldersToOpen
=
windowsToOpen
.
filter
(
path
=>
!!
path
.
folderPath
);
if
(
foldersToOpen
.
length
>
1
)
{
const
workspace
=
this
.
workspacesService
.
createWorkspaceSync
(
foldersToOpen
.
map
(
folder
=>
({
uri
:
URI
.
file
(
folder
.
folderPath
)
})));
const
workspace
=
this
.
workspaces
Main
Service
.
createWorkspaceSync
(
foldersToOpen
.
map
(
folder
=>
({
uri
:
URI
.
file
(
folder
.
folderPath
)
})));
// Add workspace and remove folders thereby
windowsToOpen
.
push
({
workspace
});
...
...
@@ -970,7 +970,7 @@ export class WindowsManager implements IWindowsMainService {
// Workspace (unless disabled via flag)
if
(
!
options
||
!
options
.
forceOpenWorkspaceAsFile
)
{
const
workspace
=
this
.
workspacesService
.
resolveWorkspaceSync
(
candidate
);
const
workspace
=
this
.
workspaces
Main
Service
.
resolveWorkspaceSync
(
candidate
);
if
(
workspace
)
{
return
{
workspace
:
{
id
:
workspace
.
id
,
configPath
:
workspace
.
configPath
}
};
}
...
...
@@ -990,7 +990,7 @@ export class WindowsManager implements IWindowsMainService {
};
}
}
catch
(
error
)
{
this
.
historyService
.
removeFromRecentlyOpened
([
candidate
]);
// since file does not seem to exist anymore, remove from recent
this
.
history
Main
Service
.
removeFromRecentlyOpened
([
candidate
]);
// since file does not seem to exist anymore, remove from recent
if
(
options
&&
options
.
ignoreFileNotFound
)
{
return
{
filePath
:
candidate
,
createFilePath
:
true
};
// assume this is a file that does not yet exist
...
...
@@ -1158,11 +1158,11 @@ export class WindowsManager implements IWindowsMainService {
// Register window for backups
if
(
!
configuration
.
extensionDevelopmentPath
)
{
if
(
configuration
.
workspace
)
{
configuration
.
backupPath
=
this
.
backupService
.
registerWorkspaceBackupSync
(
configuration
.
workspace
);
configuration
.
backupPath
=
this
.
backup
Main
Service
.
registerWorkspaceBackupSync
(
configuration
.
workspace
);
}
else
if
(
configuration
.
folderPath
)
{
configuration
.
backupPath
=
this
.
backupService
.
registerFolderBackupSync
(
configuration
.
folderPath
);
configuration
.
backupPath
=
this
.
backup
Main
Service
.
registerFolderBackupSync
(
configuration
.
folderPath
);
}
else
{
configuration
.
backupPath
=
this
.
backupService
.
registerEmptyWindowBackupSync
(
options
.
emptyWindowBackupFolder
);
configuration
.
backupPath
=
this
.
backup
Main
Service
.
registerEmptyWindowBackupSync
(
options
.
emptyWindowBackupFolder
);
}
}
...
...
@@ -1332,7 +1332,7 @@ export class WindowsManager implements IWindowsMainService {
private
doEnterWorkspace
(
win
:
CodeWindow
,
result
:
IEnterWorkspaceResult
):
IEnterWorkspaceResult
{
// Mark as recently opened
this
.
historyService
.
addRecentlyOpened
([
result
.
workspace
],
[]);
this
.
history
Main
Service
.
addRecentlyOpened
([
result
.
workspace
],
[]);
// Trigger Eevent to indicate load of workspace into window
this
.
_onWindowReady
.
fire
(
win
);
...
...
@@ -1352,7 +1352,7 @@ export class WindowsManager implements IWindowsMainService {
}
const
workspace
=
e
.
window
.
openedWorkspace
;
if
(
!
workspace
||
!
this
.
workspacesService
.
isUntitledWorkspace
(
workspace
))
{
if
(
!
workspace
||
!
this
.
workspaces
Main
Service
.
isUntitledWorkspace
(
workspace
))
{
return
;
// only care about untitled workspaces to ask for saving
}
...
...
@@ -1587,7 +1587,7 @@ class FileDialog {
constructor
(
private
environmentService
:
IEnvironmentService
,
private
telemetryService
:
ITelemetryService
,
private
storageService
:
IStorageMainService
,
private
storage
Main
Service
:
IStorageMainService
,
private
windowsMainService
:
IWindowsMainService
)
{
}
...
...
@@ -1628,7 +1628,7 @@ class FileDialog {
// Ensure defaultPath
if
(
!
options
.
dialogOptions
.
defaultPath
)
{
options
.
dialogOptions
.
defaultPath
=
this
.
storageService
.
getItem
<
string
>
(
FileDialog
.
workingDirPickerStorageKey
);
options
.
dialogOptions
.
defaultPath
=
this
.
storage
Main
Service
.
getItem
<
string
>
(
FileDialog
.
workingDirPickerStorageKey
);
}
// Ensure properties
...
...
@@ -1657,7 +1657,7 @@ class FileDialog {
}
// Remember path in storage for next time
this
.
storageService
.
setItem
(
FileDialog
.
workingDirPickerStorageKey
,
dirname
(
paths
[
0
]));
this
.
storage
Main
Service
.
setItem
(
FileDialog
.
workingDirPickerStorageKey
,
dirname
(
paths
[
0
]));
// Return
return
clb
(
paths
);
...
...
src/vs/platform/history/electron-main/historyMainService.ts
浏览文件 @
ac0ba660
...
...
@@ -41,9 +41,9 @@ export class HistoryMainService implements IHistoryMainService {
private
macOSRecentDocumentsUpdater
:
RunOnceScheduler
;
constructor
(
@
IStorageMainService
private
storageService
:
IStorageMainService
,
@
IStorageMainService
private
storage
Main
Service
:
IStorageMainService
,
@
ILogService
private
logService
:
ILogService
,
@
IWorkspacesMainService
private
workspacesService
:
IWorkspacesMainService
,
@
IWorkspacesMainService
private
workspaces
Main
Service
:
IWorkspacesMainService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
)
{
this
.
macOSRecentDocumentsUpdater
=
new
RunOnceScheduler
(()
=>
this
.
updateMacOSRecentDocuments
(),
800
);
...
...
@@ -52,7 +52,7 @@ export class HistoryMainService implements IHistoryMainService {
}
private
registerListeners
():
void
{
this
.
workspacesService
.
onWorkspaceSaved
(
e
=>
this
.
onWorkspaceSaved
(
e
));
this
.
workspaces
Main
Service
.
onWorkspaceSaved
(
e
=>
this
.
onWorkspaceSaved
(
e
));
}
private
onWorkspaceSaved
(
e
:
IWorkspaceSavedEvent
):
void
{
...
...
@@ -67,7 +67,7 @@ export class HistoryMainService implements IHistoryMainService {
// Workspaces
workspaces
.
forEach
(
workspace
=>
{
const
isUntitledWorkspace
=
!
isSingleFolderWorkspaceIdentifier
(
workspace
)
&&
this
.
workspacesService
.
isUntitledWorkspace
(
workspace
);
const
isUntitledWorkspace
=
!
isSingleFolderWorkspaceIdentifier
(
workspace
)
&&
this
.
workspaces
Main
Service
.
isUntitledWorkspace
(
workspace
);
if
(
isUntitledWorkspace
)
{
return
;
// only store saved workspaces
}
...
...
@@ -179,7 +179,7 @@ export class HistoryMainService implements IHistoryMainService {
let
files
:
string
[];
// Get from storage
const
storedRecents
=
this
.
storageService
.
getItem
<
IRecentlyOpened
>
(
HistoryMainService
.
recentlyOpenedStorageKey
)
as
ILegacyRecentlyOpened
;
const
storedRecents
=
this
.
storage
Main
Service
.
getItem
<
IRecentlyOpened
>
(
HistoryMainService
.
recentlyOpenedStorageKey
)
as
ILegacyRecentlyOpened
;
if
(
storedRecents
)
{
workspaces
=
storedRecents
.
workspaces
||
storedRecents
.
folders
||
[];
files
=
storedRecents
.
files
||
[];
...
...
@@ -203,7 +203,7 @@ export class HistoryMainService implements IHistoryMainService {
files
=
arrays
.
distinct
(
files
,
file
=>
this
.
distinctFn
(
file
));
// Hide untitled workspaces
workspaces
=
workspaces
.
filter
(
workspace
=>
isSingleFolderWorkspaceIdentifier
(
workspace
)
||
!
this
.
workspacesService
.
isUntitledWorkspace
(
workspace
));
workspaces
=
workspaces
.
filter
(
workspace
=>
isSingleFolderWorkspaceIdentifier
(
workspace
)
||
!
this
.
workspaces
Main
Service
.
isUntitledWorkspace
(
workspace
));
return
{
workspaces
,
files
};
}
...
...
@@ -217,7 +217,7 @@ export class HistoryMainService implements IHistoryMainService {
}
private
saveRecentlyOpened
(
recent
:
IRecentlyOpened
):
void
{
this
.
storageService
.
setItem
(
HistoryMainService
.
recentlyOpenedStorageKey
,
recent
);
this
.
storage
Main
Service
.
setItem
(
HistoryMainService
.
recentlyOpenedStorageKey
,
recent
);
}
public
updateWindowsJumpList
():
void
{
...
...
src/vs/platform/lifecycle/electron-main/lifecycleMain.ts
浏览文件 @
ac0ba660
...
...
@@ -94,7 +94,7 @@ export class LifecycleService implements ILifecycleService {
constructor
(
@
ILogService
private
logService
:
ILogService
,
@
IStorageMainService
private
storageService
:
IStorageMainService
@
IStorageMainService
private
storage
Main
Service
:
IStorageMainService
)
{
this
.
windowToCloseRequest
=
Object
.
create
(
null
);
this
.
quitRequested
=
false
;
...
...
@@ -105,10 +105,10 @@ export class LifecycleService implements ILifecycleService {
}
private
handleRestarted
():
void
{
this
.
_wasRestarted
=
!!
this
.
storageService
.
getItem
(
LifecycleService
.
QUIT_FROM_RESTART_MARKER
);
this
.
_wasRestarted
=
!!
this
.
storage
Main
Service
.
getItem
(
LifecycleService
.
QUIT_FROM_RESTART_MARKER
);
if
(
this
.
_wasRestarted
)
{
this
.
storageService
.
removeItem
(
LifecycleService
.
QUIT_FROM_RESTART_MARKER
);
// remove the marker right after if found
this
.
storage
Main
Service
.
removeItem
(
LifecycleService
.
QUIT_FROM_RESTART_MARKER
);
// remove the marker right after if found
}
}
...
...
@@ -258,7 +258,7 @@ export class LifecycleService implements ILifecycleService {
app
.
once
(
'
will-quit
'
,
()
=>
{
if
(
this
.
pendingQuitPromiseComplete
)
{
if
(
fromUpdate
)
{
this
.
storageService
.
setItem
(
LifecycleService
.
QUIT_FROM_RESTART_MARKER
,
true
);
this
.
storage
Main
Service
.
setItem
(
LifecycleService
.
QUIT_FROM_RESTART_MARKER
,
true
);
}
this
.
pendingQuitPromiseComplete
(
false
/* no veto */
);
...
...
@@ -296,7 +296,7 @@ export class LifecycleService implements ILifecycleService {
let
vetoed
=
false
;
app
.
once
(
'
quit
'
,
()
=>
{
if
(
!
vetoed
)
{
this
.
storageService
.
setItem
(
LifecycleService
.
QUIT_FROM_RESTART_MARKER
,
true
);
this
.
storage
Main
Service
.
setItem
(
LifecycleService
.
QUIT_FROM_RESTART_MARKER
,
true
);
app
.
relaunch
({
args
});
}
});
...
...
src/vs/platform/workspaces/common/workspacesIpc.ts
浏览文件 @
ac0ba660
...
...
@@ -7,7 +7,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IChannel
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
IWorkspacesService
,
IWorkspaceIdentifier
,
IWorkspaceFolderCreationData
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspacesService
,
IWorkspaceIdentifier
,
IWorkspaceFolderCreationData
,
IWorkspacesMainService
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
URI
from
'
vs/base/common/uri
'
;
export
interface
IWorkspacesChannel
extends
IChannel
{
...
...
@@ -17,7 +17,7 @@ export interface IWorkspacesChannel extends IChannel {
export
class
WorkspacesChannel
implements
IWorkspacesChannel
{
constructor
(
private
service
:
IWorkspacesService
)
{
}
constructor
(
private
service
:
IWorkspaces
Main
Service
)
{
}
public
call
(
command
:
string
,
arg
?:
any
):
TPromise
<
any
>
{
switch
(
command
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录