Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f9dac592
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,发现更多精彩内容 >>
提交
f9dac592
编写于
1月 08, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add warning/'missing name'-message when symbol has no name, fixes #65545
上级
3cd48529
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
11 deletion
+10
-11
src/vs/workbench/api/node/extHostLanguageFeatures.ts
src/vs/workbench/api/node/extHostLanguageFeatures.ts
+9
-10
src/vs/workbench/api/node/extHostTypeConverters.ts
src/vs/workbench/api/node/extHostTypeConverters.ts
+1
-1
未找到文件。
src/vs/workbench/api/node/extHostLanguageFeatures.ts
浏览文件 @
f9dac592
...
...
@@ -29,7 +29,7 @@ import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
// --- adapter
class
Outline
Adapter
{
class
DocumentSymbol
Adapter
{
private
_documents
:
ExtHostDocuments
;
private
_provider
:
vscode
.
DocumentSymbolProvider
;
...
...
@@ -44,16 +44,15 @@ class OutlineAdapter {
return
asPromise
(()
=>
this
.
_provider
.
provideDocumentSymbols
(
doc
,
token
)).
then
(
value
=>
{
if
(
isFalsyOrEmpty
(
value
))
{
return
undefined
;
}
if
(
value
[
0
]
instanceof
DocumentSymbol
)
{
}
else
if
(
value
[
0
]
instanceof
DocumentSymbol
)
{
return
(
<
DocumentSymbol
[]
>
value
).
map
(
typeConvert
.
DocumentSymbol
.
from
);
}
else
{
return
OutlineAdapter
.
_asDocumentSymbolTree
(
resource
,
<
SymbolInformation
[]
>
value
);
return
DocumentSymbolAdapter
.
_asDocumentSymbolTree
(
<
SymbolInformation
[]
>
value
);
}
});
}
private
static
_asDocumentSymbolTree
(
resource
:
URI
,
infos
:
SymbolInformation
[]):
modes
.
DocumentSymbol
[]
{
private
static
_asDocumentSymbolTree
(
infos
:
SymbolInformation
[]):
modes
.
DocumentSymbol
[]
{
// first sort by start (and end) and then loop over all elements
// and build a tree based on containment.
infos
=
infos
.
slice
(
0
).
sort
((
a
,
b
)
=>
{
...
...
@@ -67,7 +66,7 @@ class OutlineAdapter {
let
parentStack
:
modes
.
DocumentSymbol
[]
=
[];
for
(
const
info
of
infos
)
{
let
element
=
<
modes
.
DocumentSymbol
>
{
name
:
info
.
name
,
name
:
info
.
name
||
'
!!MISSING: name!!
'
,
kind
:
typeConvert
.
SymbolKind
.
from
(
info
.
kind
),
containerName
:
info
.
containerName
,
range
:
typeConvert
.
Range
.
from
(
info
.
location
.
range
),
...
...
@@ -96,7 +95,7 @@ class OutlineAdapter {
class
CodeLensAdapter
{
private
static
_badCmd
:
vscode
.
Command
=
{
command
:
'
missing
'
,
title
:
'
<<MISSING COMMAND>>
'
};
private
static
_badCmd
:
vscode
.
Command
=
{
command
:
'
missing
'
,
title
:
'
!!MISSING: command!!
'
};
constructor
(
private
readonly
_documents
:
ExtHostDocuments
,
...
...
@@ -875,7 +874,7 @@ class SelectionRangeAdapter {
}
}
type
Adapter
=
Outline
Adapter
|
CodeLensAdapter
|
DefinitionAdapter
|
HoverAdapter
type
Adapter
=
DocumentSymbol
Adapter
|
CodeLensAdapter
|
DefinitionAdapter
|
HoverAdapter
|
DocumentHighlightAdapter
|
ReferenceAdapter
|
CodeActionAdapter
|
DocumentFormattingAdapter
|
RangeFormattingAdapter
|
OnTypeFormattingAdapter
|
NavigateTypeAdapter
|
RenameAdapter
|
SuggestAdapter
|
SignatureHelpAdapter
|
LinkProviderAdapter
|
ImplementationAdapter
|
TypeDefinitionAdapter
...
...
@@ -1002,14 +1001,14 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- outline
registerDocumentSymbolProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentSymbolProvider
,
metadata
?:
vscode
.
DocumentSymbolProviderMetadata
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
Outline
Adapter
(
this
.
_documents
,
provider
),
extension
);
const
handle
=
this
.
_addNewAdapter
(
new
DocumentSymbol
Adapter
(
this
.
_documents
,
provider
),
extension
);
const
displayName
=
(
metadata
&&
metadata
.
label
)
||
(
extension
&&
(
extension
.
displayName
||
extension
.
name
))
||
undefined
;
this
.
_proxy
.
$registerOutlineSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
),
displayName
);
return
this
.
_createDisposable
(
handle
);
}
$provideDocumentSymbols
(
handle
:
number
,
resource
:
UriComponents
,
token
:
CancellationToken
):
Promise
<
modes
.
DocumentSymbol
[]
>
{
return
this
.
_withAdapter
(
handle
,
Outline
Adapter
,
adapter
=>
adapter
.
provideDocumentSymbols
(
URI
.
revive
(
resource
),
token
));
return
this
.
_withAdapter
(
handle
,
DocumentSymbol
Adapter
,
adapter
=>
adapter
.
provideDocumentSymbols
(
URI
.
revive
(
resource
),
token
));
}
// --- code lens
...
...
src/vs/workbench/api/node/extHostTypeConverters.ts
浏览文件 @
f9dac592
...
...
@@ -543,7 +543,7 @@ export namespace WorkspaceSymbol {
export
namespace
DocumentSymbol
{
export
function
from
(
info
:
vscode
.
DocumentSymbol
):
modes
.
DocumentSymbol
{
const
result
:
modes
.
DocumentSymbol
=
{
name
:
info
.
name
,
name
:
info
.
name
||
'
!!MISSING: name!!
'
,
detail
:
info
.
detail
,
range
:
Range
.
from
(
info
.
range
),
selectionRange
:
Range
.
from
(
info
.
selectionRange
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录