Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
26c4541c
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,发现更多精彩内容 >>
提交
26c4541c
编写于
11月 06, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add coalease helper function
上级
69263017
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
20 addition
and
18 deletion
+20
-18
extensions/typescript-language-features/src/features/bufferSyncSupport.ts
...cript-language-features/src/features/bufferSyncSupport.ts
+2
-3
extensions/typescript-language-features/src/features/folding.ts
...ions/typescript-language-features/src/features/folding.ts
+2
-3
extensions/typescript-language-features/src/features/tsconfig.ts
...ons/typescript-language-features/src/features/tsconfig.ts
+5
-5
extensions/typescript-language-features/src/typeScriptServiceClientHost.ts
...ript-language-features/src/typeScriptServiceClientHost.ts
+4
-4
extensions/typescript-language-features/src/utils/arrays.ts
extensions/typescript-language-features/src/utils/arrays.ts
+7
-3
未找到文件。
extensions/typescript-language-features/src/features/bufferSyncSupport.ts
浏览文件 @
26c4541c
...
...
@@ -7,6 +7,7 @@ import * as vscode from 'vscode';
import
*
as
Proto
from
'
../protocol
'
;
import
{
ITypeScriptServiceClient
}
from
'
../typescriptService
'
;
import
API
from
'
../utils/api
'
;
import
{
coalease
}
from
'
../utils/arrays
'
;
import
{
Delayer
}
from
'
../utils/async
'
;
import
{
nulToken
}
from
'
../utils/cancellation
'
;
import
{
Disposable
}
from
'
../utils/dispose
'
;
...
...
@@ -278,9 +279,7 @@ class GetErrRequest {
)
{
const
args
:
Proto
.
GeterrRequestArgs
=
{
delay
:
0
,
files
:
Array
.
from
(
files
.
entries
)
.
map
(
entry
=>
client
.
normalizedPath
(
entry
.
resource
))
.
filter
(
x
=>
!!
x
)
as
string
[]
files
:
coalease
(
Array
.
from
(
files
.
entries
).
map
(
entry
=>
client
.
normalizedPath
(
entry
.
resource
)))
};
client
.
executeAsync
(
'
geterr
'
,
args
,
_token
.
token
)
...
...
extensions/typescript-language-features/src/features/folding.ts
浏览文件 @
26c4541c
...
...
@@ -7,6 +7,7 @@ import * as vscode from 'vscode';
import
*
as
Proto
from
'
../protocol
'
;
import
{
ITypeScriptServiceClient
}
from
'
../typescriptService
'
;
import
API
from
'
../utils/api
'
;
import
{
coalease
}
from
'
../utils/arrays
'
;
import
{
VersionDependentRegistration
}
from
'
../utils/dependentRegistration
'
;
import
*
as
typeConverters
from
'
../utils/typeConverters
'
;
...
...
@@ -33,9 +34,7 @@ class TypeScriptFoldingProvider implements vscode.FoldingRangeProvider {
return
;
}
return
response
.
body
.
map
(
span
=>
this
.
convertOutliningSpan
(
span
,
document
))
.
filter
(
foldingRange
=>
!!
foldingRange
)
as
vscode
.
FoldingRange
[];
return
coalease
(
response
.
body
.
map
(
span
=>
this
.
convertOutliningSpan
(
span
,
document
)));
}
private
convertOutliningSpan
(
...
...
extensions/typescript-language-features/src/features/tsconfig.ts
浏览文件 @
26c4541c
...
...
@@ -4,9 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import
*
as
jsonc
from
'
jsonc-parser
'
;
import
{
dirname
,
join
,
basename
}
from
'
path
'
;
import
{
basename
,
dirname
,
join
}
from
'
path
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
flatten
}
from
'
../utils/arrays
'
;
import
{
coalease
,
flatten
}
from
'
../utils/arrays
'
;
function
mapChildren
<
R
>
(
node
:
jsonc
.
Node
|
undefined
,
f
:
(
x
:
jsonc
.
Node
)
=>
R
):
R
[]
{
return
node
&&
node
.
type
===
'
array
'
&&
node
.
children
...
...
@@ -25,11 +25,11 @@ class TsconfigLinkProvider implements vscode.DocumentLinkProvider {
return
null
;
}
return
[
return
coalease
(
[
this
.
getExtendsLink
(
document
,
root
),
...
this
.
getFilesLinks
(
document
,
root
),
...
this
.
getReferencesLinks
(
document
,
root
)
]
.
filter
(
x
=>
!!
x
)
as
vscode
.
DocumentLink
[]
;
]
)
;
}
private
getExtendsLink
(
document
:
vscode
.
TextDocument
,
root
:
jsonc
.
Node
):
vscode
.
DocumentLink
|
undefined
{
...
...
@@ -68,7 +68,7 @@ class TsconfigLinkProvider implements vscode.DocumentLinkProvider {
}
return
new
vscode
.
DocumentLink
(
this
.
getRange
(
document
,
pathNode
),
basename
(
pathNode
.
value
).
match
(
'
.json$
'
)
basename
(
pathNode
.
value
).
endsWith
(
'
.json
'
)
?
this
.
getFileTarget
(
document
,
pathNode
)
:
this
.
getFolderTarget
(
document
,
pathNode
));
});
...
...
extensions/typescript-language-features/src/typeScriptServiceClientHost.ts
浏览文件 @
26c4541c
...
...
@@ -23,7 +23,7 @@ import { PluginManager } from './utils/plugins';
import
*
as
typeConverters
from
'
./utils/typeConverters
'
;
import
TypingsStatus
,
{
AtaProgressReporter
}
from
'
./utils/typingsStatus
'
;
import
VersionStatus
from
'
./utils/versionStatus
'
;
import
{
flatten
}
from
'
./utils/arrays
'
;
import
{
flatten
,
coalease
}
from
'
./utils/arrays
'
;
// Style check diagnostics that can be reported as warnings
const
styleCheckDiagnostics
=
[
...
...
@@ -245,13 +245,13 @@ export default class TypeScriptServiceClientHost extends Disposable {
}
const
relatedInformation
=
diagnostic
.
relatedInformation
;
if
(
relatedInformation
)
{
converted
.
relatedInformation
=
relatedInformation
.
map
((
info
:
any
)
=>
{
le
t
span
=
info
.
span
;
converted
.
relatedInformation
=
coalease
(
relatedInformation
.
map
((
info
:
any
)
=>
{
cons
t
span
=
info
.
span
;
if
(
!
span
)
{
return
undefined
;
}
return
new
vscode
.
DiagnosticRelatedInformation
(
typeConverters
.
Location
.
fromTextSpan
(
this
.
client
.
toResource
(
span
.
file
),
span
),
info
.
message
);
})
.
filter
((
x
:
any
)
=>
!!
x
)
as
vscode
.
DiagnosticRelatedInformation
[]
;
})
)
;
}
if
(
diagnostic
.
reportsUnnecessary
)
{
converted
.
tags
=
[
vscode
.
DiagnosticTag
.
Unnecessary
];
...
...
extensions/typescript-language-features/src/utils/arrays.ts
浏览文件 @
26c4541c
...
...
@@ -19,6 +19,10 @@ export function equals<T>(
return
a
.
every
((
x
,
i
)
=>
itemEquals
(
x
,
b
[
i
]));
}
export
function
flatten
<
T
>
(
arr
:
ReadonlyArray
<
T
>
[]):
T
[]
{
return
Array
.
prototype
.
concat
.
apply
([],
arr
);
export
function
flatten
<
T
>
(
array
:
ReadonlyArray
<
T
>
[]):
T
[]
{
return
Array
.
prototype
.
concat
.
apply
([],
array
);
}
export
function
coalease
<
T
>
(
array
:
ReadonlyArray
<
T
|
undefined
>
):
T
[]
{
return
<
T
[]
>
array
.
filter
(
e
=>
!!
e
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录