Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
128a345e
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,发现更多精彩内容 >>
未验证
提交
128a345e
编写于
1月 25, 2018
作者:
R
Rachel Macfarlane
提交者:
GitHub
1月 25, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add 'Cancel Search' button, #30336
上级
ed4c2374
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
59 addition
and
5 deletion
+59
-5
src/vs/workbench/parts/search/browser/media/searchviewlet.css
...vs/workbench/parts/search/browser/media/searchviewlet.css
+9
-0
src/vs/workbench/parts/search/browser/media/stop-inverse.svg
src/vs/workbench/parts/search/browser/media/stop-inverse.svg
+1
-0
src/vs/workbench/parts/search/browser/media/stop.svg
src/vs/workbench/parts/search/browser/media/stop.svg
+1
-0
src/vs/workbench/parts/search/browser/searchActions.ts
src/vs/workbench/parts/search/browser/searchActions.ts
+26
-0
src/vs/workbench/parts/search/browser/searchViewlet.ts
src/vs/workbench/parts/search/browser/searchViewlet.ts
+22
-5
未找到文件。
src/vs/workbench/parts/search/browser/media/searchviewlet.css
浏览文件 @
128a345e
...
...
@@ -310,6 +310,15 @@
background
:
url('clear-search-results-dark.svg')
center
center
no-repeat
;
}
.monaco-workbench
.search-action.cancel-search
{
background
:
url('stop.svg')
center
center
no-repeat
;
}
.vs-dark
.monaco-workbench
.search-action.cancel-search
,
.hc-black
.monaco-workbench
.search-action.cancel-search
{
background
:
url('stop-inverse.svg')
center
center
no-repeat
;
}
.vs
.monaco-workbench
.search-viewlet
.query-details
.file-types
.controls
>
.custom-checkbox.pattern
{
background
:
url('pattern.svg')
center
center
no-repeat
;
}
...
...
src/vs/workbench/parts/search/browser/media/stop-inverse.svg
0 → 100644
浏览文件 @
128a345e
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 16 16"
enable-background=
"new 0 0 16 16"
height=
"16"
width=
"16"
><path
fill=
"#F6F6F6"
d=
"M13 13h-10v-10h10v10z"
/><path
fill=
"#C5C5C5"
d=
"M12 12h-8v-8h8v8z"
/></svg>
\ No newline at end of file
src/vs/workbench/parts/search/browser/media/stop.svg
0 → 100644
浏览文件 @
128a345e
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 16 16"
enable-background=
"new 0 0 16 16"
height=
"16"
width=
"16"
><path
fill=
"#F6F6F6"
d=
"M13 13h-10v-10h10v10z"
/><path
fill=
"#424242"
d=
"M12 12h-8v-8h8v8z"
/></svg>
\ No newline at end of file
src/vs/workbench/parts/search/browser/searchActions.ts
浏览文件 @
128a345e
...
...
@@ -379,6 +379,32 @@ export class ClearSearchResultsAction extends SearchAction {
}
}
export
class
CancelSearchAction
extends
SearchAction
{
static
ID
:
string
=
'
search.action.cancelSearch
'
;
static
LABEL
:
string
=
nls
.
localize
(
'
CancelSearchAction.label
'
,
"
Cancel Search
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IViewletService
viewletService
:
IViewletService
)
{
super
(
id
,
label
,
viewletService
);
this
.
class
=
'
search-action cancel-search
'
;
this
.
update
();
}
update
():
void
{
const
searchViewlet
=
this
.
getSearchViewlet
();
this
.
enabled
=
searchViewlet
&&
searchViewlet
.
isSearching
();
}
public
run
():
TPromise
<
void
>
{
const
searchViewlet
=
this
.
getSearchViewlet
();
if
(
searchViewlet
)
{
searchViewlet
.
cancelSearch
();
}
return
TPromise
.
as
(
null
);
}
}
export
class
FocusNextSearchResultAction
extends
Action
{
public
static
readonly
ID
=
'
search.action.focusNextSearchResult
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
FocusNextSearchResult.label
'
,
"
Focus Next Search Result
"
);
...
...
src/vs/workbench/parts/search/browser/searchViewlet.ts
浏览文件 @
128a345e
...
...
@@ -45,7 +45,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
import
{
PatternInputWidget
,
ExcludePatternInputWidget
}
from
'
vs/workbench/parts/search/browser/patternInputWidget
'
;
import
{
SearchRenderer
,
SearchDataSource
,
SearchSorter
,
SearchAccessibilityProvider
,
SearchFilter
}
from
'
vs/workbench/parts/search/browser/searchResultsView
'
;
import
{
SearchWidget
,
ISearchWidgetOptions
}
from
'
vs/workbench/parts/search/browser/searchWidget
'
;
import
{
RefreshAction
,
CollapseDeepestExpandedLevelAction
,
ClearSearchResultsAction
,
SearchAction
}
from
'
vs/workbench/parts/search/browser/searchActions
'
;
import
{
RefreshAction
,
CollapseDeepestExpandedLevelAction
,
ClearSearchResultsAction
,
SearchAction
,
CancelSearchAction
}
from
'
vs/workbench/parts/search/browser/searchActions
'
;
import
{
IReplaceService
}
from
'
vs/workbench/parts/search/common/replace
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
...
...
@@ -81,6 +81,7 @@ export class SearchViewlet extends Viewlet {
private
folderMatchFocused
:
IContextKey
<
boolean
>
;
private
matchFocused
:
IContextKey
<
boolean
>
;
private
searchSubmitted
:
boolean
;
private
searching
:
boolean
;
private
actions
:
SearchAction
[]
=
[];
private
tree
:
ITree
;
...
...
@@ -785,6 +786,10 @@ export class SearchViewlet extends Viewlet {
return
this
.
searchSubmitted
;
}
public
isSearching
():
boolean
{
return
this
.
searching
;
}
public
hasSearchResults
():
boolean
{
return
!
this
.
viewModel
.
searchResult
.
isEmpty
();
}
...
...
@@ -1066,11 +1071,17 @@ export class SearchViewlet extends Viewlet {
this
.
progressService
.
show
(
progressTotal
);
this
.
searchWidget
.
searchInput
.
clearMessage
();
this
.
searching
=
true
;
setTimeout
(()
=>
{
if
(
this
.
searching
)
{
this
.
changeActionAtPosition
(
0
,
this
.
instantiationService
.
createInstance
(
CancelSearchAction
,
CancelSearchAction
.
ID
,
CancelSearchAction
.
LABEL
));
}
},
2000
);
this
.
showEmptyStage
();
let
isDone
=
false
;
let
onComplete
=
(
completed
?:
ISearchComplete
)
=>
{
isDone
=
true
;
this
.
searching
=
false
;
this
.
changeActionAtPosition
(
0
,
this
.
instantiationService
.
createInstance
(
RefreshAction
,
RefreshAction
.
ID
,
RefreshAction
.
LABEL
));
// Complete up to 100% as needed
if
(
completed
&&
!
query
.
useRipgrep
)
{
...
...
@@ -1201,7 +1212,8 @@ export class SearchViewlet extends Viewlet {
if
(
errors
.
isPromiseCanceledError
(
e
))
{
onComplete
(
null
);
}
else
{
isDone
=
true
;
this
.
searching
=
false
;
this
.
changeActionAtPosition
(
0
,
this
.
instantiationService
.
createInstance
(
RefreshAction
,
RefreshAction
.
ID
,
RefreshAction
.
LABEL
));
progressRunner
.
done
();
this
.
searchWidget
.
searchInput
.
showMessage
({
content
:
e
.
message
,
type
:
MessageType
.
ERROR
});
this
.
viewModel
.
searchResult
.
clear
();
...
...
@@ -1223,7 +1235,7 @@ export class SearchViewlet extends Viewlet {
// Handle UI updates in an interval to show frequent progress and results
let
uiRefreshHandle
=
setInterval
(()
=>
{
if
(
isDone
)
{
if
(
!
this
.
searching
)
{
window
.
clearInterval
(
uiRefreshHandle
);
return
;
}
...
...
@@ -1424,6 +1436,11 @@ export class SearchViewlet extends Viewlet {
return
this
.
actions
;
}
private
changeActionAtPosition
(
index
:
number
,
newAction
:
SearchAction
):
void
{
this
.
actions
.
splice
(
index
,
1
,
newAction
);
this
.
updateTitleArea
();
}
public
shutdown
():
void
{
const
isRegex
=
this
.
searchWidget
.
searchInput
.
getRegex
();
const
isWholeWords
=
this
.
searchWidget
.
searchInput
.
getWholeWords
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录