Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1d44116f
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,发现更多精彩内容 >>
提交
1d44116f
编写于
11月 06, 2018
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add textSearchManager to strict null checks
上级
defa76ed
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
13 deletion
+16
-13
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+2
-1
src/vs/workbench/services/search/node/search.ts
src/vs/workbench/services/search/node/search.ts
+1
-1
src/vs/workbench/services/search/node/textSearchManager.ts
src/vs/workbench/services/search/node/textSearchManager.ts
+13
-11
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
1d44116f
...
...
@@ -669,7 +669,8 @@
"./vs/workbench/services/title/common/titleService.ts"
,
"./vs/workbench/services/workspace/common/workspaceEditing.ts"
,
"./vs/workbench/test/electron-browser/api/mock.ts"
,
"./vs/workbench/services/search/node/ripgrepSearchUtils.ts"
"./vs/workbench/services/search/node/ripgrepSearchUtils.ts"
,
"./vs/workbench/services/search/node/textSearchManager.ts"
],
"exclude"
:
[
"./typings/require-monaco.d.ts"
,
...
...
src/vs/workbench/services/search/node/search.ts
浏览文件 @
1d44116f
...
...
@@ -107,7 +107,7 @@ export class FileMatch implements ISerializedFileMatch {
/**
* Computes the patterns that the provider handles. Discards sibling clauses and 'false' patterns
*/
export
function
resolvePatternsForProvider
(
globalPattern
:
glob
.
IExpression
,
folderPattern
:
glob
.
IExpression
):
string
[]
{
export
function
resolvePatternsForProvider
(
globalPattern
:
glob
.
IExpression
|
undefined
,
folderPattern
:
glob
.
IExpression
|
undefined
):
string
[]
{
const
merged
=
{
...(
globalPattern
||
{}),
...(
folderPattern
||
{})
...
...
src/vs/workbench/services/search/node/textSearchManager.ts
浏览文件 @
1d44116f
...
...
@@ -28,7 +28,7 @@ export class TextSearchManager {
}
public
search
(
onProgress
:
(
matches
:
IFileMatch
[])
=>
void
,
token
:
CancellationToken
):
TPromise
<
ISearchCompleteStats
>
{
const
folderQueries
=
this
.
query
.
folderQueries
;
const
folderQueries
=
this
.
query
.
folderQueries
||
[]
;
const
tokenSource
=
new
CancellationTokenSource
();
token
.
onCancellationRequested
(()
=>
tokenSource
.
cancel
());
...
...
@@ -41,7 +41,7 @@ export class TextSearchManager {
return
;
}
if
(
this
.
resultCount
>=
this
.
query
.
maxResults
)
{
if
(
t
ypeof
this
.
query
.
maxResults
===
'
number
'
&&
t
his
.
resultCount
>=
this
.
query
.
maxResults
)
{
this
.
isLimitHit
=
true
;
isCanceled
=
true
;
tokenSource
.
cancel
();
...
...
@@ -60,7 +60,7 @@ export class TextSearchManager {
tokenSource
.
dispose
();
this
.
collector
.
flush
();
const
someFolderHitLImit
=
results
.
some
(
result
=>
result
&&
result
.
limitHit
);
const
someFolderHitLImit
=
results
.
some
(
result
=>
!!
result
&&
!!
result
.
limitHit
);
resolve
({
limitHit
:
this
.
isLimitHit
||
someFolderHitLImit
,
stats
:
{
...
...
@@ -78,16 +78,18 @@ export class TextSearchManager {
});
}
private
searchInFolder
(
folderQuery
:
IFolderQuery
<
URI
>
,
onResult
:
(
result
:
vscode
.
TextSearchResult
)
=>
void
,
token
:
CancellationToken
):
TPromise
<
vscode
.
TextSearchComplete
>
{
private
searchInFolder
(
folderQuery
:
IFolderQuery
<
URI
>
,
onResult
:
(
result
:
vscode
.
TextSearchResult
)
=>
void
,
token
:
CancellationToken
):
TPromise
<
vscode
.
TextSearchComplete
|
null
|
undefined
>
{
const
queryTester
=
new
QueryGlobTester
(
this
.
query
,
folderQuery
);
const
testingPs
:
TPromise
<
void
>
[]
=
[];
const
progress
=
{
report
:
(
result
:
vscode
.
TextSearchResult
)
=>
{
// TODO: validate result.ranges vs result.preview.matches
const
hasSibling
=
folderQuery
.
folder
.
scheme
===
'
file
'
&&
glob
.
hasSiblingPromiseFn
(()
=>
{
return
this
.
readdir
(
path
.
dirname
(
result
.
uri
.
fsPath
));
});
const
hasSibling
=
folderQuery
.
folder
.
scheme
===
'
file
'
?
glob
.
hasSiblingPromiseFn
(()
=>
{
return
this
.
readdir
(
path
.
dirname
(
result
.
uri
.
fsPath
));
})
:
undefined
;
const
relativePath
=
path
.
relative
(
folderQuery
.
folder
.
fsPath
,
result
.
uri
.
fsPath
);
testingPs
.
push
(
...
...
@@ -159,7 +161,7 @@ export class TextSearchResultsCollector {
private
_currentFolderIdx
:
number
;
private
_currentUri
:
URI
;
private
_currentFileMatch
:
IFileMatch
;
private
_currentFileMatch
:
IFileMatch
|
null
=
null
;
constructor
(
private
_onResult
:
(
result
:
IFileMatch
[])
=>
void
)
{
this
.
_batchedCollector
=
new
BatchedCollector
<
IFileMatch
>
(
512
,
items
=>
this
.
sendItems
(
items
));
...
...
@@ -182,14 +184,14 @@ export class TextSearchResultsCollector {
};
}
this
.
_currentFileMatch
.
results
.
push
(
extensionResultToFrontendResult
(
data
));
this
.
_currentFileMatch
.
results
!
.
push
(
extensionResultToFrontendResult
(
data
));
}
private
pushToCollector
():
void
{
const
size
=
this
.
_currentFileMatch
?
const
size
=
this
.
_currentFileMatch
&&
this
.
_currentFileMatch
.
results
?
this
.
_currentFileMatch
.
results
.
length
:
0
;
this
.
_batchedCollector
.
addItem
(
this
.
_currentFileMatch
,
size
);
this
.
_batchedCollector
.
addItem
(
this
.
_currentFileMatch
!
,
size
);
}
flush
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录