Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
84678e08
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,发现更多精彩内容 >>
提交
84678e08
编写于
6月 28, 2019
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use 'var'
上级
ab2aebb5
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
66 addition
and
66 deletion
+66
-66
src/EditorFeatures/TestUtilities/BlindAggregatorFactory.cs
src/EditorFeatures/TestUtilities/BlindAggregatorFactory.cs
+3
-3
src/EditorFeatures/TestUtilities/ChangeSignature/AbstractChangeSignatureTests.cs
...Utilities/ChangeSignature/AbstractChangeSignatureTests.cs
+7
-7
src/EditorFeatures/TestUtilities/Classification/ClassificationTestHelper.cs
.../TestUtilities/Classification/ClassificationTestHelper.cs
+1
-1
src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
...ies/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
+1
-1
src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs
...stUtilities/Completion/AbstractCompletionProviderTests.cs
+2
-2
src/EditorFeatures/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs
...s/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs
+1
-1
src/EditorFeatures/TestUtilities/DirectoryExtensions.cs
src/EditorFeatures/TestUtilities/DirectoryExtensions.cs
+4
-4
src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs
...tUtilities/EditAndContinue/ActiveStatementsDescription.cs
+5
-5
src/EditorFeatures/TestUtilities/EditAndContinue/DeclaratorMapDescription.cs
...TestUtilities/EditAndContinue/DeclaratorMapDescription.cs
+3
-3
src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs
...stUtilities/EditAndContinue/EditAndContinueTestHelpers.cs
+11
-11
src/EditorFeatures/TestUtilities/EditAndContinue/Extensions.cs
...ditorFeatures/TestUtilities/EditAndContinue/Extensions.cs
+4
-4
src/EditorFeatures/TestUtilities/KeywordHighlighting/AbstractKeywordHighlighterTests.cs
...es/KeywordHighlighting/AbstractKeywordHighlighterTests.cs
+2
-2
src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs
...tures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs
+3
-3
src/EditorFeatures/TestUtilities/SignatureHelp/AbstractSignatureHelpProviderTests.cs
...ities/SignatureHelp/AbstractSignatureHelpProviderTests.cs
+4
-4
src/EditorFeatures/TestUtilities/Structure/AbstractSyntaxStructureProviderTests.cs
...ilities/Structure/AbstractSyntaxStructureProviderTests.cs
+1
-1
src/EditorFeatures/TestUtilities/Workspaces/TestHostProject.cs
...ditorFeatures/TestUtilities/Workspaces/TestHostProject.cs
+1
-1
src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace.cs
src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace.cs
+2
-2
src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace_Create.cs
...Features/TestUtilities/Workspaces/TestWorkspace_Create.cs
+1
-1
src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace_XmlConsumption.cs
.../TestUtilities/Workspaces/TestWorkspace_XmlConsumption.cs
+10
-10
未找到文件。
src/EditorFeatures/TestUtilities/BlindAggregatorFactory.cs
浏览文件 @
84678e08
...
...
@@ -18,7 +18,7 @@ public static unsafe IntPtr CreateWrapper()
public
static
unsafe
void
SetInnerObject
(
IntPtr
wrapperUnknown
,
IntPtr
innerUnknown
,
IntPtr
managedObjectGCHandlePtr
)
{
BlindAggregator
*
pWrapper
=
(
BlindAggregator
*)
wrapperUnknown
;
var
pWrapper
=
(
BlindAggregator
*)
wrapperUnknown
;
pWrapper
->
SetInnerObject
(
innerUnknown
,
managedObjectGCHandlePtr
);
}
...
...
@@ -35,7 +35,7 @@ private struct BlindAggregator
public
static
unsafe
BlindAggregator
*
CreateInstance
()
{
BlindAggregator
*
pResult
=
(
BlindAggregator
*)
Marshal
.
AllocCoTaskMem
(
sizeof
(
BlindAggregator
));
var
pResult
=
(
BlindAggregator
*)
Marshal
.
AllocCoTaskMem
(
sizeof
(
BlindAggregator
));
if
(
pResult
!=
null
)
{
pResult
->
Construct
();
...
...
@@ -163,7 +163,7 @@ private static unsafe uint AddRef(BlindAggregator* pThis)
private
static
unsafe
uint
Release
(
BlindAggregator
*
pThis
)
{
uint
result
=
unchecked
((
uint
)
Interlocked
.
Decrement
(
ref
pThis
->
_refCount
));
var
result
=
unchecked
((
uint
)
Interlocked
.
Decrement
(
ref
pThis
->
_refCount
));
if
(
result
==
0u
)
{
pThis
->
FinalRelease
();
...
...
src/EditorFeatures/TestUtilities/ChangeSignature/AbstractChangeSignatureTests.cs
浏览文件 @
84678e08
...
...
@@ -133,7 +133,7 @@ private string GetSignatureDescriptionString(int[] signature, int? totalParamete
if
(
totalParameters
.
HasValue
)
{
var
removed
=
new
List
<
int
>();
for
(
int
i
=
0
;
i
<
totalParameters
;
i
++)
for
(
var
i
=
0
;
i
<
totalParameters
;
i
++)
{
if
(!
signature
.
Contains
(
i
))
{
...
...
@@ -180,9 +180,9 @@ public async Task TestAllSignatureChangesAsync(string languageName, string marku
private
IEnumerable
<
int
[
]>
GetAllSignatureSpecifications
(
int
[]
signaturePartCounts
)
{
int
regularParameterStartIndex
=
signaturePartCounts
[
0
];
int
defaultValueParameterStartIndex
=
signaturePartCounts
[
0
]
+
signaturePartCounts
[
1
];
int
paramParameterIndex
=
signaturePartCounts
[
0
]
+
signaturePartCounts
[
1
]
+
signaturePartCounts
[
2
];
var
regularParameterStartIndex
=
signaturePartCounts
[
0
];
var
defaultValueParameterStartIndex
=
signaturePartCounts
[
0
]
+
signaturePartCounts
[
1
];
var
paramParameterIndex
=
signaturePartCounts
[
0
]
+
signaturePartCounts
[
1
]
+
signaturePartCounts
[
2
];
var
regularParameterArrangements
=
GetPermutedSubsets
(
regularParameterStartIndex
,
signaturePartCounts
[
1
]);
var
defaultValueParameterArrangements
=
GetPermutedSubsets
(
defaultValueParameterStartIndex
,
signaturePartCounts
[
2
]);
...
...
@@ -223,8 +223,8 @@ private IEnumerable<IEnumerable<int>> GetPermutations(IEnumerable<int> list)
yield
break
;
}
int
index
=
0
;
foreach
(
int
element
in
list
)
var
index
=
0
;
foreach
(
var
element
in
list
)
{
var
permutationsWithoutElement
=
GetPermutations
(
GetListWithoutElementAtIndex
(
list
,
index
));
foreach
(
var
perm
in
permutationsWithoutElement
)
...
...
@@ -238,7 +238,7 @@ private IEnumerable<IEnumerable<int>> GetPermutations(IEnumerable<int> list)
private
IEnumerable
<
int
>
GetListWithoutElementAtIndex
(
IEnumerable
<
int
>
list
,
int
skippedIndex
)
{
int
index
=
0
;
var
index
=
0
;
foreach
(
var
x
in
list
)
{
if
(
index
!=
skippedIndex
)
...
...
src/EditorFeatures/TestUtilities/Classification/ClassificationTestHelper.cs
浏览文件 @
84678e08
...
...
@@ -33,7 +33,7 @@ private static string GetText(ClassifiedSpan tuple)
actualClassificationList
.
Sort
((
t1
,
t2
)
=>
t1
.
TextSpan
.
Start
-
t2
.
TextSpan
.
Start
);
var
max
=
Math
.
Max
(
expectedClassificationList
.
Count
,
actualClassificationList
.
Count
);
for
(
int
i
=
0
;
i
<
max
;
i
++)
for
(
var
i
=
0
;
i
<
max
;
i
++)
{
if
(
i
>=
expectedClassificationList
.
Count
)
{
...
...
src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
浏览文件 @
84678e08
...
...
@@ -663,7 +663,7 @@ protected static (OptionKey, object) SingleOption<T>(PerLanguageOption<CodeStyle
TestParameters
parameters
,
params
string
[]
outputs
)
{
for
(
int
index
=
0
;
index
<
outputs
.
Length
;
index
++)
for
(
var
index
=
0
;
index
<
outputs
.
Length
;
index
++)
{
var
output
=
outputs
[
index
];
await
TestInRegularAndScript1Async
(
input
,
output
,
index
,
parameters
:
parameters
);
...
...
src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs
浏览文件 @
84678e08
...
...
@@ -454,7 +454,7 @@ protected virtual void SetWorkspaceOptions(TestWorkspace workspace)
var
textBuffer
=
WorkspaceFixture
.
CurrentDocument
.
TextBuffer
;
string
actualCodeAfterCommit
=
textBuffer
.
CurrentSnapshot
.
AsText
().
ToString
();
var
actualCodeAfterCommit
=
textBuffer
.
CurrentSnapshot
.
AsText
().
ToString
();
var
caretPosition
=
commit
.
NewPosition
!=
null
?
commit
.
NewPosition
.
Value
:
textView
.
Caret
.
Position
.
BufferPosition
.
Position
;
Assert
.
Equal
(
actualExpectedCode
,
actualCodeAfterCommit
);
...
...
@@ -483,7 +483,7 @@ protected virtual void SetWorkspaceOptions(TestWorkspace workspace)
customCommitCompletionProvider
.
Commit
(
completionItem
,
textView
,
textBuffer
,
textView
.
TextSnapshot
,
commitChar
);
string
actualCodeAfterCommit
=
textBuffer
.
CurrentSnapshot
.
AsText
().
ToString
();
var
actualCodeAfterCommit
=
textBuffer
.
CurrentSnapshot
.
AsText
().
ToString
();
var
caretPosition
=
textView
.
Caret
.
Position
.
BufferPosition
.
Position
;
Assert
.
Equal
(
actualExpectedCode
,
actualCodeAfterCommit
);
...
...
src/EditorFeatures/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs
浏览文件 @
84678e08
...
...
@@ -162,7 +162,7 @@ protected Document GetDocumentAndAnnotatedSpan(TestWorkspace workspace, out stri
return
(
ImmutableArray
<
Diagnostic
>.
Empty
,
ImmutableArray
<
CodeAction
>.
Empty
,
null
);
}
FixAllScope
?
scope
=
GetFixAllScope
(
annotation
);
var
scope
=
GetFixAllScope
(
annotation
);
return
await
GetDiagnosticAndFixesAsync
(
diagnostics
,
fixer
,
testDriver
,
document
,
span
,
scope
,
index
);
}
...
...
src/EditorFeatures/TestUtilities/DirectoryExtensions.cs
浏览文件 @
84678e08
...
...
@@ -13,17 +13,17 @@ public static class DirectoryExtensions
/// <param name="path">The directory path to delete</param>
public
static
void
DeleteRecursively
(
string
path
)
{
string
[]
files
=
Directory
.
GetFiles
(
path
);
string
[]
dirs
=
Directory
.
GetDirectories
(
path
);
var
files
=
Directory
.
GetFiles
(
path
);
var
dirs
=
Directory
.
GetDirectories
(
path
);
foreach
(
string
file
in
files
)
foreach
(
var
file
in
files
)
{
// If there were read-only attributes on the file, the delete would throw, so set normal permissions.
File
.
SetAttributes
(
file
,
FileAttributes
.
Normal
);
File
.
Delete
(
file
);
}
foreach
(
string
dir
in
dirs
)
foreach
(
var
dir
in
dirs
)
{
DeleteRecursively
(
dir
);
}
...
...
src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs
浏览文件 @
84678e08
...
...
@@ -105,7 +105,7 @@ private static IEnumerable<(TextSpan Span, int[] Ids)> GetSpansRecursive(Regex r
{
var
markedSyntax
=
match
.
Groups
[
contentGroupName
];
var
ids
=
GetIds
(
match
.
Groups
[
"Id"
].
Value
);
int
absoluteOffset
=
offset
+
markedSyntax
.
Index
;
var
absoluteOffset
=
offset
+
markedSyntax
.
Index
;
var
span
=
markedSyntax
.
Length
!=
0
?
new
TextSpan
(
absoluteOffset
,
markedSyntax
.
Length
)
:
new
TextSpan
();
yield
return
(
span
,
ids
);
...
...
@@ -121,7 +121,7 @@ internal static IEnumerable<(TextSpan Span, int Id)> GetActiveSpans(string marke
{
foreach
(
var
(
span
,
ids
)
in
GetSpansRecursive
(
s_activeStatementPattern
,
"ActiveStatement"
,
markedSource
,
offset
:
0
))
{
foreach
(
int
id
in
ids
)
foreach
(
var
id
in
ids
)
{
yield
return
(
span
,
id
);
}
...
...
@@ -156,10 +156,10 @@ internal static ActiveStatement CreateActiveStatement(TextSpan span, int id, Sou
var
result
=
new
TextSpan
?[
count
];
for
(
int
i
=
0
;
i
<
matches
.
Count
;
i
++)
for
(
var
i
=
0
;
i
<
matches
.
Count
;
i
++)
{
var
span
=
matches
[
i
].
Groups
[
"TrackingStatement"
];
foreach
(
int
id
in
GetIds
(
matches
[
i
]))
foreach
(
var
id
in
GetIds
(
matches
[
i
]))
{
result
[
id
]
=
new
TextSpan
(
span
.
Index
,
span
.
Length
);
}
...
...
@@ -173,7 +173,7 @@ internal static ImmutableArray<TextSpan>[] GetExceptionRegions(string src, int a
var
matches
=
ExceptionRegionPattern
.
Matches
(
src
);
var
result
=
new
List
<
TextSpan
>[
activeStatementCount
];
for
(
int
i
=
0
;
i
<
matches
.
Count
;
i
++)
for
(
var
i
=
0
;
i
<
matches
.
Count
;
i
++)
{
var
exceptionRegion
=
matches
[
i
].
Groups
[
"ExceptionRegion"
];
...
...
src/EditorFeatures/TestUtilities/EditAndContinue/DeclaratorMapDescription.cs
浏览文件 @
84678e08
...
...
@@ -21,7 +21,7 @@ public SyntaxMapDescription(string oldSource, string newSource)
NewSpans
=
GetSpans
(
newSource
);
Assert
.
Equal
(
OldSpans
.
Length
,
NewSpans
.
Length
);
for
(
int
i
=
0
;
i
<
OldSpans
.
Length
;
i
++)
for
(
var
i
=
0
;
i
<
OldSpans
.
Length
;
i
++)
{
Assert
.
Equal
(
OldSpans
[
i
].
Length
,
NewSpans
[
i
].
Length
);
}
...
...
@@ -37,7 +37,7 @@ internal static ImmutableArray<ImmutableArray<TextSpan>> GetSpans(string src)
var
matches
=
s_statementPattern
.
Matches
(
src
);
var
result
=
new
List
<
List
<
TextSpan
>>();
for
(
int
i
=
0
;
i
<
matches
.
Count
;
i
++)
for
(
var
i
=
0
;
i
<
matches
.
Count
;
i
++)
{
var
stmt
=
matches
[
i
].
Groups
[
"Node"
];
var
id
=
matches
[
i
].
Groups
[
"Id"
].
Value
.
Split
(
'.'
);
...
...
@@ -62,7 +62,7 @@ internal static ImmutableArray<ImmutableArray<TextSpan>> GetSpans(string src)
{
get
{
for
(
int
j
=
0
;
j
<
OldSpans
[
i
].
Length
;
j
++)
for
(
var
j
=
0
;
j
<
OldSpans
[
i
].
Length
;
j
++)
{
yield
return
KeyValuePairUtil
.
Create
(
OldSpans
[
i
][
j
],
NewSpans
[
i
][
j
]);
}
...
...
src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs
浏览文件 @
84678e08
...
...
@@ -38,7 +38,7 @@ internal abstract class EditAndContinueTestHelpers
tree
.
GetDiagnostics
().
Where
(
d
=>
d
.
Severity
==
DiagnosticSeverity
.
Error
).
Verify
();
DocumentId
documentId
=
DocumentId
.
CreateNewId
(
ProjectId
.
CreateNewId
(
"TestEnCProject"
),
"TestEnCDocument"
);
var
documentId
=
DocumentId
.
CreateNewId
(
ProjectId
.
CreateNewId
(
"TestEnCProject"
),
"TestEnCDocument"
);
TestActiveStatementTrackingService
trackingService
;
if
(
trackingSpansOpt
!=
null
)
...
...
@@ -67,7 +67,7 @@ internal abstract class EditAndContinueTestHelpers
// check new exception regions:
Assert
.
Equal
(
expectedNewExceptionRegions
.
Length
,
actualNewExceptionRegions
.
Length
);
for
(
int
i
=
0
;
i
<
expectedNewExceptionRegions
.
Length
;
i
++)
for
(
var
i
=
0
;
i
<
expectedNewExceptionRegions
.
Length
;
i
++)
{
AssertSpansEqual
(
expectedNewExceptionRegions
[
i
],
actualNewExceptionRegions
[
i
],
source
,
text
);
}
...
...
@@ -85,8 +85,8 @@ internal abstract class EditAndContinueTestHelpers
Assert
.
Equal
(
oldActiveStatements
.
Length
,
description
.
OldTrackingSpans
.
Length
);
}
string
newSource
=
editScript
.
Match
.
NewRoot
.
SyntaxTree
.
ToString
();
string
oldSource
=
editScript
.
Match
.
OldRoot
.
SyntaxTree
.
ToString
();
var
newSource
=
editScript
.
Match
.
NewRoot
.
SyntaxTree
.
ToString
();
var
oldSource
=
editScript
.
Match
.
OldRoot
.
SyntaxTree
.
ToString
();
var
oldText
=
SourceText
.
From
(
oldSource
);
var
newText
=
SourceText
.
From
(
newSource
);
...
...
@@ -97,7 +97,7 @@ internal abstract class EditAndContinueTestHelpers
var
updatedActiveMethodMatches
=
new
List
<
AbstractEditAndContinueAnalyzer
.
UpdatedMemberInfo
>();
var
editMap
=
Analyzer
.
BuildEditMap
(
editScript
);
DocumentId
documentId
=
DocumentId
.
CreateNewId
(
ProjectId
.
CreateNewId
(
"TestEnCProject"
),
"TestEnCDocument"
);
var
documentId
=
DocumentId
.
CreateNewId
(
ProjectId
.
CreateNewId
(
"TestEnCProject"
),
"TestEnCDocument"
);
TestActiveStatementTrackingService
trackingService
;
if
(
description
.
OldTrackingSpans
!=
null
)
...
...
@@ -130,7 +130,7 @@ internal abstract class EditAndContinueTestHelpers
if
(
diagnostics
.
Count
==
0
)
{
// check old exception regions:
for
(
int
i
=
0
;
i
<
oldActiveStatements
.
Length
;
i
++)
for
(
var
i
=
0
;
i
<
oldActiveStatements
.
Length
;
i
++)
{
var
actualOldExceptionRegions
=
Analyzer
.
GetExceptionRegions
(
oldText
,
...
...
@@ -144,14 +144,14 @@ internal abstract class EditAndContinueTestHelpers
// check new exception regions:
Assert
.
Equal
(
description
.
NewRegions
.
Length
,
actualNewExceptionRegions
.
Length
);
for
(
int
i
=
0
;
i
<
description
.
NewRegions
.
Length
;
i
++)
for
(
var
i
=
0
;
i
<
description
.
NewRegions
.
Length
;
i
++)
{
AssertSpansEqual
(
description
.
NewRegions
[
i
],
actualNewExceptionRegions
[
i
],
newSource
,
newText
);
}
}
else
{
for
(
int
i
=
0
;
i
<
oldActiveStatements
.
Length
;
i
++)
for
(
var
i
=
0
;
i
<
oldActiveStatements
.
Length
;
i
++)
{
Assert
.
Equal
(
0
,
description
.
NewRegions
[
i
].
Length
);
}
...
...
@@ -170,8 +170,8 @@ internal abstract class EditAndContinueTestHelpers
IEnumerable
<
string
>
expectedNodeUpdates
,
RudeEditDiagnosticDescription
[]
expectedDiagnostics
)
{
string
newSource
=
editScript
.
Match
.
NewRoot
.
SyntaxTree
.
ToString
();
string
oldSource
=
editScript
.
Match
.
OldRoot
.
SyntaxTree
.
ToString
();
var
newSource
=
editScript
.
Match
.
NewRoot
.
SyntaxTree
.
ToString
();
var
oldSource
=
editScript
.
Match
.
OldRoot
.
SyntaxTree
.
ToString
();
var
oldText
=
SourceText
.
From
(
oldSource
);
var
newText
=
SourceText
.
From
(
newSource
);
...
...
@@ -303,7 +303,7 @@ internal abstract class EditAndContinueTestHelpers
Assert
.
Equal
(
expectedSemanticEdits
.
Length
,
actualSemanticEdits
.
Count
);
for
(
int
i
=
0
;
i
<
actualSemanticEdits
.
Count
;
i
++)
for
(
var
i
=
0
;
i
<
actualSemanticEdits
.
Count
;
i
++)
{
var
editKind
=
expectedSemanticEdits
[
i
].
Kind
;
...
...
src/EditorFeatures/TestUtilities/EditAndContinue/Extensions.cs
浏览文件 @
84678e08
...
...
@@ -30,17 +30,17 @@ private static IEnumerable<RudeEditDiagnosticDescription> ToDescription(this IEn
private
static
string
GetLineAt
(
string
source
,
int
position
)
{
int
start
=
source
.
LastIndexOf
(
LineSeparator
,
position
,
position
);
int
end
=
source
.
IndexOf
(
LineSeparator
,
position
);
var
start
=
source
.
LastIndexOf
(
LineSeparator
,
position
,
position
);
var
end
=
source
.
IndexOf
(
LineSeparator
,
position
);
return
source
.
Substring
(
start
+
1
,
end
-
start
).
Trim
();
}
public
static
IEnumerable
<
string
>
ToLines
(
this
string
str
)
{
int
i
=
0
;
var
i
=
0
;
while
(
true
)
{
int
eoln
=
str
.
IndexOf
(
LineSeparator
,
i
,
StringComparison
.
Ordinal
);
var
eoln
=
str
.
IndexOf
(
LineSeparator
,
i
,
StringComparison
.
Ordinal
);
if
(
eoln
<
0
)
{
yield
return
str
.
Substring
(
i
);
...
...
src/EditorFeatures/TestUtilities/KeywordHighlighting/AbstractKeywordHighlighterTests.cs
浏览文件 @
84678e08
...
...
@@ -50,7 +50,7 @@ public abstract class AbstractKeywordHighlighterTests
var
root
=
await
document
.
GetSyntaxRootAsync
();
for
(
int
i
=
0
;
i
<=
cursorSpan
.
Length
;
i
++)
for
(
var
i
=
0
;
i
<=
cursorSpan
.
Length
;
i
++)
{
var
position
=
cursorSpan
.
Start
+
i
;
var
highlightSpans
=
highlighter
.
GetHighlights
(
root
,
position
,
CancellationToken
.
None
).
ToList
();
...
...
@@ -63,7 +63,7 @@ public abstract class AbstractKeywordHighlighterTests
private
static
void
CheckSpans
(
SyntaxTree
tree
,
IList
<
TextSpan
>
expectedHighlightSpans
,
List
<
TextSpan
>
highlightSpans
)
{
for
(
int
j
=
0
;
j
<
Math
.
Max
(
highlightSpans
.
Count
,
expectedHighlightSpans
.
Count
);
j
++)
for
(
var
j
=
0
;
j
<
Math
.
Max
(
highlightSpans
.
Count
,
expectedHighlightSpans
.
Count
);
j
++)
{
if
(
j
>=
expectedHighlightSpans
.
Count
)
{
...
...
src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs
浏览文件 @
84678e08
...
...
@@ -154,7 +154,7 @@ internal void InitializeWorkspace(TestWorkspace workspace)
Assert
.
Equal
(
expecteditems
.
Count
(),
items
.
Count
());
for
(
int
i
=
0
;
i
<
expecteditems
.
Count
;
i
++)
for
(
var
i
=
0
;
i
<
expecteditems
.
Count
;
i
++)
{
var
expectedItem
=
expecteditems
[
i
];
var
actualItem
=
items
.
ElementAt
(
i
);
...
...
@@ -201,7 +201,7 @@ internal void InitializeWorkspace(TestWorkspace workspace)
internal
BitmapSource
CreateIconBitmapSource
()
{
int
stride
=
PixelFormats
.
Bgr32
.
BitsPerPixel
/
8
*
16
;
var
stride
=
PixelFormats
.
Bgr32
.
BitsPerPixel
/
8
*
16
;
return
BitmapSource
.
Create
(
16
,
16
,
96
,
96
,
PixelFormats
.
Bgr32
,
null
,
new
byte
[
16
*
stride
],
stride
);
}
...
...
@@ -209,7 +209,7 @@ internal BitmapSource CreateIconBitmapSource()
// http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.language.navigateto.interfaces.navigatetoitem.aspx
protected
static
int
CompareNavigateToItems
(
NavigateToItem
a
,
NavigateToItem
b
)
{
int
result
=
((
int
)
a
.
PatternMatch
.
Kind
)
-
((
int
)
b
.
PatternMatch
.
Kind
);
var
result
=
((
int
)
a
.
PatternMatch
.
Kind
)
-
((
int
)
b
.
PatternMatch
.
Kind
);
if
(
result
!=
0
)
{
return
result
;
...
...
src/EditorFeatures/TestUtilities/SignatureHelp/AbstractSignatureHelpProviderTests.cs
浏览文件 @
84678e08
...
...
@@ -137,7 +137,7 @@ protected virtual void VerifyTriggerCharacters(char[] expectedTriggerCharacters,
private
void
VerifyTriggerCharactersWorker
(
char
[]
expectedTriggerCharacters
,
char
[]
unexpectedTriggerCharacters
,
SourceCodeKind
sourceCodeKind
)
{
ISignatureHelpProvide
r
signatureHelpProvider
=
CreateSignatureHelpProvider
();
va
r
signatureHelpProvider
=
CreateSignatureHelpProvider
();
foreach
(
var
expectedTriggerCharacter
in
expectedTriggerCharacters
)
{
...
...
@@ -186,7 +186,7 @@ private async Task VerifyCurrentParameterNameWorkerAsync(string markup, string e
{
Assert
.
Equal
(
expectedTestItems
.
Count
(),
actualSignatureHelpItems
.
Items
.
Count
());
for
(
int
i
=
0
;
i
<
expectedTestItems
.
Count
();
i
++)
for
(
var
i
=
0
;
i
<
expectedTestItems
.
Count
();
i
++)
{
CompareSigHelpItemsAndCurrentPosition
(
actualSignatureHelpItems
,
...
...
@@ -208,7 +208,7 @@ private async Task VerifyCurrentParameterNameWorkerAsync(string markup, string e
int
cursorPosition
,
TextSpan
applicableSpan
)
{
int
currentParameterIndex
=
-
1
;
var
currentParameterIndex
=
-
1
;
if
(
expectedTestItem
.
CurrentParameterIndex
!=
null
)
{
if
(
expectedTestItem
.
CurrentParameterIndex
.
Value
>=
0
&&
expectedTestItem
.
CurrentParameterIndex
.
Value
<
actualSignatureHelpItem
.
Parameters
.
Length
)
...
...
@@ -432,7 +432,7 @@ private void CompareSelectedIndex(IEnumerable<SignatureHelpTestItem> expectedOrd
Assert
.
True
(
expectedOrderedItemsOrNull
.
Count
(
i
=>
i
.
IsSelected
)
==
1
,
"Only one expected item can be marked with 'IsSelected'"
);
Assert
.
True
(
selectedItemIndex
!=
null
,
"Expected an item to be selected, but no item was actually selected"
);
int
counter
=
0
;
var
counter
=
0
;
foreach
(
var
item
in
expectedOrderedItemsOrNull
)
{
if
(
item
.
IsSelected
)
...
...
src/EditorFeatures/TestUtilities/Structure/AbstractSyntaxStructureProviderTests.cs
浏览文件 @
84678e08
...
...
@@ -44,7 +44,7 @@ protected async Task VerifyBlockSpansAsync(string markupCode, params Tuple<strin
Assert
.
True
(
expectedRegions
.
Length
==
actualRegions
.
Length
,
$"Expected
{
expectedRegions
.
Length
}
regions but there were
{
actualRegions
.
Length
}
"
);
for
(
int
i
=
0
;
i
<
expectedRegions
.
Length
;
i
++)
for
(
var
i
=
0
;
i
<
expectedRegions
.
Length
;
i
++)
{
AssertRegion
(
expectedRegions
[
i
],
actualRegions
[
i
]);
}
...
...
src/EditorFeatures/TestUtilities/Workspaces/TestHostProject.cs
浏览文件 @
84678e08
...
...
@@ -395,7 +395,7 @@ private static string GetDefaultExtension(OutputKind kind)
private
string
GetTestOutputFilePath
(
string
filepath
)
{
string
outputFilePath
=
@"Z:\"
;
var
outputFilePath
=
@"Z:\"
;
try
{
...
...
src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace.cs
浏览文件 @
84678e08
...
...
@@ -416,7 +416,7 @@ internal override void SetDocumentContext(DocumentId documentId)
IProjectionEditResolver
editResolver
=
null
)
{
GetSpansAndCaretFromSurfaceBufferMarkup
(
markup
,
baseDocuments
,
out
var
projectionBufferSpans
,
out
Dictionary
<
string
,
ImmutableArray
<
TextSpan
>>
mappedSpans
,
out
var
mappedCaretLocation
);
out
var
projectionBufferSpans
,
out
var
mappedSpans
,
out
var
mappedCaretLocation
);
var
projectionBufferFactory
=
this
.
GetService
<
IProjectionBufferFactoryService
>();
var
projectionBuffer
=
projectionBufferFactory
.
CreateProjectionBuffer
(
editResolver
,
projectionBufferSpans
,
options
);
...
...
@@ -578,7 +578,7 @@ internal override void SetDocumentContext(DocumentId documentId)
{
var
tempMappedMarkupSpans
=
new
Dictionary
<
string
,
ArrayBuilder
<
TextSpan
>>();
foreach
(
string
key
in
markupSpans
.
Keys
)
foreach
(
var
key
in
markupSpans
.
Keys
)
{
tempMappedMarkupSpans
[
key
]
=
ArrayBuilder
<
TextSpan
>.
GetInstance
();
foreach
(
var
markupSpan
in
markupSpans
[
key
])
...
...
src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace_Create.cs
浏览文件 @
84678e08
...
...
@@ -183,7 +183,7 @@ internal static string GetDefaultTestSourceDocumentName(int index, string extens
var
index
=
0
;
var
extension
=
""
;
for
(
int
i
=
0
;
i
<
files
.
Length
;
i
++)
for
(
var
i
=
0
;
i
<
files
.
Length
;
i
++)
{
if
(
language
==
LanguageNames
.
CSharp
)
{
...
...
src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace_XmlConsumption.cs
浏览文件 @
84678e08
...
...
@@ -92,8 +92,8 @@ public static TestWorkspace Create(string xmlDefinition, bool completed = true,
var
projectNameToTestHostProject
=
new
Dictionary
<
string
,
TestHostProject
>();
var
projectElementToProjectName
=
new
Dictionary
<
XElement
,
string
>();
var
filePathToTextBufferMap
=
new
Dictionary
<
string
,
ITextBuffer
>();
int
projectIdentifier
=
0
;
int
documentIdentifier
=
0
;
var
projectIdentifier
=
0
;
var
documentIdentifier
=
0
;
foreach
(
var
projectElement
in
workspaceElement
.
Elements
(
ProjectElementName
))
{
...
...
@@ -147,14 +147,14 @@ public static TestWorkspace Create(string xmlDefinition, bool completed = true,
}
}
for
(
int
i
=
1
;
i
<
submissions
.
Count
;
i
++)
for
(
var
i
=
1
;
i
<
submissions
.
Count
;
i
++)
{
if
(
submissions
[
i
].
CompilationOptions
==
null
)
{
continue
;
}
for
(
int
j
=
i
-
1
;
j
>=
0
;
j
--)
for
(
var
j
=
i
-
1
;
j
>=
0
;
j
--)
{
if
(
submissions
[
j
].
CompilationOptions
!=
null
)
{
...
...
@@ -265,7 +265,7 @@ public static TestWorkspace Create(string xmlDefinition, bool completed = true,
string
filePath
;
string
projectName
=
projectElement
.
Attribute
(
ProjectNameAttribute
)?.
Value
??
assemblyName
;
var
projectName
=
projectElement
.
Attribute
(
ProjectNameAttribute
)?.
Value
??
assemblyName
;
if
(
projectElement
.
Attribute
(
FilePathAttributeName
)
!=
null
)
{
...
...
@@ -471,7 +471,7 @@ private static string GetAssemblyName(TestWorkspace workspace, XElement projectE
private
static
string
GetLanguage
(
TestWorkspace
workspace
,
XElement
projectElement
)
{
string
languageName
=
projectElement
.
Attribute
(
LanguageAttributeName
).
Value
;
var
languageName
=
projectElement
.
Attribute
(
LanguageAttributeName
).
Value
;
if
(!
workspace
.
Services
.
SupportedLanguages
.
Contains
(
languageName
))
{
...
...
@@ -660,7 +660,7 @@ private static CompilationOptions CreateCompilationOptions(TestWorkspace workspa
string
filePath
;
var
isLinkFileAttribute
=
documentElement
.
Attribute
(
IsLinkFileAttributeName
);
bool
isLinkFile
=
isLinkFileAttribute
!=
null
&&
((
bool
?)
isLinkFileAttribute
).
HasValue
&&
((
bool
?)
isLinkFileAttribute
).
Value
;
var
isLinkFile
=
isLinkFileAttribute
!=
null
&&
((
bool
?)
isLinkFileAttribute
).
HasValue
&&
((
bool
?)
isLinkFileAttribute
).
Value
;
if
(
isLinkFile
)
{
// This is a linked file. Use the filePath and markup from the referenced document.
...
...
@@ -788,7 +788,7 @@ private static MetadataReference CreateMetadataReferenceFromSource(TestWorkspace
var
aliasElement
=
referencedSource
.
Attribute
(
"Aliases"
)?.
Value
;
var
aliases
=
aliasElement
!=
null
?
aliasElement
.
Split
(
','
).
Select
(
s
=>
s
.
Trim
()).
ToImmutableArray
()
:
default
;
bool
includeXmlDocComments
=
false
;
var
includeXmlDocComments
=
false
;
var
includeXmlDocCommentsAttribute
=
referencedSource
.
Attribute
(
IncludeXmlDocCommentsAttributeName
);
if
(
includeXmlDocCommentsAttribute
!=
null
&&
((
bool
?)
includeXmlDocCommentsAttribute
).
HasValue
&&
...
...
@@ -802,9 +802,9 @@ private static MetadataReference CreateMetadataReferenceFromSource(TestWorkspace
private
static
Compilation
CreateCompilation
(
TestWorkspace
workspace
,
XElement
referencedSource
)
{
string
languageName
=
GetLanguage
(
workspace
,
referencedSource
);
var
languageName
=
GetLanguage
(
workspace
,
referencedSource
);
string
assemblyName
=
"ReferencedAssembly"
;
var
assemblyName
=
"ReferencedAssembly"
;
var
assemblyNameAttribute
=
referencedSource
.
Attribute
(
AssemblyNameAttributeName
);
if
(
assemblyNameAttribute
!=
null
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录