Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
961f5610
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,发现更多精彩内容 >>
提交
961f5610
编写于
10月 19, 2016
作者:
C
CyrusNajmabadi
提交者:
GitHub
10月 19, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14622 from CyrusNajmabadi/portFix14
Spell checking fixes.
上级
bed95961
2b5480e5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
56 addition
and
33 deletion
+56
-33
src/Features/CSharp/Portable/CodeFixes/SpellCheck/CSharpSpellcheckCodeFixProvider.cs
...e/CodeFixes/SpellCheck/CSharpSpellcheckCodeFixProvider.cs
+7
-0
src/Features/Core/Portable/CodeFixes/Qualify/AbstractFullyQualifyCodeFixProvider.cs
.../CodeFixes/Qualify/AbstractFullyQualifyCodeFixProvider.cs
+21
-13
src/Features/Core/Portable/FeaturesResources.Designer.cs
src/Features/Core/Portable/FeaturesResources.Designer.cs
+6
-6
src/Features/Core/Portable/FeaturesResources.resx
src/Features/Core/Portable/FeaturesResources.resx
+4
-4
src/Features/Core/Portable/GenerateMember/GenerateVariable/AbstractGenerateVariableService.cs
...ember/GenerateVariable/AbstractGenerateVariableService.cs
+4
-3
src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.cs
...Core/Portable/GenerateType/AbstractGenerateTypeService.cs
+3
-3
src/Features/Core/Portable/SpellCheck/AbstractSpellCheckCodeFixProvider.cs
.../Portable/SpellCheck/AbstractSpellCheckCodeFixProvider.cs
+7
-4
src/Features/VisualBasic/Portable/CodeFixes/Spellcheck/VisualBasicSpellCheckCodeFixProvider.vb
...eFixes/Spellcheck/VisualBasicSpellCheckCodeFixProvider.vb
+4
-0
未找到文件。
src/Features/CSharp/Portable/CodeFixes/SpellCheck/CSharpSpellcheckCodeFixProvider.cs
浏览文件 @
961f5610
...
...
@@ -22,6 +22,13 @@ internal partial class CSharpSpellCheckCodeFixProvider : AbstractSpellCheckCodeF
GenerateMethodDiagnosticIds
.
FixableDiagnosticIds
).
Concat
(
ImmutableArray
.
Create
(
CS0426
));
protected
override
bool
DescendIntoChildren
(
SyntaxNode
arg
)
{
// Don't dive into type argument lists. We don't want to report spell checking
// fixes for type args when we're called on an outer generic type.
return
!(
arg
is
TypeArgumentListSyntax
);
}
protected
override
bool
IsGeneric
(
SimpleNameSyntax
nameNode
)
{
return
nameNode
is
GenericNameSyntax
;
...
...
src/Features/Core/Portable/CodeFixes/Qualify/AbstractFullyQualifyCodeFixProvider.cs
浏览文件 @
961f5610
...
...
@@ -76,7 +76,9 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
// Wrap the spell checking actions into a single top level suggestion
// so as to not clutter the list.
context
.
RegisterCodeFix
(
new
GroupingCodeAction
(
codeActions
),
context
.
Diagnostics
);
context
.
RegisterCodeFix
(
new
GroupingCodeAction
(
string
.
Format
(
FeaturesResources
.
Fully_qualify_0
,
GetNodeName
(
document
,
node
)),
codeActions
),
context
.
Diagnostics
);
}
else
{
...
...
@@ -86,19 +88,16 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
}
private
IEnumerable
<
CodeAction
>
CreateActions
(
CodeFixContext
context
,
Document
document
,
Diagnostic
diagnostic
,
SyntaxNode
node
,
SemanticModel
semanticModel
,
IEnumerable
<
INamespaceOrTypeSymbol
>
proposedContainers
,
CodeFixContext
context
,
Document
document
,
Diagnostic
diagnostic
,
SyntaxNode
node
,
SemanticModel
semanticModel
,
IEnumerable
<
INamespaceOrTypeSymbol
>
proposedContainers
,
ISymbolDisplayService
displayService
)
{
foreach
(
var
container
in
proposedContainers
)
{
var
containerName
=
displayService
.
ToMinimalDisplayString
(
semanticModel
,
node
.
SpanStart
,
container
);
var
syntaxFacts
=
document
.
Project
.
LanguageServices
.
GetService
<
ISyntaxFactsService
>();
string
name
;
int
arity
;
syntaxFacts
.
GetNameAndArityOfSimpleName
(
node
,
out
name
,
out
arity
);
var
name
=
GetNodeName
(
document
,
node
);
// Actual member name might differ by case.
string
memberName
;
...
...
@@ -120,6 +119,15 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
}
}
private
static
string
GetNodeName
(
Document
document
,
SyntaxNode
node
)
{
var
syntaxFacts
=
document
.
Project
.
LanguageServices
.
GetService
<
ISyntaxFactsService
>();
string
name
;
int
arity
;
syntaxFacts
.
GetNameAndArityOfSimpleName
(
node
,
out
name
,
out
arity
);
return
name
;
}
private
async
Task
<
Document
>
ProcessNode
(
Document
document
,
SyntaxNode
node
,
string
containerName
,
CancellationToken
cancellationToken
)
{
var
newRoot
=
await
this
.
ReplaceNodeAsync
(
node
,
containerName
,
cancellationToken
).
ConfigureAwait
(
false
);
...
...
@@ -231,7 +239,7 @@ private bool BindsWithoutErrors(INamespaceSymbol ns, string rightName, bool isAt
{
return
false
;
}
return
BindsWithoutErrors
(
ns
,
rightName
+
"Attribute"
,
isAttributeName
:
false
);
}
...
...
@@ -270,17 +278,17 @@ private IEnumerable<INamespaceOrTypeSymbol> FilterAndSort(IEnumerable<SymbolResu
private
class
MyCodeAction
:
CodeAction
.
DocumentChangeAction
{
public
MyCodeAction
(
string
title
,
Func
<
CancellationToken
,
Task
<
Document
>>
createChangedDocument
)
:
base
(
title
,
createChangedDocument
)
base
(
title
,
createChangedDocument
,
equivalenceKey
:
title
)
{
}
}
private
class
GroupingCodeAction
:
CodeAction
.
SimpleCodeAction
{
public
GroupingCodeAction
(
ImmutableArray
<
CodeAction
>
nestedActions
)
:
base
(
FeaturesResources
.
Fully_qualify_nam
e
,
nestedActions
)
public
GroupingCodeAction
(
string
title
,
ImmutableArray
<
CodeAction
>
nestedActions
)
:
base
(
titl
e
,
nestedActions
)
{
}
}
}
}
}
\ No newline at end of file
src/Features/Core/Portable/FeaturesResources.Designer.cs
浏览文件 @
961f5610
...
...
@@ -1306,20 +1306,20 @@ internal class FeaturesResources {
}
/// <summary>
/// Looks up a localized string similar to Generate type.
/// Looks up a localized string similar to Generate type
'{0}'
.
/// </summary>
internal
static
string
Generate_type
{
internal
static
string
Generate_type
_0
{
get
{
return
ResourceManager
.
GetString
(
"Generate_type"
,
resourceCulture
);
return
ResourceManager
.
GetString
(
"Generate_type
_0
"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Generate variable.
/// Looks up a localized string similar to Generate variable
'{0}'
.
/// </summary>
internal
static
string
Generate_variable
{
internal
static
string
Generate_variable
_0
{
get
{
return
ResourceManager
.
GetString
(
"Generate_variable"
,
resourceCulture
);
return
ResourceManager
.
GetString
(
"Generate_variable
_0
"
,
resourceCulture
);
}
}
...
...
src/Features/Core/Portable/FeaturesResources.resx
浏览文件 @
961f5610
...
...
@@ -858,8 +858,8 @@ Do you want to continue?</value>
<data
name=
"Method_referenced_implicitly"
xml:space=
"preserve"
>
<value>
Method referenced implicitly
</value>
</data>
<data
name=
"Generate_type"
xml:space=
"preserve"
>
<value>
Generate type
</value>
<data
name=
"Generate_type
_0
"
xml:space=
"preserve"
>
<value>
Generate type
'{0}'
</value>
</data>
<data
name=
"Generate_0_1"
xml:space=
"preserve"
>
<value>
Generate {0} '{1}'
</value>
...
...
@@ -956,8 +956,8 @@ This version used in: {2}</value>
<data
name=
"Install_version_0"
xml:space=
"preserve"
>
<value>
Install version '{0}'
</value>
</data>
<data
name=
"Generate_variable"
xml:space=
"preserve"
>
<value>
Generate variable
</value>
<data
name=
"Generate_variable
_0
"
xml:space=
"preserve"
>
<value>
Generate variable
'{0}'
</value>
</data>
<data
name=
"Classes"
xml:space=
"preserve"
>
<value>
Classes
</value>
...
...
src/Features/Core/Portable/GenerateMember/GenerateVariable/AbstractGenerateVariableService.cs
浏览文件 @
961f5610
...
...
@@ -78,8 +78,9 @@ protected AbstractGenerateVariableService()
{
// Wrap the generate variable actions into a single top level suggestion
// so as to not clutter the list.
return
ImmutableArray
.
Create
<
CodeAction
>(
new
MyCodeAction
(
FeaturesResources
.
Generate_variable
,
actions
.
ToImmutableAndFree
()));
return
ImmutableArray
.
Create
<
CodeAction
>(
new
MyCodeAction
(
string
.
Format
(
FeaturesResources
.
Generate_variable_0
,
state
.
IdentifierToken
.
ValueText
),
actions
.
ToImmutableAndFree
()));
}
return
actions
.
ToImmutableAndFree
();
...
...
@@ -154,4 +155,4 @@ public MyCodeAction(string title, ImmutableArray<CodeAction> nestedActions)
}
}
}
}
}
\ No newline at end of file
src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.cs
浏览文件 @
961f5610
...
...
@@ -78,8 +78,8 @@ protected AbstractGenerateTypeService()
{
// Wrap the generate type actions into a single top level suggestion
// so as to not clutter the list.
return
ImmutableArray
.
Create
<
CodeAction
>(
new
MyCodeAction
(
FeaturesResources
.
Generate_type
,
actions
.
AsImmutable
()));
return
ImmutableArray
.
Create
<
CodeAction
>(
new
MyCodeAction
(
string
.
Format
(
FeaturesResources
.
Generate_type_0
,
state
.
Name
)
,
actions
.
AsImmutable
()));
}
else
{
...
...
@@ -305,4 +305,4 @@ public MyCodeAction(string title, ImmutableArray<CodeAction> nestedActions)
}
}
}
}
}
\ No newline at end of file
src/Features/Core/Portable/SpellCheck/AbstractSpellCheckCodeFixProvider.cs
浏览文件 @
961f5610
...
...
@@ -33,7 +33,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
}
SemanticModel
semanticModel
=
null
;
foreach
(
var
name
in
node
.
DescendantNodesAndSelf
().
OfType
<
TSimpleName
>())
foreach
(
var
name
in
node
.
DescendantNodesAndSelf
(
DescendIntoChildren
).
OfType
<
TSimpleName
>())
{
// Only bother with identifiers that are at least 3 characters long.
// We don't want to be too noisy as you're just starting to type something.
...
...
@@ -50,6 +50,8 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
}
}
protected
abstract
bool
DescendIntoChildren
(
SyntaxNode
arg
);
private
async
Task
CreateSpellCheckCodeIssueAsync
(
CodeFixContext
context
,
TSimpleName
nameNode
,
string
nameText
,
CancellationToken
cancellationToken
)
{
var
document
=
context
.
Document
;
...
...
@@ -103,7 +105,8 @@ private async Task CreateSpellCheckCodeIssueAsync(CodeFixContext context, TSimpl
{
// Wrap the spell checking actions into a single top level suggestion
// so as to not clutter the list.
context
.
RegisterCodeFix
(
new
MyCodeAction
(
codeActions
),
context
.
Diagnostics
);
context
.
RegisterCodeFix
(
new
MyCodeAction
(
String
.
Format
(
FeaturesResources
.
Spell_check_0
,
nameText
),
codeActions
),
context
.
Diagnostics
);
}
else
{
...
...
@@ -145,8 +148,8 @@ public SpellCheckCodeAction(string title, Func<CancellationToken, Task<Document>
private
class
MyCodeAction
:
CodeAction
.
SimpleCodeAction
{
public
MyCodeAction
(
ImmutableArray
<
CodeAction
>
nestedActions
)
:
base
(
FeaturesResources
.
Fix_spelling
,
nestedActions
)
public
MyCodeAction
(
string
title
,
ImmutableArray
<
CodeAction
>
nestedActions
)
:
base
(
title
,
nestedActions
)
{
}
}
...
...
src/Features/VisualBasic/Portable/CodeFixes/Spellcheck/VisualBasicSpellCheckCodeFixProvider.vb
浏览文件 @
961f5610
...
...
@@ -40,6 +40,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Spellcheck
End
Get
End
Property
Protected
Overrides
Function
DescendIntoChildren
(
arg
As
SyntaxNode
)
As
Boolean
Return
TypeOf
arg
IsNot
TypeArgumentListSyntax
End
Function
Protected
Overrides
Function
IsGeneric
(
nameNode
As
SimpleNameSyntax
)
As
Boolean
Return
nameNode
.
Kind
()
=
SyntaxKind
.
GenericName
End
Function
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录