Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
59213a4c
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
59213a4c
编写于
1月 10, 2020
作者:
J
Jackson Kearl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Keep track of query includes/excludes expansion state
上级
f6f99313
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
13 deletion
+19
-13
src/vs/workbench/contrib/search/browser/searchEditor.ts
src/vs/workbench/contrib/search/browser/searchEditor.ts
+13
-8
src/vs/workbench/contrib/search/browser/searchEditorCommands.ts
.../workbench/contrib/search/browser/searchEditorCommands.ts
+4
-2
src/vs/workbench/contrib/search/browser/searchWidget.ts
src/vs/workbench/contrib/search/browser/searchWidget.ts
+2
-3
未找到文件。
src/vs/workbench/contrib/search/browser/searchEditor.ts
浏览文件 @
59213a4c
...
...
@@ -57,6 +57,7 @@ export class SearchEditor extends BaseEditor {
private
runSearchDelayer
=
new
Delayer
(
300
);
private
pauseSearching
:
boolean
=
false
;
private
showingIncludesExcludes
:
boolean
=
false
;
constructor
(
@
ITelemetryService
telemetryService
:
ITelemetryService
,
...
...
@@ -82,7 +83,7 @@ export class SearchEditor extends BaseEditor {
this
.
queryEditorWidget
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
SearchWidget
,
this
.
queryEditorContainer
,
{
_hideReplaceToggle
:
true
,
showContextToggle
:
true
}));
this
.
_register
(
this
.
queryEditorWidget
.
onReplaceToggled
(()
=>
this
.
reLayout
()));
this
.
_register
(
this
.
queryEditorWidget
.
onDidHeightChange
(()
=>
this
.
reLayout
()));
this
.
queryEditorWidget
.
onSearchSubmit
(()
=>
this
.
runSearch
(
));
this
.
queryEditorWidget
.
onSearchSubmit
(()
=>
this
.
runSearch
(
true
));
// onSearchSubmit has an internal delayer, so skip over ours.
this
.
queryEditorWidget
.
searchInput
.
onDidOptionChange
(()
=>
this
.
runSearch
());
this
.
queryEditorWidget
.
onDidToggleContext
(()
=>
this
.
runSearch
());
...
...
@@ -92,14 +93,14 @@ export class SearchEditor extends BaseEditor {
this
.
toggleQueryDetailsButton
=
DOM
.
append
(
this
.
includesExcludesContainer
,
DOM
.
$
(
'
.expand.codicon.codicon-ellipsis
'
,
{
tabindex
:
0
,
role
:
'
button
'
,
title
:
localize
(
'
moreSearch
'
,
"
Toggle Search Details
"
)
}));
this
.
_register
(
DOM
.
addDisposableListener
(
this
.
toggleQueryDetailsButton
,
DOM
.
EventType
.
CLICK
,
e
=>
{
DOM
.
EventHelper
.
stop
(
e
);
this
.
toggle
QueryDetail
s
();
this
.
toggle
IncludesExclude
s
();
}));
this
.
_register
(
DOM
.
addDisposableListener
(
this
.
toggleQueryDetailsButton
,
DOM
.
EventType
.
KEY_UP
,
(
e
:
KeyboardEvent
)
=>
{
const
event
=
new
StandardKeyboardEvent
(
e
);
if
(
event
.
equals
(
KeyCode
.
Enter
)
||
event
.
equals
(
KeyCode
.
Space
))
{
DOM
.
EventHelper
.
stop
(
e
);
this
.
toggle
QueryDetail
s
();
this
.
toggle
IncludesExclude
s
();
}
}));
this
.
_register
(
DOM
.
addDisposableListener
(
this
.
toggleQueryDetailsButton
,
DOM
.
EventType
.
KEY_DOWN
,
(
e
:
KeyboardEvent
)
=>
{
...
...
@@ -159,9 +160,9 @@ export class SearchEditor extends BaseEditor {
});
}
private
async
runSearch
()
{
private
async
runSearch
(
instant
=
false
)
{
if
(
!
this
.
pauseSearching
)
{
this
.
runSearchDelayer
.
trigger
(()
=>
this
.
doRunSearch
());
this
.
runSearchDelayer
.
trigger
(()
=>
this
.
doRunSearch
()
,
instant
?
0
:
undefined
);
}
}
...
...
@@ -176,7 +177,8 @@ export class SearchEditor extends BaseEditor {
query
:
this
.
queryEditorWidget
.
searchInput
.
getValue
(),
regexp
:
this
.
queryEditorWidget
.
searchInput
.
getRegex
(),
wholeWord
:
this
.
queryEditorWidget
.
searchInput
.
getWholeWords
(),
useIgnores
:
this
.
inputPatternExcludes
.
useExcludesAndIgnoreFiles
()
useIgnores
:
this
.
inputPatternExcludes
.
useExcludesAndIgnoreFiles
(),
showIncludesExcludes
:
this
.
showingIncludesExcludes
};
const
content
:
IPatternInfo
=
{
...
...
@@ -264,15 +266,16 @@ export class SearchEditor extends BaseEditor {
this
.
inputPatternExcludes
.
setValue
(
newInput
.
config
.
excludes
);
this
.
inputPatternIncludes
.
setValue
(
newInput
.
config
.
includes
);
this
.
inputPatternExcludes
.
setUseExcludesAndIgnoreFiles
(
newInput
.
config
.
useIgnores
);
this
.
toggleIncludesExcludes
(
newInput
.
config
.
showIncludesExcludes
);
this
.
focusInput
();
await
super
.
setInput
(
newInput
,
options
,
token
);
this
.
pauseSearching
=
false
;
}
toggleQueryDetails
(
):
void
{
private
toggleIncludesExcludes
(
_shouldShow
?:
boolean
):
void
{
const
cls
=
'
expanded
'
;
const
shouldShow
=
!
DOM
.
hasClass
(
this
.
includesExcludesContainer
,
cls
);
const
shouldShow
=
_shouldShow
??
!
DOM
.
hasClass
(
this
.
includesExcludesContainer
,
cls
);
if
(
shouldShow
)
{
this
.
toggleQueryDetailsButton
.
setAttribute
(
'
aria-expanded
'
,
'
true
'
);
...
...
@@ -282,6 +285,8 @@ export class SearchEditor extends BaseEditor {
DOM
.
removeClass
(
this
.
includesExcludesContainer
,
cls
);
}
this
.
showingIncludesExcludes
=
DOM
.
hasClass
(
this
.
includesExcludesContainer
,
cls
);
this
.
reLayout
();
}
...
...
src/vs/workbench/contrib/search/browser/searchEditorCommands.ts
浏览文件 @
59213a4c
...
...
@@ -39,7 +39,8 @@ export type SearchConfiguration = {
wholeWord
:
boolean
,
caseSensitive
:
boolean
,
regexp
:
boolean
,
useIgnores
:
boolean
useIgnores
:
boolean
,
showIncludesExcludes
:
boolean
,
};
let
searchEditorInputInstances
=
0
;
...
...
@@ -57,7 +58,7 @@ export class SearchEditorInput extends EditorInput {
super
();
if
(
config
===
undefined
)
{
this
.
config
=
{
query
:
''
,
includes
:
''
,
excludes
:
''
,
contextLines
:
0
,
wholeWord
:
false
,
caseSensitive
:
false
,
regexp
:
false
,
useIgnores
:
true
};
this
.
config
=
{
query
:
''
,
includes
:
''
,
excludes
:
''
,
contextLines
:
0
,
wholeWord
:
false
,
caseSensitive
:
false
,
regexp
:
false
,
useIgnores
:
true
,
showIncludesExcludes
:
false
};
}
else
{
this
.
config
=
config
;
}
...
...
@@ -416,6 +417,7 @@ export const createEditorFromSearchResult =
excludes
:
rawExcludePattern
,
contextLines
:
0
,
useIgnores
:
!
searchResult
.
query
.
userDisabledExcludesAndIgnoreFiles
,
showIncludesExcludes
:
!!
(
rawExcludePattern
||
rawExcludePattern
||
searchResult
.
query
.
userDisabledExcludesAndIgnoreFiles
)
}),
{
pinned
:
true
})
as
SearchEditor
;
...
...
src/vs/workbench/contrib/search/browser/searchWidget.ts
浏览文件 @
59213a4c
...
...
@@ -160,7 +160,6 @@ export class SearchWidget extends Widget {
private
temporarilySkipSearchOnChange
=
false
;
private
showContextCheckbox
!
:
Checkbox
;
private
contextLinesInput
!
:
InputBox
;
private
_contextLineInputDelayer
:
Delayer
<
void
>
;
constructor
(
container
:
HTMLElement
,
...
...
@@ -179,7 +178,6 @@ export class SearchWidget extends Widget {
this
.
replaceInputBoxFocused
=
Constants
.
ReplaceInputBoxFocusedKey
.
bindTo
(
this
.
contextKeyService
);
this
.
_replaceHistoryDelayer
=
new
Delayer
<
void
>
(
500
);
this
.
_contextLineInputDelayer
=
new
Delayer
<
void
>
(
300
);
this
.
_searchDelayer
=
this
.
_register
(
new
Delayer
<
void
>
(
this
.
searchConfiguration
.
searchOnTypeDebouncePeriod
));
this
.
render
(
container
,
options
);
...
...
@@ -386,7 +384,7 @@ export class SearchWidget extends Widget {
if
(
this
.
contextLinesInput
.
value
.
includes
(
'
-
'
))
{
this
.
contextLinesInput
.
value
=
'
0
'
;
}
this
.
_
contextLineInputDelayer
.
trigger
(()
=>
this
.
_onDidToggleContext
.
fire
()
);
this
.
_
onDidToggleContext
.
fire
(
);
}));
dom
.
append
(
searchInputContainer
,
this
.
showContextCheckbox
.
domNode
);
}
...
...
@@ -400,6 +398,7 @@ export class SearchWidget extends Widget {
this
.
showContextCheckbox
.
checked
=
true
;
this
.
contextLinesInput
.
value
=
''
+
lines
;
}
dom
.
toggleClass
(
this
.
domNode
,
'
show-context
'
,
this
.
showContextCheckbox
.
checked
);
}
private
renderReplaceInput
(
parent
:
HTMLElement
,
options
:
ISearchWidgetOptions
):
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录