Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7e577073
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,发现更多精彩内容 >>
提交
7e577073
编写于
11月 30, 2016
作者:
R
roblou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Log errors from worker
上级
27f6824c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
23 addition
and
5 deletion
+23
-5
src/vs/workbench/services/search/node/textSearch.ts
src/vs/workbench/services/search/node/textSearch.ts
+12
-3
src/vs/workbench/services/search/node/worker/searchWorker.ts
src/vs/workbench/services/search/node/worker/searchWorker.ts
+10
-1
src/vs/workbench/services/search/node/worker/searchWorkerIpc.ts
.../workbench/services/search/node/worker/searchWorkerIpc.ts
+1
-1
未找到文件。
src/vs/workbench/services/search/node/textSearch.ts
浏览文件 @
7e577073
...
...
@@ -12,6 +12,7 @@ import * as path from 'path';
import
*
as
ipc
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
IProgress
}
from
'
vs/platform/search/common/search
'
;
import
{
FileWalker
}
from
'
vs/workbench/services/search/node/fileSearch
'
;
import
{
ISerializedFileMatch
,
ISerializedSearchComplete
,
IRawSearch
,
ISearchEngine
}
from
'
./search
'
;
...
...
@@ -49,7 +50,10 @@ export class Engine implements ISearchEngine<ISerializedFileMatch> {
this
.
isCanceled
=
true
;
this
.
walker
.
cancel
();
this
.
workers
.
forEach
(
w
=>
w
.
cancel
());
this
.
workers
.
forEach
(
w
=>
{
w
.
cancel
()
.
then
(
null
,
onUnexpectedError
);
});
}
search
(
onResult
:
(
match
:
ISerializedFileMatch
)
=>
void
,
onProgress
:
(
progress
:
IProgress
)
=>
void
,
done
:
(
error
:
Error
,
complete
:
ISerializedSearchComplete
)
=>
void
):
void
{
...
...
@@ -101,6 +105,11 @@ export class Engine implements ISearchEngine<ISerializedFileMatch> {
this
.
limitReached
=
true
;
}
unwind
(
batchBytes
);
},
error
=>
{
// An error on the worker's end, not in reading the file, but in processing the batch. Log and continue.
onUnexpectedError
(
error
);
unwind
(
batchBytes
);
});
};
...
...
@@ -170,7 +179,7 @@ export class Engine implements ISearchEngine<ISerializedFileMatch> {
const
channel
=
ipc
.
getNextTickChannel
(
client
.
getChannel
<
ISearchWorkerChannel
>
(
'
searchWorker
'
));
const
channelClient
=
new
SearchWorkerChannelClient
(
channel
);
const
config
:
ISearchWorkerConfig
=
{
pattern
:
this
.
config
.
contentPattern
,
id
,
fileEncoding
:
this
.
config
.
fileEncoding
};
channelClient
.
initialize
(
config
);
channelClient
.
initialize
(
config
)
.
then
(
null
,
onUnexpectedError
)
;
this
.
workers
.
push
(
channelClient
);
this
.
workerClients
.
push
(
client
);
...
...
src/vs/workbench/services/search/node/worker/searchWorker.ts
浏览文件 @
7e577073
...
...
@@ -7,6 +7,7 @@
import
*
as
fs
from
'
fs
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ISerializedFileMatch
}
from
'
../search
'
;
...
...
@@ -25,6 +26,14 @@ interface ReadLinesOptions {
// Global isCanceled flag for the process. It's only set once and this avoids awkwardness in passing it around.
let
isCanceled
=
false
;
const
MAX_FILE_ERRORS
=
5
;
// Don't report more than this number of errors, 1 per file, to avoid flooding the log when there's a general issue
let
numErrorsLogged
=
0
;
function
onError
(
error
:
any
):
void
{
if
(
numErrorsLogged
++
<
MAX_FILE_ERRORS
)
{
onUnexpectedError
(
error
);
}
}
export
class
SearchWorker
implements
ISearchWorker
{
static
CONCURRENT_SEARCH_PATHS
=
2
;
...
...
@@ -89,7 +98,7 @@ function searchBatch(absolutePaths: string[], contentPattern: RegExp, fileEncodi
if
(
absolutePaths
.
length
)
{
return
startSearchInFile
(
absolutePaths
.
shift
());
}
});
}
,
onError
);
};
let
batchPromises
:
TPromise
<
void
>
[]
=
[];
...
...
src/vs/workbench/services/search/node/worker/searchWorkerIpc.ts
浏览文件 @
7e577073
...
...
@@ -47,7 +47,7 @@ export class SearchWorkerChannel implements ISearchWorkerChannel {
call
(
command
:
string
,
arg
?:
any
):
TPromise
<
any
>
{
switch
(
command
)
{
case
'
initialize
'
:
return
TPromise
.
wrap
(
this
.
worker
.
initialize
(
arg
)
);
case
'
initialize
'
:
return
this
.
worker
.
initialize
(
arg
);
case
'
search
'
:
return
this
.
worker
.
search
(
arg
);
case
'
cancel
'
:
return
this
.
worker
.
cancel
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录