Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
34ebf969
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,发现更多精彩内容 >>
未验证
提交
34ebf969
编写于
2月 21, 2019
作者:
D
dotnet-automerge-bot
提交者:
GitHub
2月 21, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #33567 from dotnet/merges/dev16.0-to-master
Merge dev16.0 to master
上级
69071c68
558c29cd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
154 addition
and
3 deletion
+154
-3
src/CodeStyle/Core/CodeFixes/FixAllContextHelper.cs
src/CodeStyle/Core/CodeFixes/FixAllContextHelper.cs
+7
-3
src/VisualStudio/Core/Def/Implementation/Experimentation/EnhancedColorExperiment.cs
...Implementation/Experimentation/EnhancedColorExperiment.cs
+7
-0
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpCodeActions.cs
...egrationTest/IntegrationTests/CSharp/CSharpCodeActions.cs
+140
-0
未找到文件。
src/CodeStyle/Core/CodeFixes/FixAllContextHelper.cs
浏览文件 @
34ebf969
...
...
@@ -74,12 +74,13 @@ internal static class FixAllContextHelper
}
return
await
GetDocumentDiagnosticsToFixAsync
(
allDiagnostics
,
projectsToFix
,
fixAllContext
.
CancellationToken
).
ConfigureAwait
(
false
);
allDiagnostics
,
projectsToFix
,
isGeneratedCode
,
fixAllContext
.
CancellationToken
).
ConfigureAwait
(
false
);
}
private
static
async
Task
<
ImmutableDictionary
<
Document
,
ImmutableArray
<
Diagnostic
>>>
GetDocumentDiagnosticsToFixAsync
(
ImmutableArray
<
Diagnostic
>
diagnostics
,
ImmutableArray
<
Project
>
projects
,
Func
<
Document
,
CancellationToken
,
bool
>
isGeneratedCode
,
CancellationToken
cancellationToken
)
{
var
treeToDocumentMap
=
await
GetTreeToDocumentMapAsync
(
projects
,
cancellationToken
).
ConfigureAwait
(
false
);
...
...
@@ -89,8 +90,11 @@ internal static class FixAllContextHelper
{
cancellationToken
.
ThrowIfCancellationRequested
();
var
document
=
documentAndDiagnostics
.
Key
;
var
diagnosticsForDocument
=
documentAndDiagnostics
.
ToImmutableArray
();
builder
.
Add
(
document
,
diagnosticsForDocument
);
if
(!
isGeneratedCode
(
document
,
cancellationToken
))
{
var
diagnosticsForDocument
=
documentAndDiagnostics
.
ToImmutableArray
();
builder
.
Add
(
document
,
diagnosticsForDocument
);
}
}
return
builder
.
ToImmutable
();
...
...
src/VisualStudio/Core/Def/Implementation/Experimentation/EnhancedColorExperiment.cs
浏览文件 @
34ebf969
...
...
@@ -8,6 +8,7 @@
using
System.ComponentModel.Composition
;
using
System.Linq
;
using
System.Runtime.InteropServices
;
using
System.Windows
;
using
EnvDTE
;
using
Microsoft.CodeAnalysis.Classification
;
using
Microsoft.CodeAnalysis.Editor
;
...
...
@@ -96,6 +97,12 @@ private void UpdateThemeColors()
return
;
}
// We do not want to make any changes while in high contrast mode.
if
(
SystemParameters
.
HighContrast
)
{
return
;
}
var
currentThemeId
=
GetThemeId
();
// Get the preview feature flag value.
...
...
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpCodeActions.cs
浏览文件 @
34ebf969
...
...
@@ -281,6 +281,146 @@ public int Y2
Assert
.
Equal
(
expectedText
,
VisualStudio
.
Editor
.
GetText
());
}
[
CriticalWpfTheory
]
[
InlineData
(
FixAllScope
.
Project
)]
[
InlineData
(
FixAllScope
.
Solution
)]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsFixAllOccurrences
)]
[
WorkItem
(
33507
,
"https://github.com/dotnet/roslyn/issues/33507"
)]
public
void
FixAllOccurrencesIgnoresGeneratedCode
(
FixAllScope
scope
)
{
var
markup
=
@"
using System;
using $$System.Threading;
class C
{
public IntPtr X1 { get; set; }
}"
;
var
expectedText
=
@"
using System;
class C
{
public IntPtr X1 { get; set; }
}"
;
var
generatedSourceMarkup
=
@"// <auto-generated/>
using System;
using $$System.Threading;
class D
{
public IntPtr X1 { get; set; }
}"
;
var
expectedGeneratedSource
=
@"// <auto-generated/>
using System;
class D
{
public IntPtr X1 { get; set; }
}"
;
MarkupTestFile
.
GetPosition
(
generatedSourceMarkup
,
out
var
generatedSource
,
out
int
generatedSourcePosition
);
VisualStudio
.
SolutionExplorer
.
AddFile
(
new
ProjectUtils
.
Project
(
ProjectName
),
"D.cs"
,
generatedSource
,
open
:
false
);
// Switch to the main document we'll be editing
VisualStudio
.
SolutionExplorer
.
OpenFile
(
new
ProjectUtils
.
Project
(
ProjectName
),
"Class1.cs"
);
// Verify that applying a Fix All operation does not change generated files.
// This is a regression test for correctness with respect to the design.
SetUpEditor
(
markup
);
VisualStudio
.
WaitForApplicationIdle
(
CancellationToken
.
None
);
VisualStudio
.
Editor
.
InvokeCodeActionList
();
VisualStudio
.
Editor
.
Verify
.
CodeAction
(
"Remove Unnecessary Usings"
,
applyFix
:
true
,
fixAllScope
:
scope
);
Assert
.
Equal
(
expectedText
,
VisualStudio
.
Editor
.
GetText
());
VisualStudio
.
SolutionExplorer
.
OpenFile
(
new
ProjectUtils
.
Project
(
ProjectName
),
"D.cs"
);
Assert
.
Equal
(
generatedSource
,
VisualStudio
.
Editor
.
GetText
());
// Verify that a Fix All in Document in the generated file still does nothing.
// ⚠ This is a statement of the current behavior, and not a claim regarding correctness of the design.
// The current behavior is observable; any change to this behavior should be part of an intentional design
// change.
VisualStudio
.
Editor
.
MoveCaret
(
generatedSourcePosition
);
VisualStudio
.
Editor
.
InvokeCodeActionList
();
VisualStudio
.
Editor
.
Verify
.
CodeAction
(
"Remove Unnecessary Usings"
,
applyFix
:
true
,
fixAllScope
:
FixAllScope
.
Document
);
Assert
.
Equal
(
generatedSource
,
VisualStudio
.
Editor
.
GetText
());
// Verify that the code action can still be applied manually from within the generated file.
// This is a regression test for correctness with respect to the design.
VisualStudio
.
Editor
.
MoveCaret
(
generatedSourcePosition
);
VisualStudio
.
Editor
.
InvokeCodeActionList
();
VisualStudio
.
Editor
.
Verify
.
CodeAction
(
"Remove Unnecessary Usings"
,
applyFix
:
true
,
fixAllScope
:
null
);
Assert
.
Equal
(
expectedGeneratedSource
,
VisualStudio
.
Editor
.
GetText
());
}
[
CriticalWpfTheory
]
[
InlineData
(
FixAllScope
.
Project
)]
[
InlineData
(
FixAllScope
.
Solution
)]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsFixAllOccurrences
)]
[
WorkItem
(
33507
,
"https://github.com/dotnet/roslyn/issues/33507"
)]
public
void
FixAllOccurrencesTriggeredFromGeneratedCode
(
FixAllScope
scope
)
{
var
markup
=
@"// <auto-generated/>
using System;
using $$System.Threading;
class C
{
public IntPtr X1 { get; set; }
}"
;
var
secondFile
=
@"
using System;
using System.Threading;
class D
{
public IntPtr X1 { get; set; }
}"
;
var
expectedSecondFile
=
@"
using System;
class D
{
public IntPtr X1 { get; set; }
}"
;
VisualStudio
.
SolutionExplorer
.
AddFile
(
new
ProjectUtils
.
Project
(
ProjectName
),
"D.cs"
,
secondFile
,
open
:
false
);
// Switch to the main document we'll be editing
VisualStudio
.
SolutionExplorer
.
OpenFile
(
new
ProjectUtils
.
Project
(
ProjectName
),
"Class1.cs"
);
// Verify that applying a Fix All operation does not change generated file, but does change other files.
// ⚠ This is a statement of the current behavior, and not a claim regarding correctness of the design.
// The current behavior is observable; any change to this behavior should be part of an intentional design
// change.
MarkupTestFile
.
GetPosition
(
markup
,
out
var
expectedText
,
out
int
_
);
SetUpEditor
(
markup
);
VisualStudio
.
WaitForApplicationIdle
(
CancellationToken
.
None
);
VisualStudio
.
Editor
.
InvokeCodeActionList
();
VisualStudio
.
Editor
.
Verify
.
CodeAction
(
"Remove Unnecessary Usings"
,
applyFix
:
true
,
fixAllScope
:
scope
);
Assert
.
Equal
(
expectedText
,
VisualStudio
.
Editor
.
GetText
());
VisualStudio
.
SolutionExplorer
.
OpenFile
(
new
ProjectUtils
.
Project
(
ProjectName
),
"D.cs"
);
Assert
.
Equal
(
expectedSecondFile
,
VisualStudio
.
Editor
.
GetText
());
}
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateMethod
)]
public
void
ClassificationInPreviewPane
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录