Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
db472f9a
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,发现更多精彩内容 >>
提交
db472f9a
编写于
7月 06, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
context key - a bit of bufferChangeEvents when changing many context keys at once
上级
9e17e6de
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
47 addition
and
36 deletion
+47
-36
src/vs/platform/contextkey/common/contextkey.ts
src/vs/platform/contextkey/common/contextkey.ts
+0
-1
src/vs/platform/list/browser/listService.ts
src/vs/platform/list/browser/listService.ts
+10
-6
src/vs/workbench/browser/parts/editor/titleControl.ts
src/vs/workbench/browser/parts/editor/titleControl.ts
+5
-3
src/vs/workbench/common/resources.ts
src/vs/workbench/common/resources.ts
+26
-22
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+6
-4
未找到文件。
src/vs/platform/contextkey/common/contextkey.ts
浏览文件 @
db472f9a
...
...
@@ -998,7 +998,6 @@ export interface IContextKeyService {
onDidChangeContext
:
Event
<
IContextKeyChangeEvent
>
;
bufferChangeEvents
(
callback
:
Function
):
void
;
createKey
<
T
>
(
key
:
string
,
defaultValue
:
T
|
undefined
):
IContextKey
<
T
>
;
contextMatchesRules
(
rules
:
ContextKeyExpression
|
undefined
):
boolean
;
getContextKeyValue
<
T
>
(
key
:
string
):
T
|
undefined
;
...
...
src/vs/platform/list/browser/listService.ts
浏览文件 @
db472f9a
...
...
@@ -255,9 +255,11 @@ export class WorkbenchList<T> extends List<T> {
const
selection
=
this
.
getSelection
();
const
focus
=
this
.
getFocus
();
this
.
listHasSelectionOrFocus
.
set
(
selection
.
length
>
0
||
focus
.
length
>
0
);
this
.
listMultiSelection
.
set
(
selection
.
length
>
1
);
this
.
listDoubleSelection
.
set
(
selection
.
length
===
2
);
this
.
contextKeyService
.
bufferChangeEvents
(()
=>
{
this
.
listHasSelectionOrFocus
.
set
(
selection
.
length
>
0
||
focus
.
length
>
0
);
this
.
listMultiSelection
.
set
(
selection
.
length
>
1
);
this
.
listDoubleSelection
.
set
(
selection
.
length
===
2
);
});
}));
this
.
disposables
.
add
(
this
.
onDidChangeFocus
(()
=>
{
const
selection
=
this
.
getSelection
();
...
...
@@ -906,9 +908,11 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> {
const
selection
=
tree
.
getSelection
();
const
focus
=
tree
.
getFocus
();
this
.
hasSelectionOrFocus
.
set
(
selection
.
length
>
0
||
focus
.
length
>
0
);
this
.
hasMultiSelection
.
set
(
selection
.
length
>
1
);
this
.
hasDoubleSelection
.
set
(
selection
.
length
===
2
);
this
.
contextKeyService
.
bufferChangeEvents
(()
=>
{
this
.
hasSelectionOrFocus
.
set
(
selection
.
length
>
0
||
focus
.
length
>
0
);
this
.
hasMultiSelection
.
set
(
selection
.
length
>
1
);
this
.
hasDoubleSelection
.
set
(
selection
.
length
===
2
);
});
}),
tree
.
onDidChangeFocus
(()
=>
{
const
selection
=
tree
.
getSelection
();
...
...
src/vs/workbench/browser/parts/editor/titleControl.ts
浏览文件 @
db472f9a
...
...
@@ -223,9 +223,11 @@ export abstract class TitleControl extends Themable {
this
.
editorToolBarMenuDisposables
.
clear
();
// Update contexts
this
.
resourceContext
.
set
(
this
.
group
.
activeEditor
?
withUndefinedAsNull
(
toResource
(
this
.
group
.
activeEditor
,
{
supportSideBySide
:
SideBySideEditor
.
PRIMARY
}))
:
null
);
this
.
editorPinnedContext
.
set
(
this
.
group
.
activeEditor
?
this
.
group
.
isPinned
(
this
.
group
.
activeEditor
)
:
false
);
this
.
editorStickyContext
.
set
(
this
.
group
.
activeEditor
?
this
.
group
.
isSticky
(
this
.
group
.
activeEditor
)
:
false
);
this
.
contextKeyService
.
bufferChangeEvents
(()
=>
{
this
.
resourceContext
.
set
(
this
.
group
.
activeEditor
?
withUndefinedAsNull
(
toResource
(
this
.
group
.
activeEditor
,
{
supportSideBySide
:
SideBySideEditor
.
PRIMARY
}))
:
null
);
this
.
editorPinnedContext
.
set
(
this
.
group
.
activeEditor
?
this
.
group
.
isPinned
(
this
.
group
.
activeEditor
)
:
false
);
this
.
editorStickyContext
.
set
(
this
.
group
.
activeEditor
?
this
.
group
.
isSticky
(
this
.
group
.
activeEditor
)
:
false
);
});
// Editor actions require the editor control to be there, so we retrieve it via service
const
activeEditorPane
=
this
.
group
.
activeEditorPane
;
...
...
src/vs/workbench/common/resources.ts
浏览文件 @
db472f9a
...
...
@@ -39,19 +39,19 @@ export class ResourceContextKey extends Disposable implements IContextKey<URI> {
private
readonly
_isFileSystemResource
:
IContextKey
<
boolean
>
;
constructor
(
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IContextKeyService
private
readonly
_
contextKeyService
:
IContextKeyService
,
@
IFileService
private
readonly
_fileService
:
IFileService
,
@
IModeService
private
readonly
_modeService
:
IModeService
)
{
super
();
this
.
_schemeKey
=
ResourceContextKey
.
Scheme
.
bindTo
(
contextKeyService
);
this
.
_filenameKey
=
ResourceContextKey
.
Filename
.
bindTo
(
contextKeyService
);
this
.
_langIdKey
=
ResourceContextKey
.
LangId
.
bindTo
(
contextKeyService
);
this
.
_resourceKey
=
ResourceContextKey
.
Resource
.
bindTo
(
contextKeyService
);
this
.
_extensionKey
=
ResourceContextKey
.
Extension
.
bindTo
(
contextKeyService
);
this
.
_hasResource
=
ResourceContextKey
.
HasResource
.
bindTo
(
contextKeyService
);
this
.
_isFileSystemResource
=
ResourceContextKey
.
IsFileSystemResource
.
bindTo
(
contextKeyService
);
this
.
_schemeKey
=
ResourceContextKey
.
Scheme
.
bindTo
(
this
.
_
contextKeyService
);
this
.
_filenameKey
=
ResourceContextKey
.
Filename
.
bindTo
(
this
.
_
contextKeyService
);
this
.
_langIdKey
=
ResourceContextKey
.
LangId
.
bindTo
(
this
.
_
contextKeyService
);
this
.
_resourceKey
=
ResourceContextKey
.
Resource
.
bindTo
(
this
.
_
contextKeyService
);
this
.
_extensionKey
=
ResourceContextKey
.
Extension
.
bindTo
(
this
.
_
contextKeyService
);
this
.
_hasResource
=
ResourceContextKey
.
HasResource
.
bindTo
(
this
.
_
contextKeyService
);
this
.
_isFileSystemResource
=
ResourceContextKey
.
IsFileSystemResource
.
bindTo
(
this
.
_
contextKeyService
);
this
.
_register
(
_fileService
.
onDidChangeFileSystemProviderRegistrations
(()
=>
{
const
resource
=
this
.
_resourceKey
.
get
();
...
...
@@ -66,24 +66,28 @@ export class ResourceContextKey extends Disposable implements IContextKey<URI> {
set
(
value
:
URI
|
null
)
{
if
(
!
ResourceContextKey
.
_uriEquals
(
this
.
_resourceKey
.
get
(),
value
))
{
this
.
_resourceKey
.
set
(
value
);
this
.
_schemeKey
.
set
(
value
?
value
.
scheme
:
null
);
this
.
_filenameKey
.
set
(
value
?
basename
(
value
)
:
null
);
this
.
_langIdKey
.
set
(
value
?
this
.
_modeService
.
getModeIdByFilepathOrFirstLine
(
value
)
:
null
);
this
.
_extensionKey
.
set
(
value
?
extname
(
value
)
:
null
);
this
.
_hasResource
.
set
(
!!
value
);
this
.
_isFileSystemResource
.
set
(
value
?
this
.
_fileService
.
canHandleResource
(
value
)
:
false
);
this
.
_contextKeyService
.
bufferChangeEvents
(()
=>
{
this
.
_resourceKey
.
set
(
value
);
this
.
_schemeKey
.
set
(
value
?
value
.
scheme
:
null
);
this
.
_filenameKey
.
set
(
value
?
basename
(
value
)
:
null
);
this
.
_langIdKey
.
set
(
value
?
this
.
_modeService
.
getModeIdByFilepathOrFirstLine
(
value
)
:
null
);
this
.
_extensionKey
.
set
(
value
?
extname
(
value
)
:
null
);
this
.
_hasResource
.
set
(
!!
value
);
this
.
_isFileSystemResource
.
set
(
value
?
this
.
_fileService
.
canHandleResource
(
value
)
:
false
);
});
}
}
reset
():
void
{
this
.
_schemeKey
.
reset
();
this
.
_langIdKey
.
reset
();
this
.
_resourceKey
.
reset
();
this
.
_langIdKey
.
reset
();
this
.
_extensionKey
.
reset
();
this
.
_hasResource
.
reset
();
this
.
_isFileSystemResource
.
reset
();
this
.
_contextKeyService
.
bufferChangeEvents
(()
=>
{
this
.
_schemeKey
.
reset
();
this
.
_langIdKey
.
reset
();
this
.
_resourceKey
.
reset
();
this
.
_langIdKey
.
reset
();
this
.
_extensionKey
.
reset
();
this
.
_hasResource
.
reset
();
this
.
_isFileSystemResource
.
reset
();
});
}
get
():
URI
|
undefined
{
...
...
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
db472f9a
...
...
@@ -755,10 +755,12 @@ export class HistoryService extends Disposable implements IHistoryService {
private
readonly
canReopenClosedEditorContextKey
=
(
new
RawContextKey
<
boolean
>
(
'
canReopenClosedEditor
'
,
false
)).
bindTo
(
this
.
contextKeyService
);
private
updateContextKeys
():
void
{
this
.
canNavigateBackContextKey
.
set
(
this
.
navigationStack
.
length
>
0
&&
this
.
navigationStackIndex
>
0
);
this
.
canNavigateForwardContextKey
.
set
(
this
.
navigationStack
.
length
>
0
&&
this
.
navigationStackIndex
<
this
.
navigationStack
.
length
-
1
);
this
.
canNavigateToLastEditLocationContextKey
.
set
(
!!
this
.
lastEditLocation
);
this
.
canReopenClosedEditorContextKey
.
set
(
this
.
recentlyClosedEditors
.
length
>
0
);
this
.
contextKeyService
.
bufferChangeEvents
(()
=>
{
this
.
canNavigateBackContextKey
.
set
(
this
.
navigationStack
.
length
>
0
&&
this
.
navigationStackIndex
>
0
);
this
.
canNavigateForwardContextKey
.
set
(
this
.
navigationStack
.
length
>
0
&&
this
.
navigationStackIndex
<
this
.
navigationStack
.
length
-
1
);
this
.
canNavigateToLastEditLocationContextKey
.
set
(
!!
this
.
lastEditLocation
);
this
.
canReopenClosedEditorContextKey
.
set
(
this
.
recentlyClosedEditors
.
length
>
0
);
});
}
//#endregion
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录