Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
cba8cb96
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cba8cb96
编写于
3月 19, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add location converter
上级
681b0cf1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
14 addition
and
10 deletion
+14
-10
extensions/typescript/src/features/definitionProviderBase.ts
extensions/typescript/src/features/definitionProviderBase.ts
+1
-1
extensions/typescript/src/features/documentSymbolProvider.ts
extensions/typescript/src/features/documentSymbolProvider.ts
+3
-3
extensions/typescript/src/features/referenceProvider.ts
extensions/typescript/src/features/referenceProvider.ts
+1
-1
extensions/typescript/src/features/referencesCodeLensProvider.ts
...ons/typescript/src/features/referencesCodeLensProvider.ts
+2
-2
extensions/typescript/src/features/workspaceSymbolProvider.ts
...nsions/typescript/src/features/workspaceSymbolProvider.ts
+2
-3
extensions/typescript/src/utils/typeConverters.ts
extensions/typescript/src/utils/typeConverters.ts
+5
-0
未找到文件。
extensions/typescript/src/features/definitionProviderBase.ts
浏览文件 @
cba8cb96
...
...
@@ -35,7 +35,7 @@ export default class TypeScriptDefinitionProviderBase {
return
locations
.
map
(
location
=>
{
const
resource
=
this
.
client
.
asUrl
(
location
.
file
);
return
resource
?
new
Location
(
resource
,
typeConverters
.
Range
.
fromTextSpan
(
location
)
)
?
typeConverters
.
Location
.
fromTextSpan
(
resource
,
location
)
:
undefined
;
}).
filter
(
x
=>
x
)
as
Location
[];
}
catch
{
...
...
extensions/typescript/src/features/documentSymbolProvider.ts
浏览文件 @
cba8cb96
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
DocumentSymbolProvider
,
SymbolInformation
,
SymbolKind
,
TextDocument
,
Location
,
CancellationToken
,
Uri
}
from
'
vscode
'
;
import
{
DocumentSymbolProvider
,
SymbolInformation
,
SymbolKind
,
TextDocument
,
CancellationToken
,
Uri
}
from
'
vscode
'
;
import
*
as
Proto
from
'
../protocol
'
;
import
*
as
PConst
from
'
../protocol.const
'
;
...
...
@@ -71,7 +71,7 @@ export default class TypeScriptDocumentSymbolProvider implements DocumentSymbolP
let
result
=
new
SymbolInformation
(
item
.
text
,
outlineTypeTable
[
item
.
kind
as
string
]
||
SymbolKind
.
Variable
,
containerLabel
?
containerLabel
:
''
,
new
Location
(
resource
,
typeConverters
.
Range
.
fromTextSpan
(
item
.
spans
[
0
])
));
typeConverters
.
Location
.
fromTextSpan
(
resource
,
item
.
spans
[
0
]
));
foldingMap
[
key
]
=
result
;
bucket
.
push
(
result
);
}
...
...
@@ -86,7 +86,7 @@ export default class TypeScriptDocumentSymbolProvider implements DocumentSymbolP
const
result
=
new
SymbolInformation
(
item
.
text
,
outlineTypeTable
[
item
.
kind
as
string
]
||
SymbolKind
.
Variable
,
containerLabel
?
containerLabel
:
''
,
new
Location
(
resource
,
typeConverters
.
Range
.
fromTextSpan
(
item
.
spans
[
0
])
)
typeConverters
.
Location
.
fromTextSpan
(
resource
,
item
.
spans
[
0
]
)
);
if
(
item
.
childItems
&&
item
.
childItems
.
length
>
0
)
{
for
(
const
child
of
item
.
childItems
)
{
...
...
extensions/typescript/src/features/referenceProvider.ts
浏览文件 @
cba8cb96
...
...
@@ -36,7 +36,7 @@ export default class TypeScriptReferenceSupport implements ReferenceProvider {
continue
;
}
const
url
=
this
.
client
.
asUrl
(
ref
.
file
);
const
location
=
new
Location
(
url
,
typeConverters
.
Range
.
fromTextSpan
(
ref
)
);
const
location
=
typeConverters
.
Location
.
fromTextSpan
(
url
,
ref
);
result
.
push
(
location
);
}
return
result
;
...
...
extensions/typescript/src/features/referencesCodeLensProvider.ts
浏览文件 @
cba8cb96
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
CodeLens
,
CancellationToken
,
TextDocument
,
Range
,
Location
,
workspace
}
from
'
vscode
'
;
import
{
CodeLens
,
CancellationToken
,
TextDocument
,
Range
,
workspace
}
from
'
vscode
'
;
import
*
as
Proto
from
'
../protocol
'
;
import
*
as
PConst
from
'
../protocol.const
'
;
...
...
@@ -45,7 +45,7 @@ export default class TypeScriptReferencesCodeLensProvider extends TypeScriptBase
const
locations
=
response
.
body
.
refs
.
map
(
reference
=>
new
Location
(
this
.
client
.
asUrl
(
reference
.
file
),
typeConverters
.
Range
.
fromTextSpan
(
reference
)
))
typeConverters
.
Location
.
fromTextSpan
(
this
.
client
.
asUrl
(
reference
.
file
),
reference
))
.
filter
(
location
=>
// Exclude original definition from references
!
(
location
.
uri
.
toString
()
===
codeLens
.
document
.
toString
()
&&
...
...
extensions/typescript/src/features/workspaceSymbolProvider.ts
浏览文件 @
cba8cb96
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
workspace
,
window
,
Uri
,
WorkspaceSymbolProvider
,
SymbolInformation
,
SymbolKind
,
Location
,
CancellationToken
}
from
'
vscode
'
;
import
{
workspace
,
window
,
Uri
,
WorkspaceSymbolProvider
,
SymbolInformation
,
SymbolKind
,
CancellationToken
}
from
'
vscode
'
;
import
*
as
Proto
from
'
../protocol
'
;
import
{
ITypeScriptServiceClient
}
from
'
../typescriptService
'
;
...
...
@@ -71,10 +71,9 @@ export default class TypeScriptWorkspaceSymbolProvider implements WorkspaceSymbo
if
(
!
item
.
containerName
&&
item
.
kind
===
'
alias
'
)
{
continue
;
}
const
range
=
typeConverters
.
Range
.
fromTextSpan
(
item
);
const
label
=
TypeScriptWorkspaceSymbolProvider
.
getLabel
(
item
);
result
.
push
(
new
SymbolInformation
(
label
,
getSymbolKind
(
item
),
item
.
containerName
||
''
,
new
Location
(
this
.
client
.
asUrl
(
item
.
file
),
range
)));
typeConverters
.
Location
.
fromTextSpan
(
this
.
client
.
asUrl
(
item
.
file
),
item
)));
}
return
result
;
}
...
...
extensions/typescript/src/utils/typeConverters.ts
浏览文件 @
cba8cb96
...
...
@@ -37,6 +37,11 @@ export namespace Position {
});
}
export
namespace
Location
{
export
const
fromTextSpan
=
(
resource
:
vscode
.
Uri
,
tsTextSpan
:
Proto
.
TextSpan
):
vscode
.
Location
=>
new
vscode
.
Location
(
resource
,
Range
.
fromTextSpan
(
tsTextSpan
));
}
export
namespace
TextEdit
{
export
const
fromCodeEdit
=
(
edit
:
Proto
.
CodeEdit
):
vscode
.
TextEdit
=>
new
vscode
.
TextEdit
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录