Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4c41eca2
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,发现更多精彩内容 >>
提交
4c41eca2
编写于
3月 24, 2017
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
✨
"Use exclude settings" button to control using search.exclude and files.exclude
上级
16d82e7d
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
109 addition
and
54 deletion
+109
-54
src/vs/platform/search/common/search.ts
src/vs/platform/search/common/search.ts
+1
-0
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/patternInputWidget.ts
src/vs/workbench/parts/search/browser/patternInputWidget.ts
+76
-39
src/vs/workbench/parts/search/browser/searchViewlet.ts
src/vs/workbench/parts/search/browser/searchViewlet.ts
+16
-10
src/vs/workbench/parts/search/common/searchQuery.ts
src/vs/workbench/parts/search/common/searchQuery.ts
+7
-5
未找到文件。
src/vs/platform/search/common/search.ts
浏览文件 @
4c41eca2
...
...
@@ -37,6 +37,7 @@ export interface IQueryOptions {
fileEncoding
?:
string
;
useRipgrep
?:
boolean
;
useIgnoreFiles
?:
boolean
;
useExcludeSettings
?:
boolean
;
}
export
interface
ISearchQuery
extends
IQueryOptions
{
...
...
src/vs/workbench/parts/search/browser/media/searchviewlet.css
浏览文件 @
4c41eca2
...
...
@@ -310,6 +310,15 @@
background-size
:
18px
18px
;
}
.vs
.monaco-workbench
.search-viewlet
.query-details
.file-types
.controls
>
.custom-checkbox.useExcludeSettings
{
background
:
url('configure.svg')
center
center
no-repeat
;
}
.vs-dark
.monaco-workbench
.search-viewlet
.query-details
.file-types
.controls
>
.custom-checkbox.useExcludeSettings
,
.hc-black
.monaco-workbench
.search-viewlet
.query-details
.file-types
.controls
>
.custom-checkbox.useExcludeSettings
{
background
:
url('configure-inverse.svg')
center
center
no-repeat
;
}
.search-viewlet
.findInFileMatch
,
.monaco-editor
.findInFileMatch
{
background-color
:
rgba
(
234
,
92
,
0
,
0.3
);
...
...
src/vs/workbench/parts/search/browser/patternInputWidget.ts
浏览文件 @
4c41eca2
...
...
@@ -31,22 +31,21 @@ export class PatternInputWidget extends Widget {
public
inputFocusTracker
:
dom
.
IFocusTracker
;
pr
ivate
onOptionChange
:
(
event
:
Event
)
=>
void
;
pr
otected
onOptionChange
:
(
event
:
Event
)
=>
void
;
private
width
:
number
;
private
placeholder
:
string
;
private
ariaLabel
:
string
;
private
pattern
:
Checkbox
;
private
useIgnoreFilesBox
:
Checkbox
;
private
domNode
:
HTMLElement
;
private
inputNode
:
HTMLInputElement
;
pr
ivate
inputBox
:
InputBox
;
pr
otected
inputBox
:
InputBox
;
private
_onSubmit
=
this
.
_register
(
new
Emitter
<
boolean
>
());
public
onSubmit
:
CommonEvent
<
boolean
>
=
this
.
_onSubmit
.
event
;
constructor
(
parent
:
HTMLElement
,
private
contextViewProvider
:
IContextViewProvider
,
private
themeService
:
IThemeService
,
options
:
IOptions
=
Object
.
create
(
null
)
,
private
showUseIgnoreFiles
=
false
)
{
constructor
(
parent
:
HTMLElement
,
private
contextViewProvider
:
IContextViewProvider
,
private
themeService
:
IThemeService
,
options
:
IOptions
=
Object
.
create
(
null
))
{
super
();
this
.
onOptionChange
=
null
;
this
.
width
=
options
.
width
||
100
;
...
...
@@ -54,7 +53,6 @@ export class PatternInputWidget extends Widget {
this
.
ariaLabel
=
options
.
ariaLabel
||
nls
.
localize
(
'
defaultLabel
'
,
"
input
"
);
this
.
pattern
=
null
;
this
.
useIgnoreFilesBox
=
null
;
this
.
domNode
=
null
;
this
.
inputNode
=
null
;
this
.
inputBox
=
null
;
...
...
@@ -67,7 +65,6 @@ export class PatternInputWidget extends Widget {
public
dispose
():
void
{
super
.
dispose
();
this
.
pattern
.
dispose
();
this
.
useIgnoreFilesBox
.
dispose
();
if
(
this
.
inputFocusTracker
)
{
this
.
inputFocusTracker
.
dispose
();
}
...
...
@@ -141,27 +138,20 @@ export class PatternInputWidget extends Widget {
return
this
.
inputBox
.
hasFocus
();
}
public
useIgnoreFiles
():
boolean
{
return
this
.
useIgnoreFilesBox
.
checked
;
}
public
setUseIgnoreFiles
(
value
:
boolean
):
void
{
this
.
useIgnoreFilesBox
.
checked
=
value
;
this
.
setInputWidth
();
}
public
isGlobPattern
():
boolean
{
return
this
.
pattern
.
checked
;
}
public
setIsGlobPattern
(
value
:
boolean
):
void
{
this
.
pattern
.
checked
=
value
;
this
.
setInputWidth
();
}
private
setInputWidth
():
void
{
let
w
=
this
.
width
-
this
.
pattern
.
width
()
-
this
.
useIgnoreFilesBox
.
width
();
this
.
inputBox
.
width
=
w
;
this
.
inputBox
.
width
=
this
.
width
-
this
.
getSubcontrolsWidth
();
}
protected
getSubcontrolsWidth
():
number
{
return
this
.
pattern
.
width
();
}
private
render
():
void
{
...
...
@@ -190,7 +180,6 @@ export class PatternInputWidget extends Widget {
if
(
!
viaKeyboard
)
{
this
.
inputBox
.
focus
();
}
this
.
setInputWidth
();
if
(
this
.
isGlobPattern
())
{
this
.
showGlobHelp
();
...
...
@@ -200,19 +189,6 @@ export class PatternInputWidget extends Widget {
}
});
this
.
useIgnoreFilesBox
=
new
Checkbox
({
actionClassName
:
'
useIgnoreFiles
'
,
title
:
nls
.
localize
(
'
useIgnoreFilesDescription
'
,
"
Use Ignore Files
"
),
isChecked
:
false
,
onChange
:
(
viaKeyboard
)
=>
{
this
.
onOptionChange
(
null
);
if
(
!
viaKeyboard
)
{
this
.
inputBox
.
focus
();
}
this
.
setInputWidth
();
}
});
$
(
this
.
pattern
.
domNode
).
on
(
'
mouseover
'
,
()
=>
{
if
(
this
.
isGlobPattern
())
{
this
.
showGlobHelp
();
...
...
@@ -223,17 +199,16 @@ export class PatternInputWidget extends Widget {
this
.
inputBox
.
hideMessage
();
});
this
.
setInputWidth
();
let
controls
=
document
.
createElement
(
'
div
'
);
controls
.
className
=
'
controls
'
;
if
(
this
.
showUseIgnoreFiles
)
{
controls
.
appendChild
(
this
.
useIgnoreFilesBox
.
domNode
);
}
controls
.
appendChild
(
this
.
pattern
.
domNode
);
this
.
renderSubcontrols
(
controls
);
this
.
domNode
.
appendChild
(
controls
);
this
.
setInputWidth
();
}
protected
renderSubcontrols
(
controlsDiv
:
HTMLDivElement
):
void
{
controlsDiv
.
appendChild
(
this
.
pattern
.
domNode
);
}
private
showGlobHelp
():
void
{
...
...
@@ -256,3 +231,65 @@ export class PatternInputWidget extends Widget {
}
}
}
export
class
ExcludePatternInputWidget
extends
PatternInputWidget
{
private
useIgnoreFilesBox
:
Checkbox
;
private
useExcludeSettingsBox
:
Checkbox
;
public
dispose
():
void
{
super
.
dispose
();
this
.
useIgnoreFilesBox
.
dispose
();
this
.
useExcludeSettingsBox
.
dispose
();
}
public
useExcludeSettings
():
boolean
{
return
this
.
useExcludeSettingsBox
.
checked
;
}
public
setUseExcludeSettings
(
value
:
boolean
)
{
this
.
useExcludeSettingsBox
.
checked
=
value
;
}
public
useIgnoreFiles
():
boolean
{
return
this
.
useIgnoreFilesBox
.
checked
;
}
public
setUseIgnoreFiles
(
value
:
boolean
):
void
{
this
.
useIgnoreFilesBox
.
checked
=
value
;
}
protected
getSubcontrolsWidth
():
number
{
return
super
.
getSubcontrolsWidth
()
+
this
.
useIgnoreFilesBox
.
width
()
+
this
.
useExcludeSettingsBox
.
width
();
}
protected
renderSubcontrols
(
controlsDiv
:
HTMLDivElement
):
void
{
this
.
useIgnoreFilesBox
=
new
Checkbox
({
actionClassName
:
'
useIgnoreFiles
'
,
title
:
nls
.
localize
(
'
useIgnoreFilesDescription
'
,
"
Use Ignore Files
"
),
isChecked
:
false
,
onChange
:
(
viaKeyboard
)
=>
{
this
.
onOptionChange
(
null
);
if
(
!
viaKeyboard
)
{
this
.
inputBox
.
focus
();
}
}
});
this
.
useExcludeSettingsBox
=
new
Checkbox
({
actionClassName
:
'
useExcludeSettings
'
,
title
:
nls
.
localize
(
'
useExcludeSettingsDescription
'
,
"
Use Exclude Settings
"
),
isChecked
:
false
,
onChange
:
(
viaKeyboard
)
=>
{
this
.
onOptionChange
(
null
);
if
(
!
viaKeyboard
)
{
this
.
inputBox
.
focus
();
}
}
});
controlsDiv
.
appendChild
(
this
.
useIgnoreFilesBox
.
domNode
);
controlsDiv
.
appendChild
(
this
.
useExcludeSettingsBox
.
domNode
);
super
.
renderSubcontrols
(
controlsDiv
);
}
}
\ No newline at end of file
src/vs/workbench/parts/search/browser/searchViewlet.ts
浏览文件 @
4c41eca2
...
...
@@ -48,7 +48,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
PatternInputWidget
}
from
'
vs/workbench/parts/search/browser/patternInputWidget
'
;
import
{
PatternInputWidget
,
ExcludePatternInputWidget
}
from
'
vs/workbench/parts/search/browser/patternInputWidget
'
;
import
{
SearchRenderer
,
SearchDataSource
,
SearchSorter
,
SearchController
,
SearchAccessibilityProvider
,
SearchFilter
}
from
'
vs/workbench/parts/search/browser/searchResultsView
'
;
import
{
SearchWidget
}
from
'
vs/workbench/parts/search/browser/searchWidget
'
;
import
{
RefreshAction
,
CollapseAllAction
,
ClearSearchResultsAction
,
ConfigureGlobalExclusionsAction
}
from
'
vs/workbench/parts/search/browser/searchActions
'
;
...
...
@@ -86,7 +86,7 @@ export class SearchViewlet extends Viewlet {
private
searchWidget
:
SearchWidget
;
private
size
:
Dimension
;
private
queryDetails
:
HTMLElement
;
private
inputPatternExclusions
:
PatternInputWidget
;
private
inputPatternExclusions
:
Exclude
PatternInputWidget
;
private
inputPatternGlobalExclusions
:
InputBox
;
private
inputPatternGlobalExclusionsContainer
:
Builder
;
private
inputPatternIncludes
:
PatternInputWidget
;
...
...
@@ -167,6 +167,9 @@ export class SearchViewlet extends Viewlet {
const
useIgnoreFiles
=
typeof
this
.
viewletSettings
[
'
query.useIgnoreFiles
'
]
===
'
boolean
'
?
this
.
viewletSettings
[
'
query.useIgnoreFiles
'
]
:
this
.
configurationService
.
getConfiguration
<
ISearchConfiguration
>
().
search
.
useIgnoreFilesByDefault
;
const
useExcludeSettings
=
typeof
this
.
viewletSettings
[
'
query.useExcludeSettings
'
]
===
'
boolean
'
?
this
.
viewletSettings
[
'
query.useExcludeSettings
'
]
:
true
;
this
.
queryDetails
=
this
.
searchWidgetsContainer
.
div
({
'
class
'
:
[
'
query-details
'
]
},
(
builder
)
=>
{
builder
.
div
({
'
class
'
:
'
more
'
,
'
tabindex
'
:
0
,
'
role
'
:
'
button
'
,
'
title
'
:
nls
.
localize
(
'
moreSearch
'
,
"
Toggle Search Details
"
)
})
...
...
@@ -208,14 +211,14 @@ export class SearchViewlet extends Viewlet {
let
title
=
nls
.
localize
(
'
searchScope.excludes
'
,
"
files to exclude
"
);
builder
.
element
(
'
h4
'
,
{
text
:
title
});
const
configuration
=
this
.
configurationService
.
getConfiguration
<
ISearchConfiguration
>
();
this
.
inputPatternExclusions
=
new
PatternInputWidget
(
builder
.
getContainer
(),
this
.
contextViewService
,
this
.
themeService
,
{
this
.
inputPatternExclusions
=
new
ExcludePatternInputWidget
(
builder
.
getContainer
(),
this
.
contextViewService
,
this
.
themeService
,
{
ariaLabel
:
nls
.
localize
(
'
label.excludes
'
,
'
Search Exclude Patterns
'
)
}
,
configuration
.
search
.
useRipgrep
);
});
this
.
inputPatternExclusions
.
setIsGlobPattern
(
exclusionsUsePattern
);
this
.
inputPatternExclusions
.
setValue
(
patternExclusions
);
this
.
inputPatternExclusions
.
setUseIgnoreFiles
(
useIgnoreFiles
);
this
.
inputPatternExclusions
.
setUseExcludeSettings
(
useExcludeSettings
);
this
.
inputPatternExclusions
.
on
(
FindInput
.
OPTION_CHANGE
,
(
e
)
=>
{
...
...
@@ -908,6 +911,7 @@ export class SearchViewlet extends Viewlet {
const
patternIncludes
=
this
.
inputPatternIncludes
.
getValue
().
trim
();
const
includesUsePattern
=
this
.
inputPatternIncludes
.
isGlobPattern
();
const
useIgnoreFiles
=
this
.
inputPatternExclusions
.
useIgnoreFiles
();
const
useExcludeSettings
=
this
.
inputPatternExclusions
.
useExcludeSettings
();
// store memento
this
.
viewletSettings
[
'
query.contentPattern
'
]
=
contentPattern
;
...
...
@@ -919,6 +923,7 @@ export class SearchViewlet extends Viewlet {
this
.
viewletSettings
[
'
query.folderIncludes
'
]
=
patternIncludes
;
this
.
viewletSettings
[
'
query.includesUsePattern
'
]
=
includesUsePattern
;
this
.
viewletSettings
[
'
query.useIgnoreFiles
'
]
=
useIgnoreFiles
;
this
.
viewletSettings
[
'
query.useExcludeSettings
'
]
=
useExcludeSettings
;
if
(
!
rerunQuery
)
{
return
;
...
...
@@ -942,23 +947,24 @@ export class SearchViewlet extends Viewlet {
}
}
le
t
content
=
{
cons
t
content
=
{
pattern
:
contentPattern
,
isRegExp
:
isRegex
,
isCaseSensitive
:
isCaseSensitive
,
isWordMatch
:
isWholeWords
};
le
t
excludes
:
IExpression
=
this
.
inputPatternExclusions
.
getGlob
();
le
t
includes
:
IExpression
=
this
.
inputPatternIncludes
.
getGlob
();
cons
t
excludes
:
IExpression
=
this
.
inputPatternExclusions
.
getGlob
();
cons
t
includes
:
IExpression
=
this
.
inputPatternIncludes
.
getGlob
();
le
t
options
:
IQueryOptions
=
{
cons
t
options
:
IQueryOptions
=
{
folderResources
:
this
.
contextService
.
hasWorkspace
()
?
[
this
.
contextService
.
getWorkspace
().
resource
]
:
[],
extraFileResources
:
getOutOfWorkspaceEditorResources
(
this
.
editorGroupService
,
this
.
contextService
),
excludePattern
:
excludes
,
maxResults
:
SearchViewlet
.
MAX_TEXT_RESULTS
,
includePattern
:
includes
,
useIgnoreFiles
useIgnoreFiles
,
useExcludeSettings
};
this
.
onQueryTriggered
(
this
.
queryBuilder
.
text
(
content
,
options
),
patternExcludes
,
patternIncludes
);
...
...
src/vs/workbench/parts/search/common/searchQuery.ts
浏览文件 @
4c41eca2
...
...
@@ -24,11 +24,13 @@ export class QueryBuilder {
private
query
(
type
:
QueryType
,
contentPattern
:
IPatternInfo
,
options
:
IQueryOptions
=
{}):
ISearchQuery
{
const
configuration
=
this
.
configurationService
.
getConfiguration
<
ISearchConfiguration
>
();
const
excludePattern
=
getExcludes
(
configuration
);
if
(
!
options
.
excludePattern
)
{
options
.
excludePattern
=
excludePattern
;
const
settingsExcludePattern
=
getExcludes
(
configuration
);
if
(
options
.
useExcludeSettings
)
{
if
(
options
.
excludePattern
)
{
mixin
(
options
.
excludePattern
,
settingsExcludePattern
,
false
/* no overwrite */
);
}
else
{
mixin
(
options
.
excludePattern
,
excludePattern
,
false
/* no overwrite */
);
options
.
excludePattern
=
settingsExcludePattern
;
}
}
return
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录