Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4cf9c461
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,发现更多精彩内容 >>
提交
4cf9c461
编写于
5月 01, 2020
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Distinguish a user removing a row from 'clear' in search
Fix #91901
上级
e17eb58a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
19 deletion
+20
-19
src/vs/workbench/contrib/search/browser/searchActions.ts
src/vs/workbench/contrib/search/browser/searchActions.ts
+1
-1
src/vs/workbench/contrib/search/common/searchModel.ts
src/vs/workbench/contrib/search/common/searchModel.ts
+19
-18
未找到文件。
src/vs/workbench/contrib/search/browser/searchActions.ts
浏览文件 @
4cf9c461
...
@@ -615,7 +615,7 @@ export class RemoveAction extends AbstractSearchAndReplaceAction {
...
@@ -615,7 +615,7 @@ export class RemoveAction extends AbstractSearchAndReplaceAction {
this
.
viewer
.
setFocus
([
nextFocusElement
],
getSelectionKeyboardEvent
());
this
.
viewer
.
setFocus
([
nextFocusElement
],
getSelectionKeyboardEvent
());
}
}
this
.
element
.
parent
().
remove
(
<
any
>
this
.
element
);
this
.
element
.
parent
().
remove
(
<
any
>
this
.
element
,
true
);
this
.
viewer
.
domFocus
();
this
.
viewer
.
domFocus
();
return
Promise
.
resolve
();
return
Promise
.
resolve
();
...
...
src/vs/workbench/contrib/search/common/searchModel.ts
浏览文件 @
4cf9c461
...
@@ -192,8 +192,8 @@ export class FileMatch extends Disposable implements IFileMatch {
...
@@ -192,8 +192,8 @@ export class FileMatch extends Disposable implements IFileMatch {
return
(
selected
?
FileMatch
.
_CURRENT_FIND_MATCH
:
FileMatch
.
_FIND_MATCH
);
return
(
selected
?
FileMatch
.
_CURRENT_FIND_MATCH
:
FileMatch
.
_FIND_MATCH
);
}
}
private
_onChange
=
this
.
_register
(
new
Emitter
<
{
didRemove
?:
boolean
;
forceUpdateModel
?:
boolean
}
>
());
private
_onChange
=
this
.
_register
(
new
Emitter
<
{
didRemove
?:
boolean
;
forceUpdateModel
?:
boolean
;
userRemoved
?:
boolean
}
>
());
readonly
onChange
:
Event
<
{
didRemove
?:
boolean
;
forceUpdateModel
?:
boolean
}
>
=
this
.
_onChange
.
event
;
readonly
onChange
:
Event
<
{
didRemove
?:
boolean
;
forceUpdateModel
?:
boolean
;
userRemoved
?:
boolean
}
>
=
this
.
_onChange
.
event
;
private
_onDispose
=
this
.
_register
(
new
Emitter
<
void
>
());
private
_onDispose
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onDispose
:
Event
<
void
>
=
this
.
_onDispose
.
event
;
readonly
onDispose
:
Event
<
void
>
=
this
.
_onDispose
.
event
;
...
@@ -354,10 +354,10 @@ export class FileMatch extends Disposable implements IFileMatch {
...
@@ -354,10 +354,10 @@ export class FileMatch extends Disposable implements IFileMatch {
return
values
(
this
.
_matches
);
return
values
(
this
.
_matches
);
}
}
remove
(
match
:
Match
):
void
{
remove
(
match
:
Match
,
userRemoved
?:
boolean
):
void
{
this
.
removeMatch
(
match
);
this
.
removeMatch
(
match
);
this
.
_removedMatches
.
add
(
match
.
id
());
this
.
_removedMatches
.
add
(
match
.
id
());
this
.
_onChange
.
fire
({
didRemove
:
true
});
this
.
_onChange
.
fire
({
didRemove
:
true
,
userRemoved
});
}
}
replace
(
toReplace
:
Match
):
Promise
<
void
>
{
replace
(
toReplace
:
Match
):
Promise
<
void
>
{
...
@@ -447,6 +447,7 @@ export interface IChangeEvent {
...
@@ -447,6 +447,7 @@ export interface IChangeEvent {
elements
:
FileMatch
[];
elements
:
FileMatch
[];
added
?:
boolean
;
added
?:
boolean
;
removed
?:
boolean
;
removed
?:
boolean
;
userRemoved
?:
boolean
;
}
}
export
class
FolderMatch
extends
Disposable
{
export
class
FolderMatch
extends
Disposable
{
...
@@ -529,7 +530,7 @@ export class FolderMatch extends Disposable {
...
@@ -529,7 +530,7 @@ export class FolderMatch extends Disposable {
const
fileMatch
=
this
.
instantiationService
.
createInstance
(
FileMatch
,
this
.
_query
.
contentPattern
,
this
.
_query
.
previewOptions
,
this
.
_query
.
maxResults
,
this
,
rawFileMatch
);
const
fileMatch
=
this
.
instantiationService
.
createInstance
(
FileMatch
,
this
.
_query
.
contentPattern
,
this
.
_query
.
previewOptions
,
this
.
_query
.
maxResults
,
this
,
rawFileMatch
);
this
.
doAdd
(
fileMatch
);
this
.
doAdd
(
fileMatch
);
added
.
push
(
fileMatch
);
added
.
push
(
fileMatch
);
const
disposable
=
fileMatch
.
onChange
(({
didRemove
})
=>
this
.
onFileChange
(
fileMatch
,
didRemove
));
const
disposable
=
fileMatch
.
onChange
(({
didRemove
,
userRemoved
})
=>
this
.
onFileChange
(
fileMatch
,
didRemove
,
userRemoved
));
fileMatch
.
onDispose
(()
=>
disposable
.
dispose
());
fileMatch
.
onDispose
(()
=>
disposable
.
dispose
());
}
}
});
});
...
@@ -540,14 +541,14 @@ export class FolderMatch extends Disposable {
...
@@ -540,14 +541,14 @@ export class FolderMatch extends Disposable {
}
}
}
}
clear
():
void
{
clear
(
userRemoved
?:
boolean
):
void
{
const
changed
:
FileMatch
[]
=
this
.
matches
();
const
changed
:
FileMatch
[]
=
this
.
matches
();
this
.
disposeMatches
();
this
.
disposeMatches
();
this
.
_onChange
.
fire
({
elements
:
changed
,
removed
:
true
});
this
.
_onChange
.
fire
({
elements
:
changed
,
removed
:
true
,
userRemoved
});
}
}
remove
(
matches
:
FileMatch
|
FileMatch
[]):
void
{
remove
(
matches
:
FileMatch
|
FileMatch
[]
,
userRemoved
?:
boolean
):
void
{
this
.
doRemove
(
matches
);
this
.
doRemove
(
matches
,
undefined
,
undefined
,
userRemoved
);
}
}
replace
(
match
:
FileMatch
):
Promise
<
any
>
{
replace
(
match
:
FileMatch
):
Promise
<
any
>
{
...
@@ -577,7 +578,7 @@ export class FolderMatch extends Disposable {
...
@@ -577,7 +578,7 @@ export class FolderMatch extends Disposable {
return
this
.
matches
().
reduce
<
number
>
((
prev
,
match
)
=>
prev
+
match
.
count
(),
0
);
return
this
.
matches
().
reduce
<
number
>
((
prev
,
match
)
=>
prev
+
match
.
count
(),
0
);
}
}
private
onFileChange
(
fileMatch
:
FileMatch
,
removed
=
false
):
void
{
private
onFileChange
(
fileMatch
:
FileMatch
,
removed
=
false
,
userRemoved
=
false
):
void
{
let
added
=
false
;
let
added
=
false
;
if
(
!
this
.
_fileMatches
.
has
(
fileMatch
.
resource
))
{
if
(
!
this
.
_fileMatches
.
has
(
fileMatch
.
resource
))
{
this
.
doAdd
(
fileMatch
);
this
.
doAdd
(
fileMatch
);
...
@@ -589,7 +590,7 @@ export class FolderMatch extends Disposable {
...
@@ -589,7 +590,7 @@ export class FolderMatch extends Disposable {
removed
=
true
;
removed
=
true
;
}
}
if
(
!
this
.
_replacingAll
)
{
if
(
!
this
.
_replacingAll
)
{
this
.
_onChange
.
fire
({
elements
:
[
fileMatch
],
added
:
added
,
removed
:
removed
});
this
.
_onChange
.
fire
({
elements
:
[
fileMatch
],
added
:
added
,
removed
:
removed
,
userRemoved
});
}
}
}
}
...
@@ -600,7 +601,7 @@ export class FolderMatch extends Disposable {
...
@@ -600,7 +601,7 @@ export class FolderMatch extends Disposable {
}
}
}
}
private
doRemove
(
fileMatches
:
FileMatch
|
FileMatch
[],
dispose
:
boolean
=
true
,
trigger
:
boolean
=
true
):
void
{
private
doRemove
(
fileMatches
:
FileMatch
|
FileMatch
[],
dispose
:
boolean
=
true
,
trigger
:
boolean
=
true
,
userRemoved
:
boolean
=
false
):
void
{
if
(
!
Array
.
isArray
(
fileMatches
))
{
if
(
!
Array
.
isArray
(
fileMatches
))
{
fileMatches
=
[
fileMatches
];
fileMatches
=
[
fileMatches
];
}
}
...
@@ -615,7 +616,7 @@ export class FolderMatch extends Disposable {
...
@@ -615,7 +616,7 @@ export class FolderMatch extends Disposable {
}
}
if
(
trigger
)
{
if
(
trigger
)
{
this
.
_onChange
.
fire
({
elements
:
fileMatches
,
removed
:
true
});
this
.
_onChange
.
fire
({
elements
:
fileMatches
,
removed
:
true
,
userRemoved
});
}
}
}
}
...
@@ -717,7 +718,7 @@ export class SearchResult extends Disposable {
...
@@ -717,7 +718,7 @@ export class SearchResult extends Disposable {
this
.
_register
(
this
.
modelService
.
onModelAdded
(
model
=>
this
.
onModelAdded
(
model
)));
this
.
_register
(
this
.
modelService
.
onModelAdded
(
model
=>
this
.
onModelAdded
(
model
)));
this
.
_register
(
this
.
onChange
(
e
=>
{
this
.
_register
(
this
.
onChange
(
e
=>
{
if
(
e
.
r
emoved
)
{
if
(
e
.
userR
emoved
)
{
this
.
_hasRemovedResults
=
true
;
this
.
_hasRemovedResults
=
true
;
}
}
}));
}));
...
@@ -808,14 +809,14 @@ export class SearchResult extends Disposable {
...
@@ -808,14 +809,14 @@ export class SearchResult extends Disposable {
this
.
_otherFilesMatch
=
null
;
this
.
_otherFilesMatch
=
null
;
}
}
remove
(
matches
:
FileMatch
|
FolderMatch
|
(
FileMatch
|
FolderMatch
)[]):
void
{
remove
(
matches
:
FileMatch
|
FolderMatch
|
(
FileMatch
|
FolderMatch
)[]
,
userRemoved
?:
boolean
):
void
{
if
(
!
Array
.
isArray
(
matches
))
{
if
(
!
Array
.
isArray
(
matches
))
{
matches
=
[
matches
];
matches
=
[
matches
];
}
}
matches
.
forEach
(
m
=>
{
matches
.
forEach
(
m
=>
{
if
(
m
instanceof
FolderMatch
)
{
if
(
m
instanceof
FolderMatch
)
{
m
.
clear
();
m
.
clear
(
userRemoved
);
}
}
});
});
...
@@ -827,11 +828,11 @@ export class SearchResult extends Disposable {
...
@@ -827,11 +828,11 @@ export class SearchResult extends Disposable {
return
;
return
;
}
}
this
.
getFolderMatch
(
matches
[
0
].
resource
).
remove
(
<
FileMatch
[]
>
matches
);
this
.
getFolderMatch
(
matches
[
0
].
resource
).
remove
(
<
FileMatch
[]
>
matches
,
userRemoved
);
});
});
if
(
other
.
length
)
{
if
(
other
.
length
)
{
this
.
getFolderMatch
(
other
[
0
].
resource
).
remove
(
<
FileMatch
[]
>
other
);
this
.
getFolderMatch
(
other
[
0
].
resource
).
remove
(
<
FileMatch
[]
>
other
,
userRemoved
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录