Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
33189b32
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,发现更多精彩内容 >>
提交
33189b32
编写于
2月 06, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
workspaces service
💄
上级
4a59a415
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
25 addition
and
20 deletion
+25
-20
src/vs/platform/menubar/electron-main/menubar.ts
src/vs/platform/menubar/electron-main/menubar.ts
+1
-1
src/vs/platform/windows/electron-main/windowsMainService.ts
src/vs/platform/windows/electron-main/windowsMainService.ts
+1
-1
src/vs/platform/workspaces/common/workspaces.ts
src/vs/platform/workspaces/common/workspaces.ts
+1
-1
src/vs/platform/workspaces/electron-main/workspacesHistoryMainService.ts
.../workspaces/electron-main/workspacesHistoryMainService.ts
+3
-3
src/vs/platform/workspaces/electron-main/workspacesService.ts
...vs/platform/workspaces/electron-main/workspacesService.ts
+2
-2
src/vs/workbench/api/common/apiCommands.ts
src/vs/workbench/api/common/apiCommands.ts
+1
-1
src/vs/workbench/browser/actions/windowActions.ts
src/vs/workbench/browser/actions/windowActions.ts
+1
-1
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+1
-1
src/vs/workbench/services/workspaces/browser/workspacesService.ts
...orkbench/services/workspaces/browser/workspacesService.ts
+8
-6
src/vs/workbench/services/workspaces/electron-browser/workspaceEditingService.ts
...es/workspaces/electron-browser/workspaceEditingService.ts
+6
-3
未找到文件。
src/vs/platform/menubar/electron-main/menubar.ts
浏览文件 @
33189b32
...
...
@@ -491,7 +491,7 @@ export class Menubar {
}).
length
>
0
;
if
(
!
success
)
{
this
.
workspacesHistoryMainService
.
remove
From
RecentlyOpened
([
revivedUri
]);
this
.
workspacesHistoryMainService
.
removeRecentlyOpened
([
revivedUri
]);
}
}
},
false
));
...
...
src/vs/platform/windows/electron-main/windowsMainService.ts
浏览文件 @
33189b32
...
...
@@ -1190,7 +1190,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
}
}
catch
(
error
)
{
const
fileUri
=
URI
.
file
(
candidate
);
this
.
workspacesHistoryMainService
.
remove
From
RecentlyOpened
([
fileUri
]);
// since file does not seem to exist anymore, remove from recent
this
.
workspacesHistoryMainService
.
removeRecentlyOpened
([
fileUri
]);
// since file does not seem to exist anymore, remove from recent
// assume this is a file that does not yet exist
if
(
options
?.
ignoreFileNotFound
)
{
...
...
src/vs/platform/workspaces/common/workspaces.ts
浏览文件 @
33189b32
...
...
@@ -40,7 +40,7 @@ export interface IWorkspacesService {
// History
readonly
onRecentlyOpenedChange
:
CommonEvent
<
void
>
;
addRecentlyOpened
(
recents
:
IRecent
[]):
Promise
<
void
>
;
remove
From
RecentlyOpened
(
workspaces
:
URI
[]):
Promise
<
void
>
;
removeRecentlyOpened
(
workspaces
:
URI
[]):
Promise
<
void
>
;
clearRecentlyOpened
():
Promise
<
void
>
;
getRecentlyOpened
():
Promise
<
IRecentlyOpened
>
;
}
...
...
src/vs/platform/workspaces/electron-main/workspacesHistoryMainService.ts
浏览文件 @
33189b32
...
...
@@ -35,7 +35,7 @@ export interface IWorkspacesHistoryMainService {
addRecentlyOpened
(
recents
:
IRecent
[]):
void
;
getRecentlyOpened
(
currentWorkspace
?:
IWorkspaceIdentifier
,
currentFolder
?:
ISingleFolderWorkspaceIdentifier
,
currentFiles
?:
IPath
[]):
IRecentlyOpened
;
remove
From
RecentlyOpened
(
paths
:
URI
[]):
void
;
removeRecentlyOpened
(
paths
:
URI
[]):
void
;
clearRecentlyOpened
():
void
;
updateWindowsJumpList
():
void
;
...
...
@@ -148,7 +148,7 @@ export class WorkspacesHistoryMainService extends Disposable implements IWorkspa
}
}
remove
From
RecentlyOpened
(
toRemove
:
URI
[]):
void
{
removeRecentlyOpened
(
toRemove
:
URI
[]):
void
{
const
keep
=
(
recent
:
IRecent
)
=>
{
const
uri
=
location
(
recent
);
for
(
const
r
of
toRemove
)
{
...
...
@@ -344,7 +344,7 @@ export class WorkspacesHistoryMainService extends Disposable implements IWorkspa
}
}
}
this
.
remove
From
RecentlyOpened
(
toRemove
);
this
.
removeRecentlyOpened
(
toRemove
);
// Add entries
jumpList
.
push
({
...
...
src/vs/platform/workspaces/electron-main/workspacesService.ts
浏览文件 @
33189b32
...
...
@@ -63,8 +63,8 @@ export class WorkspacesService implements AddFirstParameterToFunctions<IWorkspac
return
this
.
workspacesHistoryMainService
.
addRecentlyOpened
(
recents
);
}
async
remove
From
RecentlyOpened
(
windowId
:
number
,
paths
:
URI
[]):
Promise
<
void
>
{
return
this
.
workspacesHistoryMainService
.
remove
From
RecentlyOpened
(
paths
);
async
removeRecentlyOpened
(
windowId
:
number
,
paths
:
URI
[]):
Promise
<
void
>
{
return
this
.
workspacesHistoryMainService
.
removeRecentlyOpened
(
paths
);
}
async
clearRecentlyOpened
(
windowId
:
number
):
Promise
<
void
>
{
...
...
src/vs/workbench/api/common/apiCommands.ts
浏览文件 @
33189b32
...
...
@@ -158,7 +158,7 @@ CommandsRegistry.registerCommand(OpenWithAPICommand.ID, adjustHandler(OpenWithAP
CommandsRegistry
.
registerCommand
(
'
_workbench.removeFromRecentlyOpened
'
,
function
(
accessor
:
ServicesAccessor
,
uri
:
URI
)
{
const
workspacesService
=
accessor
.
get
(
IWorkspacesService
);
return
workspacesService
.
remove
From
RecentlyOpened
([
uri
]);
return
workspacesService
.
removeRecentlyOpened
([
uri
]);
});
export
class
RemoveFromRecentlyOpenedAPICommand
{
...
...
src/vs/workbench/browser/actions/windowActions.ts
浏览文件 @
33189b32
...
...
@@ -129,7 +129,7 @@ abstract class BaseOpenRecentAction extends Action {
onKeyMods
:
mods
=>
keyMods
=
mods
,
quickNavigate
:
this
.
isQuickNavigate
()
?
{
keybindings
:
this
.
keybindingService
.
lookupKeybindings
(
this
.
id
)
}
:
undefined
,
onDidTriggerItemButton
:
async
context
=>
{
await
this
.
workspacesService
.
remove
From
RecentlyOpened
([
context
.
item
.
resource
]);
await
this
.
workspacesService
.
removeRecentlyOpened
([
context
.
item
.
resource
]);
context
.
removeItem
();
}
});
...
...
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
33189b32
...
...
@@ -273,7 +273,7 @@ export class HistoryService extends Disposable implements IHistoryService {
const
input
=
arg1
as
IResourceInput
;
this
.
workspacesService
.
remove
From
RecentlyOpened
([
input
.
resource
]);
this
.
workspacesService
.
removeRecentlyOpened
([
input
.
resource
]);
}
clear
():
void
{
...
...
src/vs/workbench/services/workspaces/browser/workspacesService.ts
浏览文件 @
33189b32
...
...
@@ -35,6 +35,8 @@ export class BrowserWorkspacesService extends Disposable implements IWorkspacesS
)
{
super
();
// Opening a workspace should push it as most
// recently used to the workspaces history
this
.
addWorkspaceToRecentlyOpened
();
this
.
registerListeners
();
...
...
@@ -76,13 +78,13 @@ export class BrowserWorkspacesService extends Disposable implements IWorkspacesS
recents
.
forEach
(
recent
=>
{
if
(
isRecentFile
(
recent
))
{
this
.
doRemove
From
RecentlyOpened
(
recentlyOpened
,
[
recent
.
fileUri
]);
this
.
doRemoveRecentlyOpened
(
recentlyOpened
,
[
recent
.
fileUri
]);
recentlyOpened
.
files
.
unshift
(
recent
);
}
else
if
(
isRecentFolder
(
recent
))
{
this
.
doRemove
From
RecentlyOpened
(
recentlyOpened
,
[
recent
.
folderUri
]);
this
.
doRemoveRecentlyOpened
(
recentlyOpened
,
[
recent
.
folderUri
]);
recentlyOpened
.
workspaces
.
unshift
(
recent
);
}
else
{
this
.
doRemove
From
RecentlyOpened
(
recentlyOpened
,
[
recent
.
workspace
.
configPath
]);
this
.
doRemoveRecentlyOpened
(
recentlyOpened
,
[
recent
.
workspace
.
configPath
]);
recentlyOpened
.
workspaces
.
unshift
(
recent
);
}
});
...
...
@@ -90,15 +92,15 @@ export class BrowserWorkspacesService extends Disposable implements IWorkspacesS
return
this
.
saveRecentlyOpened
(
recentlyOpened
);
}
async
remove
From
RecentlyOpened
(
paths
:
URI
[]):
Promise
<
void
>
{
async
removeRecentlyOpened
(
paths
:
URI
[]):
Promise
<
void
>
{
const
recentlyOpened
=
await
this
.
getRecentlyOpened
();
this
.
doRemove
From
RecentlyOpened
(
recentlyOpened
,
paths
);
this
.
doRemoveRecentlyOpened
(
recentlyOpened
,
paths
);
return
this
.
saveRecentlyOpened
(
recentlyOpened
);
}
private
doRemove
From
RecentlyOpened
(
recentlyOpened
:
IRecentlyOpened
,
paths
:
URI
[]):
void
{
private
doRemoveRecentlyOpened
(
recentlyOpened
:
IRecentlyOpened
,
paths
:
URI
[]):
void
{
recentlyOpened
.
files
=
recentlyOpened
.
files
.
filter
(
file
=>
{
return
!
paths
.
some
(
path
=>
path
.
toString
()
===
file
.
fileUri
.
toString
());
});
...
...
src/vs/workbench/services/workspaces/electron-browser/workspaceEditingService.ts
浏览文件 @
33189b32
...
...
@@ -131,11 +131,14 @@ export class NativeWorkspaceEditingService extends AbstractWorkspaceEditingServi
try
{
await
this
.
saveWorkspaceAs
(
workspaceIdentifier
,
newWorkspacePath
);
// Make sure to add the new workspace to the history to find it again
const
newWorkspaceIdentifier
=
await
this
.
workspacesService
.
getWorkspaceIdentifier
(
newWorkspacePath
);
this
.
workspacesService
.
addRecentlyOpened
([{
label
:
this
.
labelService
.
getWorkspaceLabel
(
newWorkspaceIdentifier
,
{
verbose
:
true
}),
workspace
:
newWorkspaceIdentifier
}]);
const
label
=
this
.
labelService
.
getWorkspaceLabel
(
newWorkspaceIdentifier
,
{
verbose
:
true
});
this
.
workspacesService
.
addRecentlyOpened
([{
label
,
workspace
:
newWorkspaceIdentifier
}]);
// Delete the untitled one
this
.
workspacesService
.
deleteUntitledWorkspace
(
workspaceIdentifier
);
}
catch
(
error
)
{
// ignore
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录