Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
77ba628a
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,发现更多精彩内容 >>
提交
77ba628a
编写于
10月 26, 2017
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Anchor patterns (fixes #36438)
上级
9c62fff9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
49 addition
and
3 deletion
+49
-3
src/vs/workbench/services/search/node/ripgrepFileSearch.ts
src/vs/workbench/services/search/node/ripgrepFileSearch.ts
+7
-3
src/vs/workbench/services/search/test/node/fixtures2/36438/modules/do-not-find.txt
.../search/test/node/fixtures2/36438/modules/do-not-find.txt
+0
-0
src/vs/workbench/services/search/test/node/fixtures2/36438/more/modules/find.txt
...es/search/test/node/fixtures2/36438/more/modules/find.txt
+0
-0
src/vs/workbench/services/search/test/node/search.test.ts
src/vs/workbench/services/search/test/node/search.test.ts
+42
-0
未找到文件。
src/vs/workbench/services/search/node/ripgrepFileSearch.ts
浏览文件 @
77ba628a
...
...
@@ -8,7 +8,7 @@ import { rgPath } from 'vscode-ripgrep';
import
{
isMacintosh
as
isMac
}
from
'
vs/base/common/platform
'
;
import
*
as
glob
from
'
vs/base/common/glob
'
;
import
{
normalizeNFD
}
from
'
vs/base/common/strings
'
;
import
{
normalizeNFD
,
startsWith
}
from
'
vs/base/common/strings
'
;
import
{
IFolderSearch
,
IRawSearch
}
from
'
./search
'
;
import
{
foldersToIncludeGlobs
,
foldersToRgExcludeGlobs
}
from
'
./ripgrepTextSearch
'
;
...
...
@@ -26,14 +26,14 @@ function getRgArgs(config: IRawSearch, folderQuery: IFolderSearch, includePatter
// includePattern can't have siblingClauses
foldersToIncludeGlobs
([
folderQuery
],
includePattern
,
false
).
forEach
(
globArg
=>
{
args
.
push
(
'
-g
'
,
isMac
?
normalizeNFD
(
globArg
)
:
globArg
);
args
.
push
(
'
-g
'
,
anchor
(
isMac
?
normalizeNFD
(
globArg
)
:
globArg
)
);
});
let
siblingClauses
:
glob
.
IExpression
;
const
rgGlobs
=
foldersToRgExcludeGlobs
([
folderQuery
],
excludePattern
,
undefined
,
false
);
rgGlobs
.
globArgs
.
forEach
(
rgGlob
=>
args
.
push
(
'
-g
'
,
`!
${
isMac
?
normalizeNFD
(
rgGlob
)
:
rgGlob
}
`
));
.
forEach
(
rgGlob
=>
args
.
push
(
'
-g
'
,
`!
${
anchor
(
isMac
?
normalizeNFD
(
rgGlob
)
:
rgGlob
)
}
`
));
siblingClauses
=
rgGlobs
.
siblingClauses
;
if
(
config
.
disregardIgnoreFiles
)
{
...
...
@@ -57,3 +57,7 @@ function getRgArgs(config: IRawSearch, folderQuery: IFolderSearch, includePatter
return
{
globArgs
:
args
,
siblingClauses
};
}
function
anchor
(
glob
:
string
)
{
return
startsWith
(
glob
,
'
**
'
)
||
startsWith
(
glob
,
'
/
'
)
?
glob
:
`/
${
glob
}
`
;
}
\ No newline at end of file
src/vs/workbench/services/search/test/node/fixtures2/36438/modules/do-not-find.txt
0 → 100644
浏览文件 @
77ba628a
src/vs/workbench/services/search/test/node/fixtures2/36438/more/modules/find.txt
0 → 100644
浏览文件 @
77ba628a
src/vs/workbench/services/search/test/node/search.test.ts
浏览文件 @
77ba628a
...
...
@@ -22,6 +22,10 @@ const ROOT_FOLDER_QUERY: IFolderSearch[] = [
TEST_ROOT_FOLDER
];
const
ROOT_FOLDER_QUERY_36438
:
IFolderSearch
[]
=
[
{
folder
:
path
.
normalize
(
require
.
toUrl
(
'
./fixtures2/36438
'
))
}
];
const
MULTIROOT_QUERIES
:
IFolderSearch
[]
=
[
{
folder
:
EXAMPLES_FIXTURES
},
{
folder
:
MORE_FIXTURES
}
...
...
@@ -381,6 +385,44 @@ suite('FileSearchEngine', () => {
});
});
test
(
'
Files: exclude folder without wildcard #36438
'
,
function
(
done
:
()
=>
void
)
{
this
.
timeout
(
testTimeout
);
let
engine
=
new
FileSearchEngine
({
folderQueries
:
ROOT_FOLDER_QUERY_36438
,
excludePattern
:
{
'
modules
'
:
true
}
});
let
count
=
0
;
engine
.
search
((
result
)
=>
{
if
(
result
)
{
count
++
;
}
},
()
=>
{
},
(
error
)
=>
{
assert
.
ok
(
!
error
);
assert
.
equal
(
count
,
1
);
done
();
});
});
test
(
'
Files: include folder without wildcard #36438
'
,
function
(
done
:
()
=>
void
)
{
this
.
timeout
(
testTimeout
);
let
engine
=
new
FileSearchEngine
({
folderQueries
:
ROOT_FOLDER_QUERY_36438
,
includePattern
:
{
'
modules/**
'
:
true
}
});
let
count
=
0
;
engine
.
search
((
result
)
=>
{
if
(
result
)
{
count
++
;
}
},
()
=>
{
},
(
error
)
=>
{
assert
.
ok
(
!
error
);
assert
.
equal
(
count
,
1
);
done
();
});
});
test
(
'
Files: *.* exclude folder with leading wildcard
'
,
function
(
done
:
()
=>
void
)
{
this
.
timeout
(
testTimeout
);
let
engine
=
new
FileSearchEngine
({
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录