Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
29b07304
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,发现更多精彩内容 >>
提交
29b07304
编写于
7月 27, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Classified blocks of text.
上级
bbbf0735
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
31 addition
and
84 deletion
+31
-84
src/Features/CSharp/Portable/LanguageServices/CSharpSymbolDisplayService.SymbolDescriptionBuilder.cs
...es/CSharpSymbolDisplayService.SymbolDescriptionBuilder.cs
+1
-1
src/Features/VisualBasic/Portable/LanguageServices/VisualBasicSymbolDisplayService.SymbolDescriptionBuilder.vb
...sualBasicSymbolDisplayService.SymbolDescriptionBuilder.vb
+1
-1
src/VisualStudio/Core/Def.Next/FindReferences/StreamingFindReferencesPresenter.ReferenceEntry.cs
...rences/StreamingFindReferencesPresenter.ReferenceEntry.cs
+1
-69
src/VisualStudio/Core/Def.Next/FindReferences/StreamingFindReferencesPresenter.TableDataSourceFindReferencesContext.cs
...ferencesPresenter.TableDataSourceFindReferencesContext.cs
+7
-4
src/Workspaces/Core/Portable/Classification/Classifier.cs
src/Workspaces/Core/Portable/Classification/Classifier.cs
+21
-9
未找到文件。
src/Features/CSharp/Portable/LanguageServices/CSharpSymbolDisplayService.SymbolDescriptionBuilder.cs
浏览文件 @
29b07304
...
@@ -210,7 +210,7 @@ protected override void AddDescriptionForProperty(IPropertySymbol symbol)
...
@@ -210,7 +210,7 @@ protected override void AddDescriptionForProperty(IPropertySymbol symbol)
{
{
return
await
Classifier
.
GetClassifiedSymbolDisplayPartsAsync
(
return
await
Classifier
.
GetClassifiedSymbolDisplayPartsAsync
(
semanticModel
,
equalsValue
.
Value
.
Span
,
semanticModel
,
equalsValue
.
Value
.
Span
,
this
.
Workspace
,
this
.
CancellationToken
).
ConfigureAwait
(
false
);
this
.
Workspace
,
cancellationToken
:
this
.
CancellationToken
).
ConfigureAwait
(
false
);
}
}
}
}
...
...
src/Features/VisualBasic/Portable/LanguageServices/VisualBasicSymbolDisplayService.SymbolDescriptionBuilder.vb
浏览文件 @
29b07304
...
@@ -138,7 +138,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LanguageServices
...
@@ -138,7 +138,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LanguageServices
If
semanticModel
IsNot
Nothing
Then
If
semanticModel
IsNot
Nothing
Then
Return
Await
Classifier
.
GetClassifiedSymbolDisplayPartsAsync
(
Return
Await
Classifier
.
GetClassifiedSymbolDisplayPartsAsync
(
semanticModel
,
equalsValue
.
Value
.
Span
,
semanticModel
,
equalsValue
.
Value
.
Span
,
Me
.
Workspace
,
Me
.
CancellationToken
).
ConfigureAwait
(
False
)
Me
.
Workspace
,
cancellationToken
:
=
Me
.
CancellationToken
).
ConfigureAwait
(
False
)
End
If
End
If
End
If
End
If
...
...
src/VisualStudio/Core/Def.Next/FindReferences/StreamingFindReferencesPresenter.ReferenceEntry.cs
浏览文件 @
29b07304
...
@@ -119,11 +119,7 @@ private object GetValue(string keyName)
...
@@ -119,11 +119,7 @@ private object GetValue(string keyName)
return
_boxedProjectGuid
;
return
_boxedProjectGuid
;
case
StandardTableKeyNames
.
Text
:
case
StandardTableKeyNames
.
Text
:
return
_sourceText
.
Lines
.
GetLineFromPosition
(
SourceSpan
.
Start
).
ToString
().
Trim
();
// case StandardTableKeyNames.FullText:
case
StandardTableKeyNames
.
FullText
:
// When we support classified lines, change this to:
// return GetEllisionBufferAroundReference();
return
_sourceText
.
Lines
.
GetLineFromPosition
(
SourceSpan
.
Start
).
ToString
().
Trim
();
return
_sourceText
.
Lines
.
GetLineFromPosition
(
SourceSpan
.
Start
).
ToString
().
Trim
();
case
StandardTableKeyNames2
.
TextInlines
:
case
StandardTableKeyNames2
.
TextInlines
:
...
@@ -182,70 +178,6 @@ internal bool TryCreateToolTip(string columnName, out object toolTip)
...
@@ -182,70 +178,6 @@ internal bool TryCreateToolTip(string columnName, out object toolTip)
toolTip
=
textBlock
;
toolTip
=
textBlock
;
return
true
;
return
true
;
}
}
private
FrameworkElement
GetEllisionBufferAroundReference
()
{
var
snapshotSpanAndCloseAction
=
GetSnapshotSpanAroundReference
();
if
(
snapshotSpanAndCloseAction
==
null
)
{
return
null
;
}
var
snapshotSpan
=
snapshotSpanAndCloseAction
.
Item1
;
var
closeAction
=
snapshotSpanAndCloseAction
.
Item2
;
var
content
=
new
ElisionBufferDeferredContent
(
snapshotSpan
,
_presenter
.
_projectionBufferFactoryService
,
_presenter
.
_editorOptionsFactoryService
,
_presenter
.
_textEditorFactoryService
);
var
element
=
content
.
Create
();
return
element
;
}
private
Tuple
<
SnapshotSpan
,
Action
>
GetSnapshotSpanAroundReference
()
{
var
snapshotAndCloseAction
=
GetTextSnapshotAndCloseAction
();
var
snapshot
=
snapshotAndCloseAction
.
Item1
;
var
closeAction
=
snapshotAndCloseAction
.
Item2
;
var
wholeSnapshotSpan
=
new
TextSpan
(
0
,
snapshot
.
Length
);
var
finalSpan
=
this
.
SourceSpan
.
Intersection
(
wholeSnapshotSpan
)
??
default
(
TextSpan
);
var
lineNumber
=
snapshot
.
GetLineNumberFromPosition
(
finalSpan
.
Start
);
var
firstLineNumber
=
Math
.
Max
(
0
,
lineNumber
-
2
);
var
lastLineNumber
=
Math
.
Min
(
snapshot
.
LineCount
-
1
,
lineNumber
+
2
);
var
snapshotSpan
=
new
SnapshotSpan
(
snapshot
,
Span
.
FromBounds
(
snapshot
.
GetLineFromLineNumber
(
firstLineNumber
).
Start
,
snapshot
.
GetLineFromLineNumber
(
lastLineNumber
).
End
));
return
Tuple
.
Create
(
snapshotSpan
,
closeAction
);
}
private
Tuple
<
ITextSnapshot
,
Action
>
GetTextSnapshotAndCloseAction
()
{
// Get the existing editor snapshot (if this is already open in an editor),
// otherwise create a new snapshot that we can display.
var
snapshot
=
_sourceText
.
FindCorrespondingEditorTextSnapshot
();
if
(
snapshot
!=
null
)
{
return
Tuple
.
Create
(
snapshot
,
(
Action
)
null
);
}
return
OpenInvisibleEditorAndGetTextSnapshot
();
}
private
Tuple
<
ITextSnapshot
,
Action
>
OpenInvisibleEditorAndGetTextSnapshot
()
{
var
editor
=
_workspace
.
OpenInvisibleEditor
(
this
.
Document
.
Id
);
return
Tuple
.
Create
(
editor
.
TextBuffer
.
CurrentSnapshot
,
(
Action
)(()
=>
editor
.
Dispose
()));
}
}
}
}
}
}
}
\ No newline at end of file
src/VisualStudio/Core/Def.Next/FindReferences/StreamingFindReferencesPresenter.TableDataSourceFindReferencesContext.cs
浏览文件 @
29b07304
...
@@ -219,10 +219,11 @@ private TextSpan GetLineSpanForReference(SourceText sourceText, TextSpan referen
...
@@ -219,10 +219,11 @@ private TextSpan GetLineSpanForReference(SourceText sourceText, TextSpan referen
private
TextSpan
GetRegionSpanForReference
(
SourceText
sourceText
,
TextSpan
referenceSpan
)
private
TextSpan
GetRegionSpanForReference
(
SourceText
sourceText
,
TextSpan
referenceSpan
)
{
{
var
lineNumber
=
sourceText
.
Lines
.
GetLineFromPosition
(
referenceSpan
.
Start
).
LineNumber
;
const
int
AdditionalLineCountPerSide
=
3
;
var
firstLineNumber
=
Math
.
Max
(
0
,
lineNumber
-
2
);
var
lineNumber
=
sourceText
.
Lines
.
GetLineFromPosition
(
referenceSpan
.
Start
).
LineNumber
;
var
lastLineNumber
=
Math
.
Min
(
sourceText
.
Lines
.
Count
-
1
,
lineNumber
+
2
);
var
firstLineNumber
=
Math
.
Max
(
0
,
lineNumber
-
AdditionalLineCountPerSide
);
var
lastLineNumber
=
Math
.
Min
(
sourceText
.
Lines
.
Count
-
1
,
lineNumber
+
AdditionalLineCountPerSide
);
return
TextSpan
.
FromBounds
(
return
TextSpan
.
FromBounds
(
sourceText
.
Lines
[
firstLineNumber
].
Start
,
sourceText
.
Lines
[
firstLineNumber
].
Start
,
...
@@ -235,7 +236,9 @@ private TextSpan GetRegionSpanForReference(SourceText sourceText, TextSpan refer
...
@@ -235,7 +236,9 @@ private TextSpan GetRegionSpanForReference(SourceText sourceText, TextSpan refer
var
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
classifiedLineParts
=
await
Classifier
.
GetClassifiedSymbolDisplayPartsAsync
(
var
classifiedLineParts
=
await
Classifier
.
GetClassifiedSymbolDisplayPartsAsync
(
semanticModel
,
widenedSpan
,
document
.
Project
.
Solution
.
Workspace
,
cancellationToken
).
ConfigureAwait
(
false
);
semanticModel
,
widenedSpan
,
document
.
Project
.
Solution
.
Workspace
,
insertSourceTextInGaps
:
true
,
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
false
);
var
taggedText
=
classifiedLineParts
.
ToTaggedText
();
var
taggedText
=
classifiedLineParts
.
ToTaggedText
();
...
...
src/Workspaces/Core/Portable/Classification/Classifier.cs
浏览文件 @
29b07304
...
@@ -55,45 +55,57 @@ public static class Classifier
...
@@ -55,45 +55,57 @@ public static class Classifier
internal
static
async
Task
<
List
<
SymbolDisplayPart
>>
GetClassifiedSymbolDisplayPartsAsync
(
internal
static
async
Task
<
List
<
SymbolDisplayPart
>>
GetClassifiedSymbolDisplayPartsAsync
(
Document
document
,
Document
document
,
TextSpan
textSpan
,
TextSpan
textSpan
,
CancellationToken
cancellationToken
)
bool
insertSourceTextInGaps
=
false
,
CancellationToken
cancellationToken
=
default
(
CancellationToken
))
{
{
var
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
return
await
GetClassifiedSymbolDisplayPartsAsync
(
return
await
GetClassifiedSymbolDisplayPartsAsync
(
semanticModel
,
textSpan
,
semanticModel
,
textSpan
,
document
.
Project
.
Solution
.
Workspace
,
document
.
Project
.
Solution
.
Workspace
,
insertSourceTextInGaps
,
cancellationToken
).
ConfigureAwait
(
false
);
cancellationToken
).
ConfigureAwait
(
false
);
}
}
internal
static
async
Task
<
List
<
SymbolDisplayPart
>>
GetClassifiedSymbolDisplayPartsAsync
(
internal
static
async
Task
<
List
<
SymbolDisplayPart
>>
GetClassifiedSymbolDisplayPartsAsync
(
SemanticModel
semanticModel
,
TextSpan
textSpan
,
Workspace
workspace
,
CancellationToken
cancellationToken
)
SemanticModel
semanticModel
,
TextSpan
textSpan
,
Workspace
workspace
,
bool
insertSourceTextInGaps
=
false
,
CancellationToken
cancellationToken
=
default
(
CancellationToken
))
{
{
var
classifiedSpans
=
GetClassifiedSpans
(
semanticModel
,
textSpan
,
workspace
,
cancellationToken
);
var
classifiedSpans
=
GetClassifiedSpans
(
semanticModel
,
textSpan
,
workspace
,
cancellationToken
);
var
sourceText
=
await
semanticModel
.
SyntaxTree
.
GetTextAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
sourceText
=
await
semanticModel
.
SyntaxTree
.
GetTextAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
return
ConvertClassifications
(
sourceText
,
classifiedSpan
s
);
return
ConvertClassifications
(
sourceText
,
textSpan
.
Start
,
classifiedSpans
,
insertSourceTextInGap
s
);
}
}
private
static
List
<
SymbolDisplayPart
>
ConvertClassifications
(
private
static
List
<
SymbolDisplayPart
>
ConvertClassifications
(
SourceText
sourceText
,
IEnumerable
<
ClassifiedSpan
>
classifiedSpans
)
SourceText
sourceText
,
int
startPosition
,
IEnumerable
<
ClassifiedSpan
>
classifiedSpans
,
bool
insertSourceTextInGaps
=
false
)
{
{
var
parts
=
new
List
<
SymbolDisplayPart
>();
var
parts
=
new
List
<
SymbolDisplayPart
>();
ClassifiedSpan
?
lastSpan
=
null
;
foreach
(
var
span
in
classifiedSpans
)
foreach
(
var
span
in
classifiedSpans
)
{
{
// If there is space between this span and the last one, then add a space.
// If there is space between this span and the last one, then add a space.
if
(
lastSpan
!=
null
&&
lastSpan
.
Value
.
TextSpan
.
End
!=
span
.
TextSpan
.
Start
)
if
(
startPosition
!=
span
.
TextSpan
.
Start
)
{
if
(
insertSourceTextInGaps
)
{
parts
.
Add
(
new
SymbolDisplayPart
(
SymbolDisplayPartKind
.
Text
,
null
,
sourceText
.
ToString
(
TextSpan
.
FromBounds
(
startPosition
,
span
.
TextSpan
.
Start
))));
}
else
{
{
parts
.
AddRange
(
Space
());
parts
.
AddRange
(
Space
());
}
}
}
var
kind
=
GetClassificationKind
(
span
.
ClassificationType
);
var
kind
=
GetClassificationKind
(
span
.
ClassificationType
);
if
(
kind
!=
null
)
if
(
kind
!=
null
)
{
{
parts
.
Add
(
new
SymbolDisplayPart
(
kind
.
Value
,
null
,
sourceText
.
ToString
(
span
.
TextSpan
)));
parts
.
Add
(
new
SymbolDisplayPart
(
kind
.
Value
,
null
,
sourceText
.
ToString
(
span
.
TextSpan
)));
lastSpan
=
span
;
startPosition
=
span
.
TextSpan
.
End
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录