Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
004c6203
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,发现更多精彩内容 >>
提交
004c6203
编写于
7月 28, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Properly formatted tooltips.
上级
3860d834
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
65 addition
and
24 deletion
+65
-24
src/EditorFeatures/Core/Implementation/IntelliSense/QuickInfo/DeferredContent/ElisionBufferDeferredContent.cs
...QuickInfo/DeferredContent/ElisionBufferDeferredContent.cs
+8
-5
src/VisualStudio/Core/Def.Next/FindReferences/StreamingFindReferencesPresenter.ReferenceEntry.cs
...rences/StreamingFindReferencesPresenter.ReferenceEntry.cs
+44
-11
src/VisualStudio/Core/Def.Next/FindReferences/StreamingFindReferencesPresenter.TableEntriesSnapshot.cs
.../StreamingFindReferencesPresenter.TableEntriesSnapshot.cs
+8
-8
src/VisualStudio/Core/Def.Next/FindReferences/StreamingFindReferencesPresenter.cs
...f.Next/FindReferences/StreamingFindReferencesPresenter.cs
+5
-0
未找到文件。
src/EditorFeatures/Core/Implementation/IntelliSense/QuickInfo/DeferredContent/ElisionBufferDeferredContent.cs
浏览文件 @
004c6203
...
...
@@ -25,6 +25,7 @@ internal class ElisionBufferDeferredContent : IDeferredQuickInfoContent
private
readonly
ITextEditorFactoryService
_textEditorFactoryService
;
private
readonly
IContentType
_contentType
;
private
readonly
ITextViewRoleSet
_roleSet
;
private
readonly
Brush
_backgroundBrush
;
public
ElisionBufferDeferredContent
(
SnapshotSpan
span
,
...
...
@@ -32,14 +33,16 @@ internal class ElisionBufferDeferredContent : IDeferredQuickInfoContent
IEditorOptionsFactoryService
editorOptionsFactoryService
,
ITextEditorFactoryService
textEditorFactoryService
,
IContentType
contentType
=
null
,
ITextViewRoleSet
roleSet
=
null
)
ITextViewRoleSet
roleSet
=
null
,
Brush
backgroundBrush
=
null
)
{
_span
=
span
;
_projectionBufferFactoryService
=
projectionBufferFactoryService
;
_editorOptionsFactoryService
=
editorOptionsFactoryService
;
_textEditorFactoryService
=
textEditorFactoryService
;
_contentType
=
contentType
;
_roleSet
=
roleSet
;
_roleSet
=
roleSet
??
_textEditorFactoryService
.
NoRoles
;
_backgroundBrush
=
backgroundBrush
??
Brushes
.
Transparent
;
}
public
ContentControl
Create
()
...
...
@@ -51,11 +54,11 @@ public ContentControl Create()
private
IWpfTextView
CreateView
(
ITextBuffer
buffer
)
{
var
view
=
_textEditorFactoryService
.
CreateTextView
(
buffer
,
_roleSet
??
_textEditorFactoryService
.
NoRoles
);
var
view
=
_textEditorFactoryService
.
CreateTextView
(
buffer
,
_roleSet
);
view
.
SizeToFit
();
view
.
Background
=
Brushes
.
Transparent
;
view
.
Background
=
_backgroundBrush
;
// Zoom out a bit to shrink the text.
view
.
ZoomLevel
*=
0.75
;
...
...
src/VisualStudio/Core/Def.Next/FindReferences/StreamingFindReferencesPresenter.ReferenceEntry.cs
浏览文件 @
004c6203
...
...
@@ -21,6 +21,8 @@
using
Microsoft.CodeAnalysis.Editor.Shared.Preview
;
using
Microsoft.CodeAnalysis.Editor.Implementation.ReferenceHighlighting
;
using
Microsoft.VisualStudio.Text.Editor
;
using
System.Linq
;
using
System.Windows.Controls
;
namespace
Microsoft.VisualStudio.LanguageServices.FindReferences
{
...
...
@@ -100,8 +102,8 @@ private object GetValue(string keyName)
case
StandardTableKeyNames
.
Text
:
return
_sourceText
.
Lines
.
GetLineFromPosition
(
SourceSpan
.
Start
).
ToString
().
Trim
();
case
StandardTableKeyNames2
.
TextInlines
:
return
GetHighlightedInlines
(
Presenter
,
_taggedLineParts
);
//
case StandardTableKeyNames2.TextInlines:
//
return GetHighlightedInlines(Presenter, _taggedLineParts);
case
StandardTableKeyNames2
.
DefinitionIcon
:
return
_definitionBucket
.
DefinitionItem
.
Tags
.
GetGlyph
().
GetImageMoniker
();
...
...
@@ -113,6 +115,33 @@ private object GetValue(string keyName)
return
null
;
}
internal
bool
TryCreateColumnContent
(
string
columnName
,
out
FrameworkElement
content
)
{
if
(
columnName
==
StandardTableColumnDefinitions2
.
LineText
)
{
var
inlines
=
GetHighlightedInlines
(
Presenter
,
_taggedLineParts
);
var
textBlock
=
inlines
.
ToTextBlock
(
Presenter
.
_typeMap
);
var
toolTipContent
=
CreateToolTipContent
();
var
toolTip
=
new
ToolTip
{
Content
=
toolTipContent
};
textBlock
.
ToolTip
=
toolTip
;
var
style
=
Presenter
.
_presenterStyles
.
FirstOrDefault
(
s
=>
!
string
.
IsNullOrEmpty
(
s
.
QuickInfoAppearanceCategory
));
if
(
style
?.
BackgroundBrush
!=
null
)
{
toolTip
.
Background
=
style
.
BackgroundBrush
;
}
content
=
textBlock
;
return
true
;
}
content
=
null
;
return
false
;
}
private
static
IList
<
System
.
Windows
.
Documents
.
Inline
>
GetHighlightedInlines
(
StreamingFindReferencesPresenter
presenter
,
TaggedTextAndHighlightSpan
taggedTextAndHighlight
,
...
...
@@ -143,14 +172,14 @@ private object GetValue(string keyName)
return
inlines
;
}
internal
bool
TryCreateToolTip
(
string
columnName
,
out
object
toolTip
)
{
Presenter
.
AssertIsForeground
();
//
internal bool TryCreateToolTip(string columnName, out object toolTip)
//
{
//
Presenter.AssertIsForeground();
return
TryCreateEllision
(
columnName
,
out
toolTip
);
}
//
return TryCreateEllision(columnName, out toolTip);
//
}
private
bool
TryCreateEllision
(
string
columnName
,
out
object
toolTip
)
private
ContentControl
CreateToolTipContent
(
)
{
var
textBuffer
=
_context
.
GetTextBufferForPreview
(
Document
,
_sourceText
);
...
...
@@ -164,8 +193,12 @@ private bool TryCreateEllision(string columnName, out object toolTip)
var
contentType
=
Presenter
.
_contentTypeRegistryService
.
GetContentType
(
IProjectionBufferFactoryServiceExtensions
.
RoslynPreviewContentType
);
var
roleSet
=
Presenter
.
_textEditorFactoryService
.
CreateTextViewRoleSet
(
TextViewRoles
.
PreviewRole
,
PredefinedTextViewRoles
.
Analyzable
);
TextViewRoles
.
PreviewRole
,
PredefinedTextViewRoles
.
Analyzable
,
PredefinedTextViewRoles
.
Document
,
PredefinedTextViewRoles
.
Editable
);
var
content
=
new
ElisionBufferDeferredContent
(
snapshotSpan
,
...
...
@@ -176,8 +209,8 @@ private bool TryCreateEllision(string columnName, out object toolTip)
roleSet
);
var
element
=
content
.
Create
();
toolTip
=
element
;
return
true
;
return
element
;
}
private
Span
GetRegionSpanForReference
()
...
...
src/VisualStudio/Core/Def.Next/FindReferences/StreamingFindReferencesPresenter.TableEntriesSnapshot.cs
浏览文件 @
004c6203
...
...
@@ -35,16 +35,16 @@ public override bool TryGetValue(int index, string keyName, out object content)
return
_referenceEntries
[
index
].
TryGetValue
(
keyName
,
out
content
);
}
public
override
bool
TryCreateToolTip
(
int
index
,
string
columnName
,
out
object
toolTip
)
{
return
this
.
_referenceEntries
[
index
].
TryCreateToolTip
(
columnName
,
out
toolTip
);
}
//public override bool TryCreateColumnContent(
// int index, string columnName, bool singleColumnView, out FrameworkElement content)
//public override bool TryCreateToolTip(int index, string columnName, out object toolTip)
//{
// return this._referenceEntries[index].TryCreate
ColumnContent(columnName, out content
);
// return this._referenceEntries[index].TryCreate
ToolTip(columnName, out toolTip
);
//}
public
override
bool
TryCreateColumnContent
(
int
index
,
string
columnName
,
bool
singleColumnView
,
out
FrameworkElement
content
)
{
return
this
.
_referenceEntries
[
index
].
TryCreateColumnContent
(
columnName
,
out
content
);
}
}
}
}
\ No newline at end of file
src/VisualStudio/Core/Def.Next/FindReferences/StreamingFindReferencesPresenter.cs
浏览文件 @
004c6203
...
...
@@ -12,6 +12,7 @@
using
Microsoft.VisualStudio.Text.Classification
;
using
System.Linq
;
using
Microsoft.VisualStudio.Utilities
;
using
Microsoft.VisualStudio.Language.Intellisense
;
namespace
Microsoft.VisualStudio.LanguageServices.FindReferences
{
...
...
@@ -37,6 +38,7 @@ internal partial class StreamingFindReferencesPresenter :
private
readonly
ClassificationTypeMap
_typeMap
;
private
readonly
IEditorFormatMapService
_formatMapService
;
private
readonly
IFindAllReferencesService
_vsFindAllReferencesService
;
private
readonly
IEnumerable
<
QuickInfoPresenterStyle
>
_presenterStyles
;
[
ImportingConstructor
]
public
StreamingFindReferencesPresenter
(
...
...
@@ -48,6 +50,7 @@ internal partial class StreamingFindReferencesPresenter :
IContentTypeRegistryService
contentTypeRegistryService
,
ClassificationTypeMap
typeMap
,
IEditorFormatMapService
formatMapService
,
[
ImportMany
]
IEnumerable
<
QuickInfoPresenterStyle
>
presenterStyles
,
[
ImportMany
]
IEnumerable
<
Lazy
<
IAsynchronousOperationListener
,
FeatureMetadata
>>
asyncListeners
)
{
_serviceProvider
=
serviceProvider
;
...
...
@@ -59,6 +62,8 @@ internal partial class StreamingFindReferencesPresenter :
_textEditorFactoryService
=
textEditorFactoryService
;
_typeMap
=
typeMap
;
_formatMapService
=
formatMapService
;
_presenterStyles
=
presenterStyles
;
_asyncListener
=
new
AggregateAsynchronousOperationListener
(
asyncListeners
,
FeatureAttribute
.
ReferenceHighlighting
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录