Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6681c86c
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,发现更多精彩内容 >>
提交
6681c86c
编写于
11月 11, 2017
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #31260 - implement 'replace all' button for folder match in search viewlet
上级
5c6a388c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
2 deletion
+41
-2
src/vs/workbench/parts/search/browser/searchActions.ts
src/vs/workbench/parts/search/browser/searchActions.ts
+24
-0
src/vs/workbench/parts/search/browser/searchResultsView.ts
src/vs/workbench/parts/search/browser/searchResultsView.ts
+10
-2
src/vs/workbench/parts/search/common/searchModel.ts
src/vs/workbench/parts/search/common/searchModel.ts
+7
-0
未找到文件。
src/vs/workbench/parts/search/browser/searchActions.ts
浏览文件 @
6681c86c
...
@@ -604,6 +604,30 @@ export class ReplaceAllAction extends AbstractSearchAndReplaceAction {
...
@@ -604,6 +604,30 @@ export class ReplaceAllAction extends AbstractSearchAndReplaceAction {
}
}
}
}
export
class
ReplaceAllInFolderAction
extends
AbstractSearchAndReplaceAction
{
constructor
(
private
viewer
:
ITree
,
private
folderMatch
:
FolderMatch
,
@
IKeybindingService
keyBindingService
:
IKeybindingService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
)
{
super
(
Constants
.
ReplaceAllInFileActionId
,
nls
.
localize
(
'
file.replaceAll.label
'
,
"
Replace All
"
),
'
action-replace-all
'
);
}
public
async
run
():
TPromise
<
any
>
{
/* __GDPR__
"replaceAllInFolder.action.selected" : {}
*/
this
.
telemetryService
.
publicLog
(
'
replaceAllInFolder.action.selected
'
);
let
nextFocusElement
=
this
.
getElementToFocusAfterRemoved
(
this
.
viewer
,
this
.
folderMatch
);
await
this
.
folderMatch
.
replaceAll
();
if
(
nextFocusElement
)
{
this
.
viewer
.
setFocus
(
nextFocusElement
);
}
this
.
viewer
.
DOMFocus
();
}
}
export
class
ReplaceAction
extends
AbstractSearchAndReplaceAction
{
export
class
ReplaceAction
extends
AbstractSearchAndReplaceAction
{
constructor
(
private
viewer
:
ITree
,
private
element
:
Match
,
private
viewlet
:
SearchViewlet
,
constructor
(
private
viewer
:
ITree
,
private
element
:
Match
,
private
viewlet
:
SearchViewlet
,
...
...
src/vs/workbench/parts/search/browser/searchResultsView.ts
浏览文件 @
6681c86c
...
@@ -17,7 +17,7 @@ import { Match, SearchResult, FileMatch, FileMatchOrMatch, SearchModel, FolderMa
...
@@ -17,7 +17,7 @@ import { Match, SearchResult, FileMatch, FileMatchOrMatch, SearchModel, FolderMa
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
SearchViewlet
}
from
'
vs/workbench/parts/search/browser/searchViewlet
'
;
import
{
SearchViewlet
}
from
'
vs/workbench/parts/search/browser/searchViewlet
'
;
import
{
RemoveAction
,
ReplaceAllAction
,
ReplaceAction
}
from
'
vs/workbench/parts/search/browser/searchActions
'
;
import
{
RemoveAction
,
ReplaceAllAction
,
ReplaceAction
,
ReplaceAllInFolderAction
}
from
'
vs/workbench/parts/search/browser/searchActions
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
attachBadgeStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
attachBadgeStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
...
@@ -251,7 +251,15 @@ export class SearchRenderer extends Disposable implements IRenderer {
...
@@ -251,7 +251,15 @@ export class SearchRenderer extends Disposable implements IRenderer {
templateData
.
badge
.
setTitleFormat
(
count
>
1
?
nls
.
localize
(
'
searchFileMatches
'
,
"
{0} files found
"
,
count
)
:
nls
.
localize
(
'
searchFileMatch
'
,
"
{0} file found
"
,
count
));
templateData
.
badge
.
setTitleFormat
(
count
>
1
?
nls
.
localize
(
'
searchFileMatches
'
,
"
{0} files found
"
,
count
)
:
nls
.
localize
(
'
searchFileMatch
'
,
"
{0} file found
"
,
count
));
templateData
.
actions
.
clear
();
templateData
.
actions
.
clear
();
templateData
.
actions
.
push
([
new
RemoveAction
(
tree
,
folderMatch
)],
{
icon
:
true
,
label
:
false
});
const
input
=
<
SearchResult
>
tree
.
getInput
();
const
actions
:
IAction
[]
=
[];
if
(
input
.
searchModel
.
isReplaceActive
()
&&
count
>
0
)
{
actions
.
push
(
this
.
instantiationService
.
createInstance
(
ReplaceAllInFolderAction
,
tree
,
folderMatch
));
}
actions
.
push
(
new
RemoveAction
(
tree
,
folderMatch
));
templateData
.
actions
.
push
(
actions
,
{
icon
:
true
,
label
:
false
});
}
}
private
renderFileMatch
(
tree
:
ITree
,
fileMatch
:
FileMatch
,
templateData
:
IFileMatchTemplate
):
void
{
private
renderFileMatch
(
tree
:
ITree
,
fileMatch
:
FileMatch
,
templateData
:
IFileMatchTemplate
):
void
{
...
...
src/vs/workbench/parts/search/common/searchModel.ts
浏览文件 @
6681c86c
...
@@ -422,6 +422,13 @@ export class FolderMatch extends Disposable {
...
@@ -422,6 +422,13 @@ export class FolderMatch extends Disposable {
});
});
}
}
public
replaceAll
():
TPromise
<
any
>
{
const
matches
=
this
.
matches
();
return
this
.
replaceService
.
replace
(
matches
).
then
(()
=>
{
matches
.
forEach
(
match
=>
this
.
doRemove
(
match
,
false
,
true
));
});
}
public
matches
():
FileMatch
[]
{
public
matches
():
FileMatch
[]
{
return
this
.
_fileMatches
.
values
();
return
this
.
_fileMatches
.
values
();
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录