Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0a9ef2ad
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 搜索 >>
提交
0a9ef2ad
编写于
9月 02, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code
💄
上级
95161e0f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
22 deletion
+27
-22
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+13
-13
src/vs/platform/backup/electron-main/backupMainService.ts
src/vs/platform/backup/electron-main/backupMainService.ts
+5
-5
src/vs/platform/backup/test/electron-main/backupMainService.test.ts
...tform/backup/test/electron-main/backupMainService.test.ts
+2
-2
src/vs/platform/windows/electron-main/windowsService.ts
src/vs/platform/windows/electron-main/windowsService.ts
+7
-2
未找到文件。
src/vs/code/electron-main/windows.ts
浏览文件 @
0a9ef2ad
...
...
@@ -309,7 +309,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
if
(
!
currentWindowsState
.
lastActiveWindow
)
{
let
activeWindow
=
this
.
getLastActiveWindow
();
if
(
!
activeWindow
||
activeWindow
.
isExtensionDevelopmentHost
)
{
activeWindow
=
WindowsManager
.
WINDOWS
.
filter
(
w
=>
!
w
.
isExtensionDevelopmentHost
)[
0
];
activeWindow
=
WindowsManager
.
WINDOWS
.
filter
(
w
indow
=>
!
windo
w
.
isExtensionDevelopmentHost
)[
0
];
}
if
(
activeWindow
)
{
...
...
@@ -318,7 +318,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
}
// 2.) Find extension host window
const
extensionHostWindow
=
WindowsManager
.
WINDOWS
.
filter
(
w
=>
w
.
isExtensionDevelopmentHost
&&
!
w
.
isExtensionTestHost
)[
0
];
const
extensionHostWindow
=
WindowsManager
.
WINDOWS
.
filter
(
w
indow
=>
window
.
isExtensionDevelopmentHost
&&
!
windo
w
.
isExtensionTestHost
)[
0
];
if
(
extensionHostWindow
)
{
currentWindowsState
.
lastPluginDevelopmentHostWindow
=
this
.
toWindowState
(
extensionHostWindow
);
}
...
...
@@ -329,7 +329,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
// so if we ever want to persist the UI state of the last closed window (window count === 1), it has
// to come from the stored lastClosedWindowState on Win/Linux at least
if
(
this
.
getWindowCount
()
>
1
)
{
currentWindowsState
.
openedWindows
=
WindowsManager
.
WINDOWS
.
filter
(
w
=>
!
w
.
isExtensionDevelopmentHost
).
map
(
w
=>
this
.
toWindowState
(
w
));
currentWindowsState
.
openedWindows
=
WindowsManager
.
WINDOWS
.
filter
(
w
indow
=>
!
window
.
isExtensionDevelopmentHost
).
map
(
window
=>
this
.
toWindowState
(
windo
w
));
}
// Persist
...
...
@@ -456,7 +456,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
// 1.) focus last active window if we are not instructed to open any paths
if
(
focusLastActive
)
{
const
lastActiveWindow
=
usedWindows
.
filter
(
w
=>
w
.
backupPath
===
this
.
windowsState
.
lastActiveWindow
!
.
backupPath
);
const
lastActiveWindow
=
usedWindows
.
filter
(
w
indow
=>
windo
w
.
backupPath
===
this
.
windowsState
.
lastActiveWindow
!
.
backupPath
);
if
(
lastActiveWindow
.
length
)
{
lastActiveWindow
[
0
].
focus
();
focusLastOpened
=
false
;
...
...
@@ -490,7 +490,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
// Remember in recent document list (unless this opens for extension development)
// Also do not add paths when files are opened for diffing, only if opened individually
if
(
!
usedWindows
.
some
(
w
=>
w
.
isExtensionDevelopmentHost
)
&&
!
openConfig
.
diffMode
&&
!
openConfig
.
noRecentEntry
)
{
if
(
!
usedWindows
.
some
(
w
indow
=>
windo
w
.
isExtensionDevelopmentHost
)
&&
!
openConfig
.
diffMode
&&
!
openConfig
.
noRecentEntry
)
{
const
recents
:
IRecent
[]
=
[];
for
(
let
pathToOpen
of
pathsToOpen
)
{
if
(
pathToOpen
.
workspace
)
{
...
...
@@ -556,7 +556,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
const
fileToCheck
=
fileInputs
.
filesToOpenOrCreate
[
0
]
||
fileInputs
.
filesToDiff
[
0
];
// only look at the windows with correct authority
const
windows
=
WindowsManager
.
WINDOWS
.
filter
(
w
=>
w
.
remoteAuthority
===
fileInputs
!
.
remoteAuthority
);
const
windows
=
WindowsManager
.
WINDOWS
.
filter
(
w
indow
=>
windo
w
.
remoteAuthority
===
fileInputs
!
.
remoteAuthority
);
const
bestWindowOrFolder
=
findBestWindowOrFolderForFile
({
windows
,
...
...
@@ -1599,7 +1599,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
}
getLastActiveWindowForAuthority
(
remoteAuthority
:
string
|
undefined
):
ICodeWindow
|
undefined
{
return
getLastActiveWindow
(
WindowsManager
.
WINDOWS
.
filter
(
w
=>
w
.
remoteAuthority
===
remoteAuthority
));
return
getLastActiveWindow
(
WindowsManager
.
WINDOWS
.
filter
(
w
indow
=>
windo
w
.
remoteAuthority
===
remoteAuthority
));
}
openNewWindow
(
context
:
OpenContext
,
options
?:
INewWindowOptions
):
ICodeWindow
[]
{
...
...
@@ -1642,13 +1642,13 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
}
sendToAll
(
channel
:
string
,
payload
?:
any
,
windowIdsToIgnore
?:
number
[]):
void
{
WindowsManager
.
WINDOWS
.
forEach
(
w
=>
{
if
(
windowIdsToIgnore
&&
windowIdsToIgnore
.
indexOf
(
w
.
id
)
>=
0
)
{
return
;
// do not send if we are instructed to ignore it
for
(
const
window
of
WindowsManager
.
WINDOWS
)
{
if
(
windowIdsToIgnore
&&
windowIdsToIgnore
.
indexOf
(
w
indow
.
id
)
>=
0
)
{
continue
;
// do not send if we are instructed to ignore it
}
w
.
sendWhenReady
(
channel
,
payload
);
}
);
w
indow
.
sendWhenReady
(
channel
,
payload
);
}
}
getFocusedWindow
():
ICodeWindow
|
undefined
{
...
...
@@ -1661,7 +1661,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
}
getWindowById
(
windowId
:
number
):
ICodeWindow
|
undefined
{
const
res
=
WindowsManager
.
WINDOWS
.
filter
(
w
=>
w
.
id
===
windowId
);
const
res
=
WindowsManager
.
WINDOWS
.
filter
(
w
indow
=>
windo
w
.
id
===
windowId
);
if
(
res
&&
res
.
length
===
1
)
{
return
res
[
0
];
}
...
...
src/vs/platform/backup/electron-main/backupMainService.ts
浏览文件 @
0a9ef2ad
...
...
@@ -138,7 +138,7 @@ export class BackupMainService implements IBackupMainService {
}
registerWorkspaceBackupSync
(
workspaceInfo
:
IWorkspaceBackupInfo
,
migrateFrom
?:
string
):
string
{
if
(
!
this
.
rootWorkspaces
.
some
(
w
=>
workspaceInfo
.
workspace
.
id
===
w
.
workspace
.
id
))
{
if
(
!
this
.
rootWorkspaces
.
some
(
w
indow
=>
workspaceInfo
.
workspace
.
id
===
windo
w
.
workspace
.
id
))
{
this
.
rootWorkspaces
.
push
(
workspaceInfo
);
this
.
saveSync
();
}
...
...
@@ -219,7 +219,7 @@ export class BackupMainService implements IBackupMainService {
backupFolder
=
this
.
getRandomEmptyWindowId
();
}
if
(
!
this
.
emptyWorkspaces
.
some
(
w
=>
!!
w
.
backupFolder
&&
isEqual
(
w
.
backupFolder
,
backupFolder
!
,
!
platform
.
isLinux
)))
{
if
(
!
this
.
emptyWorkspaces
.
some
(
w
indow
=>
!!
window
.
backupFolder
&&
isEqual
(
windo
w
.
backupFolder
,
backupFolder
!
,
!
platform
.
isLinux
)))
{
this
.
emptyWorkspaces
.
push
({
backupFolder
,
remoteAuthority
});
this
.
saveSync
();
}
...
...
@@ -353,7 +353,7 @@ export class BackupMainService implements IBackupMainService {
// New empty window backup
let
newBackupFolder
=
this
.
getRandomEmptyWindowId
();
while
(
this
.
emptyWorkspaces
.
some
(
w
=>
!!
w
.
backupFolder
&&
isEqual
(
w
.
backupFolder
,
newBackupFolder
,
platform
.
isLinux
)))
{
while
(
this
.
emptyWorkspaces
.
some
(
w
indow
=>
!!
window
.
backupFolder
&&
isEqual
(
windo
w
.
backupFolder
,
newBackupFolder
,
platform
.
isLinux
)))
{
newBackupFolder
=
this
.
getRandomEmptyWindowId
();
}
...
...
@@ -374,7 +374,7 @@ export class BackupMainService implements IBackupMainService {
// New empty window backup
let
newBackupFolder
=
this
.
getRandomEmptyWindowId
();
while
(
this
.
emptyWorkspaces
.
some
(
w
=>
!!
w
.
backupFolder
&&
isEqual
(
w
.
backupFolder
,
newBackupFolder
,
platform
.
isLinux
)))
{
while
(
this
.
emptyWorkspaces
.
some
(
w
indow
=>
!!
window
.
backupFolder
&&
isEqual
(
windo
w
.
backupFolder
,
newBackupFolder
,
platform
.
isLinux
)))
{
newBackupFolder
=
this
.
getRandomEmptyWindowId
();
}
...
...
@@ -457,4 +457,4 @@ export class BackupMainService implements IBackupMainService {
protected
getLegacyFolderHash
(
folderPath
:
string
):
string
{
return
crypto
.
createHash
(
'
md5
'
).
update
(
platform
.
isLinux
?
folderPath
:
folderPath
.
toLowerCase
()).
digest
(
'
hex
'
);
}
}
\ No newline at end of file
}
src/vs/platform/backup/test/electron-main/backupMainService.test.ts
浏览文件 @
0a9ef2ad
...
...
@@ -322,7 +322,7 @@ suite('BackupMainService', () => {
assert
.
deepEqual
(
json
.
folderURIWorkspaces
,
[
URI
.
file
(
folderPath
).
toString
()]);
assert
.
deepEqual
(
json
.
rootURIWorkspaces
,
[{
id
:
workspace
.
id
,
configURIPath
:
URI
.
file
(
workspacePath
).
toString
()
}]);
assertEqualUris
(
service
.
getWorkspaceBackups
().
map
(
w
=>
w
.
workspace
.
configPath
),
[
workspace
.
configPath
]);
assertEqualUris
(
service
.
getWorkspaceBackups
().
map
(
w
indow
=>
windo
w
.
workspace
.
configPath
),
[
workspace
.
configPath
]);
});
});
...
...
@@ -731,4 +731,4 @@ suite('BackupMainService', () => {
}
});
});
});
\ No newline at end of file
});
src/vs/platform/windows/electron-main/windowsService.ts
浏览文件 @
0a9ef2ad
...
...
@@ -322,9 +322,14 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH
this
.
logService
.
trace
(
'
windowsService#getWindows
'
);
const
windows
=
this
.
windowsMainService
.
getWindows
();
const
result
=
windows
.
map
(
w
=>
({
id
:
w
.
id
,
workspace
:
w
.
openedWorkspace
,
folderUri
:
w
.
openedFolderUri
,
title
:
w
.
win
.
getTitle
(),
filename
:
w
.
getRepresentedFilename
()
}));
return
result
;
return
windows
.
map
(
window
=>
({
id
:
window
.
id
,
workspace
:
window
.
openedWorkspace
,
folderUri
:
window
.
openedFolderUri
,
title
:
window
.
win
.
getTitle
(),
filename
:
window
.
getRepresentedFilename
()
}));
}
async
getWindowCount
():
Promise
<
number
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录