Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
0afe42d8
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 搜索 >>
提交
0afe42d8
编写于
6月 24, 2020
作者:
A
Ankita Khera
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting fixes
上级
2c1643a2
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
60 addition
and
30 deletion
+60
-30
src/EditorFeatures/Core.Wpf/InlineParamNameHints/InlineParamNameHintsTag.cs
.../Core.Wpf/InlineParamNameHints/InlineParamNameHintsTag.cs
+8
-5
src/EditorFeatures/Core.Wpf/InlineParamNameHints/InlineParamNameHintsTagger.cs
...re.Wpf/InlineParamNameHints/InlineParamNameHintsTagger.cs
+21
-9
src/EditorFeatures/Core.Wpf/InlineParamNameHints/InlineParamNameHintsTaggerProvider.cs
...nlineParamNameHints/InlineParamNameHintsTaggerProvider.cs
+7
-3
src/EditorFeatures/Core/InlineParameterNameHints/InlineParamNameHintDataTag.cs
...re/InlineParameterNameHints/InlineParamNameHintDataTag.cs
+7
-2
src/EditorFeatures/Core/InlineParameterNameHints/InlineParamNameHintsDataTaggerProvider.cs
...ameterNameHints/InlineParamNameHintsDataTaggerProvider.cs
+6
-2
src/EditorFeatures/Test2/InlineParameterNameHints/AbstractInlineParamNameHintsTests.vb
...neParameterNameHints/AbstractInlineParamNameHintsTests.vb
+2
-5
src/EditorFeatures/Test2/InlineParameterNameHints/CSharpInlineParamNameHintsTests.vb
...lineParameterNameHints/CSharpInlineParamNameHintsTests.vb
+1
-1
src/Features/CSharp/Portable/InlineParameterNameHints/InlineParamNameHintsService.cs
...e/InlineParameterNameHints/InlineParamNameHintsService.cs
+6
-2
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/ArgumentSyntaxExtensions.cs
...ns/Compiler/CSharp/Extensions/ArgumentSyntaxExtensions.cs
+2
-1
未找到文件。
src/EditorFeatures/Core.Wpf/InlineParamNameHints/InlineParamNameHintsTag.cs
浏览文件 @
0afe42d8
using
System.Windows
;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using
System.Windows
;
using
System.Windows.Controls
;
using
Microsoft.VisualStudio.Text
;
using
Microsoft.VisualStudio.Text.Editor
;
namespace
Microsoft.CodeAnalysis.Editor.InlineParamNameHints
namespace
Microsoft.CodeAnalysis.Editor.InlineParam
eter
NameHints
{
/// <summary>
/// This is the tag which implements the IntraTextAdornmentTag and is meant to
/// create the UIElements that get shown in the editor
/// </summary>
class
InlineParamNameHintsTag
:
IntraTextAdornmentTag
internal
class
InlineParamNameHintsTag
:
IntraTextAdornmentTag
{
public
readonly
string
TagName
;
...
...
@@ -18,7 +22,7 @@ class InlineParamNameHintsTag : IntraTextAdornmentTag
/// </summary>
/// <param name="text">The name of the parameter associated with the argument</param>
public
InlineParamNameHintsTag
(
string
text
)
:
base
(
CreateElement
(
text
),
null
,
(
PositionAffinity
?)
PositionAffinity
.
Successor
)
:
base
(
CreateElement
(
text
),
removalCallback
:
null
,
(
PositionAffinity
?)
PositionAffinity
.
Successor
)
{
TagName
=
text
;
if
(
TagName
.
Length
!=
0
)
...
...
@@ -46,5 +50,4 @@ private static UIElement CreateElement(string text)
return
block
;
}
}
}
src/EditorFeatures/Core.Wpf/InlineParamNameHints/InlineParamNameHintsTagger.cs
浏览文件 @
0afe42d8
using
System
;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
Microsoft.CodeAnalysis.ExtractMethod
;
using
Microsoft.VisualStudio.Text
;
using
Microsoft.VisualStudio.Text.Editor
;
using
Microsoft.VisualStudio.Text.Tagging
;
namespace
Microsoft.CodeAnalysis.Editor.InlineParamNameHints
namespace
Microsoft.CodeAnalysis.Editor.InlineParam
eter
NameHints
{
/// <summary>
/// The purpose of this tagger is to convert the InlineParamNameHintsDataTags to
/// the InlineParamNameHintsTag, which actually creates the UIElement. It reacts to
/// tags changing and updates the adornments accordingly.
/// </summary>
class
InlineParamNameHintsTagger
:
ITagger
<
IntraTextAdornmentTag
>
class
InlineParamNameHintsTagger
:
ITagger
<
IntraTextAdornmentTag
>
,
IDisposable
{
private
readonly
ITagAggregator
<
InlineParamNameHintDataTag
>
_tagAggregator
;
private
readonly
ITextBuffer
_buffer
;
public
event
EventHandler
<
SnapshotSpanEventArgs
>
TagsChanged
;
public
InlineParamNameHintsTagger
(
ITextBuffer
buffer
,
ITagAggregator
<
InlineParamNameHintDataTag
>
tagAggregator
)
{
...
...
@@ -29,18 +35,20 @@ private void _tagAggregator_TagsChanged(object sender, TagsChangedEventArgs e)
var
spans
=
e
.
Span
.
GetSpans
(
_buffer
);
foreach
(
var
span
in
spans
)
{
TagsChanged
?.
Invoke
(
this
,
new
SnapshotSpanEventArgs
(
new
SnapshotSpan
(
span
.
Snapshot
,
0
,
span
.
Snapshot
.
Length
)));
TagsChanged
?.
Invoke
(
this
,
new
SnapshotSpanEventArgs
(
span
));
//
new SnapshotSpan(span.Snapshot, 0, span.Snapshot.Length)));
}
}
public
event
EventHandler
<
SnapshotSpanEventArgs
>
TagsChanged
;
public
IEnumerable
<
ITagSpan
<
IntraTextAdornmentTag
>>
GetTags
(
NormalizedSnapshotSpanCollection
spans
)
{
var
tagsList
=
new
List
<
TagSpan
<
IntraTextAdornmentTag
>>();
var
tagsList
=
new
List
<
I
TagSpan
<
IntraTextAdornmentTag
>>();
var
dataTags
=
_tagAggregator
.
GetTags
(
spans
);
foreach
(
var
tag
in
dataTags
)
{
if
(
spans
.
Count
<=
0
)
{
return
tagsList
;
}
var
dataTagSpans
=
tag
.
Span
.
GetSpans
(
spans
[
0
].
Snapshot
);
var
textTag
=
tag
.
Tag
;
if
(
dataTagSpans
.
Count
>
0
)
...
...
@@ -48,10 +56,14 @@ public IEnumerable<ITagSpan<IntraTextAdornmentTag>> GetTags(NormalizedSnapshotSp
var
dataTagSpan
=
dataTagSpans
[
0
];
var
adornmentSpan
=
new
SnapshotSpan
(
dataTagSpan
.
Start
,
0
);
tagsList
.
Add
(
new
TagSpan
<
IntraTextAdornmentTag
>(
adornmentSpan
,
new
InlineParamNameHintsTag
(
textTag
.
TagName
)));
}
}
return
tagsList
.
AsEnumerable
();
return
tagsList
;
}
public
void
Dispose
()
{
_tagAggregator
.
Dispose
();
}
}
}
src/EditorFeatures/Core.Wpf/InlineParamNameHints/InlineParamNameHintsTaggerProvider.cs
浏览文件 @
0afe42d8
using
System.ComponentModel.Composition
;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using
System.ComponentModel.Composition
;
using
Microsoft.VisualStudio.Text
;
using
Microsoft.VisualStudio.Text.Editor
;
using
Microsoft.VisualStudio.Text.Tagging
;
using
Microsoft.VisualStudio.Utilities
;
namespace
Microsoft.CodeAnalysis.Editor.InlineParamNameHints
namespace
Microsoft.CodeAnalysis.Editor.InlineParam
eter
NameHints
{
/// <summary>
/// The provider that is used as a middleman to create the tagger so that the data tag
...
...
@@ -16,7 +20,7 @@ namespace Microsoft.CodeAnalysis.Editor.InlineParamNameHints
[
Name
(
nameof
(
InlineParamNameHintsTaggerProvider
))]
class
InlineParamNameHintsTaggerProvider
:
ITaggerProvider
{
private
IBufferTagAggregatorFactoryService
_bufferTagAggregatorFactoryService
;
private
readonly
IBufferTagAggregatorFactoryService
_bufferTagAggregatorFactoryService
;
[
ImportingConstructor
]
public
InlineParamNameHintsTaggerProvider
(
IBufferTagAggregatorFactoryService
bufferTagAggregatorFactoryService
)
{
...
...
src/EditorFeatures/Core/InlineParameterNameHints/InlineParamNameHintDataTag.cs
浏览文件 @
0afe42d8
using
Microsoft.VisualStudio.Text.Tagging
;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace
Microsoft.CodeAnalysis.Editor.InlineParamNameHints
using
Microsoft.VisualStudio.Text.Tagging
;
namespace
Microsoft.CodeAnalysis.Editor.InlineParameterNameHints
{
/// <summary>
/// The simple tag that only holds information regarding the associated parameter name
...
...
@@ -9,6 +13,7 @@ namespace Microsoft.CodeAnalysis.Editor.InlineParamNameHints
class
InlineParamNameHintDataTag
:
ITag
{
public
readonly
string
TagName
;
public
InlineParamNameHintDataTag
(
string
name
)
{
TagName
=
name
;
...
...
src/EditorFeatures/Core/InlineParameterNameHints/InlineParamNameHintsDataTaggerProvider.cs
浏览文件 @
0afe42d8
using
System.ComponentModel.Composition
;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using
System.ComponentModel.Composition
;
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis.Editor.Shared.Extensions
;
using
Microsoft.CodeAnalysis.Editor.Shared.Tagging
;
...
...
@@ -13,7 +17,7 @@
using
Microsoft.VisualStudio.Text.Tagging
;
using
Microsoft.VisualStudio.Utilities
;
namespace
Microsoft.CodeAnalysis.Editor.InlineParamNameHints
namespace
Microsoft.CodeAnalysis.Editor.InlineParam
eter
NameHints
{
/// <summary>
/// The TaggerProvider that calls upon the service in order to locate the spans and names
...
...
src/EditorFeatures/Test2/InlineParameterNameHints/AbstractInlineParamNameHintsTests.vb
浏览文件 @
0afe42d8
...
...
@@ -3,7 +3,7 @@
' See the LICENSE file in the project root for more information.
Imports
System.Threading
Imports
Microsoft.CodeAnalysis.Editor.InlineParamNameHints
Imports
Microsoft.CodeAnalysis.Editor.InlineParam
eter
NameHints
Imports
Microsoft.CodeAnalysis.Editor.Shared.Extensions
Imports
Microsoft.CodeAnalysis.Editor.Shared.Utilities
Imports
Microsoft.CodeAnalysis.Editor.Tagging
...
...
@@ -11,7 +11,7 @@ Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports
Microsoft.CodeAnalysis.Shared.TestHooks
Imports
Microsoft.VisualStudio.Text
Namespace
Microsoft.CodeAnalysis.Editor.UnitTests.InlineParamNameHints
Namespace
Microsoft.CodeAnalysis.Editor.UnitTests.InlineParam
eter
NameHints
<
[
UseExportProvider
]
>
Public
MustInherit
Class
AbstractInlineParamNameHintsTests
...
...
@@ -57,9 +57,6 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineParamNameHints
AssertEx
.
Equal
(
expectedTags
,
producedTags
)
End
Using
End
Function
End
Class
End
Namespace
src/EditorFeatures/Test2/InlineParameterNameHints/CSharpInlineParamNameHintsTests.vb
浏览文件 @
0afe42d8
...
...
@@ -2,7 +2,7 @@
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Namespace
Microsoft.CodeAnalysis.Editor.UnitTests.InlineParamNameHints
Namespace
Microsoft.CodeAnalysis.Editor.UnitTests.InlineParam
eter
NameHints
Public
Class
CSharpInlineParamNameHintsTests
Inherits
AbstractInlineParamNameHintsTests
...
...
src/Features/CSharp/Portable/InlineParameterNameHints/InlineParamNameHintsService.cs
浏览文件 @
0afe42d8
using
System
;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.Collections.Generic
;
using
System.Composition
;
using
System.Linq
;
...
...
@@ -9,7 +14,6 @@
using
Microsoft.CodeAnalysis.Host.Mef
;
using
Microsoft.CodeAnalysis.InlineParameterNameHints
;
using
Microsoft.CodeAnalysis.Text
;
#
nullable
enable
namespace
Microsoft.CodeAnalysis.CSharp.InlineParameterNameHints
{
...
...
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/ArgumentSyntaxExtensions.cs
浏览文件 @
0afe42d8
...
...
@@ -6,6 +6,7 @@
using
System.Threading
;
using
Microsoft.CodeAnalysis.CSharp.Syntax
;
using
Microsoft.CodeAnalysis.Shared.Extensions
;
#
nullable
enable
namespace
Microsoft.CodeAnalysis.CSharp.Extensions
{
...
...
@@ -41,7 +42,7 @@ public static RefKind GetRefKind(this ArgumentSyntax argument)
/// is true, the last parameter will be returned if it is params parameter and the index of
/// the specified argument is greater than the number of parameters.
/// </summary>
public
static
IParameterSymbol
DetermineParameter
(
public
static
IParameterSymbol
?
DetermineParameter
(
this
ArgumentSyntax
argument
,
SemanticModel
semanticModel
,
bool
allowParams
=
false
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录