Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
750fb7e0
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
750fb7e0
编写于
12月 16, 2020
作者:
M
Martin Strecker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add IsObsolete to ISymbolExtensions and use it.
上级
95d214cb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
7 deletion
+14
-7
src/Features/Core/Portable/Completion/CommonCompletionUtilities.cs
...res/Core/Portable/Completion/CommonCompletionUtilities.cs
+3
-6
src/Features/Core/Portable/LanguageServices/SymbolDisplayService/AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs
...tSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs
+1
-1
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ISymbolExtensions.cs
...dExtensions/Compiler/Core/Extensions/ISymbolExtensions.cs
+10
-0
未找到文件。
src/Features/Core/Portable/Completion/CommonCompletionUtilities.cs
浏览文件 @
750fb7e0
...
...
@@ -171,16 +171,13 @@ public static bool IsStartingNewWord(SourceText text, int characterPosition, Fun
Workspace
workspace
,
SemanticModel
semanticModel
,
int
position
,
IReadOnlyList
<
ISymbol
>
symbols
,
SupportedPlatformData
supportedPlatforms
,
CancellationToken
cancellationToken
)
{
var
symbol
=
symbols
[
0
];
if
(
IsObsolete
(
symbol
))
if
(
symbol
.
IsObsolete
(
))
{
// The symbol is obsolete/deprecated. Lets try to find another one that is not and take that instead.
symbol
=
symbols
.
FirstOrDefault
(
s
=>
!
IsObsolete
(
s
))
??
symbol
;
// The
first
symbol is obsolete/deprecated. Lets try to find another one that is not and take that instead.
symbol
=
symbols
.
Skip
(
1
).
FirstOrDefault
(
s
=>
!
s
.
IsObsolete
(
))
??
symbol
;
}
return
CreateDescriptionAsync
(
workspace
,
semanticModel
,
position
,
symbol
,
overloadCount
:
symbols
.
Count
-
1
,
supportedPlatforms
,
cancellationToken
);
static
bool
IsObsolete
(
ISymbol
symbol
)
=>
symbol
.
GetAttributes
().
Any
(
x
=>
x
.
AttributeClass
.
MetadataName
==
"ObsoleteAttribute"
);
}
private
static
void
AddOverloadPart
(
List
<
TaggedText
>
textContentBuilder
,
int
overloadCount
,
bool
isGeneric
)
...
...
src/Features/Core/Portable/LanguageServices/SymbolDisplayService/AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs
浏览文件 @
750fb7e0
...
...
@@ -247,7 +247,7 @@ protected void AddCaptures(SyntaxNode syntax)
private
async
Task
AddDescriptionPartAsync
(
ISymbol
symbol
)
{
if
(
symbol
.
GetAttributes
().
Any
(
x
=>
x
.
AttributeClass
.
MetadataName
==
"ObsoleteAttribute"
))
if
(
symbol
.
IsObsolete
(
))
{
AddDeprecatedPrefix
();
}
...
...
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ISymbolExtensions.cs
浏览文件 @
750fb7e0
...
...
@@ -749,5 +749,15 @@ private static bool VerifyGetAsyncEnumerator(IMethodSymbol getAsyncEnumerator)
public
static
bool
IsSymbolWithSpecialDiscardName
(
this
ISymbol
symbol
)
=>
symbol
.
Name
.
StartsWith
(
"_"
)
&&
(
symbol
.
Name
.
Length
==
1
||
uint
.
TryParse
(
symbol
.
Name
.
Substring
(
1
),
out
_
));
/// <summary>
/// Returns <see langword="true"/>, if the symbol is marked with the <see cref="System.ObsoleteAttribute"/>.
/// </summary>
/// <param name="symbol"></param>
/// <returns><see langword="true"/> if the symbol is marked with the <see cref="System.ObsoleteAttribute"/>.</returns>
public
static
bool
IsObsolete
(
this
ISymbol
symbol
)
=>
symbol
.
GetAttributes
().
Any
(
x
=>
x
.
AttributeClass
?.
MetadataName
==
nameof
(
ObsoleteAttribute
)
&&
x
.
AttributeClass
?.
ContainingNamespace
.
Name
==
nameof
(
System
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录