Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
58655457
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,体验更适合开发者的 AI 搜索 >>
提交
58655457
编写于
2月 07, 2020
作者:
J
Jackson Kearl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add link to run search again when empty #89474
上级
bf4e9b09
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
11 deletion
+48
-11
src/vs/workbench/contrib/searchEditor/browser/media/searchEditor.css
...bench/contrib/searchEditor/browser/media/searchEditor.css
+15
-0
src/vs/workbench/contrib/searchEditor/browser/searchEditor.ts
...vs/workbench/contrib/searchEditor/browser/searchEditor.ts
+33
-11
未找到文件。
src/vs/workbench/contrib/searchEditor/browser/media/searchEditor.css
浏览文件 @
58655457
...
...
@@ -163,3 +163,18 @@
font-size
:
11px
;
font-weight
:
normal
;
}
.search-editor
.messages
{
margin-top
:
-5px
;
cursor
:
default
;
}
.search-editor
.message
{
padding-left
:
22px
;
padding-right
:
22px
;
padding-top
:
0px
;
}
.search-editor
a
.prominent
{
text-decoration
:
underline
;
}
src/vs/workbench/contrib/searchEditor/browser/searchEditor.ts
浏览文件 @
58655457
...
...
@@ -5,8 +5,10 @@
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
{
StandardKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
Delayer
}
from
'
vs/base/common/async
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
KeyCode
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
'
vs/css!./media/searchEditor
'
;
import
{
CodeEditorWidget
,
ICodeEditorWidgetOptions
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
...
...
@@ -14,34 +16,33 @@ import type { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
TrackedRangeStickiness
}
from
'
vs/editor/common/model
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
ReferencesController
}
from
'
vs/editor/contrib/gotoSymbol/peek/referencesController
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
IEditorProgressService
,
LongRunningOperation
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
inputBorder
,
registerColor
,
searchEditorFindMatch
,
searchEditorFindMatchBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
attachInputBoxStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IThemeService
,
registerThemingParticipant
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
EditorOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
ExcludePatternInputWidget
,
PatternInputWidget
}
from
'
vs/workbench/contrib/search/browser/patternInputWidget
'
;
import
{
SearchWidget
}
from
'
vs/workbench/contrib/search/browser/searchWidget
'
;
import
{
InputBoxFocusedKey
}
from
'
vs/workbench/contrib/search/common/constants
'
;
import
{
ITextQueryBuilderOptions
,
QueryBuilder
}
from
'
vs/workbench/contrib/search/common/queryBuilder
'
;
import
{
getOutOfWorkspaceEditorResources
}
from
'
vs/workbench/contrib/search/common/search
'
;
import
{
SearchModel
}
from
'
vs/workbench/contrib/search/common/searchModel
'
;
import
{
IPatternInfo
,
ISearchConfigurationProperties
,
ITextQuery
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
Delayer
}
from
'
vs/base/common/async
'
;
import
{
serializeSearchResultForEditor
,
serializeSearchConfiguration
,
extractSearchQuery
}
from
'
vs/workbench/contrib/searchEditor/browser/searchEditorSerialization
'
;
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
InputBoxFocusedKey
}
from
'
vs/workbench/contrib/search/common/constants
'
;
import
{
IEditorProgressService
,
LongRunningOperation
}
from
'
vs/platform/progress/common/progress
'
;
import
type
{
SearchEditorInput
,
SearchConfiguration
}
from
'
vs/workbench/contrib/searchEditor/browser/searchEditorInput
'
;
import
{
searchEditorFindMatchBorder
,
searchEditorFindMatch
,
registerColor
,
inputBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
attachInputBoxStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
ReferencesController
}
from
'
vs/editor/contrib/gotoSymbol/peek/referencesController
'
;
import
{
InSearchEditor
}
from
'
vs/workbench/contrib/searchEditor/browser/constants
'
;
import
type
{
SearchConfiguration
,
SearchEditorInput
}
from
'
vs/workbench/contrib/searchEditor/browser/searchEditorInput
'
;
import
{
extractSearchQuery
,
serializeSearchConfiguration
,
serializeSearchResultForEditor
}
from
'
vs/workbench/contrib/searchEditor/browser/searchEditorSerialization
'
;
import
{
IPatternInfo
,
ISearchConfigurationProperties
,
ITextQuery
}
from
'
vs/workbench/services/search/common/search
'
;
const
RESULT_LINE_REGEX
=
/^
(\s
+
)(\d
+
)(
:|
)(\s
+
)(
.*
)
$/
;
const
FILE_LINE_REGEX
=
/^
(\S
.*
)
:$/
;
...
...
@@ -57,6 +58,7 @@ export class SearchEditor extends BaseEditor {
private
inputPatternExcludes
!
:
ExcludePatternInputWidget
;
private
includesExcludesContainer
!
:
HTMLElement
;
private
toggleQueryDetailsButton
!
:
HTMLElement
;
private
messageBox
!
:
HTMLElement
;
private
runSearchDelayer
=
new
Delayer
(
300
);
private
pauseSearching
:
boolean
=
false
;
...
...
@@ -65,6 +67,7 @@ export class SearchEditor extends BaseEditor {
private
inputFocusContextKey
:
IContextKey
<
boolean
>
;
private
searchOperation
:
LongRunningOperation
;
private
searchHistoryDelayer
:
Delayer
<
void
>
;
private
messageDisposables
:
IDisposable
[]
=
[];
constructor
(
@
ITelemetryService
telemetryService
:
ITelemetryService
,
...
...
@@ -153,6 +156,24 @@ export class SearchEditor extends BaseEditor {
[
this
.
queryEditorWidget
.
searchInput
,
this
.
inputPatternIncludes
,
this
.
inputPatternExcludes
].
map
(
input
=>
this
.
_register
(
attachInputBoxStyler
(
input
,
this
.
themeService
,
{
inputBorder
:
searchEditorTextInputBorder
})));
// Messages
this
.
messageBox
=
DOM
.
append
(
this
.
queryEditorContainer
,
DOM
.
$
(
'
.messages
'
));
}
private
toggleRunAgainMessage
(
show
:
boolean
)
{
DOM
.
clearNode
(
this
.
messageBox
);
dispose
(
this
.
messageDisposables
);
this
.
messageDisposables
=
[];
if
(
show
)
{
const
runAgainLink
=
DOM
.
append
(
this
.
messageBox
,
DOM
.
$
(
'
a.pointer.prominent.message
'
,
{},
localize
(
'
runAgain
'
,
"
Run Again
"
)));
this
.
messageDisposables
.
push
(
DOM
.
addDisposableListener
(
runAgainLink
,
DOM
.
EventType
.
CLICK
,
async
()
=>
{
await
this
.
runSearch
(
true
,
true
);
this
.
toggleRunAgainMessage
(
false
);
}));
}
}
private
createResultsEditor
(
parent
:
HTMLElement
)
{
...
...
@@ -265,7 +286,7 @@ export class SearchEditor extends BaseEditor {
async
runSearch
(
resetCursor
=
true
,
instant
=
false
)
{
if
(
!
this
.
pauseSearching
)
{
this
.
runSearchDelayer
.
trigger
(
async
()
=>
{
await
this
.
runSearchDelayer
.
trigger
(
async
()
=>
{
await
this
.
doRunSearch
();
if
(
resetCursor
)
{
this
.
searchResultEditor
.
setSelection
(
new
Range
(
1
,
1
,
1
,
1
));
...
...
@@ -393,6 +414,7 @@ export class SearchEditor extends BaseEditor {
this
.
pauseSearching
=
true
;
const
config
=
extractSearchQuery
(
header
);
this
.
toggleRunAgainMessage
(
body
.
getLineCount
()
===
1
&&
body
.
getValue
()
===
''
&&
config
.
query
!==
''
);
this
.
queryEditorWidget
.
setValue
(
config
.
query
,
true
);
this
.
queryEditorWidget
.
searchInput
.
setCaseSensitive
(
config
.
caseSensitive
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录