Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
27d7141d
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,发现更多精彩内容 >>
提交
27d7141d
编写于
10月 01, 2019
作者:
S
skprabhanjan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Changed hyphen and underscore ordering"
This reverts commit
a3fc301d
.
上级
a3fc301d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
9 addition
and
32 deletion
+9
-32
src/vs/base/common/search.ts
src/vs/base/common/search.ts
+9
-8
src/vs/editor/contrib/find/test/replacePattern.test.ts
src/vs/editor/contrib/find/test/replacePattern.test.ts
+0
-24
未找到文件。
src/vs/base/common/search.ts
浏览文件 @
27d7141d
...
...
@@ -7,19 +7,20 @@ import * as strings from './strings';
export
function
buildReplaceStringWithCasePreserved
(
matches
:
string
[]
|
null
,
pattern
:
string
):
string
{
if
(
matches
&&
(
matches
[
0
]
!==
''
))
{
if
(
matches
[
0
].
toUpperCase
()
===
matches
[
0
])
{
return
pattern
.
toUpperCase
();
}
else
if
(
matches
[
0
].
toLowerCase
()
===
matches
[
0
])
{
return
pattern
.
toLowerCase
();
}
else
if
(
strings
.
containsUppercaseCharacter
(
matches
[
0
][
0
]))
{
const
containsHyphens
=
validateSpecificSpecialCharacter
(
matches
,
pattern
,
'
-
'
);
const
containsUnderscores
=
validateSpecificSpecialCharacter
(
matches
,
pattern
,
'
_
'
);
if
(
containsHyphens
&&
!
containsUnderscores
)
{
return
buildReplaceStringForSpecificSpecialCharacter
(
matches
,
pattern
,
'
-
'
);
}
else
if
(
!
containsHyphens
&&
containsUnderscores
)
{
return
buildReplaceStringForSpecificSpecialCharacter
(
matches
,
pattern
,
'
_
'
);
}
if
(
matches
[
0
].
toUpperCase
()
===
matches
[
0
])
{
return
pattern
.
toUpperCase
();
}
else
if
(
matches
[
0
].
toLowerCase
()
===
matches
[
0
])
{
return
pattern
.
toLowerCase
();
}
else
if
(
strings
.
containsUppercaseCharacter
(
matches
[
0
][
0
]))
{
}
else
{
return
pattern
[
0
].
toUpperCase
()
+
pattern
.
substr
(
1
);
}
}
else
{
// we don't understand its pattern yet.
return
pattern
;
...
...
src/vs/editor/contrib/find/test/replacePattern.test.ts
浏览文件 @
27d7141d
...
...
@@ -183,10 +183,6 @@ suite('Replace Pattern test', () => {
assert
.
equal
(
buildReplaceStringWithCasePreserved
(
actual
,
'
newfoo-newbar-newabc
'
),
'
Newfoo-Newbar-Newabc
'
);
actual
=
[
'
Foo-Bar-abc
'
];
assert
.
equal
(
buildReplaceStringWithCasePreserved
(
actual
,
'
newfoo-newbar
'
),
'
Newfoo-newbar
'
);
actual
=
[
'
foo-Bar
'
];
assert
.
equal
(
buildReplaceStringWithCasePreserved
(
actual
,
'
newfoo-newbar
'
),
'
newfoo-Newbar
'
);
actual
=
[
'
foo-BAR
'
];
assert
.
equal
(
buildReplaceStringWithCasePreserved
(
actual
,
'
newfoo-newbar
'
),
'
newfoo-NEWBAR
'
);
actual
=
[
'
Foo_Bar
'
];
assert
.
equal
(
buildReplaceStringWithCasePreserved
(
actual
,
'
newfoo_newbar
'
),
'
Newfoo_Newbar
'
);
...
...
@@ -196,10 +192,6 @@ suite('Replace Pattern test', () => {
assert
.
equal
(
buildReplaceStringWithCasePreserved
(
actual
,
'
newfoo_newbar
'
),
'
Newfoo_newbar
'
);
actual
=
[
'
Foo_Bar-abc
'
];
assert
.
equal
(
buildReplaceStringWithCasePreserved
(
actual
,
'
newfoo_newbar-abc
'
),
'
Newfoo_newbar-abc
'
);
actual
=
[
'
foo_Bar
'
];
assert
.
equal
(
buildReplaceStringWithCasePreserved
(
actual
,
'
newfoo_newbar
'
),
'
newfoo_Newbar
'
);
actual
=
[
'
Foo_BAR
'
];
assert
.
equal
(
buildReplaceStringWithCasePreserved
(
actual
,
'
newfoo_newbar
'
),
'
Newfoo_NEWBAR
'
);
});
test
(
'
preserve case
'
,
()
=>
{
...
...
@@ -235,14 +227,6 @@ suite('Replace Pattern test', () => {
actual
=
replacePattern
.
buildReplaceString
([
'
Foo-Bar-abc
'
],
true
);
assert
.
equal
(
actual
,
'
Newfoo-newbar
'
);
replacePattern
=
parseReplaceString
(
'
newfoo-newbar
'
);
actual
=
replacePattern
.
buildReplaceString
([
'
foo-Bar
'
],
true
);
assert
.
equal
(
actual
,
'
newfoo-Newbar
'
);
replacePattern
=
parseReplaceString
(
'
newfoo-newbar
'
);
actual
=
replacePattern
.
buildReplaceString
([
'
foo-BAR
'
],
true
);
assert
.
equal
(
actual
,
'
newfoo-NEWBAR
'
);
replacePattern
=
parseReplaceString
(
'
newfoo_newbar
'
);
actual
=
replacePattern
.
buildReplaceString
([
'
Foo_Bar
'
],
true
);
assert
.
equal
(
actual
,
'
Newfoo_Newbar
'
);
...
...
@@ -258,13 +242,5 @@ suite('Replace Pattern test', () => {
replacePattern
=
parseReplaceString
(
'
newfoo_newbar-abc
'
);
actual
=
replacePattern
.
buildReplaceString
([
'
Foo_Bar-abc
'
],
true
);
assert
.
equal
(
actual
,
'
Newfoo_newbar-abc
'
);
replacePattern
=
parseReplaceString
(
'
newfoo_newbar
'
);
actual
=
replacePattern
.
buildReplaceString
([
'
foo_Bar
'
],
true
);
assert
.
equal
(
actual
,
'
newfoo_Newbar
'
);
replacePattern
=
parseReplaceString
(
'
newfoo_newbar
'
);
actual
=
replacePattern
.
buildReplaceString
([
'
foo_BAR
'
],
true
);
assert
.
equal
(
actual
,
'
newfoo_NEWBAR
'
);
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录