Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7bbd1338
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,发现更多精彩内容 >>
提交
7bbd1338
编写于
9月 23, 2020
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove strings.startsWith() (#103454)
上级
ad5cb8ea
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
8 addition
and
45 deletion
+8
-45
src/vs/base/common/strings.ts
src/vs/base/common/strings.ts
+0
-21
src/vs/base/test/common/resources.test.ts
src/vs/base/test/common/resources.test.ts
+1
-2
src/vs/base/test/common/strings.test.ts
src/vs/base/test/common/strings.test.ts
+0
-10
src/vs/editor/contrib/codeAction/types.ts
src/vs/editor/contrib/codeAction/types.ts
+1
-2
src/vs/workbench/api/common/extHostTypes.ts
src/vs/workbench/api/common/extHostTypes.ts
+1
-2
src/vs/workbench/api/common/jsonValidationExtensionPoint.ts
src/vs/workbench/api/common/jsonValidationExtensionPoint.ts
+1
-2
src/vs/workbench/contrib/tasks/node/processRunnerDetector.ts
src/vs/workbench/contrib/tasks/node/processRunnerDetector.ts
+1
-1
src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts
src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts
+2
-3
src/vs/workbench/services/themes/common/colorThemeData.ts
src/vs/workbench/services/themes/common/colorThemeData.ts
+1
-2
未找到文件。
src/vs/base/common/strings.ts
浏览文件 @
7bbd1338
...
...
@@ -144,27 +144,6 @@ export function stripWildcards(pattern: string): string {
return
pattern
.
replace
(
/
\*
/g
,
''
);
}
/**
* @deprecated ES6: use `String.startsWith`
*/
export
function
startsWith
(
haystack
:
string
,
needle
:
string
):
boolean
{
if
(
haystack
.
length
<
needle
.
length
)
{
return
false
;
}
if
(
haystack
===
needle
)
{
return
true
;
}
for
(
let
i
=
0
;
i
<
needle
.
length
;
i
++
)
{
if
(
haystack
[
i
]
!==
needle
[
i
])
{
return
false
;
}
}
return
true
;
}
/**
* @deprecated ES6: use `String.endsWith`
*/
...
...
src/vs/base/test/common/resources.test.ts
浏览文件 @
7bbd1338
...
...
@@ -7,7 +7,6 @@ import { dirname, basename, distinctParents, joinPath, normalizePath, isAbsolute
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
toSlashes
}
from
'
vs/base/common/extpath
'
;
import
{
startsWith
}
from
'
vs/base/common/strings
'
;
import
{
win32
,
posix
}
from
'
vs/base/common/path
'
;
...
...
@@ -304,7 +303,7 @@ suite('Resources', () => {
const
p
=
path
.
indexOf
(
'
/
'
)
!==
-
1
?
posix
:
win32
;
if
(
!
p
.
isAbsolute
(
path
))
{
let
expectedPath
=
isWindows
?
toSlashes
(
path
)
:
path
;
expectedPath
=
startsWith
(
expectedPath
,
'
./
'
)
?
expectedPath
.
substr
(
2
)
:
expectedPath
;
expectedPath
=
expectedPath
.
startsWith
(
'
./
'
)
?
expectedPath
.
substr
(
2
)
:
expectedPath
;
assert
.
equal
(
relativePath
(
u1
,
actual
),
expectedPath
,
`relativePath (
${
u1
.
toString
()}
) on actual (
${
actual
.
toString
()}
) should be to path (
${
expectedPath
}
)`
);
}
}
...
...
src/vs/base/test/common/strings.test.ts
浏览文件 @
7bbd1338
...
...
@@ -140,16 +140,6 @@ suite('Strings', () => {
assert
.
strictEqual
(
strings
.
escape
(
'
<foo>Hello</foo>
'
),
'
<foo>Hello</foo>
'
);
});
test
(
'
startsWith
'
,
()
=>
{
assert
(
strings
.
startsWith
(
'
foo
'
,
'
f
'
));
assert
(
strings
.
startsWith
(
'
foo
'
,
'
fo
'
));
assert
(
strings
.
startsWith
(
'
foo
'
,
'
foo
'
));
assert
(
!
strings
.
startsWith
(
'
foo
'
,
'
o
'
));
assert
(
!
strings
.
startsWith
(
''
,
'
f
'
));
assert
(
strings
.
startsWith
(
'
foo
'
,
''
));
assert
(
strings
.
startsWith
(
''
,
''
));
});
test
(
'
endsWith
'
,
()
=>
{
assert
(
strings
.
endsWith
(
'
foo
'
,
'
o
'
));
assert
(
strings
.
endsWith
(
'
foo
'
,
'
oo
'
));
...
...
src/vs/editor/contrib/codeAction/types.ts
浏览文件 @
7bbd1338
...
...
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
startsWith
}
from
'
vs/base/common/strings
'
;
import
{
CodeAction
,
CodeActionTriggerType
}
from
'
vs/editor/common/modes
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
...
...
@@ -27,7 +26,7 @@ export class CodeActionKind {
}
public
contains
(
other
:
CodeActionKind
):
boolean
{
return
this
.
equals
(
other
)
||
this
.
value
===
''
||
startsWith
(
other
.
value
,
this
.
value
+
CodeActionKind
.
sep
);
return
this
.
equals
(
other
)
||
this
.
value
===
''
||
other
.
value
.
startsWith
(
this
.
value
+
CodeActionKind
.
sep
);
}
public
intersects
(
other
:
CodeActionKind
):
boolean
{
...
...
src/vs/workbench/api/common/extHostTypes.ts
浏览文件 @
7bbd1338
...
...
@@ -9,7 +9,6 @@ import { illegalArgument } from 'vs/base/common/errors';
import
{
IRelativePattern
}
from
'
vs/base/common/glob
'
;
import
{
isMarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
{
ResourceMap
}
from
'
vs/base/common/map
'
;
import
{
startsWith
}
from
'
vs/base/common/strings
'
;
import
{
isStringArray
}
from
'
vs/base/common/types
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
...
...
@@ -1171,7 +1170,7 @@ export class CodeActionKind {
}
public
contains
(
other
:
CodeActionKind
):
boolean
{
return
this
.
value
===
other
.
value
||
startsWith
(
other
.
value
,
this
.
value
+
CodeActionKind
.
sep
);
return
this
.
value
===
other
.
value
||
other
.
value
.
startsWith
(
this
.
value
+
CodeActionKind
.
sep
);
}
}
CodeActionKind
.
Empty
=
new
CodeActionKind
(
''
);
...
...
src/vs/workbench/api/common/jsonValidationExtensionPoint.ts
浏览文件 @
7bbd1338
...
...
@@ -5,7 +5,6 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
ExtensionsRegistry
}
from
'
vs/workbench/services/extensions/common/extensionsRegistry
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
*
as
resources
from
'
vs/base/common/resources
'
;
import
{
isString
}
from
'
vs/base/common/types
'
;
...
...
@@ -64,7 +63,7 @@ export class JSONValidationExtensionPoint {
collector
.
error
(
nls
.
localize
(
'
invalid.url
'
,
"
'configuration.jsonValidation.url' must be a URL or relative path
"
));
return
;
}
if
(
strings
.
startsWith
(
uri
,
'
./
'
))
{
if
(
uri
.
startsWith
(
'
./
'
))
{
try
{
const
colorThemeLocation
=
resources
.
joinPath
(
extensionLocation
,
uri
);
if
(
!
resources
.
isEqualOrParent
(
colorThemeLocation
,
extensionLocation
))
{
...
...
src/vs/workbench/contrib/tasks/node/processRunnerDetector.ts
浏览文件 @
7bbd1338
...
...
@@ -379,7 +379,7 @@ export class ProcessRunnerDetector {
if
(
taskName
===
test
)
{
taskInfo
.
index
=
index
;
taskInfo
.
exact
=
3
;
}
else
if
((
Strings
.
startsWith
(
taskName
,
test
)
||
Strings
.
endsWith
(
taskName
,
test
))
&&
taskInfo
.
exact
<
3
)
{
}
else
if
((
taskName
.
startsWith
(
test
)
||
taskName
.
endsWith
(
test
))
&&
taskInfo
.
exact
<
3
)
{
taskInfo
.
index
=
index
;
taskInfo
.
exact
=
2
;
}
else
if
(
taskName
.
indexOf
(
test
)
!==
-
1
&&
taskInfo
.
exact
<
2
)
{
...
...
src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts
浏览文件 @
7bbd1338
...
...
@@ -6,7 +6,6 @@
import
'
vs/css!./welcomePage
'
;
import
'
vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
CommandsRegistry
,
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
*
as
arrays
from
'
vs/base/common/arrays
'
;
import
{
WalkThroughInput
}
from
'
vs/workbench/contrib/welcome/walkThrough/browser/walkThroughInput
'
;
...
...
@@ -78,7 +77,7 @@ export class WelcomePageContribution implements IWorkbenchContribution {
.
then
(
folder
=>
{
const
files
=
folder
.
children
?
folder
.
children
.
map
(
child
=>
child
.
name
)
:
[];
const
file
=
files
.
sort
().
find
(
file
=>
strings
.
startsWith
(
file
.
toLowerCase
(),
'
readme
'
));
const
file
=
files
.
sort
().
find
(
file
=>
file
.
toLowerCase
().
startsWith
(
'
readme
'
));
if
(
file
)
{
return
joinPath
(
folderUri
,
file
);
}
...
...
@@ -88,7 +87,7 @@ export class WelcomePageContribution implements IWorkbenchContribution {
.
then
<
any
>
(
readmes
=>
{
if
(
!
editorService
.
activeEditor
)
{
if
(
readmes
.
length
)
{
const
isMarkDown
=
(
readme
:
URI
)
=>
strings
.
endsWith
(
readme
.
path
.
toLowerCase
(),
'
.md
'
);
const
isMarkDown
=
(
readme
:
URI
)
=>
readme
.
path
.
toLowerCase
().
endsWith
(
'
.md
'
);
return
Promise
.
all
([
this
.
commandService
.
executeCommand
(
'
markdown.showPreview
'
,
null
,
readmes
.
filter
(
isMarkDown
),
{
locked
:
true
}),
editorService
.
openEditors
(
readmes
.
filter
(
readme
=>
!
isMarkDown
(
readme
))
...
...
src/vs/workbench/services/themes/common/colorThemeData.ts
浏览文件 @
7bbd1338
...
...
@@ -19,7 +19,6 @@ import { Registry } from 'vs/platform/registry/common/platform';
import
{
getParseErrorMessage
}
from
'
vs/base/common/jsonErrorMessages
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
parse
as
parsePList
}
from
'
vs/workbench/services/themes/common/plistParser
'
;
import
{
startsWith
}
from
'
vs/base/common/strings
'
;
import
{
TokenStyle
,
SemanticTokenRule
,
ProbeScope
,
getTokenClassificationRegistry
,
TokenStyleValue
,
TokenStyleData
,
parseClassifierString
}
from
'
vs/platform/theme/common/tokenClassificationRegistry
'
;
import
{
MatcherWithPriority
,
Matcher
,
createMatchers
}
from
'
vs/workbench/services/themes/common/textMateScopeMatcher
'
;
import
{
IExtensionResourceLoaderService
}
from
'
vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader
'
;
...
...
@@ -641,7 +640,7 @@ export class ColorThemeData implements IWorkbenchColorTheme {
}
function
toCSSSelector
(
extensionId
:
string
,
path
:
string
)
{
if
(
startsWith
(
path
,
'
./
'
))
{
if
(
path
.
startsWith
(
'
./
'
))
{
path
=
path
.
substr
(
2
);
}
let
str
=
`
${
extensionId
}
-
${
path
}
`
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录