Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
435128fc
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,发现更多精彩内容 >>
未验证
提交
435128fc
编写于
3月 23, 2019
作者:
D
dotnet-automerge-bot
提交者:
GitHub
3月 23, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #34374 from dotnet/merges/dev16.0-to-master
Merge dev16.0 to master
上级
f55c6054
ced90cb6
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
101 addition
and
9 deletion
+101
-9
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpCodeActions.cs
...egrationTest/IntegrationTests/CSharp/CSharpCodeActions.cs
+28
-4
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpFormatting.cs
...tegrationTest/IntegrationTests/CSharp/CSharpFormatting.cs
+24
-5
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs
...onTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs
+41
-0
src/VisualStudio/IntegrationTest/TestUtilities/Microsoft.VisualStudio.IntegrationTest.Utilities.csproj
...s/Microsoft.VisualStudio.IntegrationTest.Utilities.csproj
+1
-0
src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs
.../TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs
+7
-0
未找到文件。
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpCodeActions.cs
浏览文件 @
435128fc
...
...
@@ -198,6 +198,12 @@ class C
MarkupTestFile
.
GetSpans
(
markup
,
out
var
text
,
out
ImmutableArray
<
TextSpan
>
spans
);
SetUpEditor
(
markup
);
VisualStudio
.
WaitForApplicationIdle
(
CancellationToken
.
None
);
VisualStudio
.
Workspace
.
WaitForAllAsyncOperations
(
Helper
.
HangMitigatingTimeout
,
FeatureAttribute
.
Workspace
,
FeatureAttribute
.
SolutionCrawler
,
FeatureAttribute
.
DiagnosticService
,
FeatureAttribute
.
ErrorSquiggles
);
VisualStudio
.
Editor
.
Verify
.
CodeActionsNotShowing
();
var
editorConfig
=
@"root = true
...
...
@@ -206,7 +212,15 @@ class C
csharp_style_expression_bodied_properties = true:warning
"
;
VisualStudio
.
SolutionExplorer
.
BeginWatchForCodingConventionsChange
(
new
ProjectUtils
.
Project
(
ProjectName
),
"Class1.cs"
);
try
{
VisualStudio
.
SolutionExplorer
.
AddFile
(
new
ProjectUtils
.
Project
(
ProjectName
),
".editorconfig"
,
editorConfig
,
open
:
false
);
}
finally
{
VisualStudio
.
SolutionExplorer
.
EndWaitForCodingConventionsChange
(
Helper
.
HangMitigatingTimeout
);
}
// Wait for CodingConventions library events to propagate to the workspace
VisualStudio
.
WaitForApplicationIdle
(
CancellationToken
.
None
);
...
...
@@ -214,7 +228,8 @@ class C
Helper
.
HangMitigatingTimeout
,
FeatureAttribute
.
Workspace
,
FeatureAttribute
.
SolutionCrawler
,
FeatureAttribute
.
DiagnosticService
);
FeatureAttribute
.
DiagnosticService
,
FeatureAttribute
.
ErrorSquiggles
);
VisualStudio
.
Editor
.
InvokeCodeActionList
();
VisualStudio
.
Editor
.
Verify
.
CodeAction
(
"Use expression body for properties"
,
...
...
@@ -230,7 +245,15 @@ class C
* outcome for the modified .editorconfig style.
*/
VisualStudio
.
SolutionExplorer
.
BeginWatchForCodingConventionsChange
(
new
ProjectUtils
.
Project
(
ProjectName
),
"Class1.cs"
);
try
{
VisualStudio
.
SolutionExplorer
.
SetFileContents
(
new
ProjectUtils
.
Project
(
ProjectName
),
".editorconfig"
,
editorConfig
.
Replace
(
"true:warning"
,
"false:warning"
));
}
finally
{
VisualStudio
.
SolutionExplorer
.
EndWaitForCodingConventionsChange
(
Helper
.
HangMitigatingTimeout
);
}
// Wait for CodingConventions library events to propagate to the workspace
VisualStudio
.
WaitForApplicationIdle
(
CancellationToken
.
None
);
...
...
@@ -238,7 +261,8 @@ class C
Helper
.
HangMitigatingTimeout
,
FeatureAttribute
.
Workspace
,
FeatureAttribute
.
SolutionCrawler
,
FeatureAttribute
.
DiagnosticService
);
FeatureAttribute
.
DiagnosticService
,
FeatureAttribute
.
ErrorSquiggles
);
VisualStudio
.
Editor
.
InvokeCodeActionList
();
VisualStudio
.
Editor
.
Verify
.
CodeAction
(
"Use block body for properties"
,
...
...
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpFormatting.cs
浏览文件 @
435128fc
...
...
@@ -318,7 +318,8 @@ public int X1
Helper
.
HangMitigatingTimeout
,
FeatureAttribute
.
Workspace
,
FeatureAttribute
.
SolutionCrawler
,
FeatureAttribute
.
DiagnosticService
);
FeatureAttribute
.
DiagnosticService
,
FeatureAttribute
.
ErrorSquiggles
);
VisualStudio
.
Editor
.
FormatDocumentViaCommand
();
Assert
.
Equal
(
expectedTextFourSpaceIndent
,
VisualStudio
.
Editor
.
GetText
());
...
...
@@ -334,7 +335,15 @@ public int X1
indent_size = 2
"
;
VisualStudio
.
SolutionExplorer
.
BeginWatchForCodingConventionsChange
(
new
ProjectUtils
.
Project
(
ProjectName
),
"Class1.cs"
);
try
{
VisualStudio
.
SolutionExplorer
.
AddFile
(
new
ProjectUtils
.
Project
(
ProjectName
),
".editorconfig"
,
editorConfig
,
open
:
false
);
}
finally
{
VisualStudio
.
SolutionExplorer
.
EndWaitForCodingConventionsChange
(
Helper
.
HangMitigatingTimeout
);
}
// Wait for CodingConventions library events to propagate to the workspace
VisualStudio
.
WaitForApplicationIdle
(
CancellationToken
.
None
);
...
...
@@ -342,7 +351,8 @@ public int X1
Helper
.
HangMitigatingTimeout
,
FeatureAttribute
.
Workspace
,
FeatureAttribute
.
SolutionCrawler
,
FeatureAttribute
.
DiagnosticService
);
FeatureAttribute
.
DiagnosticService
,
FeatureAttribute
.
ErrorSquiggles
);
VisualStudio
.
Editor
.
FormatDocumentViaCommand
();
Assert
.
Equal
(
expectedTextTwoSpaceIndent
,
VisualStudio
.
Editor
.
GetText
());
...
...
@@ -352,7 +362,15 @@ public int X1
* and verifies that the next Format Document operation adheres to the updated formatting.
*/
VisualStudio
.
SolutionExplorer
.
BeginWatchForCodingConventionsChange
(
new
ProjectUtils
.
Project
(
ProjectName
),
"Class1.cs"
);
try
{
VisualStudio
.
SolutionExplorer
.
SetFileContents
(
new
ProjectUtils
.
Project
(
ProjectName
),
".editorconfig"
,
editorConfig
.
Replace
(
"2"
,
"4"
));
}
finally
{
VisualStudio
.
SolutionExplorer
.
EndWaitForCodingConventionsChange
(
Helper
.
HangMitigatingTimeout
);
}
// Wait for CodingConventions library events to propagate to the workspace
VisualStudio
.
WaitForApplicationIdle
(
CancellationToken
.
None
);
...
...
@@ -360,7 +378,8 @@ public int X1
Helper
.
HangMitigatingTimeout
,
FeatureAttribute
.
Workspace
,
FeatureAttribute
.
SolutionCrawler
,
FeatureAttribute
.
DiagnosticService
);
FeatureAttribute
.
DiagnosticService
,
FeatureAttribute
.
ErrorSquiggles
);
VisualStudio
.
Editor
.
FormatDocumentViaCommand
();
Assert
.
Equal
(
expectedTextFourSpaceIndent
,
VisualStudio
.
Editor
.
GetText
());
...
...
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs
浏览文件 @
435128fc
...
...
@@ -7,11 +7,13 @@
using
System.Linq
;
using
System.Runtime.InteropServices
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Xml.Linq
;
using
EnvDTE80
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.EditAndContinue
;
using
Microsoft.CodeAnalysis.Shared.TestHooks
;
using
Microsoft.VisualStudio.CodingConventions
;
using
Microsoft.VisualStudio.IntegrationTest.Utilities.Input
;
using
Microsoft.VisualStudio.ProjectSystem.Properties
;
using
Microsoft.VisualStudio.Shell
;
...
...
@@ -21,6 +23,7 @@
using
NuGet.SolutionRestoreManager
;
using
Roslyn.Hosting.Diagnostics.Waiters
;
using
VSLangProj
;
using
Task
=
System
.
Threading
.
Tasks
.
Task
;
namespace
Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess
{
...
...
@@ -1124,5 +1127,43 @@ public string[] GetChildrenOfItemAtPath(params string[] path)
return
null
;
}
private
CodingConventionsChangedWatcher
_codingConventionsChangedWatcher
;
public
void
BeginWatchForCodingConventionsChange
(
string
projectName
,
string
relativeFilePath
)
{
var
filePath
=
GetAbsolutePathForProjectRelativeFilePath
(
projectName
,
relativeFilePath
);
_codingConventionsChangedWatcher
=
new
CodingConventionsChangedWatcher
(
filePath
);
}
public
void
EndWaitForCodingConventionsChange
(
TimeSpan
timeout
)
{
var
watcher
=
Interlocked
.
Exchange
(
ref
_codingConventionsChangedWatcher
,
null
);
if
(
watcher
is
null
)
{
throw
new
InvalidOperationException
();
}
watcher
.
Changed
.
Wait
(
timeout
);
}
private
class
CodingConventionsChangedWatcher
{
private
readonly
TaskCompletionSource
<
object
>
_taskCompletionSource
=
new
TaskCompletionSource
<
object
>();
private
readonly
ICodingConventionContext
_codingConventionContext
;
public
CodingConventionsChangedWatcher
(
string
filePath
)
{
var
codingConventionsManager
=
GetComponentModelService
<
ICodingConventionsManager
>();
_codingConventionContext
=
codingConventionsManager
.
GetConventionContextAsync
(
filePath
,
CancellationToken
.
None
).
Result
;
_codingConventionContext
.
CodingConventionsChangedAsync
+=
(
sender
,
e
)
=>
{
_taskCompletionSource
.
SetResult
(
null
);
return
Task
.
CompletedTask
;
};
}
public
Task
Changed
=>
_taskCompletionSource
.
Task
;
}
}
}
src/VisualStudio/IntegrationTest/TestUtilities/Microsoft.VisualStudio.IntegrationTest.Utilities.csproj
浏览文件 @
435128fc
...
...
@@ -39,6 +39,7 @@
<PackageReference
Include=
"EnvDTE"
Version=
"$(EnvDTEVersion)"
/>
<PackageReference
Include=
"EnvDTE80"
Version=
"$(EnvDTE80Version)"
/>
<PackageReference
Include=
"VSLangProj"
Version=
"$(VSLangProjVersion)"
/>
<PackageReference
Include=
"Microsoft.VisualStudio.CodingConventions"
Version=
"$(MicrosoftVisualStudioCodingConventionsVersion)"
/>
<PackageReference
Include=
"Microsoft.VisualStudio.CoreUtility"
Version=
"$(MicrosoftVisualStudioCoreUtilityVersion)"
/>
<PackageReference
Include=
"Microsoft.VisualStudio.InteractiveWindow"
Version=
"$(MicrosoftVisualStudioInteractiveWindowVersion)"
/>
<PackageReference
Include=
"Microsoft.VisualStudio.Language"
Version=
"$(MicrosoftVisualStudioLanguageVersion)"
/>
...
...
src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs
浏览文件 @
435128fc
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using
System
;
using
System.Xml.Linq
;
using
Microsoft.CodeAnalysis.Shared.TestHooks
;
using
Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess
;
...
...
@@ -205,5 +206,11 @@ public void EditProjectFile(ProjectUtils.Project project)
public
void
AddStandaloneFile
(
string
fileName
)
=>
_inProc
.
AddStandaloneFile
(
fileName
);
public
void
BeginWatchForCodingConventionsChange
(
ProjectUtils
.
Project
project
,
string
fileName
)
=>
_inProc
.
BeginWatchForCodingConventionsChange
(
project
.
Name
,
fileName
);
public
void
EndWaitForCodingConventionsChange
(
TimeSpan
timeout
)
=>
_inProc
.
EndWaitForCodingConventionsChange
(
timeout
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录