Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f32ba85e
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,发现更多精彩内容 >>
提交
f32ba85e
编写于
3月 11, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #57272
上级
5a4c9902
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
10 deletion
+17
-10
src/vs/platform/history/electron-main/historyMainService.ts
src/vs/platform/history/electron-main/historyMainService.ts
+17
-10
未找到文件。
src/vs/platform/history/electron-main/historyMainService.ts
浏览文件 @
f32ba85e
...
...
@@ -14,13 +14,14 @@ import { Event as CommonEvent, Emitter } from 'vs/base/common/event';
import
{
isWindows
,
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
IWorkspaceIdentifier
,
IWorkspacesMainService
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IHistoryMainService
,
IRecentlyOpened
,
isRecentWorkspace
,
isRecentFolder
,
IRecent
,
isRecentFile
,
IRecentFolder
,
IRecentWorkspace
,
IRecentFile
}
from
'
vs/platform/history/common/history
'
;
import
{
RunOnceSchedul
er
}
from
'
vs/base/common/async
'
;
import
{
ThrottledDelay
er
}
from
'
vs/base/common/async
'
;
import
{
isEqual
as
areResourcesEqual
,
dirname
,
originalFSPath
}
from
'
vs/base/common/resources
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
getSimpleWorkspaceLabel
}
from
'
vs/platform/label/common/label
'
;
import
{
toStoreData
,
restoreRecentlyOpened
,
RecentlyOpenedStorageData
}
from
'
vs/platform/history/electron-main/historyStorage
'
;
import
{
exists
}
from
'
vs/base/node/pfs
'
;
export
class
HistoryMainService
implements
IHistoryMainService
{
...
...
@@ -35,7 +36,7 @@ export class HistoryMainService implements IHistoryMainService {
private
_onRecentlyOpenedChange
=
new
Emitter
<
void
>
();
onRecentlyOpenedChange
:
CommonEvent
<
void
>
=
this
.
_onRecentlyOpenedChange
.
event
;
private
macOSRecentDocumentsUpdater
:
RunOnceScheduler
;
private
macOSRecentDocumentsUpdater
:
ThrottledDelayer
<
void
>
;
constructor
(
@
IStateService
private
readonly
stateService
:
IStateService
,
...
...
@@ -43,7 +44,7 @@ export class HistoryMainService implements IHistoryMainService {
@
IWorkspacesMainService
private
readonly
workspacesMainService
:
IWorkspacesMainService
,
@
IEnvironmentService
private
readonly
environmentService
:
IEnvironmentService
)
{
this
.
macOSRecentDocumentsUpdater
=
new
RunOnceScheduler
(()
=>
this
.
updateMacOSRecentDocuments
(),
800
);
this
.
macOSRecentDocumentsUpdater
=
new
ThrottledDelayer
<
void
>
(
800
);
}
addRecentlyOpened
(
newlyAdded
:
IRecent
[]):
void
{
...
...
@@ -77,7 +78,7 @@ export class HistoryMainService implements IHistoryMainService {
// Schedule update to recent documents on macOS dock
if
(
isMacintosh
)
{
this
.
macOSRecentDocumentsUpdater
.
schedule
(
);
this
.
macOSRecentDocumentsUpdater
.
trigger
(()
=>
this
.
updateMacOSRecentDocuments
()
);
}
}
}
...
...
@@ -103,12 +104,12 @@ export class HistoryMainService implements IHistoryMainService {
// Schedule update to recent documents on macOS dock
if
(
isMacintosh
)
{
this
.
macOSRecentDocumentsUpdater
.
schedule
(
);
this
.
macOSRecentDocumentsUpdater
.
trigger
(()
=>
this
.
updateMacOSRecentDocuments
()
);
}
}
}
private
updateMacOSRecentDocuments
():
void
{
private
async
updateMacOSRecentDocuments
():
Promise
<
void
>
{
if
(
!
isMacintosh
)
{
return
;
}
...
...
@@ -125,8 +126,11 @@ export class HistoryMainService implements IHistoryMainService {
for
(
let
i
=
0
,
entries
=
0
;
i
<
mru
.
workspaces
.
length
&&
entries
<
HistoryMainService
.
MAX_MACOS_DOCK_RECENT_FOLDERS
;
i
++
)
{
const
loc
=
location
(
mru
.
workspaces
[
i
]);
if
(
loc
.
scheme
===
Schemas
.
file
)
{
app
.
addRecentDocument
(
originalFSPath
(
loc
));
entries
++
;
const
workspacePath
=
originalFSPath
(
loc
);
if
(
await
exists
(
workspacePath
))
{
app
.
addRecentDocument
(
workspacePath
);
entries
++
;
}
}
}
...
...
@@ -134,8 +138,11 @@ export class HistoryMainService implements IHistoryMainService {
for
(
let
i
=
0
,
entries
=
0
;
i
<
mru
.
files
.
length
&&
entries
<
HistoryMainService
.
MAX_MACOS_DOCK_RECENT_FILES
;
i
++
)
{
const
loc
=
location
(
mru
.
files
[
i
]);
if
(
loc
.
scheme
===
Schemas
.
file
)
{
app
.
addRecentDocument
(
originalFSPath
(
loc
));
entries
++
;
const
filePath
=
originalFSPath
(
loc
);
if
(
await
exists
(
filePath
))
{
app
.
addRecentDocument
(
filePath
);
entries
++
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录