Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a86e6b45
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,发现更多精彩内容 >>
提交
a86e6b45
编写于
9月 12, 2016
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement Search History #5508
上级
a9b91a0a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
62 addition
and
1 deletion
+62
-1
src/vs/workbench/parts/search/browser/search.contribution.ts
src/vs/workbench/parts/search/browser/search.contribution.ts
+9
-1
src/vs/workbench/parts/search/browser/searchActions.ts
src/vs/workbench/parts/search/browser/searchActions.ts
+32
-0
src/vs/workbench/parts/search/browser/searchWidget.ts
src/vs/workbench/parts/search/browser/searchWidget.ts
+21
-0
未找到文件。
src/vs/workbench/parts/search/browser/search.contribution.ts
浏览文件 @
a86e6b45
...
...
@@ -25,7 +25,7 @@ import {IKeybindings} from 'vs/platform/keybinding/common/keybinding';
import
{
IQuickOpenService
}
from
'
vs/workbench/services/quickopen/common/quickOpenService
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/common/viewletService
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
OpenSearchViewletAction
,
ReplaceInFilesAction
,
FocusNextInputAction
,
FocusPreviousInputAction
}
from
'
vs/workbench/parts/search/browser/searchActions
'
;
import
{
OpenSearchViewletAction
,
ReplaceInFilesAction
,
ShowNextSearchTermAction
,
ShowPreviousSearchTermAction
,
FocusNextInputAction
,
FocusPreviousInputAction
}
from
'
vs/workbench/parts/search/browser/searchActions
'
;
import
*
as
Constants
from
'
vs/workbench/parts/search/common/constants
'
;
import
{
registerContributions
as
replaceContributions
}
from
'
vs/workbench/parts/search/browser/replaceContributions
'
;
import
{
registerContributions
as
searchWidgetContributions
}
from
'
vs/workbench/parts/search/browser/searchWidget
'
;
...
...
@@ -165,6 +165,14 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(ShowAllSymbolsAction,
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_T
}),
'
Show All Symbols
'
);
registry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ShowNextSearchTermAction
,
ShowNextSearchTermAction
.
ID
,
ShowNextSearchTermAction
.
LABEL
,
{
primary
:
KeyMod
.
Alt
|
KeyCode
.
DownArrow
},
ContextKeyExpr
.
and
(
Constants
.
SearchViewletVisibleKey
,
Constants
.
SearchInputBoxFocussedKey
)),
''
);
registry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ShowPreviousSearchTermAction
,
ShowPreviousSearchTermAction
.
ID
,
ShowPreviousSearchTermAction
.
LABEL
,
{
primary
:
KeyMod
.
Alt
|
KeyCode
.
UpArrow
},
ContextKeyExpr
.
and
(
Constants
.
SearchViewletVisibleKey
,
Constants
.
SearchInputBoxFocussedKey
)),
''
);
registry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
FocusNextInputAction
,
FocusNextInputAction
.
ID
,
FocusNextInputAction
.
LABEL
,
{
primary
:
KeyCode
.
DownArrow
},
ContextKeyExpr
.
and
(
Constants
.
SearchViewletVisibleKey
,
Constants
.
InputBoxFocussedKey
)),
''
);
...
...
src/vs/workbench/parts/search/browser/searchActions.ts
浏览文件 @
a86e6b45
...
...
@@ -39,6 +39,38 @@ export function appendKeyBindingLabel(label: string, keyBinding: any, keyBinding
return
label
+
'
(
'
+
keyBindingService2
.
getLabelFor
(
keyBinding
)
+
'
)
'
;
}
export
class
ShowNextSearchTermAction
extends
Action
{
public
static
ID
=
'
search.history.nextSearchTerm
'
;
public
static
LABEL
=
nls
.
localize
(
'
nextSearchTerm
'
,
"
Show next search term
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IViewletService
private
viewletService
:
IViewletService
)
{
super
(
id
,
label
);
}
public
run
():
TPromise
<
any
>
{
let
searchAndReplaceWidget
=
(
<
SearchViewlet
>
this
.
viewletService
.
getActiveViewlet
()).
searchAndReplaceWidget
;
searchAndReplaceWidget
.
showNextSearchTerm
();
return
TPromise
.
as
(
null
);
}
}
export
class
ShowPreviousSearchTermAction
extends
Action
{
public
static
ID
=
'
search.history.previousSearchTerm
'
;
public
static
LABEL
=
nls
.
localize
(
'
previousSearchTerm
'
,
"
Show previous search term
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IViewletService
private
viewletService
:
IViewletService
)
{
super
(
id
,
label
);
}
public
run
():
TPromise
<
any
>
{
let
searchAndReplaceWidget
=
(
<
SearchViewlet
>
this
.
viewletService
.
getActiveViewlet
()).
searchAndReplaceWidget
;
searchAndReplaceWidget
.
showPreviousSearchTerm
();
return
TPromise
.
as
(
null
);
}
}
export
class
FocusNextInputAction
extends
Action
{
public
static
ID
=
'
search.focus.nextInputBox
'
;
...
...
src/vs/workbench/parts/search/browser/searchWidget.ts
浏览文件 @
a86e6b45
...
...
@@ -25,6 +25,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/common/viewletService
'
;
import
{
isSearchViewletFocussed
,
appendKeyBindingLabel
}
from
'
vs/workbench/parts/search/browser/searchActions
'
;
import
{
CONTEXT_FIND_WIDGET_NOT_VISIBLE
}
from
'
vs/editor/contrib/find/common/findController
'
;
import
{
HistoryNavigator
}
from
'
vs/base/common/history
'
;
import
*
as
Constants
from
'
vs/workbench/parts/search/common/constants
'
;
export
interface
ISearchWidgetOptions
{
...
...
@@ -86,6 +87,8 @@ export class SearchWidget extends Widget {
private
replaceActive
:
IContextKey
<
boolean
>
;
private
replaceActionBar
:
ActionBar
;
private
searchHistory
:
HistoryNavigator
<
string
>
;
private
_onSearchSubmit
=
this
.
_register
(
new
Emitter
<
boolean
>
());
public
onSearchSubmit
:
Event
<
boolean
>
=
this
.
_onSearchSubmit
.
event
;
...
...
@@ -107,6 +110,7 @@ export class SearchWidget extends Widget {
constructor
(
container
:
Builder
,
private
contextViewService
:
IContextViewService
,
options
:
ISearchWidgetOptions
=
Object
.
create
(
null
),
private
keyBindingService
:
IContextKeyService
,
private
keyBindingService2
:
IKeybindingService
,
private
instantiationService
:
IInstantiationService
)
{
super
();
this
.
searchHistory
=
new
HistoryNavigator
<
string
>
();
this
.
replaceActive
=
Constants
.
ReplaceActiveKey
.
bindTo
(
this
.
keyBindingService
);
this
.
searchInputBoxFocussed
=
Constants
.
SearchInputBoxFocussedKey
.
bindTo
(
this
.
keyBindingService
);
this
.
render
(
container
,
options
);
...
...
@@ -156,6 +160,20 @@ export class SearchWidget extends Widget {
}
}
public
showNextSearchTerm
()
{
let
next
=
this
.
searchHistory
.
next
();
if
(
next
)
{
this
.
searchInput
.
setValue
(
next
);
}
}
public
showPreviousSearchTerm
()
{
let
previous
=
this
.
searchHistory
.
previous
();
if
(
previous
)
{
this
.
searchInput
.
setValue
(
previous
);
}
}
public
searchInputHasFocus
():
boolean
{
return
this
.
searchInputBoxFocussed
.
get
();
}
...
...
@@ -193,6 +211,9 @@ export class SearchWidget extends Widget {
this
.
searchInput
.
setRegex
(
!!
options
.
isRegex
);
this
.
searchInput
.
setCaseSensitive
(
!!
options
.
isCaseSensitive
);
this
.
searchInput
.
setWholeWords
(
!!
options
.
isWholeWords
);
this
.
_register
(
this
.
onSearchSubmit
(()
=>
{
this
.
searchHistory
.
add
(
this
.
searchInput
.
getValue
());
}));
this
.
searchInputFocusTracker
=
dom
.
trackFocus
(
this
.
searchInput
.
inputBox
.
inputElement
);
this
.
_register
(
this
.
searchInputFocusTracker
.
addFocusListener
(()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录