Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4d4f9638
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,发现更多精彩内容 >>
提交
4d4f9638
编写于
2月 15, 2019
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #68399 - fix tree errors when removing items from the search results tree
上级
df619d25
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
35 deletion
+19
-35
src/vs/workbench/contrib/search/browser/search.contribution.ts
...s/workbench/contrib/search/browser/search.contribution.ts
+1
-1
src/vs/workbench/contrib/search/browser/searchActions.ts
src/vs/workbench/contrib/search/browser/searchActions.ts
+8
-24
src/vs/workbench/contrib/search/browser/searchResultsView.ts
src/vs/workbench/contrib/search/browser/searchResultsView.ts
+5
-5
src/vs/workbench/contrib/search/browser/searchView.ts
src/vs/workbench/contrib/search/browser/searchView.ts
+4
-4
src/vs/workbench/contrib/search/common/searchModel.ts
src/vs/workbench/contrib/search/common/searchModel.ts
+1
-1
未找到文件。
src/vs/workbench/contrib/search/browser/search.contribution.ts
浏览文件 @
4d4f9638
...
...
@@ -122,7 +122,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
handler
:
(
accessor
,
args
:
any
)
=>
{
const
searchView
=
getSearchView
(
accessor
.
get
(
IViewletService
),
accessor
.
get
(
IPanelService
));
const
tree
:
WorkbenchObjectTree
<
RenderableMatch
>
=
searchView
.
getControl
();
accessor
.
get
(
IInstantiationService
).
createInstance
(
RemoveAction
,
searchView
,
tree
,
tree
.
getFocus
()[
0
]).
run
();
accessor
.
get
(
IInstantiationService
).
createInstance
(
RemoveAction
,
tree
,
tree
.
getFocus
()[
0
]).
run
();
}
});
...
...
src/vs/workbench/contrib/search/browser/searchActions.ts
浏览文件 @
4d4f9638
...
...
@@ -25,7 +25,7 @@ import { ISearchConfiguration, ISearchHistoryService, VIEW_ID } from 'vs/workben
import
{
SearchView
}
from
'
vs/workbench/contrib/search/browser/searchView
'
;
import
*
as
Constants
from
'
vs/workbench/contrib/search/common/constants
'
;
import
{
IReplaceService
}
from
'
vs/workbench/contrib/search/common/replace
'
;
import
{
FileMatch
,
FileMatchOrMatch
,
FolderMatch
,
Match
,
RenderableMatch
,
searchMatchComparer
,
SearchResult
}
from
'
vs/workbench/contrib/search/common/searchModel
'
;
import
{
FileMatch
,
FileMatchOrMatch
,
FolderMatch
,
Match
,
RenderableMatch
,
searchMatchComparer
,
SearchResult
,
BaseFolderMatch
}
from
'
vs/workbench/contrib/search/common/searchModel
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
...
...
@@ -277,7 +277,7 @@ export class CollapseDeepestExpandedLevelAction extends Action {
const
navigator
=
viewer
.
navigate
();
let
node
=
navigator
.
first
();
let
collapseFileMatchLevel
=
false
;
if
(
node
instanceof
FolderMatch
)
{
if
(
node
instanceof
Base
FolderMatch
)
{
while
(
node
=
navigator
.
next
())
{
if
(
node
instanceof
Match
)
{
collapseFileMatchLevel
=
true
;
...
...
@@ -407,8 +407,8 @@ export abstract class AbstractSearchAndReplaceAction extends Action {
getNextElementAfterRemoved
(
viewer
:
WorkbenchObjectTree
<
RenderableMatch
>
,
element
:
RenderableMatch
):
RenderableMatch
{
const
navigator
:
INavigator
<
any
>
=
viewer
.
navigate
(
element
);
if
(
element
instanceof
FolderMatch
)
{
while
(
!!
navigator
.
next
()
&&
!
(
navigator
.
current
()
instanceof
FolderMatch
))
{
}
if
(
element
instanceof
Base
FolderMatch
)
{
while
(
!!
navigator
.
next
()
&&
!
(
navigator
.
current
()
instanceof
Base
FolderMatch
))
{
}
}
else
if
(
element
instanceof
FileMatch
)
{
while
(
!!
navigator
.
next
()
&&
!
(
navigator
.
current
()
instanceof
FileMatch
))
{
}
}
else
{
...
...
@@ -435,7 +435,7 @@ export abstract class AbstractSearchAndReplaceAction extends Action {
// If the previous element is a File or Folder, expand it and go to its last child.
// Spell out the two cases, would be too easy to create an infinite loop, like by adding another level...
if
(
element
instanceof
Match
&&
previousElement
&&
previousElement
instanceof
FolderMatch
)
{
if
(
element
instanceof
Match
&&
previousElement
&&
previousElement
instanceof
Base
FolderMatch
)
{
navigator
.
next
();
viewer
.
expand
(
previousElement
);
previousElement
=
navigator
.
previous
();
...
...
@@ -456,7 +456,6 @@ export class RemoveAction extends AbstractSearchAndReplaceAction {
static
LABEL
=
nls
.
localize
(
'
RemoveAction.label
'
,
"
Dismiss
"
);
constructor
(
private
viewlet
:
SearchView
,
private
viewer
:
WorkbenchObjectTree
<
RenderableMatch
>
,
private
element
:
RenderableMatch
)
{
...
...
@@ -474,24 +473,9 @@ export class RemoveAction extends AbstractSearchAndReplaceAction {
this
.
viewer
.
setFocus
([
nextFocusElement
],
getKeyboardEventForEditorOpen
());
}
let
elementToRefresh
:
FolderMatch
|
FileMatch
|
SearchResult
|
undefined
;
const
element
=
this
.
element
;
if
(
element
instanceof
FolderMatch
)
{
const
parent
=
element
.
parent
();
parent
.
remove
(
element
);
elementToRefresh
=
parent
;
}
else
if
(
element
instanceof
FileMatch
)
{
const
parent
=
element
.
parent
();
parent
.
remove
(
element
);
elementToRefresh
=
parent
;
}
else
if
(
element
instanceof
Match
)
{
const
parent
=
element
.
parent
();
parent
.
remove
(
element
);
elementToRefresh
=
parent
.
count
()
===
0
?
parent
.
parent
()
:
parent
;
}
this
.
element
.
parent
().
remove
(
<
any
>
this
.
element
);
this
.
viewer
.
domFocus
();
this
.
viewlet
.
refreshTree
({
elements
:
[
elementToRefresh
]
});
return
Promise
.
resolve
();
}
}
...
...
@@ -716,7 +700,7 @@ export const copyMatchCommand: ICommandHandler = (accessor, match: RenderableMat
text
=
matchToString
(
match
);
}
else
if
(
match
instanceof
FileMatch
)
{
text
=
fileMatchToString
(
match
,
maxClipboardMatches
).
text
;
}
else
if
(
match
instanceof
FolderMatch
)
{
}
else
if
(
match
instanceof
Base
FolderMatch
)
{
text
=
folderMatchToString
(
match
,
maxClipboardMatches
).
text
;
}
...
...
src/vs/workbench/contrib/search/browser/searchResultsView.ts
浏览文件 @
4d4f9638
...
...
@@ -135,7 +135,7 @@ export class FolderMatchRenderer extends Disposable implements ITreeRenderer<Fol
actions
.
push
(
this
.
instantiationService
.
createInstance
(
ReplaceAllInFolderAction
,
this
.
searchView
.
getControl
(),
folderMatch
));
}
actions
.
push
(
new
RemoveAction
(
this
.
searchView
,
this
.
searchView
.
getControl
(),
folderMatch
));
actions
.
push
(
new
RemoveAction
(
this
.
searchView
.
getControl
(),
folderMatch
));
templateData
.
actions
.
push
(
actions
,
{
icon
:
true
,
label
:
false
});
}
...
...
@@ -197,7 +197,7 @@ export class FileMatchRenderer extends Disposable implements ITreeRenderer<FileM
if
(
this
.
searchModel
.
isReplaceActive
()
&&
count
>
0
)
{
actions
.
push
(
this
.
instantiationService
.
createInstance
(
ReplaceAllAction
,
this
.
searchView
,
fileMatch
));
}
actions
.
push
(
new
RemoveAction
(
this
.
searchView
,
this
.
searchView
.
getControl
(),
fileMatch
));
actions
.
push
(
new
RemoveAction
(
this
.
searchView
.
getControl
(),
fileMatch
));
templateData
.
actions
.
push
(
actions
,
{
icon
:
true
,
label
:
false
});
}
...
...
@@ -271,9 +271,9 @@ export class MatchRenderer extends Disposable implements ITreeRenderer<Match, vo
templateData
.
actions
.
clear
();
if
(
this
.
searchModel
.
isReplaceActive
())
{
templateData
.
actions
.
push
([
this
.
instantiationService
.
createInstance
(
ReplaceAction
,
this
.
searchView
.
getControl
(),
match
,
this
.
searchView
),
new
RemoveAction
(
this
.
searchView
,
this
.
searchView
.
getControl
(),
match
)],
{
icon
:
true
,
label
:
false
});
templateData
.
actions
.
push
([
this
.
instantiationService
.
createInstance
(
ReplaceAction
,
this
.
searchView
.
getControl
(),
match
,
this
.
searchView
),
new
RemoveAction
(
this
.
searchView
.
getControl
(),
match
)],
{
icon
:
true
,
label
:
false
});
}
else
{
templateData
.
actions
.
push
([
new
RemoveAction
(
this
.
searchView
,
this
.
searchView
.
getControl
(),
match
)],
{
icon
:
true
,
label
:
false
});
templateData
.
actions
.
push
([
new
RemoveAction
(
this
.
searchView
.
getControl
(),
match
)],
{
icon
:
true
,
label
:
false
});
}
}
...
...
@@ -309,7 +309,7 @@ export class SearchAccessibilityProvider implements IAccessibilityProvider<Rende
}
getAriaLabel
(
element
:
RenderableMatch
):
string
{
if
(
element
instanceof
FolderMatch
)
{
if
(
element
instanceof
Base
FolderMatch
)
{
return
element
.
hasResource
()
?
nls
.
localize
(
'
folderMatchAriaLabel
'
,
"
{0} matches in folder root {1}, Search result
"
,
element
.
count
(),
element
.
name
())
:
nls
.
localize
(
'
otherFilesAriaLabel
'
,
"
{0} matches outside of the workspace, Search result
"
,
element
.
count
());
...
...
src/vs/workbench/contrib/search/browser/searchView.ts
浏览文件 @
4d4f9638
...
...
@@ -55,7 +55,7 @@ import * as Constants from 'vs/workbench/contrib/search/common/constants';
import
{
ITextQueryBuilderOptions
,
QueryBuilder
}
from
'
vs/workbench/contrib/search/common/queryBuilder
'
;
import
{
IReplaceService
}
from
'
vs/workbench/contrib/search/common/replace
'
;
import
{
getOutOfWorkspaceEditorResources
}
from
'
vs/workbench/contrib/search/common/search
'
;
import
{
FileMatch
,
FileMatchOrMatch
,
FolderMatch
,
IChangeEvent
,
ISearchWorkbenchService
,
Match
,
RenderableMatch
,
searchMatchComparer
,
SearchModel
,
SearchResult
}
from
'
vs/workbench/contrib/search/common/searchModel
'
;
import
{
FileMatch
,
FileMatchOrMatch
,
FolderMatch
,
IChangeEvent
,
ISearchWorkbenchService
,
Match
,
RenderableMatch
,
searchMatchComparer
,
SearchModel
,
SearchResult
,
BaseFolderMatch
}
from
'
vs/workbench/contrib/search/common/searchModel
'
;
import
{
ACTIVE_GROUP
,
IEditorService
,
SIDE_GROUP
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
...
...
@@ -443,7 +443,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
this
.
tree
.
setChildren
(
null
,
this
.
createResultIterator
(
collapseResults
));
}
else
{
event
.
elements
.
forEach
(
element
=>
{
if
(
element
instanceof
FolderMatch
)
{
if
(
element
instanceof
Base
FolderMatch
)
{
// The folder may or may not be in the tree. Refresh the whole thing.
this
.
tree
.
setChildren
(
null
,
this
.
createResultIterator
(
collapseResults
));
return
;
...
...
@@ -496,9 +496,9 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
return
Iterator
.
map
(
matchesIt
,
r
=>
(
<
ITreeElement
<
RenderableMatch
>>
{
element
:
r
}));
}
private
createIterator
(
match
:
FolderMatch
|
FileMatch
|
SearchResult
,
collapseResults
:
ISearchConfigurationProperties
[
'
collapseResults
'
]):
Iterator
<
ITreeElement
<
RenderableMatch
>>
{
private
createIterator
(
match
:
Base
FolderMatch
|
FileMatch
|
SearchResult
,
collapseResults
:
ISearchConfigurationProperties
[
'
collapseResults
'
]):
Iterator
<
ITreeElement
<
RenderableMatch
>>
{
return
match
instanceof
SearchResult
?
this
.
createResultIterator
(
collapseResults
)
:
match
instanceof
FolderMatch
?
this
.
createFolderIterator
(
match
,
collapseResults
)
:
match
instanceof
Base
FolderMatch
?
this
.
createFolderIterator
(
match
,
collapseResults
)
:
this
.
createFileIterator
(
match
);
}
...
...
src/vs/workbench/contrib/search/common/searchModel.ts
浏览文件 @
4d4f9638
...
...
@@ -598,7 +598,7 @@ export class FolderMatch extends BaseFolderMatch {
* and their sort order is undefined.
*/
export
function
searchMatchComparer
(
elementA
:
RenderableMatch
,
elementB
:
RenderableMatch
):
number
{
if
(
elementA
instanceof
FolderMatch
&&
elementB
instanceof
FolderMatch
)
{
if
(
elementA
instanceof
BaseFolderMatch
&&
elementB
instanceof
Base
FolderMatch
)
{
return
elementA
.
index
()
-
elementB
.
index
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录