Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bcc789e6
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(gitcode.net)2024年7月9日维护升级公告
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
bcc789e6
编写于
3月 07, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bye bye strings.replaceAll()
上级
2a121edd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
5 addition
and
13 deletion
+5
-13
src/vs/base/common/glob.ts
src/vs/base/common/glob.ts
+1
-1
src/vs/base/common/strings.ts
src/vs/base/common/strings.ts
+1
-8
src/vs/workbench/parts/output/common/outputWorker.ts
src/vs/workbench/parts/output/common/outputWorker.ts
+1
-1
src/vs/workbench/parts/output/test/outputWorker.test.ts
src/vs/workbench/parts/output/test/outputWorker.test.ts
+1
-2
src/vs/workbench/services/search/node/fileSearch.ts
src/vs/workbench/services/search/node/fileSearch.ts
+1
-1
未找到文件。
src/vs/base/common/glob.ts
浏览文件 @
bcc789e6
...
...
@@ -299,7 +299,7 @@ function matchExpression(expression: IExpression, path: string, siblings?: strin
}
let
clause
=
<
SiblingClause
>
value
;
let
clausePattern
=
strings
.
replaceAll
(
clause
.
when
,
'
$(basename)
'
,
basename
);
let
clausePattern
=
clause
.
when
.
replace
(
'
$(basename)
'
,
basename
);
if
(
siblings
.
some
((
sibling
)
=>
sibling
===
clausePattern
))
{
return
pattern
;
}
else
{
...
...
src/vs/base/common/strings.ts
浏览文件 @
bcc789e6
...
...
@@ -65,13 +65,6 @@ export function escapeRegExpCharacters(value: string): string {
return
value
.
replace
(
/
[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]
/g
,
'
\\
$&
'
);
}
/**
* Searches for all occurrences of needle in haystack and replaces them with replacement.
*/
export
function
replaceAll
(
haystack
:
string
,
needle
:
string
,
replacement
:
string
):
string
{
return
haystack
.
replace
(
new
RegExp
(
escapeRegExpCharacters
(
needle
.
toString
()),
'
g
'
),
replacement
);
}
/**
* Removes all occurrences of needle from the beginning and end of haystack.
* @param haystack string to trim
...
...
@@ -145,7 +138,7 @@ export function convertSimple2RegExpPattern(pattern: string): string {
}
export
function
stripWildcards
(
pattern
:
string
):
string
{
return
replaceAll
(
pattern
,
'
*
'
,
''
);
return
pattern
.
replace
(
/
\*
/g
,
''
);
}
/**
...
...
src/vs/workbench/parts/output/common/outputWorker.ts
浏览文件 @
bcc789e6
...
...
@@ -105,7 +105,7 @@ export class OutputWorker {
while
((
match
=
pattern
.
exec
(
line
))
!==
null
)
{
// Convert the relative path information to a resource that we can use in links
let
workspaceRelativePath
=
strings
.
r
eplaceAll
(
strings
.
rtrim
(
match
[
1
],
'
.
'
),
'
\\
'
,
'
/
'
);
// remove trailing "." that likely indicate end of sentence
let
workspaceRelativePath
=
strings
.
r
trim
(
match
[
1
],
'
.
'
).
replace
(
/
\\
/g
,
'
/
'
);
// remove trailing "." that likely indicate end of sentence
let
resource
:
string
;
try
{
resource
=
contextService
.
toResource
(
workspaceRelativePath
).
toString
();
...
...
src/vs/workbench/parts/output/test/outputWorker.test.ts
浏览文件 @
bcc789e6
...
...
@@ -6,7 +6,6 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
replaceAll
}
from
'
vs/base/common/strings
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
isMacintosh
,
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
OutputWorker
}
from
'
vs/workbench/parts/output/common/outputWorker
'
;
...
...
@@ -14,7 +13,7 @@ import {TestContextService} from 'vs/workbench/test/browser/servicesTestUtils';
function
toOSPath
(
p
:
string
):
string
{
if
(
isMacintosh
||
isLinux
)
{
return
replaceAll
(
p
,
'
\\
'
,
'
/
'
);
return
p
.
replace
(
/
\\
/g
,
'
/
'
);
}
return
p
;
...
...
src/vs/workbench/services/search/node/fileSearch.ts
浏览文件 @
bcc789e6
...
...
@@ -45,7 +45,7 @@ export class FileWalker {
this
.
isLimitHit
=
false
;
if
(
this
.
filePattern
)
{
this
.
filePattern
=
strings
.
replaceAll
(
this
.
filePattern
,
'
\\
'
,
'
/
'
);
// Normalize file patterns to forward slashes
this
.
filePattern
=
this
.
filePattern
.
replace
(
/
\\
/g
,
'
/
'
);
// Normalize file patterns to forward slashes
this
.
normalizedFilePatternLowercase
=
strings
.
stripWildcards
(
this
.
filePattern
).
toLowerCase
();
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录