Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8531a230
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,发现更多精彩内容 >>
提交
8531a230
编写于
7月 20, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use flatten in a few places to improve readability
上级
f500f659
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
4 deletion
+18
-4
extensions/typescript-language-features/src/extension.ts
extensions/typescript-language-features/src/extension.ts
+5
-1
extensions/typescript-language-features/src/features/task.ts
extensions/typescript-language-features/src/features/task.ts
+4
-1
extensions/typescript-language-features/src/features/tsconfig.ts
...ons/typescript-language-features/src/features/tsconfig.ts
+5
-2
extensions/typescript-language-features/src/utils/arrays.ts
extensions/typescript-language-features/src/utils/arrays.ts
+4
-0
未找到文件。
extensions/typescript-language-features/src/extension.ts
浏览文件 @
8531a230
...
...
@@ -16,6 +16,7 @@ import LogDirectoryProvider from './utils/logDirectoryProvider';
import
ManagedFileContextManager
from
'
./utils/managedFileContext
'
;
import
{
getContributedTypeScriptServerPlugins
,
TypeScriptServerPlugin
}
from
'
./utils/plugins
'
;
import
*
as
ProjectStatus
from
'
./utils/projectStatus
'
;
import
{
flatten
}
from
'
./utils/arrays
'
;
export
function
activate
(
...
...
@@ -36,7 +37,10 @@ export function activate(
context
.
subscriptions
.
push
(
module
.
register
());
});
const
supportedLanguage
=
[].
concat
.
apply
([],
standardLanguageDescriptions
.
map
(
x
=>
x
.
modeIds
).
concat
(
plugins
.
map
(
x
=>
x
.
languages
)));
const
supportedLanguage
=
flatten
([
...
standardLanguageDescriptions
.
map
(
x
=>
x
.
modeIds
),
...
plugins
.
map
(
x
=>
x
.
languages
)
]);
function
didOpenTextDocument
(
textDocument
:
vscode
.
TextDocument
):
boolean
{
if
(
isSupportedDocument
(
supportedLanguage
,
textDocument
))
{
openListener
.
dispose
();
...
...
extensions/typescript-language-features/src/features/task.ts
浏览文件 @
8531a230
...
...
@@ -78,7 +78,10 @@ class TscTaskProvider implements vscode.TaskProvider {
private
async
getAllTsConfigs
(
token
:
vscode
.
CancellationToken
):
Promise
<
TSConfig
[]
>
{
const
out
=
new
Set
<
TSConfig
>
();
const
configs
=
(
await
this
.
getTsConfigForActiveFile
(
token
)).
concat
(
await
this
.
getTsConfigsInWorkspace
());
const
configs
=
[
...
await
this
.
getTsConfigForActiveFile
(
token
),
...
await
this
.
getTsConfigsInWorkspace
()
];
for
(
const
config
of
configs
)
{
if
(
await
exists
(
config
.
path
))
{
out
.
add
(
config
);
...
...
extensions/typescript-language-features/src/features/tsconfig.ts
浏览文件 @
8531a230
...
...
@@ -6,6 +6,7 @@
import
*
as
jsonc
from
'
jsonc-parser
'
;
import
{
dirname
,
join
}
from
'
path
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
flatten
}
from
'
../utils/arrays
'
;
function
mapNode
<
R
>
(
node
:
jsonc
.
Node
|
undefined
,
f
:
(
x
:
jsonc
.
Node
)
=>
R
):
R
[]
{
return
node
&&
node
.
type
===
'
array
'
&&
node
.
children
...
...
@@ -83,7 +84,9 @@ export function register() {
const
languages
=
[
'
json
'
,
'
jsonc
'
];
const
selector
:
vscode
.
DocumentSelector
=
([]
as
any
[]).
concat
(
...
languages
.
map
(
language
=>
patterns
.
map
((
pattern
):
vscode
.
DocumentFilter
=>
({
language
,
pattern
}))));
const
selector
:
vscode
.
DocumentSelector
=
flatten
(
languages
.
map
(
language
=>
patterns
.
map
((
pattern
):
vscode
.
DocumentFilter
=>
({
language
,
pattern
}))));
return
vscode
.
languages
.
registerDocumentLinkProvider
(
selector
,
new
TsconfigLinkProvider
());
}
extensions/typescript-language-features/src/utils/arrays.ts
浏览文件 @
8531a230
...
...
@@ -14,4 +14,8 @@ export function equals<T>(one: T[], other: T[], itemEquals: (a: T, b: T) => bool
}
return
true
;
}
export
function
flatten
<
T
>
(
arr
:
T
[][]):
T
[]
{
return
[].
concat
.
apply
([],
arr
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录