Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2c5a0544
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,发现更多精彩内容 >>
提交
2c5a0544
编写于
11月 16, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove some unused bits, #38414
上级
e7ceef9f
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
3 addition
and
73 deletion
+3
-73
src/vs/base/common/strings.ts
src/vs/base/common/strings.ts
+0
-33
src/vs/base/common/uuid.ts
src/vs/base/common/uuid.ts
+0
-6
src/vs/base/test/common/strings.test.ts
src/vs/base/test/common/strings.test.ts
+0
-30
src/vs/base/test/common/uuid.test.ts
src/vs/base/test/common/uuid.test.ts
+3
-4
未找到文件。
src/vs/base/common/strings.ts
浏览文件 @
2c5a0544
...
...
@@ -618,20 +618,6 @@ export function isFullWidthCharacter(charCode: number): boolean {
);
}
/**
* Returns an array in which every entry is the offset of a
* line. There is always one entry which is zero.
*/
export
function
computeLineStarts
(
text
:
string
):
number
[]
{
let
regexp
=
/
\r\n
|
\r
|
\n
/g
,
ret
:
number
[]
=
[
0
],
match
:
RegExpExecArray
;
while
((
match
=
regexp
.
exec
(
text
)))
{
ret
.
push
(
regexp
.
lastIndex
);
}
return
ret
;
}
/**
* Given a string and a max length returns a shorted version. Shorting
* happens at favorable positions - such as whitespace or punctuation characters.
...
...
@@ -683,25 +669,6 @@ export function stripUTF8BOM(str: string): string {
return
startsWithUTF8BOM
(
str
)
?
str
.
substr
(
1
)
:
str
;
}
/**
* Appends two strings. If the appended result is longer than maxLength,
* trims the start of the result and replaces it with '...'.
*/
export
function
appendWithLimit
(
first
:
string
,
second
:
string
,
maxLength
:
number
):
string
{
const
newLength
=
first
.
length
+
second
.
length
;
if
(
newLength
>
maxLength
)
{
first
=
'
...
'
+
first
.
substr
(
newLength
-
maxLength
);
}
if
(
second
.
length
>
maxLength
)
{
first
+=
second
.
substr
(
second
.
length
-
maxLength
);
}
else
{
first
+=
second
;
}
return
first
;
}
export
function
safeBtoa
(
str
:
string
):
string
{
return
btoa
(
encodeURIComponent
(
str
));
// we use encodeURIComponent because btoa fails for non Latin 1 values
}
...
...
src/vs/base/common/uuid.ts
浏览文件 @
2c5a0544
...
...
@@ -13,8 +13,6 @@ export interface UUID {
* @returns the canonical representation in sets of hexadecimal numbers separated by dashes.
*/
asHex
():
string
;
equals
(
other
:
UUID
):
boolean
;
}
class
ValueUUID
implements
UUID
{
...
...
@@ -26,10 +24,6 @@ class ValueUUID implements UUID {
public
asHex
():
string
{
return
this
.
_value
;
}
public
equals
(
other
:
UUID
):
boolean
{
return
this
.
asHex
()
===
other
.
asHex
();
}
}
class
V4UUID
extends
ValueUUID
{
...
...
src/vs/base/test/common/strings.test.ts
浏览文件 @
2c5a0544
...
...
@@ -103,29 +103,6 @@ suite('Strings', () => {
assert
.
equal
(
strings
.
overlap
(
'
full
'
,
'
full
'
),
4
);
assert
.
equal
(
strings
.
overlap
(
'
full
'
,
'
fulloverlap
'
),
4
);
});
test
(
'
computeLineStarts
'
,
function
()
{
function
assertLineStart
(
text
:
string
,
...
offsets
:
number
[]):
void
{
const
actual
=
strings
.
computeLineStarts
(
text
);
assert
.
equal
(
actual
.
length
,
offsets
.
length
);
if
(
actual
.
length
!==
offsets
.
length
)
{
return
;
}
while
(
offsets
.
length
>
0
)
{
assert
.
equal
(
actual
.
pop
(),
offsets
.
pop
());
}
}
assertLineStart
(
''
,
0
);
assertLineStart
(
'
farboo
'
,
0
);
assertLineStart
(
'
far
\n
boo
'
,
0
,
4
);
assertLineStart
(
'
far
\r
boo
'
,
0
,
4
);
assertLineStart
(
'
far
\r\n
boo
'
,
0
,
5
);
assertLineStart
(
'
far
\n\r
boo
'
,
0
,
4
,
5
);
assertLineStart
(
'
far
\n
\r
boo
'
,
0
,
4
,
6
);
assertLineStart
(
'
far
\n
boo
\n
far
'
,
0
,
4
,
8
);
});
test
(
'
lcut
'
,
()
=>
{
assert
.
strictEqual
(
strings
.
lcut
(
'
foo bar
'
,
0
),
''
);
assert
.
strictEqual
(
strings
.
lcut
(
'
foo bar
'
,
1
),
'
bar
'
);
...
...
@@ -218,13 +195,6 @@ suite('Strings', () => {
assert
.
strictEqual
(
'
'
.
trim
(),
''
);
});
test
(
'
appendWithLimit
'
,
function
()
{
assert
.
strictEqual
(
strings
.
appendWithLimit
(
'
ab
'
,
'
cd
'
,
100
),
'
abcd
'
);
assert
.
strictEqual
(
strings
.
appendWithLimit
(
'
ab
'
,
'
cd
'
,
2
),
'
...cd
'
);
assert
.
strictEqual
(
strings
.
appendWithLimit
(
'
ab
'
,
'
cdefgh
'
,
4
),
'
...efgh
'
);
assert
.
strictEqual
(
strings
.
appendWithLimit
(
'
abcdef
'
,
'
ghijk
'
,
7
),
'
...efghijk
'
);
});
test
(
'
repeat
'
,
()
=>
{
assert
.
strictEqual
(
strings
.
repeat
(
'
'
,
4
),
'
'
);
assert
.
strictEqual
(
strings
.
repeat
(
'
'
,
1
),
'
'
);
...
...
src/vs/base/test/common/uuid.test.ts
浏览文件 @
2c5a0544
...
...
@@ -12,14 +12,13 @@ suite('UUID', () => {
var
asHex
=
uuid
.
v4
().
asHex
();
assert
.
equal
(
asHex
.
length
,
36
);
assert
.
equal
(
asHex
[
14
],
'
4
'
);
assert
(
asHex
[
19
]
===
'
8
'
||
asHex
[
19
]
===
'
9
'
||
asHex
[
19
]
===
'
a
'
||
asHex
[
19
]
===
'
b
'
);
assert
.
ok
(
asHex
[
19
]
===
'
8
'
||
asHex
[
19
]
===
'
9
'
||
asHex
[
19
]
===
'
a
'
||
asHex
[
19
]
===
'
b
'
);
});
test
(
'
parse
'
,
()
=>
{
var
id
=
uuid
.
v4
();
var
asHext
=
id
.
asHex
();
var
id2
=
uuid
.
parse
(
asHext
);
assert
(
id
.
equals
(
id2
));
assert
(
id2
.
equals
(
id
));
assert
.
equal
(
id
.
asHex
(),
id2
.
asHex
());
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录