Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
0fe8e29c
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,发现更多精彩内容 >>
提交
0fe8e29c
编写于
11月 20, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Inline variable declarations.
上级
23822f4d
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
26 addition
and
76 deletion
+26
-76
src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs
...Features/TestUtilities/AbstractCommandHandlerTestState.cs
+1
-3
src/EditorFeatures/TestUtilities/AutomaticCompletion/AbstractAutomaticBraceCompletionTests.cs
...omaticCompletion/AbstractAutomaticBraceCompletionTests.cs
+6
-15
src/EditorFeatures/TestUtilities/AutomaticCompletion/AbstractAutomaticLineEnderTests.cs
...es/AutomaticCompletion/AbstractAutomaticLineEnderTests.cs
+1
-3
src/EditorFeatures/TestUtilities/BlockCommentEditing/AbstractBlockCommentEditingTests.cs
...s/BlockCommentEditing/AbstractBlockCommentEditingTests.cs
+1
-4
src/EditorFeatures/TestUtilities/BraceMatching/AbstractBraceMatcherTests.cs
.../TestUtilities/BraceMatching/AbstractBraceMatcherTests.cs
+1
-4
src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
...ies/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
+1
-3
src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs
...stUtilities/Completion/AbstractCompletionProviderTests.cs
+5
-15
src/EditorFeatures/TestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs
...tics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs
+2
-5
src/EditorFeatures/TestUtilities/Diagnostics/AbstractSuppressionDiagnosticTest.cs
...tilities/Diagnostics/AbstractSuppressionDiagnosticTest.cs
+2
-5
src/EditorFeatures/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs
...s/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs
+1
-3
src/EditorFeatures/TestUtilities/Diagnostics/TestAnalyzerReferenceByLanguage.cs
...tUtilities/Diagnostics/TestAnalyzerReferenceByLanguage.cs
+1
-2
src/EditorFeatures/TestUtilities/DocumentationComments/AbstractDocumentationCommentTests.cs
...ocumentationComments/AbstractDocumentationCommentTests.cs
+1
-4
src/EditorFeatures/TestUtilities/DocumentationComments/AbstractXmlTagCompletionTests.cs
...es/DocumentationComments/AbstractXmlTagCompletionTests.cs
+1
-4
src/EditorFeatures/TestUtilities/MoveType/AbstractMoveTypeTest.cs
...orFeatures/TestUtilities/MoveType/AbstractMoveTypeTest.cs
+1
-4
src/EditorFeatures/TestUtilities/TypeInferrer/TypeInferrerTestBase.cs
...atures/TestUtilities/TypeInferrer/TypeInferrerTestBase.cs
+1
-2
未找到文件。
src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs
浏览文件 @
0fe8e29c
...
...
@@ -69,9 +69,7 @@ internal abstract class AbstractCommandHandlerTestState : IDisposable
_textView
=
cursorDocument
.
GetTextView
();
_subjectBuffer
=
cursorDocument
.
GetTextBuffer
();
IList
<
Text
.
TextSpan
>
selectionSpanList
;
if
(
cursorDocument
.
AnnotatedSpans
.
TryGetValue
(
"Selection"
,
out
selectionSpanList
))
if
(
cursorDocument
.
AnnotatedSpans
.
TryGetValue
(
"Selection"
,
out
var
selectionSpanList
))
{
var
firstSpan
=
selectionSpanList
.
First
();
var
lastSpan
=
selectionSpanList
.
Last
();
...
...
src/EditorFeatures/TestUtilities/AutomaticCompletion/AbstractAutomaticBraceCompletionTests.cs
浏览文件 @
0fe8e29c
...
...
@@ -37,9 +37,7 @@ internal void CheckStart(IBraceCompletionSession session, bool expectValidSessio
internal
void
CheckBackspace
(
IBraceCompletionSession
session
)
{
session
.
TextView
.
TryMoveCaretToAndEnsureVisible
(
session
.
OpeningPoint
.
GetPoint
(
session
.
SubjectBuffer
.
CurrentSnapshot
).
Add
(
1
));
bool
handled
;
session
.
PreBackspace
(
out
handled
);
session
.
PreBackspace
(
out
var
handled
);
if
(!
handled
)
{
session
.
PostBackspace
();
...
...
@@ -51,8 +49,7 @@ internal void CheckBackspace(IBraceCompletionSession session)
internal
void
CheckTab
(
IBraceCompletionSession
session
,
bool
allowTab
=
true
)
{
bool
handled
;
session
.
PreTab
(
out
handled
);
session
.
PreTab
(
out
var
handled
);
if
(!
handled
)
{
session
.
PostTab
();
...
...
@@ -71,8 +68,7 @@ internal void CheckTab(IBraceCompletionSession session, bool allowTab = true)
internal
void
CheckReturn
(
IBraceCompletionSession
session
,
int
indentation
,
string
result
=
null
)
{
bool
handled
;
session
.
PreReturn
(
out
handled
);
session
.
PreReturn
(
out
var
handled
);
Type
(
session
,
Environment
.
NewLine
);
...
...
@@ -92,8 +88,7 @@ internal void CheckReturn(IBraceCompletionSession session, int indentation, stri
internal
void
CheckReturnOnNonEmptyLine
(
IBraceCompletionSession
session
,
int
expectedVirtualSpace
)
{
bool
handled
;
session
.
PreReturn
(
out
handled
);
session
.
PreReturn
(
out
var
handled
);
Type
(
session
,
Environment
.
NewLine
);
...
...
@@ -110,9 +105,7 @@ internal void CheckOverType(IBraceCompletionSession session, bool allowOverType
{
var
preClosingPoint
=
session
.
ClosingPoint
.
GetPoint
(
session
.
SubjectBuffer
.
CurrentSnapshot
);
Assert
.
Equal
(
session
.
ClosingBrace
,
preClosingPoint
.
Subtract
(
1
).
GetChar
());
bool
handled
;
session
.
PreOverType
(
out
handled
);
session
.
PreOverType
(
out
var
handled
);
if
(!
handled
)
{
session
.
PostOverType
();
...
...
@@ -164,9 +157,7 @@ internal Holder CreateSession(TestWorkspace workspace, char opening, char closin
var
provider
=
new
BraceCompletionSessionProvider
(
undoManager
,
editorOperationsFactoryService
);
var
openingPoint
=
new
SnapshotPoint
(
document
.
GetTextBuffer
().
CurrentSnapshot
,
document
.
CursorPosition
.
Value
);
IBraceCompletionSession
session
;
if
(
provider
.
TryCreateSession
(
document
.
GetTextView
(),
openingPoint
,
opening
,
closing
,
out
session
))
if
(
provider
.
TryCreateSession
(
document
.
GetTextView
(),
openingPoint
,
opening
,
closing
,
out
var
session
))
{
return
new
Holder
(
workspace
,
session
);
}
...
...
src/EditorFeatures/TestUtilities/AutomaticCompletion/AbstractAutomaticLineEnderTests.cs
浏览文件 @
0fe8e29c
...
...
@@ -59,9 +59,7 @@ protected async Task TestAsync(string expected, string code, bool completionActi
private
void
Test
(
ITextView
view
,
ITextBuffer
buffer
,
string
expectedWithAnnotations
)
{
string
expected
;
int
expectedPosition
;
MarkupTestFile
.
GetPosition
(
expectedWithAnnotations
,
out
expected
,
out
expectedPosition
);
MarkupTestFile
.
GetPosition
(
expectedWithAnnotations
,
out
var
expected
,
out
int
expectedPosition
);
// Remove any virtual space from the expected text.
var
virtualPosition
=
view
.
Caret
.
Position
.
VirtualBufferPosition
;
...
...
src/EditorFeatures/TestUtilities/BlockCommentEditing/AbstractBlockCommentEditingTests.cs
浏览文件 @
0fe8e29c
...
...
@@ -40,10 +40,7 @@ protected async Task VerifyAsync(string initialMarkup, string expectedMarkup)
var
nextHandler
=
CreateInsertTextHandler
(
view
,
"\r\n"
);
commandHandler
.
ExecuteCommand
(
args
,
nextHandler
);
string
expectedCode
;
int
expectedPosition
;
MarkupTestFile
.
GetPosition
(
expectedMarkup
,
out
expectedCode
,
out
expectedPosition
);
MarkupTestFile
.
GetPosition
(
expectedMarkup
,
out
var
expectedCode
,
out
int
expectedPosition
);
Assert
.
Equal
(
expectedCode
,
view
.
TextSnapshot
.
GetText
());
...
...
src/EditorFeatures/TestUtilities/BraceMatching/AbstractBraceMatcherTests.cs
浏览文件 @
0fe8e29c
...
...
@@ -31,10 +31,7 @@ protected async Task TestAsync(string markup, string expectedCode, ParseOptions
var
braceMatcher
=
workspace
.
GetService
<
IBraceMatchingService
>();
var
foundSpan
=
await
braceMatcher
.
FindMatchingSpanAsync
(
document
,
position
,
CancellationToken
.
None
);
string
parsedExpectedCode
;
IList
<
TextSpan
>
expectedSpans
;
MarkupTestFile
.
GetSpans
(
expectedCode
,
out
parsedExpectedCode
,
out
expectedSpans
);
MarkupTestFile
.
GetSpans
(
expectedCode
,
out
var
parsedExpectedCode
,
out
IList
<
TextSpan
>
expectedSpans
);
if
(
expectedSpans
.
Any
())
{
...
...
src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
浏览文件 @
0fe8e29c
...
...
@@ -343,9 +343,7 @@ public abstract class AbstractCodeActionOrUserDiagnosticTest
object
fixProviderData
,
CodeActionPriority
?
priority
)
{
string
expected
;
IDictionary
<
string
,
IList
<
TextSpan
>>
spanMap
;
MarkupTestFile
.
GetSpans
(
expectedMarkup
.
NormalizeLineEndings
(),
out
expected
,
out
spanMap
);
MarkupTestFile
.
GetSpans
(
expectedMarkup
.
NormalizeLineEndings
(),
out
var
expected
,
out
IDictionary
<
string
,
IList
<
TextSpan
>>
spanMap
);
var
conflictSpans
=
spanMap
.
GetOrAdd
(
"Conflict"
,
_
=>
new
List
<
TextSpan
>());
var
renameSpans
=
spanMap
.
GetOrAdd
(
"Rename"
,
_
=>
new
List
<
TextSpan
>());
...
...
src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs
浏览文件 @
0fe8e29c
...
...
@@ -135,9 +135,7 @@ internal static CompletionHelper GetCompletionHelper(Document document)
SourceCodeKind
sourceCodeKind
,
bool
usePreviousCharAsTrigger
,
bool
checkForAbsence
,
int
?
glyph
,
int
?
matchPriority
)
{
string
code
;
int
position
;
MarkupTestFile
.
GetPosition
(
markup
.
NormalizeLineEndings
(),
out
code
,
out
position
);
MarkupTestFile
.
GetPosition
(
markup
.
NormalizeLineEndings
(),
out
var
code
,
out
int
position
);
return
VerifyWorkerAsync
(
code
,
position
,
expectedItemOrNull
,
expectedDescriptionOrNull
,
...
...
@@ -146,9 +144,7 @@ internal static CompletionHelper GetCompletionHelper(Document document)
protected
async
Task
VerifyCustomCommitProviderAsync
(
string
markupBeforeCommit
,
string
itemToCommit
,
string
expectedCodeAfterCommit
,
SourceCodeKind
?
sourceCodeKind
=
null
,
char
?
commitChar
=
null
)
{
string
code
;
int
position
;
MarkupTestFile
.
GetPosition
(
markupBeforeCommit
.
NormalizeLineEndings
(),
out
code
,
out
position
);
MarkupTestFile
.
GetPosition
(
markupBeforeCommit
.
NormalizeLineEndings
(),
out
var
code
,
out
int
position
);
if
(
sourceCodeKind
.
HasValue
)
{
...
...
@@ -164,9 +160,7 @@ protected async Task VerifyCustomCommitProviderAsync(string markupBeforeCommit,
protected
async
Task
VerifyProviderCommitAsync
(
string
markupBeforeCommit
,
string
itemToCommit
,
string
expectedCodeAfterCommit
,
char
?
commitChar
,
string
textTypedSoFar
,
SourceCodeKind
?
sourceCodeKind
=
null
)
{
string
code
;
int
position
;
MarkupTestFile
.
GetPosition
(
markupBeforeCommit
.
NormalizeLineEndings
(),
out
code
,
out
position
);
MarkupTestFile
.
GetPosition
(
markupBeforeCommit
.
NormalizeLineEndings
(),
out
var
code
,
out
int
position
);
expectedCodeAfterCommit
=
expectedCodeAfterCommit
.
NormalizeLineEndings
();
if
(
sourceCodeKind
.
HasValue
)
...
...
@@ -332,9 +326,7 @@ protected virtual void SetWorkspaceOptions(TestWorkspace workspace)
string
expectedCodeAfterCommit
,
char
?
commitChar
=
null
)
{
int
expectedCaretPosition
;
string
actualExpectedCode
=
null
;
MarkupTestFile
.
GetPosition
(
expectedCodeAfterCommit
,
out
actualExpectedCode
,
out
expectedCaretPosition
);
MarkupTestFile
.
GetPosition
(
expectedCodeAfterCommit
,
out
var
actualExpectedCode
,
out
int
expectedCaretPosition
);
if
(
commitChar
.
HasValue
&&
!
Controller
.
IsCommitCharacter
(
service
.
GetRules
(),
completionItem
,
commitChar
.
Value
,
commitChar
.
Value
.
ToString
()))
...
...
@@ -371,9 +363,7 @@ protected virtual void SetWorkspaceOptions(TestWorkspace workspace)
string
expectedCodeAfterCommit
,
char
?
commitChar
=
null
)
{
int
expectedCaretPosition
;
string
actualExpectedCode
=
null
;
MarkupTestFile
.
GetPosition
(
expectedCodeAfterCommit
,
out
actualExpectedCode
,
out
expectedCaretPosition
);
MarkupTestFile
.
GetPosition
(
expectedCodeAfterCommit
,
out
var
actualExpectedCode
,
out
int
expectedCaretPosition
);
if
(
commitChar
.
HasValue
&&
!
Controller
.
IsCommitCharacter
(
service
.
GetRules
(),
completionItem
,
commitChar
.
Value
,
commitChar
.
Value
.
ToString
()))
...
...
src/EditorFeatures/TestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs
浏览文件 @
0fe8e29c
...
...
@@ -46,8 +46,7 @@ public abstract class AbstractDiagnosticProviderBasedUserDiagnosticTest : Abstra
var
providerAndFixer
=
GetOrCreateDiagnosticProviderAndFixer
(
workspace
,
fixProviderData
);
var
provider
=
providerAndFixer
.
Item1
;
TextSpan
span
;
var
document
=
GetDocumentAndSelectSpan
(
workspace
,
out
span
);
var
document
=
GetDocumentAndSelectSpan
(
workspace
,
out
var
span
);
var
allDiagnostics
=
await
DiagnosticProviderTestUtilities
.
GetAllDiagnosticsAsync
(
provider
,
document
,
span
);
AssertNoAnalyzerExceptionDiagnostics
(
allDiagnostics
);
return
allDiagnostics
;
...
...
@@ -59,10 +58,8 @@ public abstract class AbstractDiagnosticProviderBasedUserDiagnosticTest : Abstra
var
providerAndFixer
=
GetOrCreateDiagnosticProviderAndFixer
(
workspace
,
fixProviderData
);
var
provider
=
providerAndFixer
.
Item1
;
Document
document
;
TextSpan
span
;
string
annotation
=
null
;
if
(!
TryGetDocumentAndSelectSpan
(
workspace
,
out
document
,
out
span
))
if
(!
TryGetDocumentAndSelectSpan
(
workspace
,
out
var
document
,
out
var
span
))
{
document
=
GetDocumentAndAnnotatedSpan
(
workspace
,
out
annotation
,
out
span
);
}
...
...
src/EditorFeatures/TestUtilities/Diagnostics/AbstractSuppressionDiagnosticTest.cs
浏览文件 @
0fe8e29c
...
...
@@ -59,8 +59,7 @@ private ImmutableArray<Diagnostic> FilterDiagnostics(IEnumerable<Diagnostic> dia
var
providerAndFixer
=
CreateDiagnosticProviderAndFixer
(
workspace
);
var
provider
=
providerAndFixer
.
Item1
;
TextSpan
span
;
var
document
=
GetDocumentAndSelectSpan
(
workspace
,
out
span
);
var
document
=
GetDocumentAndSelectSpan
(
workspace
,
out
var
span
);
var
diagnostics
=
await
DiagnosticProviderTestUtilities
.
GetAllDiagnosticsAsync
(
provider
,
document
,
span
);
return
FilterDiagnostics
(
diagnostics
);
}
...
...
@@ -71,10 +70,8 @@ private ImmutableArray<Diagnostic> FilterDiagnostics(IEnumerable<Diagnostic> dia
var
providerAndFixer
=
CreateDiagnosticProviderAndFixer
(
workspace
);
var
provider
=
providerAndFixer
.
Item1
;
Document
document
;
TextSpan
span
;
string
annotation
=
null
;
if
(!
TryGetDocumentAndSelectSpan
(
workspace
,
out
document
,
out
span
))
if
(!
TryGetDocumentAndSelectSpan
(
workspace
,
out
var
document
,
out
var
span
))
{
document
=
GetDocumentAndAnnotatedSpan
(
workspace
,
out
annotation
,
out
span
);
}
...
...
src/EditorFeatures/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs
浏览文件 @
0fe8e29c
...
...
@@ -258,9 +258,7 @@ protected async Task TestEquivalenceKeyAsync(string initialMarkup, string equiva
string
fixAllActionEquivalenceId
=
null
,
object
fixProviderData
=
null
)
{
IList
<
TextSpan
>
spansList
;
string
unused
;
MarkupTestFile
.
GetSpans
(
expectedMarkup
,
out
unused
,
out
spansList
);
MarkupTestFile
.
GetSpans
(
expectedMarkup
,
out
var
unused
,
out
IList
<
TextSpan
>
spansList
);
var
expectedTextSpans
=
spansList
.
ToSet
();
using
(
var
workspace
=
await
CreateWorkspaceFromFileAsync
(
initialMarkup
,
parseOptions
,
compilationOptions
))
...
...
src/EditorFeatures/TestUtilities/Diagnostics/TestAnalyzerReferenceByLanguage.cs
浏览文件 @
0fe8e29c
...
...
@@ -45,8 +45,7 @@ public override ImmutableArray<DiagnosticAnalyzer> GetAnalyzersForAllLanguages()
public
override
ImmutableArray
<
DiagnosticAnalyzer
>
GetAnalyzers
(
string
language
)
{
ImmutableArray
<
DiagnosticAnalyzer
>
analyzers
;
if
(
_analyzersMap
.
TryGetValue
(
language
,
out
analyzers
))
if
(
_analyzersMap
.
TryGetValue
(
language
,
out
var
analyzers
))
{
return
analyzers
;
}
...
...
src/EditorFeatures/TestUtilities/DocumentationComments/AbstractDocumentationCommentTests.cs
浏览文件 @
0fe8e29c
...
...
@@ -150,10 +150,7 @@ private Action CreateInsertTextHandler(ITextView textView, string text)
workspace
.
GetService
<
ITextUndoHistoryRegistry
>(),
workspace
.
GetService
<
IEditorOperationsFactoryService
>(),
workspace
.
GetService
<
IAsyncCompletionService
>());
string
expectedCode
;
int
expectedPosition
;
MarkupTestFile
.
GetPosition
(
expectedMarkup
,
out
expectedCode
,
out
expectedPosition
);
MarkupTestFile
.
GetPosition
(
expectedMarkup
,
out
var
expectedCode
,
out
int
expectedPosition
);
Assert
.
Equal
(
expectedCode
,
view
.
TextSnapshot
.
GetText
());
...
...
src/EditorFeatures/TestUtilities/DocumentationComments/AbstractXmlTagCompletionTests.cs
浏览文件 @
0fe8e29c
...
...
@@ -32,10 +32,7 @@ public async Task VerifyAsync(string initialMarkup, string expectedMarkup, char
var
nextHandler
=
CreateInsertTextHandler
(
view
,
typeChar
.
ToString
());
commandHandler
.
ExecuteCommand
(
args
,
nextHandler
);
string
expectedCode
;
int
expectedPosition
;
MarkupTestFile
.
GetPosition
(
expectedMarkup
,
out
expectedCode
,
out
expectedPosition
);
MarkupTestFile
.
GetPosition
(
expectedMarkup
,
out
var
expectedCode
,
out
int
expectedPosition
);
Assert
.
Equal
(
expectedCode
,
view
.
TextSnapshot
.
GetText
());
...
...
src/EditorFeatures/TestUtilities/MoveType/AbstractMoveTypeTest.cs
浏览文件 @
0fe8e29c
...
...
@@ -39,10 +39,7 @@ protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspa
var
documentId
=
workspace
.
Documents
[
0
].
Id
;
var
documentName
=
workspace
.
Documents
[
0
].
Name
;
string
expectedText
;
TextSpan
span
;
MarkupTestFile
.
GetSpan
(
expectedCode
,
out
expectedText
,
out
span
);
MarkupTestFile
.
GetSpan
(
expectedCode
,
out
var
expectedText
,
out
var
span
);
var
codeActionTitle
=
string
.
Format
(
RenameTypeCodeActionTitle
,
expectedText
.
Substring
(
span
.
Start
,
span
.
Length
));
...
...
src/EditorFeatures/TestUtilities/TypeInferrer/TypeInferrerTestBase.cs
浏览文件 @
0fe8e29c
...
...
@@ -36,8 +36,7 @@ private static async Task<bool> CanUseSpeculativeSemanticModelAsync(Document doc
protected
async
Task
TestAsync
(
string
text
,
string
expectedType
,
bool
testNode
=
true
,
bool
testPosition
=
true
)
{
TextSpan
textSpan
;
MarkupTestFile
.
GetSpan
(
text
.
NormalizeLineEndings
(),
out
text
,
out
textSpan
);
MarkupTestFile
.
GetSpan
(
text
.
NormalizeLineEndings
(),
out
text
,
out
var
textSpan
);
if
(
testNode
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录