Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
f5620799
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 搜索 >>
提交
f5620799
编写于
8月 11, 2020
作者:
A
Ankita Khera
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Hopefully fixed jitteriness
上级
248af9d6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
11 deletion
+26
-11
src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTag.cs
...f/InlineParameterNameHints/InlineParameterNameHintsTag.cs
+22
-7
src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTagger.cs
...nlineParameterNameHints/InlineParameterNameHintsTagger.cs
+3
-3
src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTaggerProvider.cs
...ameterNameHints/InlineParameterNameHintsTaggerProvider.cs
+1
-1
未找到文件。
src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTag.cs
浏览文件 @
f5620799
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// See the LICENSE file in the project root for more information.
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Windows
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Controls
;
using
System.Windows.Media
;
using
System.Windows.Media
;
...
@@ -18,18 +21,22 @@ namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints
...
@@ -18,18 +21,22 @@ namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints
internal
class
InlineParameterNameHintsTag
:
IntraTextAdornmentTag
internal
class
InlineParameterNameHintsTag
:
IntraTextAdornmentTag
{
{
public
const
string
TagId
=
"inline parameter name hints"
;
public
const
string
TagId
=
"inline parameter name hints"
;
/// <summary>
/// <summary>
/// Creates the UIElement on call
/// Creates the UIElement on call
/// Uses PositionAffinity.Predecessor because we want the tag to be associated with the preceding character
/// Uses PositionAffinity.Predecessor because we want the tag to be associated with the preceding character
/// </summary>
/// </summary>
/// <param name="text">The name of the parameter associated with the argument</param>
/// <param name="text">The name of the parameter associated with the argument</param>
public
InlineParameterNameHintsTag
(
string
text
,
double
lineHeight
,
TextFormattingRunProperties
format
)
public
InlineParameterNameHintsTag
(
string
text
,
IWpfTextView
textView
,
TextFormattingRunProperties
format
)
:
base
(
CreateElement
(
text
,
lineHeight
,
format
),
removalCallback
:
null
,
PositionAffinity
.
Predecessor
)
:
base
(
CreateElement
(
text
,
textView
,
format
),
removalCallback
:
AdornmentCallbackFunction
,
PositionAffinity
.
Predecessor
)
{
}
private
static
void
AdornmentCallbackFunction
(
object
tag
,
UIElement
element
)
{
{
//
}
}
private
static
UIElement
CreateElement
(
string
text
,
double
lineHeight
,
TextFormattingRunProperties
format
)
private
static
UIElement
CreateElement
(
string
text
,
IWpfTextView
textView
,
TextFormattingRunProperties
format
)
{
{
// Constructs the hint block which gets assigned parameter name and fontstyles according to the options
// Constructs the hint block which gets assigned parameter name and fontstyles according to the options
// page. Calculates a font size 1/4 smaller than the font size of the rest of the editor
// page. Calculates a font size 1/4 smaller than the font size of the rest of the editor
...
@@ -52,13 +59,21 @@ private static UIElement CreateElement(string text, double lineHeight, TextForma
...
@@ -52,13 +59,21 @@ private static UIElement CreateElement(string text, double lineHeight, TextForma
Background
=
format
.
BackgroundBrush
,
Background
=
format
.
BackgroundBrush
,
Child
=
block
,
Child
=
block
,
CornerRadius
=
new
CornerRadius
(
2
),
CornerRadius
=
new
CornerRadius
(
2
),
Height
=
lineHeight
-
(
0.25
*
l
ineHeight
),
Height
=
textView
.
LineHeight
-
(
0.25
*
textView
.
L
ineHeight
),
HorizontalAlignment
=
HorizontalAlignment
.
Center
,
HorizontalAlignment
=
HorizontalAlignment
.
Center
,
Margin
=
new
Thickness
(
0
,
-
0.20
*
l
ineHeight
,
5
,
0
),
Margin
=
new
Thickness
(
0
,
-
0.20
*
textView
.
L
ineHeight
,
5
,
0
),
Padding
=
new
Thickness
(
1
),
Padding
=
new
Thickness
(
1
),
VerticalAlignment
=
VerticalAlignment
.
Center
,
SnapsToDevicePixels
=
textView
.
VisualElement
.
SnapsToDevicePixels
,
UseLayoutRounding
=
textView
.
VisualElement
.
UseLayoutRounding
,
VerticalAlignment
=
VerticalAlignment
.
Center
};
};
// Need to set these properties to avoid unecessary reformatting because some dependancy properties
// affect layout
TextOptions
.
SetTextFormattingMode
(
border
,
TextOptions
.
GetTextFormattingMode
(
textView
.
VisualElement
));
TextOptions
.
SetTextHintingMode
(
border
,
TextOptions
.
GetTextHintingMode
(
textView
.
VisualElement
));
TextOptions
.
SetTextRenderingMode
(
border
,
TextOptions
.
GetTextRenderingMode
(
textView
.
VisualElement
));
border
.
Measure
(
new
Size
(
double
.
PositiveInfinity
,
double
.
PositiveInfinity
));
border
.
Measure
(
new
Size
(
double
.
PositiveInfinity
,
double
.
PositiveInfinity
));
return
border
;
return
border
;
}
}
...
...
src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTagger.cs
浏览文件 @
f5620799
...
@@ -24,7 +24,7 @@ internal sealed class InlineParameterNameHintsTagger : ITagger<IntraTextAdornmen
...
@@ -24,7 +24,7 @@ internal sealed class InlineParameterNameHintsTagger : ITagger<IntraTextAdornmen
{
{
private
readonly
ITagAggregator
<
InlineParameterNameHintDataTag
>
_tagAggregator
;
private
readonly
ITagAggregator
<
InlineParameterNameHintDataTag
>
_tagAggregator
;
private
readonly
ITextBuffer
_buffer
;
private
readonly
ITextBuffer
_buffer
;
private
readonly
ITextView
_textView
;
private
readonly
I
Wpf
TextView
_textView
;
/// <summary>
/// <summary>
/// stores the parameter hint tags in a global location
/// stores the parameter hint tags in a global location
...
@@ -47,7 +47,7 @@ internal sealed class InlineParameterNameHintsTagger : ITagger<IntraTextAdornmen
...
@@ -47,7 +47,7 @@ internal sealed class InlineParameterNameHintsTagger : ITagger<IntraTextAdornmen
public
event
EventHandler
<
SnapshotSpanEventArgs
>?
TagsChanged
;
public
event
EventHandler
<
SnapshotSpanEventArgs
>?
TagsChanged
;
public
InlineParameterNameHintsTagger
(
InlineParameterNameHintsTaggerProvider
taggerProvider
,
ITextView
textView
,
ITextBuffer
buffer
,
ITagAggregator
<
InlineParameterNameHintDataTag
>
tagAggregator
)
public
InlineParameterNameHintsTagger
(
InlineParameterNameHintsTaggerProvider
taggerProvider
,
I
Wpf
TextView
textView
,
ITextBuffer
buffer
,
ITagAggregator
<
InlineParameterNameHintDataTag
>
tagAggregator
)
{
{
_cache
=
new
List
<
ITagSpan
<
IntraTextAdornmentTag
>>();
_cache
=
new
List
<
ITagSpan
<
IntraTextAdornmentTag
>>();
_threadAffinitizedObject
=
new
ForegroundThreadAffinitizedObject
(
taggerProvider
.
ThreadingContext
);
_threadAffinitizedObject
=
new
ForegroundThreadAffinitizedObject
(
taggerProvider
.
ThreadingContext
);
...
@@ -118,7 +118,7 @@ public IEnumerable<ITagSpan<IntraTextAdornmentTag>> GetTags(NormalizedSnapshotSp
...
@@ -118,7 +118,7 @@ public IEnumerable<ITagSpan<IntraTextAdornmentTag>> GetTags(NormalizedSnapshotSp
if
(
dataTagSpans
.
Count
==
1
)
if
(
dataTagSpans
.
Count
==
1
)
{
{
var
dataTagSpan
=
dataTagSpans
[
0
];
var
dataTagSpan
=
dataTagSpans
[
0
];
_cache
.
Add
(
new
TagSpan
<
IntraTextAdornmentTag
>(
new
SnapshotSpan
(
dataTagSpan
.
Start
,
0
),
new
InlineParameterNameHintsTag
(
textTag
.
ParameterName
,
_textView
.
LineHeight
,
Format
)));
_cache
.
Add
(
new
TagSpan
<
IntraTextAdornmentTag
>(
new
SnapshotSpan
(
dataTagSpan
.
Start
,
0
),
new
InlineParameterNameHintsTag
(
textTag
.
ParameterName
,
_textView
,
Format
)));
}
}
}
}
}
}
...
...
src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTaggerProvider.cs
浏览文件 @
f5620799
...
@@ -52,7 +52,7 @@ internal class InlineParameterNameHintsTaggerProvider : IViewTaggerProvider
...
@@ -52,7 +52,7 @@ internal class InlineParameterNameHintsTaggerProvider : IViewTaggerProvider
}
}
var
tagAggregator
=
_viewTagAggregatorFactoryService
.
CreateTagAggregator
<
InlineParameterNameHintDataTag
>(
textView
);
var
tagAggregator
=
_viewTagAggregatorFactoryService
.
CreateTagAggregator
<
InlineParameterNameHintDataTag
>(
textView
);
return
new
InlineParameterNameHintsTagger
(
this
,
textView
,
buffer
,
tagAggregator
)
as
ITagger
<
T
>;
return
new
InlineParameterNameHintsTagger
(
this
,
(
IWpfTextView
)
textView
,
buffer
,
tagAggregator
)
as
ITagger
<
T
>;
}
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录