Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7b29e7c3
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,发现更多精彩内容 >>
未验证
提交
7b29e7c3
编写于
7月 07, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reduce usage of utilities (for #99664)
上级
60fba749
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
24 addition
and
22 deletion
+24
-22
src/vs/base/common/arrays.ts
src/vs/base/common/arrays.ts
+8
-0
src/vs/editor/common/model/textModel.ts
src/vs/editor/common/model/textModel.ts
+2
-3
src/vs/editor/common/modes/tokenizationRegistry.ts
src/vs/editor/common/modes/tokenizationRegistry.ts
+3
-4
src/vs/editor/common/services/languagesRegistry.ts
src/vs/editor/common/services/languagesRegistry.ts
+1
-2
src/vs/editor/common/services/markerDecorationsServiceImpl.ts
...vs/editor/common/services/markerDecorationsServiceImpl.ts
+1
-2
src/vs/platform/contextkey/browser/contextKeyService.ts
src/vs/platform/contextkey/browser/contextKeyService.ts
+2
-2
src/vs/platform/keybinding/common/keybindingResolver.ts
src/vs/platform/keybinding/common/keybindingResolver.ts
+2
-3
src/vs/workbench/services/extensions/common/extensionsRegistry.ts
...orkbench/services/extensions/common/extensionsRegistry.ts
+2
-2
src/vs/workbench/services/extensions/electron-browser/remoteExtensionManagementIpc.ts
...tensions/electron-browser/remoteExtensionManagementIpc.ts
+3
-4
未找到文件。
src/vs/base/common/arrays.ts
浏览文件 @
7b29e7c3
...
...
@@ -591,6 +591,14 @@ export function asArray<T>(x: T | T[]): T[] {
return
Array
.
isArray
(
x
)
?
x
:
[
x
];
}
export
function
toArray
<
T
>
(
iterable
:
IterableIterator
<
T
>
):
T
[]
{
const
result
:
T
[]
=
[];
for
(
let
element
of
iterable
)
{
result
.
push
(
element
);
}
return
result
;
}
export
function
getRandomElement
<
T
>
(
arr
:
T
[]):
T
|
undefined
{
return
arr
[
Math
.
floor
(
Math
.
random
()
*
arr
.
length
)];
}
src/vs/editor/common/model/textModel.ts
浏览文件 @
7b29e7c3
...
...
@@ -30,7 +30,6 @@ import { NULL_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/nullMode';
import
{
ignoreBracketsInToken
}
from
'
vs/editor/common/modes/supports
'
;
import
{
BracketsUtils
,
RichEditBracket
,
RichEditBrackets
}
from
'
vs/editor/common/modes/supports/richEditBrackets
'
;
import
{
ThemeColor
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
withUndefinedAsNull
}
from
'
vs/base/common/types
'
;
import
{
VSBufferReadableStream
,
VSBuffer
}
from
'
vs/base/common/buffer
'
;
import
{
TokensStore
,
MultilineTokens
,
countEOL
,
MultilineTokens2
,
TokensStore2
}
from
'
vs/editor/common/model/tokensStore
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
...
...
@@ -3185,8 +3184,8 @@ export class ModelDecorationOptions implements model.IModelDecorationOptions {
this
.
stickiness
=
options
.
stickiness
||
model
.
TrackedRangeStickiness
.
AlwaysGrowsWhenTypingAtEdges
;
this
.
zIndex
=
options
.
zIndex
||
0
;
this
.
className
=
options
.
className
?
cleanClassName
(
options
.
className
)
:
null
;
this
.
hoverMessage
=
withUndefinedAsNull
(
options
.
hoverMessage
)
;
this
.
glyphMarginHoverMessage
=
withUndefinedAsNull
(
options
.
glyphMarginHoverMessage
)
;
this
.
hoverMessage
=
options
.
hoverMessage
||
null
;
this
.
glyphMarginHoverMessage
=
options
.
glyphMarginHoverMessage
||
null
;
this
.
isWholeLine
=
options
.
isWholeLine
||
false
;
this
.
showIfCollapsed
=
options
.
showIfCollapsed
||
false
;
this
.
collapseOnReplaceEdit
=
options
.
collapseOnReplaceEdit
||
false
;
...
...
src/vs/editor/common/modes/tokenizationRegistry.ts
浏览文件 @
7b29e7c3
...
...
@@ -7,8 +7,7 @@ import { Color } from 'vs/base/common/color';
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ColorId
,
ITokenizationRegistry
,
ITokenizationSupport
,
ITokenizationSupportChangedEvent
}
from
'
vs/editor/common/modes
'
;
import
{
withUndefinedAsNull
}
from
'
vs/base/common/types
'
;
import
{
keys
}
from
'
vs/base/common/map
'
;
import
{
toArray
}
from
'
vs/base/common/arrays
'
;
export
class
TokenizationRegistryImpl
implements
ITokenizationRegistry
{
...
...
@@ -77,13 +76,13 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
}
public
get
(
language
:
string
):
ITokenizationSupport
|
null
{
return
withUndefinedAsNull
(
this
.
_map
.
get
(
language
)
);
return
(
this
.
_map
.
get
(
language
)
||
null
);
}
public
setColorMap
(
colorMap
:
Color
[]):
void
{
this
.
_colorMap
=
colorMap
;
this
.
_onDidChange
.
fire
({
changedLanguages
:
keys
(
this
.
_map
),
changedLanguages
:
toArray
(
this
.
_map
.
keys
()
),
changedColorMap
:
true
});
}
...
...
src/vs/editor/common/services/languagesRegistry.ts
浏览文件 @
7b29e7c3
...
...
@@ -15,7 +15,6 @@ import { NULL_LANGUAGE_IDENTIFIER, NULL_MODE_ID } from 'vs/editor/common/modes/n
import
{
ILanguageExtensionPoint
}
from
'
vs/editor/common/services/modeService
'
;
import
{
Extensions
,
IConfigurationRegistry
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
withUndefinedAsNull
}
from
'
vs/base/common/types
'
;
const
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
;
...
...
@@ -268,7 +267,7 @@ export class LanguagesRegistry extends Disposable {
return
null
;
}
const
language
=
this
.
_languages
[
modeId
];
return
withUndefinedAsNull
(
language
.
mimetypes
[
0
]
);
return
(
language
.
mimetypes
[
0
]
||
null
);
}
public
extractModeIds
(
commaSeparatedMimetypesOrCommaSeparatedIds
:
string
|
undefined
):
string
[]
{
...
...
src/vs/editor/common/services/markerDecorationsServiceImpl.ts
浏览文件 @
7b29e7c3
...
...
@@ -16,7 +16,6 @@ import { keys } from 'vs/base/common/map';
import
{
IMarkerDecorationsService
}
from
'
vs/editor/common/services/markersDecorationService
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
withUndefinedAsNull
}
from
'
vs/base/common/types
'
;
import
{
minimapWarning
,
minimapError
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
Delayer
}
from
'
vs/base/common/async
'
;
...
...
@@ -96,7 +95,7 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor
getMarker
(
model
:
ITextModel
,
decoration
:
IModelDecoration
):
IMarker
|
null
{
const
markerDecorations
=
this
.
_markerDecorations
.
get
(
MODEL_ID
(
model
.
uri
));
return
markerDecorations
?
withUndefinedAsNull
(
markerDecorations
.
getMarker
(
decoration
)
)
:
null
;
return
markerDecorations
?
(
markerDecorations
.
getMarker
(
decoration
)
||
null
)
:
null
;
}
getLiveMarkers
(
model
:
ITextModel
):
[
Range
,
IMarker
][]
{
...
...
src/vs/platform/contextkey/browser/contextKeyService.ts
浏览文件 @
7b29e7c3
...
...
@@ -5,11 +5,11 @@
import
{
Emitter
,
Event
,
PauseableEmitter
}
from
'
vs/base/common/event
'
;
import
{
IDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
keys
}
from
'
vs/base/common/map
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ConfigurationTarget
,
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IContext
,
IContextKey
,
IContextKeyChangeEvent
,
IContextKeyService
,
IContextKeyServiceTarget
,
IReadableSet
,
SET_CONTEXT_COMMAND_ID
,
ContextKeyExpression
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
KeybindingResolver
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
toArray
}
from
'
vs/base/common/arrays
'
;
const
KEYBINDING_CONTEXT_ATTR
=
'
data-keybinding-context
'
;
...
...
@@ -102,7 +102,7 @@ class ConfigAwareContextValuesContainer extends Context {
this
.
_listener
=
this
.
_configurationService
.
onDidChangeConfiguration
(
event
=>
{
if
(
event
.
source
===
ConfigurationTarget
.
DEFAULT
)
{
// new setting, reset everything
const
allKeys
=
keys
(
this
.
_values
);
const
allKeys
=
toArray
(
this
.
_values
.
keys
()
);
this
.
_values
.
clear
();
emitter
.
fire
(
new
ArrayContextKeyChangeEvent
(
allKeys
));
}
else
{
...
...
src/vs/platform/keybinding/common/keybindingResolver.ts
浏览文件 @
7b29e7c3
...
...
@@ -8,7 +8,6 @@ import { MenuRegistry } from 'vs/platform/actions/common/actions';
import
{
CommandsRegistry
,
ICommandHandlerDescription
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IContext
,
ContextKeyExpression
,
ContextKeyExprType
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ResolvedKeybindingItem
}
from
'
vs/platform/keybinding/common/resolvedKeybindingItem
'
;
import
{
keys
}
from
'
vs/base/common/map
'
;
export
interface
IResolveResult
{
/** Whether the resolved keybinding is entering a chord */
...
...
@@ -353,10 +352,10 @@ export class KeybindingResolver {
}
unboundCommands
.
push
(
id
);
};
for
(
const
id
of
keys
(
MenuRegistry
.
getCommands
()
))
{
for
(
const
id
of
MenuRegistry
.
getCommands
().
keys
(
))
{
addCommand
(
id
,
true
);
}
for
(
const
id
of
keys
(
CommandsRegistry
.
getCommands
()
))
{
for
(
const
id
of
CommandsRegistry
.
getCommands
().
keys
(
))
{
addCommand
(
id
,
false
);
}
...
...
src/vs/workbench/services/extensions/common/extensionsRegistry.ts
浏览文件 @
7b29e7c3
...
...
@@ -12,7 +12,7 @@ import { Extensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/c
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IMessage
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ExtensionIdentifier
,
IExtensionDescription
,
EXTENSION_CATEGORIES
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
values
}
from
'
vs/base/common/map
'
;
import
{
toArray
}
from
'
vs/base/common/arrays
'
;
const
schemaRegistry
=
Registry
.
as
<
IJSONContributionRegistry
>
(
Extensions
.
JSONContribution
);
export
type
ExtensionKind
=
'
workspace
'
|
'
ui
'
|
undefined
;
...
...
@@ -444,7 +444,7 @@ export class ExtensionsRegistryImpl {
}
public
getExtensionPoints
():
ExtensionPoint
<
any
>
[]
{
return
values
(
this
.
_extensionPoints
);
return
toArray
(
this
.
_extensionPoints
.
values
()
);
}
}
...
...
src/vs/workbench/services/extensions/electron-browser/remoteExtensionManagementIpc.ts
浏览文件 @
7b29e7c3
...
...
@@ -12,8 +12,7 @@ import { areSameExtensions } from 'vs/platform/extensionManagement/common/extens
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
toErrorMessage
}
from
'
vs/base/common/errorMessage
'
;
import
{
prefersExecuteOnUI
}
from
'
vs/workbench/services/extensions/common/extensionsUtil
'
;
import
{
isNonEmptyArray
}
from
'
vs/base/common/arrays
'
;
import
{
values
}
from
'
vs/base/common/map
'
;
import
{
isNonEmptyArray
,
toArray
}
from
'
vs/base/common/arrays
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
IProductService
}
from
'
vs/platform/product/common/productService
'
;
...
...
@@ -102,14 +101,14 @@ export class RemoteExtensionManagementChannelClient extends ExtensionManagementC
const
result
=
new
Map
<
string
,
IGalleryExtension
>
();
const
extensions
=
[...(
manifest
.
extensionPack
||
[]),
...(
manifest
.
extensionDependencies
||
[])];
await
this
.
getDependenciesAndPackedExtensionsRecursively
(
extensions
,
result
,
true
,
token
);
return
values
(
result
);
return
toArray
(
result
.
values
()
);
}
private
async
getAllWorkspaceDependenciesAndPackedExtensions
(
manifest
:
IExtensionManifest
,
token
:
CancellationToken
):
Promise
<
IGalleryExtension
[]
>
{
const
result
=
new
Map
<
string
,
IGalleryExtension
>
();
const
extensions
=
[...(
manifest
.
extensionPack
||
[]),
...(
manifest
.
extensionDependencies
||
[])];
await
this
.
getDependenciesAndPackedExtensionsRecursively
(
extensions
,
result
,
false
,
token
);
return
values
(
result
);
return
toArray
(
result
.
values
()
);
}
private
async
getDependenciesAndPackedExtensionsRecursively
(
toGet
:
string
[],
result
:
Map
<
string
,
IGalleryExtension
>
,
uiExtension
:
boolean
,
token
:
CancellationToken
):
Promise
<
void
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录