Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
42c716dc
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,发现更多精彩内容 >>
提交
42c716dc
编写于
11月 06, 2018
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strict null check more search files
上级
1d44116f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
20 deletion
+20
-20
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+4
-2
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+1
-1
src/vs/workbench/services/search/common/searchHelpers.ts
src/vs/workbench/services/search/common/searchHelpers.ts
+2
-2
src/vs/workbench/services/search/node/fileSearchManager.ts
src/vs/workbench/services/search/node/fileSearchManager.ts
+13
-15
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
42c716dc
...
...
@@ -654,10 +654,14 @@
"./vs/workbench/services/part/common/partService.ts"
,
"./vs/workbench/services/scm/common/scm.ts"
,
"./vs/workbench/services/scm/common/scmService.ts"
,
"./vs/workbench/services/search/common/searchHelpers.ts"
,
"./vs/workbench/services/search/node/fileSearchManager.ts"
,
"./vs/workbench/services/search/node/legacy/search.ts"
,
"./vs/workbench/services/search/node/ripgrepSearchUtils.ts"
,
"./vs/workbench/services/search/node/search.ts"
,
"./vs/workbench/services/search/node/searchHistoryService.ts"
,
"./vs/workbench/services/search/node/searchIpc.ts"
,
"./vs/workbench/services/search/node/textSearchManager.ts"
,
"./vs/workbench/services/textMate/electron-browser/TMGrammars.ts"
,
"./vs/workbench/services/textMate/electron-browser/TMHelper.ts"
,
"./vs/workbench/services/textMate/electron-browser/textMateService.ts"
,
...
...
@@ -669,8 +673,6 @@
"./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/textSearchManager.ts"
],
"exclude"
:
[
"./typings/require-monaco.d.ts"
,
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
42c716dc
...
...
@@ -233,7 +233,7 @@ declare module 'vscode' {
/**
* The maximum number of results to be returned.
*/
maxResults
:
number
;
maxResults
?
:
number
;
}
/**
...
...
src/vs/workbench/services/search/common/searchHelpers.ts
浏览文件 @
42c716dc
...
...
@@ -51,7 +51,7 @@ export function addContextToEditorMatches(matches: ITextSearchMatch[], model: IT
let
prevLine
=
-
1
;
for
(
let
i
=
0
;
i
<
matches
.
length
;
i
++
)
{
const
{
start
:
matchStartLine
,
end
:
matchEndLine
}
=
getMatchStartEnd
(
matches
[
i
]);
if
(
query
.
beforeContext
>
0
)
{
if
(
typeof
query
.
beforeContext
===
'
number
'
&&
query
.
beforeContext
>
0
)
{
const
beforeContextStartLine
=
Math
.
max
(
prevLine
+
1
,
matchStartLine
-
query
.
beforeContext
);
for
(
let
b
=
beforeContextStartLine
;
b
<
matchStartLine
;
b
++
)
{
results
.
push
(
<
ITextSearchContext
>
{
...
...
@@ -65,7 +65,7 @@ export function addContextToEditorMatches(matches: ITextSearchMatch[], model: IT
const
nextMatch
=
matches
[
i
+
1
];
let
nextMatchStartLine
=
nextMatch
?
getMatchStartEnd
(
nextMatch
).
start
:
Number
.
MAX_VALUE
;
if
(
query
.
afterContext
>
0
)
{
if
(
typeof
query
.
afterContext
===
'
number
'
&&
query
.
afterContext
>
0
)
{
const
afterContextToLine
=
Math
.
min
(
nextMatchStartLine
-
1
,
matchEndLine
+
query
.
afterContext
,
model
.
getLineCount
()
-
1
);
for
(
let
a
=
matchEndLine
+
1
;
a
<=
afterContextToLine
;
a
++
)
{
results
.
push
(
<
ITextSearchContext
>
{
...
...
src/vs/workbench/services/search/node/fileSearchManager.ts
浏览文件 @
42c716dc
...
...
@@ -36,25 +36,23 @@ export interface IDirectoryTree {
class
FileSearchEngine
{
private
filePattern
:
string
;
private
includePattern
:
glob
.
ParsedExpression
;
private
maxResults
:
number
;
private
exists
:
boolean
;
private
isLimitHit
:
boolean
;
private
resultCount
:
number
;
private
isCanceled
:
boolean
;
private
filePattern
?
:
string
;
private
includePattern
?
:
glob
.
ParsedExpression
;
private
maxResults
?
:
number
;
private
exists
?
:
boolean
;
private
isLimitHit
=
false
;
private
resultCount
=
0
;
private
isCanceled
=
false
;
private
activeCancellationTokens
:
Set
<
CancellationTokenSource
>
;
private
globalExcludePattern
:
glob
.
ParsedExpression
;
private
globalExcludePattern
?
:
glob
.
ParsedExpression
;
constructor
(
private
config
:
IFileQuery
,
private
provider
:
vscode
.
FileSearchProvider
)
{
this
.
filePattern
=
config
.
filePattern
;
this
.
includePattern
=
config
.
includePattern
&&
glob
.
parse
(
config
.
includePattern
);
this
.
maxResults
=
config
.
maxResults
||
null
;
this
.
maxResults
=
config
.
maxResults
||
undefined
;
this
.
exists
=
config
.
exists
;
this
.
resultCount
=
0
;
this
.
isLimitHit
=
false
;
this
.
activeCancellationTokens
=
new
Set
<
CancellationTokenSource
>
();
this
.
globalExcludePattern
=
config
.
excludePattern
&&
glob
.
parse
(
config
.
excludePattern
);
...
...
@@ -67,7 +65,7 @@ class FileSearchEngine {
}
public
search
(
_onResult
:
(
match
:
IInternalFileMatch
)
=>
void
):
TPromise
<
IInternalSearchComplete
>
{
const
folderQueries
=
this
.
config
.
folderQueries
;
const
folderQueries
=
this
.
config
.
folderQueries
||
[]
;
return
new
TPromise
((
resolve
,
reject
)
=>
{
const
onResult
=
(
match
:
IInternalFileMatch
)
=>
{
...
...
@@ -101,7 +99,7 @@ class FileSearchEngine {
})).
then
(
stats
=>
{
resolve
({
limitHit
:
this
.
isLimitHit
,
stats
:
stats
[
0
]
// Only looking at single-folder workspace stats...
stats
:
stats
[
0
]
||
undefined
// Only looking at single-folder workspace stats...
});
},
(
errs
:
Error
[])
=>
{
const
errMsg
=
errs
...
...
@@ -113,7 +111,7 @@ class FileSearchEngine {
});
}
private
searchInFolder
(
fq
:
IFolderQuery
<
URI
>
,
onResult
:
(
match
:
IInternalFileMatch
)
=>
void
):
TPromise
<
IFileSearchProviderStats
>
{
private
searchInFolder
(
fq
:
IFolderQuery
<
URI
>
,
onResult
:
(
match
:
IInternalFileMatch
)
=>
void
):
TPromise
<
IFileSearchProviderStats
|
null
>
{
let
cancellation
=
new
CancellationTokenSource
();
return
new
TPromise
((
resolve
,
reject
)
=>
{
const
options
=
this
.
getSearchOptionsForFolder
(
fq
);
...
...
@@ -267,7 +265,7 @@ class FileSearchEngine {
}
private
matchFile
(
onResult
:
(
result
:
IInternalFileMatch
)
=>
void
,
candidate
:
IInternalFileMatch
):
void
{
if
(
!
this
.
includePattern
||
this
.
includePattern
(
candidate
.
relativePath
,
candidate
.
basename
))
{
if
(
!
this
.
includePattern
||
(
candidate
.
relativePath
&&
this
.
includePattern
(
candidate
.
relativePath
,
candidate
.
basename
)
))
{
if
(
this
.
exists
||
(
this
.
maxResults
&&
this
.
resultCount
>=
this
.
maxResults
))
{
this
.
isLimitHit
=
true
;
this
.
cancel
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录