Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
1cbbd1d3
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,发现更多精彩内容 >>
提交
1cbbd1d3
编写于
5月 29, 2017
作者:
R
Ryan Stringham
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Save search history when shutting down and load when starting up.
上级
8d666f34
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
3 deletion
+31
-3
src/vs/base/common/history.ts
src/vs/base/common/history.ts
+4
-0
src/vs/workbench/parts/search/browser/patternInputWidget.ts
src/vs/workbench/parts/search/browser/patternInputWidget.ts
+8
-0
src/vs/workbench/parts/search/browser/searchViewlet.ts
src/vs/workbench/parts/search/browser/searchViewlet.ts
+13
-2
src/vs/workbench/parts/search/browser/searchWidget.ts
src/vs/workbench/parts/search/browser/searchWidget.ts
+6
-1
未找到文件。
src/vs/base/common/history.ts
浏览文件 @
1cbbd1d3
...
...
@@ -17,6 +17,10 @@ export class HistoryNavigator<T> implements INavigator<T> {
this
.
_onChange
();
}
public
getHistory
():
T
[]
{
return
this
.
_elements
;
}
public
add
(
t
:
T
)
{
this
.
_history
.
add
(
t
);
this
.
_onChange
();
...
...
src/vs/workbench/parts/search/browser/patternInputWidget.ts
浏览文件 @
1cbbd1d3
...
...
@@ -189,6 +189,14 @@ export class PatternInputWidget extends Widget {
return
this
.
pattern
.
width
();
}
public
getHistory
():
string
[]
{
return
this
.
history
.
getHistory
();
}
public
setHistory
(
history
:
string
[])
{
this
.
history
=
new
HistoryNavigator
<
string
>
(
history
);
}
public
showNextTerm
()
{
let
next
=
this
.
history
.
next
();
if
(
next
)
{
...
...
src/vs/workbench/parts/search/browser/searchViewlet.ts
浏览文件 @
1cbbd1d3
...
...
@@ -180,9 +180,11 @@ export class SearchViewlet extends Viewlet {
const
filePatterns
=
this
.
viewletSettings
[
'
query.filePatterns
'
]
||
''
;
const
patternExclusions
=
this
.
viewletSettings
[
'
query.folderExclusions
'
]
||
''
;
const
patternExclusionsHistory
=
this
.
viewletSettings
[
'
query.folderExclusionsHistory
'
]
||
[];
const
exclusionsUsePattern
=
this
.
viewletSettings
[
'
query.exclusionsUsePattern
'
];
const
includesUsePattern
=
this
.
viewletSettings
[
'
query.includesUsePattern
'
];
const
patternIncludes
=
this
.
viewletSettings
[
'
query.folderIncludes
'
]
||
''
;
const
patternIncludesHistory
=
this
.
viewletSettings
[
'
query.folderIncludesHistory
'
]
||
[];
const
queryDetailsExpanded
=
this
.
viewletSettings
[
'
query.queryDetailsExpanded
'
]
||
''
;
const
useIgnoreFiles
=
typeof
this
.
viewletSettings
[
'
query.useIgnoreFiles
'
]
===
'
boolean
'
?
this
.
viewletSettings
[
'
query.useIgnoreFiles
'
]
:
...
...
@@ -214,6 +216,7 @@ export class SearchViewlet extends Viewlet {
this
.
inputPatternIncludes
.
setIsGlobPattern
(
includesUsePattern
);
this
.
inputPatternIncludes
.
setValue
(
patternIncludes
);
this
.
inputPatternIncludes
.
setHistory
(
patternIncludesHistory
);
this
.
inputPatternIncludes
.
on
(
FindInput
.
OPTION_CHANGE
,
(
e
)
=>
{
...
...
@@ -237,6 +240,7 @@ export class SearchViewlet extends Viewlet {
this
.
inputPatternExclusions
.
setValue
(
patternExclusions
);
this
.
inputPatternExclusions
.
setUseIgnoreFiles
(
useIgnoreFiles
);
this
.
inputPatternExclusions
.
setUseExcludeSettings
(
useExcludeSettings
);
this
.
inputPatternExclusions
.
setHistory
(
patternExclusionsHistory
);
this
.
inputPatternExclusions
.
on
(
FindInput
.
OPTION_CHANGE
,
(
e
)
=>
{
...
...
@@ -305,12 +309,14 @@ export class SearchViewlet extends Viewlet {
let
isRegex
=
this
.
viewletSettings
[
'
query.regex
'
]
===
true
;
let
isWholeWords
=
this
.
viewletSettings
[
'
query.wholeWords
'
]
===
true
;
let
isCaseSensitive
=
this
.
viewletSettings
[
'
query.caseSensitive
'
]
===
true
;
let
searchHistory
=
this
.
viewletSettings
[
'
query.searchHistory
'
]
||
[];
this
.
searchWidget
=
this
.
instantiationService
.
createInstance
(
SearchWidget
,
builder
,
<
ISearchWidgetOptions
>
{
value
:
contentPattern
,
isRegex
:
isRegex
,
isCaseSensitive
:
isCaseSensitive
,
isWholeWords
:
isWholeWords
isWholeWords
:
isWholeWords
,
history
:
searchHistory
});
if
(
this
.
storageService
.
getBoolean
(
SearchViewlet
.
SHOW_REPLACE_STORAGE_KEY
,
StorageScope
.
WORKSPACE
,
true
))
{
...
...
@@ -1368,23 +1374,28 @@ export class SearchViewlet extends Viewlet {
const
isWholeWords
=
this
.
searchWidget
.
searchInput
.
getWholeWords
();
const
isCaseSensitive
=
this
.
searchWidget
.
searchInput
.
getCaseSensitive
();
const
contentPattern
=
this
.
searchWidget
.
searchInput
.
getValue
();
const
searchHistory
=
this
.
searchWidget
.
getHistory
();
const
patternExcludes
=
this
.
inputPatternExclusions
.
getValue
().
trim
();
const
patternExcludesHistory
=
this
.
inputPatternExclusions
.
getHistory
();
const
exclusionsUsePattern
=
this
.
inputPatternExclusions
.
isGlobPattern
();
const
patternIncludes
=
this
.
inputPatternIncludes
.
getValue
().
trim
();
const
patternIncludesHistory
=
this
.
inputPatternIncludes
.
getHistory
();
const
includesUsePattern
=
this
.
inputPatternIncludes
.
isGlobPattern
();
const
useIgnoreFiles
=
this
.
inputPatternExclusions
.
useIgnoreFiles
();
// store memento
this
.
viewletSettings
[
'
query.contentPattern
'
]
=
contentPattern
;
this
.
viewletSettings
[
'
query.searchHistory
'
]
=
searchHistory
;
this
.
viewletSettings
[
'
query.regex
'
]
=
isRegex
;
this
.
viewletSettings
[
'
query.wholeWords
'
]
=
isWholeWords
;
this
.
viewletSettings
[
'
query.caseSensitive
'
]
=
isCaseSensitive
;
this
.
viewletSettings
[
'
query.folderExclusions
'
]
=
patternExcludes
;
this
.
viewletSettings
[
'
query.folderExclusionsHistory
'
]
=
patternExcludesHistory
;
this
.
viewletSettings
[
'
query.exclusionsUsePattern
'
]
=
exclusionsUsePattern
;
this
.
viewletSettings
[
'
query.folderIncludes
'
]
=
patternIncludes
;
this
.
viewletSettings
[
'
query.folderIncludesHistory
'
]
=
patternIncludesHistory
;
this
.
viewletSettings
[
'
query.includesUsePattern
'
]
=
includesUsePattern
;
this
.
viewletSettings
[
'
query.useIgnoreFiles
'
]
=
useIgnoreFiles
;
this
.
viewletSettings
[
'
query.contentPattern
'
]
=
contentPattern
;
super
.
shutdown
();
}
...
...
src/vs/workbench/parts/search/browser/searchWidget.ts
浏览文件 @
1cbbd1d3
...
...
@@ -35,6 +35,7 @@ export interface ISearchWidgetOptions {
isRegex
?:
boolean
;
isCaseSensitive
?:
boolean
;
isWholeWords
?:
boolean
;
history
?:
string
[];
}
class
ReplaceAllAction
extends
Action
{
...
...
@@ -119,7 +120,7 @@ export class SearchWidget extends Widget {
@
IKeybindingService
private
keyBindingService2
:
IKeybindingService
,
)
{
super
();
this
.
searchHistory
=
new
HistoryNavigator
<
string
>
();
this
.
searchHistory
=
new
HistoryNavigator
<
string
>
(
options
.
history
);
this
.
replaceActive
=
Constants
.
ReplaceActiveKey
.
bindTo
(
this
.
keyBindingService
);
this
.
searchInputBoxFocussed
=
Constants
.
SearchInputBoxFocussedKey
.
bindTo
(
this
.
keyBindingService
);
this
.
replaceInputBoxFocussed
=
Constants
.
ReplaceInputBoxFocussedKey
.
bindTo
(
this
.
keyBindingService
);
...
...
@@ -170,6 +171,10 @@ export class SearchWidget extends Widget {
}
}
public
getHistory
():
string
[]
{
return
this
.
searchHistory
.
getHistory
();
}
public
showNextSearchTerm
()
{
let
next
=
this
.
searchHistory
.
next
();
if
(
next
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录