Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
ef581a4b
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,发现更多精彩内容 >>
提交
ef581a4b
编写于
3月 23, 2015
作者:
B
Brett Forsgren
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enable quick-info for interpolated strings
上级
94c4887e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
81 addition
and
1 deletion
+81
-1
src/EditorFeatures/CSharpTest/QuickInfo/SemanticQuickInfoSourceTests.cs
...ures/CSharpTest/QuickInfo/SemanticQuickInfoSourceTests.cs
+28
-0
src/EditorFeatures/VisualBasicTest/QuickInfo/SemanticQuickInfoSourceTests.vb
...VisualBasicTest/QuickInfo/SemanticQuickInfoSourceTests.vb
+16
-0
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
...arp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
+12
-0
src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb
...ortable/LanguageServices/VisualBasicSyntaxFactsService.vb
+25
-1
未找到文件。
src/EditorFeatures/CSharpTest/QuickInfo/SemanticQuickInfoSourceTests.cs
浏览文件 @
ef581a4b
...
...
@@ -1267,6 +1267,34 @@ public void TestStringLiteral()
MainDescription
(
"class System.String"
));
}
[
WorkItem
(
1280
,
"https://github.com/dotnet/roslyn/issues/1280"
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
QuickInfo
)]
public
void
TestVerbatimStringLiteral
()
{
TestInMethod
(
@"string f = @""cat""$$"
,
MainDescription
(
"class System.String"
));
}
[
WorkItem
(
1280
,
"https://github.com/dotnet/roslyn/issues/1280"
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
QuickInfo
)]
public
void
TestInterpolatedStringLiteral
()
{
TestInMethod
(
@"string f = $""cat""$$"
,
MainDescription
(
"class System.String"
));
TestInMethod
(
@"string f = $""c$$at"""
,
MainDescription
(
"class System.String"
));
TestInMethod
(
@"string f = $""$$cat"""
,
MainDescription
(
"class System.String"
));
TestInMethod
(
@"string f = $""cat {1$$ + 2} dog"""
,
MainDescription
(
"struct System.Int32"
));
}
[
WorkItem
(
1280
,
"https://github.com/dotnet/roslyn/issues/1280"
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
QuickInfo
)]
public
void
TestVerbatimInterpolatedStringLiteral
()
{
TestInMethod
(
@"string f = $@""cat""$$"
,
MainDescription
(
"class System.String"
));
TestInMethod
(
@"string f = $@""c$$at"""
,
MainDescription
(
"class System.String"
));
TestInMethod
(
@"string f = $@""$$cat"""
,
MainDescription
(
"class System.String"
));
TestInMethod
(
@"string f = $@""cat {1$$ + 2} dog"""
,
MainDescription
(
"struct System.Int32"
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
QuickInfo
)]
public
void
TestCharLiteral
()
{
...
...
src/EditorFeatures/VisualBasicTest/QuickInfo/SemanticQuickInfoSourceTests.vb
浏览文件 @
ef581a4b
...
...
@@ -149,6 +149,22 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.QuickInfo
MainDescription("C
lass
System
.
String
"))
End Sub
<WorkItem(1280, "
https
:
//
github
.
com
/
dotnet
/
roslyn
/
issues
/
1280
")>
<Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)>
Public Sub TestStringLiteral()
TestInClass("
Dim
i
=
""
cat
""
$$
",
MainDescription("C
lass
System
.
String
"))
End Sub
<WorkItem(1280, "
https
:
//
github
.
com
/
dotnet
/
roslyn
/
issues
/
1280
")>
<Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)>
Public Sub TestInterpolatedStringLiteral()
TestInClass("
Dim
i
=
$
""
cat
""
$$
", MainDescription("C
lass
System
.
String
"))
TestInClass("
Dim
i
=
$
""
c$
$
at
"
""
, MainDescription("C
lass
System
.
String
"))
TestInClass("
Dim
i
=
$
""
$$
cat
"
""
, MainDescription("C
lass
System
.
String
"))
TestInClass("
Dim
i
=
$
""
cat
{
1
$$
+
2
}
dog
"
""
, MainDescription("
Structure
System
.
Int32
"))
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)>
Public Sub TestListOfString()
TestInClass("
Dim
l
As
$$
List
(
Of
String
)
",
...
...
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
浏览文件 @
ef581a4b
...
...
@@ -450,6 +450,10 @@ public bool IsLiteral(SyntaxToken token)
case
SyntaxKind
.
NullKeyword
:
case
SyntaxKind
.
TrueKeyword
:
case
SyntaxKind
.
FalseKeyword
:
case
SyntaxKind
.
InterpolatedStringStartToken
:
case
SyntaxKind
.
InterpolatedStringEndToken
:
case
SyntaxKind
.
InterpolatedVerbatimStringStartToken
:
case
SyntaxKind
.
InterpolatedStringTextToken
:
return
true
;
}
...
...
@@ -1272,6 +1276,14 @@ public SyntaxNode GetBindableParent(SyntaxToken token)
}
}
// The inside of an interpolated string is treated as its own token so we
// need to force navigation to the parent expression syntax.
if
(
node
is
InterpolatedStringTextSyntax
&&
parent
is
InterpolatedStringExpressionSyntax
)
{
node
=
parent
;
break
;
}
// If this node is not parented by a name, we're done.
var
name
=
parent
as
NameSyntax
;
if
(
name
==
null
)
...
...
src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb
浏览文件 @
ef581a4b
...
...
@@ -386,7 +386,24 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
Function
Public
Function
IsLiteral
(
token
As
SyntaxToken
)
As
Boolean
Implements
ISyntaxFactsService
.
IsLiteral
Return
SyntaxFacts
.
IsLiteralExpressionToken
(
CType
(
token
.
Kind
,
SyntaxKind
))
Select
Case
token
.
Kind
()
Case
_
SyntaxKind
.
IntegerLiteralToken
,
SyntaxKind
.
CharacterLiteralToken
,
SyntaxKind
.
DecimalLiteralToken
,
SyntaxKind
.
FloatingLiteralToken
,
SyntaxKind
.
DateLiteralToken
,
SyntaxKind
.
StringLiteralToken
,
SyntaxKind
.
DollarSignDoubleQuoteToken
,
SyntaxKind
.
DoubleQuoteToken
,
SyntaxKind
.
InterpolatedStringTextToken
,
SyntaxKind
.
TrueKeyword
,
SyntaxKind
.
FalseKeyword
,
SyntaxKind
.
NothingKeyword
Return
True
End
Select
Return
False
End
Function
Public
Function
IsStringLiteral
(
token
As
SyntaxToken
)
As
Boolean
Implements
ISyntaxFactsService
.
IsStringLiteral
...
...
@@ -1028,6 +1045,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
If
End
If
' The inside of an interpolated string is treated as its own token so we
' need to force navigation to the parent expression syntax.
If
TypeOf
node
Is
InterpolatedStringTextSyntax
AndAlso
TypeOf
parent
Is
InterpolatedStringExpressionSyntax
Then
node
=
parent
Exit
While
End
If
' If this node is not parented by a name, we're done.
Dim
name
=
TryCast
(
parent
,
NameSyntax
)
If
name
Is
Nothing
Then
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录