Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
8574eea5
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,发现更多精彩内容 >>
提交
8574eea5
编写于
6月 10, 2015
作者:
D
Dustin Campbell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove VB IDocumentExtensions
上级
85854fb4
变更
40
隐藏空白更改
内联
并排
Showing
40 changed file
with
81 addition
and
142 deletion
+81
-142
src/EditorFeatures/VisualBasic/BraceMatching/InterpolatedStringBraceMatcher.vb
...sualBasic/BraceMatching/InterpolatedStringBraceMatcher.vb
+1
-1
src/EditorFeatures/VisualBasic/BraceMatching/StringLiteralBraceMatcher.vb
...es/VisualBasic/BraceMatching/StringLiteralBraceMatcher.vb
+1
-1
src/EditorFeatures/VisualBasic/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb
...on/CompletionProviders/XmlDocCommentCompletionProvider.vb
+1
-1
src/EditorFeatures/VisualBasic/DocumentationComments/XmlTagCompletionCommandHandler.vb
...c/DocumentationComments/XmlTagCompletionCommandHandler.vb
+1
-1
src/EditorFeatures/VisualBasic/EndConstructGeneration/VisualBasicEndConstructGenerationService.vb
...uctGeneration/VisualBasicEndConstructGenerationService.vb
+2
-3
src/EditorFeatures/VisualBasic/LineCommit/CommitBufferManager.vb
...torFeatures/VisualBasic/LineCommit/CommitBufferManager.vb
+2
-2
src/EditorFeatures/VisualBasic/LineCommit/CommitCommandHandler.vb
...orFeatures/VisualBasic/LineCommit/CommitCommandHandler.vb
+1
-1
src/EditorFeatures/VisualBasic/LineSeparators/VisualBasicLineSeparatorService.vb
...alBasic/LineSeparators/VisualBasicLineSeparatorService.vb
+1
-2
src/EditorFeatures/VisualBasic/SignatureHelp/AttributeSignatureHelpProvider.vb
...sualBasic/SignatureHelp/AttributeSignatureHelpProvider.vb
+2
-2
src/EditorFeatures/VisualBasic/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb
...SignatureHelp/FunctionAggregationSignatureHelpProvider.vb
+2
-2
src/EditorFeatures/VisualBasic/SignatureHelp/GenericNameSignatureHelpProvider.vb
...alBasic/SignatureHelp/GenericNameSignatureHelpProvider.vb
+1
-1
src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.vb
...ignatureHelp/InvocationExpressionSignatureHelpProvider.vb
+2
-2
src/EditorFeatures/VisualBasic/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.vb
...tureHelp/ObjectCreationExpressionSignatureHelpProvider.vb
+2
-2
src/EditorFeatures/VisualBasic/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb
...SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb
+2
-2
src/EditorFeatures/VisualBasic/Utilities/CommandHandlers/AbstractImplementAbstractClassOrInterfaceCommandHandler.vb
...bstractImplementAbstractClassOrInterfaceCommandHandler.vb
+1
-2
src/Features/VisualBasic/CodeFixes/CorrectNextControlVariable/CorrectNextControlVariableCodeFixProvider.vb
...trolVariable/CorrectNextControlVariableCodeFixProvider.vb
+1
-1
src/Features/VisualBasic/CodeFixes/IncorrectExitContinue/IncorrectExitContinueCodeFixProvider.vb
...rrectExitContinue/IncorrectExitContinueCodeFixProvider.vb
+1
-1
src/Features/VisualBasic/CodeFixes/InsertMissingCast/InsertMissingCastCodeFixProvider.vb
...xes/InsertMissingCast/InsertMissingCastCodeFixProvider.vb
+1
-1
src/Features/VisualBasic/CodeFixes/MoveToTopOfFile/MoveToTopOfFileCodeFixProvider.vb
...deFixes/MoveToTopOfFile/MoveToTopOfFileCodeFixProvider.vb
+14
-10
src/Features/VisualBasic/Completion/CompletionProviders/CrefCompletionProvider.vb
.../Completion/CompletionProviders/CrefCompletionProvider.vb
+2
-3
src/Features/VisualBasic/Completion/CompletionProviders/ImplementsInheritsStatementCompletionProvider.vb
...roviders/ImplementsInheritsStatementCompletionProvider.vb
+2
-3
src/Features/VisualBasic/Completion/CompletionProviders/KeywordCompletionProvider.vb
...mpletion/CompletionProviders/KeywordCompletionProvider.vb
+1
-1
src/Features/VisualBasic/Completion/CompletionProviders/NamedParameterCompletionProvider.vb
...n/CompletionProviders/NamedParameterCompletionProvider.vb
+2
-2
src/Features/VisualBasic/Completion/CompletionProviders/PartialTypeCompletionProvider.vb
...tion/CompletionProviders/PartialTypeCompletionProvider.vb
+2
-2
src/Features/VisualBasic/Completion/CompletionProviders/SuggestionModeCompletionProvider.vb
...n/CompletionProviders/SuggestionModeCompletionProvider.vb
+1
-1
src/Features/VisualBasic/Completion/CompletionProviders/SymbolCompletionProvider.vb
...ompletion/CompletionProviders/SymbolCompletionProvider.vb
+1
-2
src/Features/VisualBasic/EncapsulateField/VisualBasicEncapsulateFieldService.vb
...ic/EncapsulateField/VisualBasicEncapsulateFieldService.vb
+1
-2
src/Features/VisualBasic/ExtractInterface/VisualBasicExtractInterfaceService.vb
...ic/ExtractInterface/VisualBasicExtractInterfaceService.vb
+6
-7
src/Features/VisualBasic/GenerateFromMembers/GenerateFromMembersHelpers.vb
...alBasic/GenerateFromMembers/GenerateFromMembersHelpers.vb
+1
-1
src/VisualStudio/VisualBasic/Impl/Debugging/DataTipInfoGetter.vb
...ualStudio/VisualBasic/Impl/Debugging/DataTipInfoGetter.vb
+1
-1
src/VisualStudio/VisualBasic/Impl/Debugging/LocationInfoGetter.vb
...alStudio/VisualBasic/Impl/Debugging/LocationInfoGetter.vb
+4
-3
src/VisualStudio/VisualBasic/Impl/Debugging/ProximityExpressionsGetter.vb
.../VisualBasic/Impl/Debugging/ProximityExpressionsGetter.vb
+2
-3
src/VisualStudio/VisualBasic/Impl/LanguageService/VisualBasicDebuggerIntelliSenseContext.vb
...LanguageService/VisualBasicDebuggerIntelliSenseContext.vb
+1
-1
src/VisualStudio/VisualBasic/Impl/Snippets/SnippetCommandHandler.vb
...Studio/VisualBasic/Impl/Snippets/SnippetCommandHandler.vb
+1
-1
src/VisualStudio/VisualBasic/Impl/Snippets/SnippetExpansionClient.vb
...tudio/VisualBasic/Impl/Snippets/SnippetExpansionClient.vb
+7
-5
src/VisualStudio/VisualBasic/Impl/Snippets/SnippetFunctions/SnippetFunctionClassName.vb
...mpl/Snippets/SnippetFunctions/SnippetFunctionClassName.vb
+1
-2
src/VisualStudio/VisualBasic/Impl/Snippets/SnippetFunctions/SnippetFunctionGenerateSwitchCases.vb
...ts/SnippetFunctions/SnippetFunctionGenerateSwitchCases.vb
+4
-8
src/VisualStudio/VisualBasic/Impl/Snippets/SnippetFunctions/SnippetFunctionSimpleTypeName.vb
...nippets/SnippetFunctions/SnippetFunctionSimpleTypeName.vb
+2
-4
src/Workspaces/VisualBasic/Portable/BasicWorkspace.vbproj
src/Workspaces/VisualBasic/Portable/BasicWorkspace.vbproj
+0
-1
src/Workspaces/VisualBasic/Portable/Extensions/IDocumentExtensions.vb
...es/VisualBasic/Portable/Extensions/IDocumentExtensions.vb
+0
-51
未找到文件。
src/EditorFeatures/VisualBasic/BraceMatching/InterpolatedStringBraceMatcher.vb
浏览文件 @
8574eea5
...
...
@@ -17,7 +17,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.BraceMatching
Optional
cancellationToken
As
CancellationToken
=
Nothing
)
As
Task
(
Of
BraceMatchingResult
?
)
Implements
IBraceMatcher
.
FindBracesAsync
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
token
=
root
.
FindToken
(
position
)
If
token
.
IsKind
(
SyntaxKind
.
DollarSignDoubleQuoteToken
,
SyntaxKind
.
DoubleQuoteToken
)
AndAlso
...
...
src/EditorFeatures/VisualBasic/BraceMatching/StringLiteralBraceMatcher.vb
浏览文件 @
8574eea5
...
...
@@ -13,7 +13,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.BraceMatching
Public
Async
Function
FindBraces
(
document
As
Document
,
position
As
Integer
,
Optional
cancellationToken
As
CancellationToken
=
Nothing
)
As
Task
(
Of
BraceMatchingResult
?
)
Implements
IBraceMatcher
.
FindBracesAsync
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
token
=
root
.
FindToken
(
position
)
If
token
.
Kind
=
SyntaxKind
.
StringLiteralToken
AndAlso
Not
token
.
ContainsDiagnostics
Then
...
...
src/EditorFeatures/VisualBasic/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb
浏览文件 @
8574eea5
...
...
@@ -46,7 +46,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Completion.CompletionProvide
Return
Nothing
End
If
Dim
tree
=
Await
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
tree
=
Await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
token
=
tree
.
FindTokenOnLeftOfPosition
(
position
,
cancellationToken
,
includeDocumentationComments
:
=
True
)
Dim
parent
=
token
.
GetAncestor
(
Of
DocumentationCommentTriviaSyntax
)()
...
...
src/EditorFeatures/VisualBasic/DocumentationComments/XmlTagCompletionCommandHandler.vb
浏览文件 @
8574eea5
...
...
@@ -22,7 +22,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.DocumentationComments
End
Sub
Protected
Overrides
Sub
TryCompleteTag
(
textView
As
ITextView
,
subjectBuffer
As
ITextBuffer
,
document
As
Document
,
position
As
SnapshotPoint
,
cancellationToken
As
CancellationToken
)
Dim
tree
=
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
tree
=
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
token
=
tree
.
FindTokenOnLeftOfPosition
(
position
,
cancellationToken
,
includeDocumentationComments
:
=
True
)
Dim
parentTrivia
=
token
.
GetAncestor
(
Of
DocumentationCommentTriviaSyntax
)()
...
...
src/EditorFeatures/VisualBasic/EndConstructGeneration/VisualBasicEndConstructGenerationService.vb
浏览文件 @
8574eea5
...
...
@@ -6,7 +6,6 @@ Imports Microsoft.CodeAnalysis
Imports
Microsoft.CodeAnalysis.Editor.Implementation.EndConstructGeneration
Imports
Microsoft.CodeAnalysis.Editor.Shared.Utilities
Imports
Microsoft.CodeAnalysis.Internal.Log
Imports
Microsoft.CodeAnalysis.Host
Imports
Microsoft.CodeAnalysis.Host.Mef
Imports
Microsoft.CodeAnalysis.Text
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
...
...
@@ -148,7 +147,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EndConstructGeneration
Return
Nothing
End
If
Dim
tree
=
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
tree
=
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
tokenToLeft
=
tree
.
FindTokenOnLeftOfPosition
(
caretPosition
.
Value
,
cancellationToken
,
includeDirectives
:
=
True
,
includeDocumentationComments
:
=
True
)
If
tokenToLeft
.
Kind
=
SyntaxKind
.
None
Then
...
...
@@ -158,7 +157,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EndConstructGeneration
Dim
bufferOptions
=
_editorOptionsFactoryService
.
GetOptions
(
subjectBuffer
)
Return
New
EndConstructState
(
caretPosition
.
Value
,
New
Lazy
(
Of
SemanticModel
)(
Function
()
document
.
Get
VisualBasic
SemanticModelAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)),
tree
,
tokenToLeft
,
bufferOptions
.
GetNewLineCharacter
())
caretPosition
.
Value
,
New
Lazy
(
Of
SemanticModel
)(
Function
()
document
.
GetSemanticModelAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)),
tree
,
tokenToLeft
,
bufferOptions
.
GetNewLineCharacter
())
End
Function
Friend
Overridable
Function
TryDoEndConstructForEnterKey
(
textView
As
ITextView
,
...
...
src/EditorFeatures/VisualBasic/LineCommit/CommitBufferManager.vb
浏览文件 @
8574eea5
...
...
@@ -147,7 +147,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LineCommit
End
If
formattingInfo
.
UseSemantics
=
True
Dim
tree
=
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
tree
=
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
' No matter what, we will always include the dirty span
Dim
finalSpanStart
=
dirtySpan
.
Start
.
Position
...
...
@@ -200,7 +200,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LineCommit
Return
False
End
If
Dim
tree
=
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
tree
=
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
oldStatement
=
ContainingStatementInfo
.
GetInfo
(
oldPoint
,
tree
,
cancellationToken
)
Dim
newStatement
=
ContainingStatementInfo
.
GetInfo
(
newPoint
,
tree
,
cancellationToken
)
...
...
src/EditorFeatures/VisualBasic/LineCommit/CommitCommandHandler.vb
浏览文件 @
8574eea5
...
...
@@ -193,7 +193,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LineCommit
Return
False
End
If
Dim
tree
=
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
tree
=
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
token
=
tree
.
FindTokenOnLeftOfPosition
(
oldCaretPositionInOldSnapshot
.
Value
,
cancellationToken
)
If
token
.
IsKind
(
SyntaxKind
.
StringLiteralToken
)
AndAlso
token
.
FullSpan
.
Contains
(
oldCaretPositionInOldSnapshot
.
Value
)
Then
...
...
src/EditorFeatures/VisualBasic/LineSeparators/VisualBasicLineSeparatorService.vb
浏览文件 @
8574eea5
...
...
@@ -3,7 +3,6 @@
Imports
System.Composition
Imports
System.Threading
Imports
System.Threading.Tasks
Imports
Microsoft.CodeAnalysis.Host
Imports
Microsoft.CodeAnalysis.Host.Mef
Imports
Microsoft.CodeAnalysis.Text
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
...
...
@@ -45,7 +44,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LineSeparators
Public
Async
Function
GetLineSeparatorsAsync
(
document
As
Document
,
textSpan
As
TextSpan
,
Optional
cancellationToken
As
CancellationToken
=
Nothing
)
As
Task
(
Of
IEnumerable
(
Of
TextSpan
))
Implements
ILineSeparatorService
.
GetLineSeparatorsAsync
Dim
syntaxTree
=
Await
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
syntaxTree
=
Await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
syntaxTree
.
GetRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
spans
As
New
List
(
Of
TextSpan
)
...
...
src/EditorFeatures/VisualBasic/SignatureHelp/AttributeSignatureHelpProvider.vb
浏览文件 @
8574eea5
...
...
@@ -44,14 +44,14 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
End
Function
Protected
Overrides
Async
Function
GetItemsWorkerAsync
(
document
As
Document
,
position
As
Integer
,
triggerInfo
As
SignatureHelpTriggerInfo
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
SignatureHelpItems
)
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
attribute
As
AttributeSyntax
=
Nothing
If
Not
TryGetAttributeExpression
(
root
,
position
,
document
.
GetLanguageService
(
Of
ISyntaxFactsService
),
triggerInfo
.
TriggerReason
,
cancellationToken
,
attribute
)
Then
Return
Nothing
End
If
Dim
semanticModel
=
Await
document
.
Get
VisualBasic
SemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
semanticModel
=
Await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
attributeType
=
TryCast
(
semanticModel
.
GetTypeInfo
(
attribute
,
cancellationToken
).
Type
,
INamedTypeSymbol
)
If
attributeType
Is
Nothing
Then
Return
Nothing
...
...
src/EditorFeatures/VisualBasic/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb
浏览文件 @
8574eea5
...
...
@@ -47,14 +47,14 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
End
Function
Protected
Overrides
Async
Function
GetItemsWorkerAsync
(
document
As
Document
,
position
As
Integer
,
triggerInfo
As
SignatureHelpTriggerInfo
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
SignatureHelpItems
)
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
functionAggregation
As
FunctionAggregationSyntax
=
Nothing
If
Not
TryGetFunctionAggregation
(
root
,
position
,
document
.
GetLanguageService
(
Of
ISyntaxFactsService
),
triggerInfo
.
TriggerReason
,
cancellationToken
,
functionAggregation
)
Then
Return
Nothing
End
If
Dim
semanticModel
=
Await
document
.
Get
VisualBasic
SemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
semanticModel
=
Await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
methods
=
semanticModel
.
LookupSymbols
(
functionAggregation
.
SpanStart
,
name
:
=
functionAggregation
.
FunctionName
.
ValueText
,
...
...
src/EditorFeatures/VisualBasic/SignatureHelp/GenericNameSignatureHelpProvider.vb
浏览文件 @
8574eea5
...
...
@@ -54,7 +54,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
End
Function
Protected
Overrides
Async
Function
GetItemsWorkerAsync
(
document
As
Document
,
position
As
Integer
,
triggerInfo
As
SignatureHelpTriggerInfo
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
SignatureHelpItems
)
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
genericName
As
GenericNameSyntax
=
Nothing
If
Not
TryGetGenericName
(
root
,
position
,
document
.
GetLanguageService
(
Of
ISyntaxFactsService
),
triggerInfo
.
TriggerReason
,
cancellationToken
,
genericName
)
Then
...
...
src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.vb
浏览文件 @
8574eea5
...
...
@@ -55,14 +55,14 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
End
Function
Protected
Overrides
Async
Function
GetItemsWorkerAsync
(
document
As
Document
,
position
As
Integer
,
triggerInfo
As
SignatureHelpTriggerInfo
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
SignatureHelpItems
)
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
invocationExpression
As
InvocationExpressionSyntax
=
Nothing
If
Not
TryGetInvocationExpression
(
root
,
position
,
document
.
GetLanguageService
(
Of
ISyntaxFactsService
),
triggerInfo
.
TriggerReason
,
cancellationToken
,
invocationExpression
)
Then
Return
Nothing
End
If
Dim
semanticModel
=
Await
document
.
Get
VisualBasic
SemanticModelForNodeAsync
(
invocationExpression
,
cancellationToken
).
ConfigureAwait
(
False
)
Dim
semanticModel
=
Await
document
.
GetSemanticModelForNodeAsync
(
invocationExpression
,
cancellationToken
).
ConfigureAwait
(
False
)
Dim
within
=
semanticModel
.
GetEnclosingNamedTypeOrAssembly
(
position
,
cancellationToken
)
If
within
Is
Nothing
Then
Return
Nothing
...
...
src/EditorFeatures/VisualBasic/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.vb
浏览文件 @
8574eea5
...
...
@@ -54,14 +54,14 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
End
Function
Protected
Overrides
Async
Function
GetItemsWorkerAsync
(
document
As
Document
,
position
As
Integer
,
triggerInfo
As
SignatureHelpTriggerInfo
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
SignatureHelpItems
)
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
objectCreationExpression
As
ObjectCreationExpressionSyntax
=
Nothing
If
Not
TryGetObjectCreationExpression
(
root
,
position
,
document
.
GetLanguageService
(
Of
ISyntaxFactsService
),
triggerInfo
.
TriggerReason
,
cancellationToken
,
objectCreationExpression
)
Then
Return
Nothing
End
If
Dim
semanticModel
=
Await
document
.
Get
VisualBasic
SemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
semanticModel
=
Await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
type
=
TryCast
(
semanticModel
.
GetTypeInfo
(
objectCreationExpression
,
cancellationToken
).
Type
,
INamedTypeSymbol
)
If
type
Is
Nothing
Then
Return
Nothing
...
...
src/EditorFeatures/VisualBasic/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb
浏览文件 @
8574eea5
...
...
@@ -59,14 +59,14 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
cancellationToken
As
CancellationToken
)
As
Task
(
Of
SignatureHelpItems
)
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
raiseEventStatement
As
RaiseEventStatementSyntax
=
Nothing
If
Not
TryGetRaiseEventStatement
(
root
,
position
,
document
.
GetLanguageService
(
Of
ISyntaxFactsService
),
triggerInfo
.
TriggerReason
,
cancellationToken
,
raiseEventStatement
)
Then
Return
Nothing
End
If
Dim
semanticModel
=
Await
document
.
Get
VisualBasic
SemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
semanticModel
=
Await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
containingType
=
semanticModel
.
GetEnclosingSymbol
(
position
,
cancellationToken
).
ContainingType
Dim
syntaxFactsService
=
document
.
Project
.
LanguageServices
.
GetService
(
Of
ISyntaxFactsService
)()
...
...
src/EditorFeatures/VisualBasic/Utilities/CommandHandlers/AbstractImplementAbstractClassOrInterfaceCommandHandler.vb
浏览文件 @
8574eea5
...
...
@@ -8,7 +8,6 @@ Imports Microsoft.CodeAnalysis.Formatting
Imports
Microsoft.CodeAnalysis.Simplification
Imports
Microsoft.CodeAnalysis.Text
Imports
Microsoft.CodeAnalysis.Text.Shared.Extensions
Imports
Microsoft.CodeAnalysis.VisualBasic.Extensions
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports
Microsoft.VisualStudio.Text
Imports
Microsoft.VisualStudio.Text.Operations
...
...
@@ -116,7 +115,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Utilities.CommandHandlers
Return
False
End
If
Dim
syntaxRoot
=
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
syntaxRoot
=
document
.
GetSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
token
=
syntaxRoot
.
FindTokenOnLeftOfPosition
(
caretPosition
)
If
text
.
Lines
.
IndexOf
(
token
.
SpanStart
)
<>
text
.
Lines
.
IndexOf
(
caretPosition
)
Then
...
...
src/Features/VisualBasic/CodeFixes/CorrectNextControlVariable/CorrectNextControlVariableCodeFixProvider.vb
浏览文件 @
8574eea5
...
...
@@ -21,7 +21,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.CorrectNextControlVariabl
End
Property
Public
NotOverridable
Overrides
Async
Function
RegisterCodeFixesAsync
(
context
As
CodeFixContext
)
As
Task
Dim
root
=
Await
context
.
Document
.
Get
VisualBasic
SyntaxRootAsync
(
context
.
CancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
context
.
Document
.
GetSyntaxRootAsync
(
context
.
CancellationToken
).
ConfigureAwait
(
False
)
Dim
node
=
root
.
FindNode
(
context
.
Span
,
getInnermostNodeForTie
:
=
True
)
Dim
nextStatement
=
node
.
FirstAncestorOrSelf
(
Of
NextStatementSyntax
)()
...
...
src/Features/VisualBasic/CodeFixes/IncorrectExitContinue/IncorrectExitContinueCodeFixProvider.vb
浏览文件 @
8574eea5
...
...
@@ -45,7 +45,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue
Dim
document
=
context
.
Document
Dim
span
=
context
.
Span
Dim
cancellationToken
=
context
.
CancellationToken
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
token
=
root
.
FindToken
(
span
.
Start
)
If
Not
token
.
Span
.
IntersectsWith
(
span
)
Then
...
...
src/Features/VisualBasic/CodeFixes/InsertMissingCast/InsertMissingCastCodeFixProvider.vb
浏览文件 @
8574eea5
...
...
@@ -24,7 +24,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.InsertMissingCast
Dim
document
=
context
.
Document
Dim
span
=
context
.
Span
Dim
cancellationToken
=
context
.
CancellationToken
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
node
=
TryCast
(
root
.
FindNode
(
span
,
getInnermostNodeForTie
:
=
True
),
ExpressionSyntax
)
If
node
Is
Nothing
Then
...
...
src/Features/VisualBasic/CodeFixes/MoveToTopOfFile/MoveToTopOfFileCodeFixProvider.vb
浏览文件 @
8574eea5
...
...
@@ -30,40 +30,44 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.MoveToTopOfFile
Dim
document
=
context
.
Document
Dim
span
=
context
.
Span
Dim
cancellationToken
=
context
.
CancellationToken
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
token
=
root
.
FindToken
(
span
.
Start
)
If
Not
token
.
Span
.
IntersectsWith
(
span
)
Then
Return
End
If
Dim
node
=
token
.
GetAncestors
(
Of
DeclarationStatementSyntax
)
_
.
FirstOrDefault
(
Function
(
c
)
c
.
Span
.
IntersectsWith
(
span
))
Dim
node
=
token
_
.
GetAncestors
(
Of
DeclarationStatementSyntax
)
_
.
FirstOrDefault
(
Function
(
c
)
c
.
Span
.
IntersectsWith
(
span
))
If
node
Is
Nothing
Then
Return
End
If
Dim
compilationUnit
=
CType
(
root
,
CompilationUnitSyntax
)
Dim
result
=
SpecializedCollections
.
EmptyEnumerable
(
Of
CodeAction
)()
If
node
.
Kind
=
SyntaxKind
.
ImportsStatement
Then
Dim
importsStatement
=
DirectCast
(
node
,
ImportsStatementSyntax
)
If
Not
roo
t
.
Imports
.
Contains
(
importsStatement
)
Then
If
DeclarationsExistAfterImports
(
node
,
root
)
OrElse
roo
t
.
Attributes
.
Any
(
Function
(
a
)
a
.
SpanStart
<
node
.
SpanStart
)
Then
result
=
CreateActionForImports
(
document
,
importsStatement
,
roo
t
,
cancellationToken
)
If
Not
compilationUni
t
.
Imports
.
Contains
(
importsStatement
)
Then
If
DeclarationsExistAfterImports
(
node
,
compilationUnit
)
OrElse
compilationUni
t
.
Attributes
.
Any
(
Function
(
a
)
a
.
SpanStart
<
node
.
SpanStart
)
Then
result
=
CreateActionForImports
(
document
,
importsStatement
,
compilationUni
t
,
cancellationToken
)
End
If
End
If
End
If
If
node
.
Kind
=
SyntaxKind
.
OptionStatement
Then
Dim
optionStatement
=
DirectCast
(
node
,
OptionStatementSyntax
)
If
Not
roo
t
.
Options
.
Contains
(
optionStatement
)
Then
result
=
CreateActionForOptions
(
document
,
optionStatement
,
roo
t
,
cancellationToken
)
If
Not
compilationUni
t
.
Options
.
Contains
(
optionStatement
)
Then
result
=
CreateActionForOptions
(
document
,
optionStatement
,
compilationUni
t
,
cancellationToken
)
End
If
End
If
If
node
.
Kind
=
SyntaxKind
.
AttributesStatement
Then
Dim
attributesStatement
=
DirectCast
(
node
,
AttributesStatementSyntax
)
If
Not
roo
t
.
Attributes
.
Contains
(
attributesStatement
)
Then
result
=
CreateActionForAttribute
(
document
,
attributesStatement
,
roo
t
,
cancellationToken
)
If
Not
compilationUni
t
.
Attributes
.
Contains
(
attributesStatement
)
Then
result
=
CreateActionForAttribute
(
document
,
attributesStatement
,
compilationUni
t
,
cancellationToken
)
End
If
End
If
...
...
src/Features/VisualBasic/Completion/CompletionProviders/CrefCompletionProvider.vb
浏览文件 @
8574eea5
...
...
@@ -6,7 +6,6 @@ Imports Microsoft.CodeAnalysis.Completion
Imports
Microsoft.CodeAnalysis.Completion.Providers
Imports
Microsoft.CodeAnalysis.Options
Imports
Microsoft.CodeAnalysis.Text
Imports
Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace
Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
...
...
@@ -44,7 +43,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
End
Function
Protected
Overrides
Async
Function
GetItemsWorkerAsync
(
document
As
Document
,
position
As
Integer
,
triggerInfo
As
CompletionTriggerInfo
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
IEnumerable
(
Of
CompletionItem
))
Dim
tree
=
Await
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
tree
=
Await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
text
=
Await
document
.
GetTextAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
span
=
CompletionUtilities
.
GetTextChangeSpan
(
text
,
position
)
...
...
@@ -62,7 +61,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
' To get a Speculative SemanticModel (which is much faster), we need to
' walk up to the node the DocumentationTrivia is attached to.
Dim
parentNode
=
token
.
GetAncestor
(
Of
DocumentationCommentTriviaSyntax
)().
ParentTrivia
.
Token
.
Parent
Dim
semanticModel
=
Await
document
.
Get
VisualBasic
SemanticModelForNodeAsync
(
parentNode
,
cancellationToken
).
ConfigureAwait
(
False
)
Dim
semanticModel
=
Await
document
.
GetSemanticModelForNodeAsync
(
parentNode
,
cancellationToken
).
ConfigureAwait
(
False
)
Dim
workspace
=
document
.
Project
.
Solution
.
Workspace
If
IsXmlStringContext
(
touchingToken
)
OrElse
...
...
src/Features/VisualBasic/Completion/CompletionProviders/ImplementsInheritsStatementCompletionProvider.vb
浏览文件 @
8574eea5
...
...
@@ -7,7 +7,6 @@ Imports Microsoft.CodeAnalysis.Completion
Imports
Microsoft.CodeAnalysis.Completion.Providers
Imports
Microsoft.CodeAnalysis.LanguageServices
Imports
Microsoft.CodeAnalysis.Text
Imports
Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports
Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Imports
Microsoft.CodeAnalysis.Options
...
...
@@ -54,7 +53,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
End
Class
Protected
Overrides
Async
Function
GetItemsWorkerAsync
(
document
As
Document
,
position
As
Integer
,
triggerInfo
As
CompletionTriggerInfo
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
IEnumerable
(
Of
CompletionItem
))
Dim
syntaxTree
=
Await
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
syntaxTree
=
Await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
token
=
syntaxTree
.
FindTokenOnLeftOfPosition
(
position
,
cancellationToken
).
GetPreviousTokenIfTouchingWord
(
position
)
If
token
.
Kind
=
SyntaxKind
.
None
Then
Return
Nothing
...
...
@@ -65,7 +64,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
Return
Nothing
End
If
Dim
semanticModel
=
Await
document
.
Get
VisualBasic
SemanticModelForNodeAsync
(
token
.
Parent
,
cancellationToken
).
ConfigureAwait
(
False
)
Dim
semanticModel
=
Await
document
.
GetSemanticModelForNodeAsync
(
token
.
Parent
,
cancellationToken
).
ConfigureAwait
(
False
)
Dim
typeBlock
=
token
.
GetAncestor
(
Of
TypeBlockSyntax
)()
If
typeBlock
Is
Nothing
OrElse
Not
typeBlock
.
IsKind
(
SyntaxKind
.
ClassBlock
,
SyntaxKind
.
InterfaceBlock
,
SyntaxKind
.
StructureBlock
)
Then
Return
Nothing
...
...
src/Features/VisualBasic/Completion/CompletionProviders/KeywordCompletionProvider.vb
浏览文件 @
8574eea5
...
...
@@ -16,7 +16,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
End
Sub
Protected
Overrides
Async
Function
CreateContextAsync
(
document
As
Document
,
position
As
Integer
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
VisualBasicSyntaxContext
)
Dim
semanticModel
=
Await
document
.
Get
VisualBasic
SemanticModelForSpanAsync
(
New
TextSpan
(
position
,
0
),
cancellationToken
).
ConfigureAwait
(
False
)
Dim
semanticModel
=
Await
document
.
GetSemanticModelForSpanAsync
(
New
TextSpan
(
position
,
0
),
cancellationToken
).
ConfigureAwait
(
False
)
Return
VisualBasicSyntaxContext
.
CreateContext
(
document
.
Project
.
Solution
.
Workspace
,
semanticModel
,
position
,
cancellationToken
)
End
Function
...
...
src/Features/VisualBasic/Completion/CompletionProviders/NamedParameterCompletionProvider.vb
浏览文件 @
8574eea5
...
...
@@ -42,7 +42,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
End
Function
Protected
Overrides
Async
Function
IsExclusiveAsync
(
document
As
Document
,
caretPosition
As
Integer
,
triggerInfo
As
CompletionTriggerInfo
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
Boolean
)
Dim
syntaxTree
=
Await
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
syntaxTree
=
Await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
token
=
syntaxTree
.
FindTokenOnLeftOfPosition
(
caretPosition
,
cancellationToken
).
GetPreviousTokenIfTouchingWord
(
caretPosition
)
...
...
@@ -65,7 +65,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
End
Function
Protected
Overrides
Async
Function
GetItemsWorkerAsync
(
document
As
Document
,
position
As
Integer
,
triggerInfo
As
CompletionTriggerInfo
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
IEnumerable
(
Of
CompletionItem
))
Dim
syntaxTree
=
Await
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
syntaxTree
=
Await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
If
syntaxTree
.
IsInNonUserCode
(
position
,
cancellationToken
)
OrElse
syntaxTree
.
IsInSkippedText
(
position
,
cancellationToken
)
Then
Return
Nothing
...
...
src/Features/VisualBasic/Completion/CompletionProviders/PartialTypeCompletionProvider.vb
浏览文件 @
8574eea5
...
...
@@ -44,7 +44,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
End
Function
Protected
Overrides
Async
Function
GetItemsWorkerAsync
(
document
As
Document
,
position
As
Integer
,
triggerInfo
As
CompletionTriggerInfo
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
IEnumerable
(
Of
CompletionItem
))
Dim
tree
=
Await
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
tree
=
Await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
If
tree
.
IsInNonUserCode
(
position
,
cancellationToken
)
OrElse
tree
.
IsInSkippedText
(
position
,
cancellationToken
)
Then
Return
Nothing
End
If
...
...
@@ -64,7 +64,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
End
Function
Private
Async
Function
CreateItemsAsync
(
document
As
Document
,
position
As
Integer
,
token
As
SyntaxToken
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
IEnumerable
(
Of
CompletionItem
))
Dim
semanticModel
=
Await
document
.
Get
VisualBasic
SemanticModelForNodeAsync
(
token
.
Parent
,
cancellationToken
).
ConfigureAwait
(
False
)
Dim
semanticModel
=
Await
document
.
GetSemanticModelForNodeAsync
(
token
.
Parent
,
cancellationToken
).
ConfigureAwait
(
False
)
' Unless the enclosing symbol is already the global namespace, we want to get it's enclosing symbol
' in order to suggest partial types in our namespace.
...
...
src/Features/VisualBasic/Completion/CompletionProviders/SuggestionModeCompletionProvider.vb
浏览文件 @
8574eea5
...
...
@@ -46,7 +46,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
End
If
Dim
span
=
New
TextSpan
(
position
,
0
)
Dim
semanticModel
=
Await
document
.
Get
VisualBasic
SemanticModelForSpanAsync
(
span
,
cancellationToken
).
ConfigureAwait
(
False
)
Dim
semanticModel
=
Await
document
.
GetSemanticModelForSpanAsync
(
span
,
cancellationToken
).
ConfigureAwait
(
False
)
Dim
syntaxTree
=
semanticModel
.
SyntaxTree
' If we're option explicit off, then basically any expression context can have a
...
...
src/Features/VisualBasic/Completion/CompletionProviders/SymbolCompletionProvider.vb
浏览文件 @
8574eea5
...
...
@@ -3,7 +3,6 @@
Imports
System.Threading
Imports
Microsoft.CodeAnalysis.Completion
Imports
Microsoft.CodeAnalysis.Completion.Providers
Imports
Microsoft.CodeAnalysis.Internal.Log
Imports
Microsoft.CodeAnalysis.LanguageServices
Imports
Microsoft.CodeAnalysis.Options
Imports
Microsoft.CodeAnalysis.Recommendations
...
...
@@ -60,7 +59,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
End
If
' don't want to trigger after a number. All other cases after dot are ok.
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
token
=
root
.
FindToken
(
characterPosition
)
Return
IsValidTriggerToken
(
token
)
End
Function
...
...
src/Features/VisualBasic/EncapsulateField/VisualBasicEncapsulateFieldService.vb
浏览文件 @
8574eea5
...
...
@@ -4,7 +4,6 @@ Imports System.Composition
Imports
System.Threading
Imports
Microsoft.CodeAnalysis.EncapsulateField
Imports
Microsoft.CodeAnalysis.Formatting
Imports
Microsoft.CodeAnalysis.Host
Imports
Microsoft.CodeAnalysis.Host.Mef
Imports
Microsoft.CodeAnalysis.Text
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
...
...
@@ -55,7 +54,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EncapsulateField
End
Function
Protected
Overrides
Async
Function
GetFieldsAsync
(
document
As
Document
,
span
As
TextSpan
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
IEnumerable
(
Of
IFieldSymbol
))
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
semanticModel
=
Await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
fields
=
root
.
DescendantNodes
(
Function
(
n
)
n
.
Span
.
IntersectsWith
(
span
))
_
...
...
src/Features/VisualBasic/ExtractInterface/VisualBasicExtractInterfaceService.vb
浏览文件 @
8574eea5
...
...
@@ -4,9 +4,7 @@ Imports System.Composition
Imports
System.Threading
Imports
Microsoft.CodeAnalysis.ExtractInterface
Imports
Microsoft.CodeAnalysis.Formatting
Imports
Microsoft.CodeAnalysis.Host
Imports
Microsoft.CodeAnalysis.Host.Mef
Imports
Microsoft.CodeAnalysis.LanguageServices
Imports
Microsoft.CodeAnalysis.Text
Imports
Microsoft.CodeAnalysis.VisualBasic
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
...
...
@@ -21,7 +19,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ExtractInterface
typeDiscoveryRule
As
TypeDiscoveryRule
,
cancellationToken
As
CancellationToken
)
As
SyntaxNode
Dim
tree
=
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
tree
=
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
token
=
tree
.
GetRoot
(
cancellationToken
).
FindToken
(
If
(
position
<>
tree
.
Length
,
position
,
Math
.
Max
(
0
,
position
-
1
)))
Dim
typeDeclaration
=
token
.
GetAncestor
(
Of
TypeBlockSyntax
)()
...
...
@@ -98,7 +96,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ExtractInterface
cancellationToken
As
CancellationToken
)
As
String
Dim
documentWithTypeNode
=
solutionWithInterfaceDocument
.
GetDocument
(
invocationLocationDocument
)
Dim
typeDeclaration
=
GetVisualBasicSyntaxRootAsync
(
documentWithTypeNode
,
cancellationToken
).
WaitAndGetResult
(
cancellationToken
).
GetAnnotatedNodes
(
Of
TypeBlockSyntax
)(
typeNodeAnnotation
).
Single
()
Dim
typeDeclaration
=
documentWithTypeNode
.
GetSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
).
GetAnnotatedNodes
(
Of
TypeBlockSyntax
)(
typeNodeAnnotation
).
Single
()
Dim
implementedInterfaceStatementSyntax
=
If
(
extractedInterfaceSymbol
.
TypeParameters
.
Any
(),
SyntaxFactory
.
GenericName
(
...
...
@@ -111,9 +109,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ExtractInterface
Dim
updatedTypeDeclaration
=
typeDeclaration
.
WithImplements
(
updatedImplementsList
)
Dim
docId
=
solutionWithInterfaceDocument
.
GetDocument
(
typeDeclaration
.
SyntaxTree
).
Id
Dim
updatedRoot
=
solutionWithInterfaceDocument
.
GetDocument
(
docId
).
GetVisualBasicSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
).
ReplaceNode
(
typeDeclaration
,
updatedTypeDeclaration
)
Dim
updatedRoot
=
solutionWithInterfaceDocument
.
GetDocument
(
docId
).
GetSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
).
ReplaceNode
(
typeDeclaration
,
updatedTypeDeclaration
)
Dim
updatedCompilationUnit
=
CType
(
updatedRoot
,
CompilationUnitSyntax
)
docToRootMap
.
Add
(
docId
,
updated
Roo
t
)
docToRootMap
.
Add
(
docId
,
updated
CompilationUni
t
)
Return
Formatter
.
Format
(
implementedInterfaceStatementSyntax
,
solutionWithInterfaceDocument
.
Workspace
).
ToFullString
()
End
Function
...
...
@@ -138,7 +137,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ExtractInterface
If
docToRootMap
.
ContainsKey
(
candidateDocId
)
Then
currentRoot
=
docToRootMap
(
candidateDocId
)
Else
currentRoot
=
solutionWithInterfaceDocument
.
GetDocument
(
candidateDocId
).
GetVisualBasicSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
currentRoot
=
CType
(
solutionWithInterfaceDocument
.
GetDocument
(
candidateDocId
).
GetSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
),
CompilationUnitSyntax
)
End
If
token
=
currentRoot
.
DescendantNodesAndTokensAndSelf
().
FirstOrDefault
(
Function
(
x
)
x
.
HasAnnotation
(
annotation
))
...
...
src/Features/VisualBasic/GenerateFromMembers/GenerateFromMembersHelpers.vb
浏览文件 @
8574eea5
...
...
@@ -8,7 +8,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.GenerateFromMembers
Friend
Class
GenerateFromMembersHelpers
Public
Shared
Async
Function
GetSelectedMembersAsync
(
document
As
Document
,
textSpan
As
TextSpan
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
IList
(
Of
StatementSyntax
))
Dim
tree
=
Await
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
tree
=
Await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Return
tree
.
GetMembersInSpan
(
textSpan
,
cancellationToken
)
End
Function
...
...
src/VisualStudio/VisualBasic/Impl/Debugging/DataTipInfoGetter.vb
浏览文件 @
8574eea5
...
...
@@ -14,7 +14,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Debugging
Namespace
DataTipInfoGetter
Friend
Module
DataTipInfoGetterModule
Friend
Async
Function
GetInfoAsync
(
document
As
Document
,
position
As
Integer
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
DebugDataTipInfo
)
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
token
=
root
.
FindToken
(
position
)
If
token
.
IsKind
(
SyntaxKind
.
CommaToken
)
Then
...
...
src/VisualStudio/VisualBasic/Impl/Debugging/LocationInfoGetter.vb
浏览文件 @
8574eea5
...
...
@@ -19,7 +19,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Debugging
' Therefore, it is important that we make this call as cheap as possible. Rather than constructing a
' containing Symbol and using ToDisplayString (which might be more *correct*), we'll just do the best we
' can with Syntax. This approach is capable of providing parity with the pre-Roslyn implementation.
Dim
tree
=
Await
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
tree
=
Await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
tree
.
GetRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
syntaxFactsService
=
document
.
Project
.
LanguageServices
.
GetService
(
Of
ISyntaxFactsService
)()
Dim
memberDeclaration
=
TryCast
(
syntaxFactsService
.
GetContainingMemberDeclaration
(
root
,
position
,
useFullSpan
:
=
True
),
DeclarationStatementSyntax
)
...
...
@@ -33,13 +33,14 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Debugging
Return
Nothing
End
If
Dim
compilation
=
Await
document
.
GetVisualBasicCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
compilation
=
Await
document
.
Project
.
GetCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
options
=
CType
(
compilation
.
Options
,
VisualBasicCompilationOptions
)
Dim
name
=
syntaxFactsService
.
GetDisplayName
(
memberDeclaration
,
DisplayNameOptions
.
IncludeNamespaces
Or
DisplayNameOptions
.
IncludeParameters
Or
DisplayNameOptions
.
IncludeType
Or
DisplayNameOptions
.
IncludeTypeParameters
,
compilation
.
O
ptions
.
RootNamespace
)
o
ptions
.
RootNamespace
)
Dim
text
=
Await
document
.
GetTextAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
lineNumber
=
text
.
Lines
.
GetLineFromPosition
(
position
).
LineNumber
...
...
src/VisualStudio/VisualBasic/Impl/Debugging/ProximityExpressionsGetter.vb
浏览文件 @
8574eea5
...
...
@@ -4,7 +4,6 @@ Imports System.Composition
Imports
System.Threading
Imports
System.Threading.Tasks
Imports
Microsoft.CodeAnalysis
Imports
Microsoft.CodeAnalysis.Host
Imports
Microsoft.CodeAnalysis.Host.Mef
Imports
Microsoft.CodeAnalysis.Shared.Extensions
Imports
Microsoft.CodeAnalysis.VisualBasic
...
...
@@ -22,7 +21,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Debugging
position
As
Integer
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
IList
(
Of
String
))
Implements
IProximityExpressionsService
.
GetProximityExpressionsAsync
Dim
tree
=
Await
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
tree
=
Await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Return
[
Do
]
(
tree
,
position
,
cancellationToken
)
End
Function
...
...
@@ -55,7 +54,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Debugging
cancellationToken
As
CancellationToken
)
As
Task
(
Of
Boolean
)
Implements
IProximityExpressionsService
.
IsValidAsync
Dim
expression
=
SyntaxFactory
.
ParseExpression
(
expressionValue
)
Dim
root
=
Await
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
token
=
root
.
FindToken
(
position
)
' The debugger stops on "End Sub" and we want to see locals and/or parameters at that point,
...
...
src/VisualStudio/VisualBasic/Impl/LanguageService/VisualBasicDebuggerIntelliSenseContext.vb
浏览文件 @
8574eea5
...
...
@@ -57,7 +57,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic
End
Sub
Protected
Overrides
Function
GetAdjustedContextPoint
(
contextPoint
As
Integer
,
document
As
Document
)
As
Integer
Dim
tree
=
document
.
Get
VisualBasic
SyntaxTreeAsync
(
CancellationToken
.
None
).
WaitAndGetResult
(
CancellationToken
.
None
)
Dim
tree
=
document
.
GetSyntaxTreeAsync
(
CancellationToken
.
None
).
WaitAndGetResult
(
CancellationToken
.
None
)
Dim
token
=
tree
.
FindTokenOnLeftOfPosition
(
contextPoint
,
CancellationToken
.
None
)
Dim
containingNode
=
token
.
Parent
.
AncestorsAndSelf
().
Where
(
Function
(
s
)
TypeOf
s
Is
ExpressionSyntax
OrElse
...
...
src/VisualStudio/VisualBasic/Impl/Snippets/SnippetCommandHandler.vb
浏览文件 @
8574eea5
...
...
@@ -29,7 +29,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets
End
Sub
Protected
Overrides
Function
IsSnippetExpansionContext
(
document
As
Document
,
startPosition
As
Integer
,
cancellationToken
As
CancellationToken
)
As
Boolean
Dim
syntaxTree
=
document
.
Get
VisualBasic
SyntaxTreeAsync
(
CancellationToken
.
None
).
WaitAndGetResult
(
cancellationToken
)
Dim
syntaxTree
=
document
.
GetSyntaxTreeAsync
(
CancellationToken
.
None
).
WaitAndGetResult
(
cancellationToken
)
Return
Not
syntaxTree
.
IsEntirelyWithinStringOrCharOrNumericLiteral
(
startPosition
,
cancellationToken
)
AndAlso
Not
syntaxTree
.
IsEntirelyWithinComment
(
startPosition
,
cancellationToken
)
AndAlso
...
...
src/VisualStudio/VisualBasic/Impl/Snippets/SnippetExpansionClient.vb
浏览文件 @
8574eea5
...
...
@@ -5,7 +5,6 @@ Imports System.Xml.Linq
Imports
Microsoft.CodeAnalysis
Imports
Microsoft.CodeAnalysis.Editor.Shared.Extensions
Imports
Microsoft.CodeAnalysis.Formatting
Imports
Microsoft.CodeAnalysis.Shared.Extensions
Imports
Microsoft.CodeAnalysis.VisualBasic
Imports
Microsoft.CodeAnalysis.VisualBasic.Extensions
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
...
...
@@ -108,9 +107,9 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets
Return
document
End
If
Dim
root
=
document
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
root
=
document
.
GetSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
newRoot
=
root
.
AddImportsStatements
(
newImportsStatements
,
placeSystemNamespaceFirst
)
Dim
newRoot
=
CType
(
root
,
CompilationUnitSyntax
)
.
AddImportsStatements
(
newImportsStatements
,
placeSystemNamespaceFirst
)
Dim
newDocument
=
document
.
WithSyntaxRoot
(
newRoot
)
Dim
formattedDocument
=
Formatter
.
FormatAsync
(
newDocument
,
Formatter
.
Annotation
,
cancellationToken
:
=
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
...
...
@@ -120,8 +119,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets
End
Function
Private
Shared
Function
GetImportsStatementsToAdd
(
document
As
Document
,
snippetNode
As
XElement
,
importsNode
As
XElement
,
cancellationToken
As
CancellationToken
)
As
IList
(
Of
ImportsStatementSyntax
)
Dim
localImportsClauses
=
document
.
GetVisualBasicSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
).
Imports
.
SelectMany
(
Function
(
x
)
x
.
ImportsClauses
)
Dim
globalImportsClauses
=
document
.
GetVisualBasicCompilationAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
).
Options
.
GlobalImports
.
Select
(
Function
(
g
)
g
.
Clause
)
Dim
root
=
document
.
GetSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
localImportsClauses
=
CType
(
root
,
CompilationUnitSyntax
).
Imports
.
SelectMany
(
Function
(
x
)
x
.
ImportsClauses
)
Dim
compilation
=
document
.
Project
.
GetCompilationAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
options
=
CType
(
compilation
.
Options
,
VisualBasicCompilationOptions
)
Dim
globalImportsClauses
=
options
.
GlobalImports
.
Select
(
Function
(
g
)
g
.
Clause
)
Dim
membersImports
=
From
clause
In
localImportsClauses
.
Union
(
globalImportsClauses
).
OfType
(
Of
SimpleImportsClauseSyntax
)
Where
clause
.
Alias
Is
Nothing
...
...
src/VisualStudio/VisualBasic/Impl/Snippets/SnippetFunctions/SnippetFunctionClassName.vb
浏览文件 @
8574eea5
...
...
@@ -9,7 +9,6 @@ Imports Microsoft.VisualStudio.Text
Imports
Microsoft.VisualStudio.Text.Editor
Imports
Microsoft.VisualStudio.LanguageServices.Implementation.Snippets
Namespace
Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets.SnippetFunctions
Friend
NotInheritable
Class
SnippetFunctionClassName
Inherits
AbstractSnippetFunctionClassName
...
...
@@ -19,7 +18,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets.SnippetFu
End
Sub
Protected
Overrides
Function
GetContainingClassName
(
document
As
Document
,
subjectBufferFieldSpan
As
SnapshotSpan
,
cancellationToken
As
CancellationToken
,
ByRef
value
As
String
,
ByRef
hasDefaultValue
As
Integer
)
As
Integer
Dim
syntaxTree
=
document
.
Get
VisualBasic
SyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
syntaxTree
=
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
typeBlock
=
syntaxTree
.
FindTokenOnLeftOfPosition
(
subjectBufferFieldSpan
.
Start
.
Position
,
cancellationToken
).
GetAncestor
(
Of
TypeBlockSyntax
)
If
typeBlock
IsNot
Nothing
AndAlso
...
...
src/VisualStudio/VisualBasic/Impl/Snippets/SnippetFunctions/SnippetFunctionGenerateSwitchCases.vb
浏览文件 @
8574eea5
...
...
@@ -6,13 +6,9 @@ Imports Microsoft.CodeAnalysis.Simplification
Imports
Microsoft.CodeAnalysis.Text
Imports
Microsoft.CodeAnalysis.VisualBasic
Imports
Microsoft.CodeAnalysis.VisualBasic.Extensions
Imports
Microsoft.VisualStudio
Imports
Microsoft.VisualStudio.Editor
Imports
Microsoft.CodeAnalysis.Editor.Shared.Extensions
Imports
Microsoft.VisualStudio.Text
Imports
Microsoft.VisualStudio.Text.Editor
Imports
Microsoft.VisualStudio.TextManager.Interop
Imports
Microsoft.VisualStudio.LanguageServices.Implementation.Extensions
Imports
Microsoft.VisualStudio.LanguageServices.Implementation.Snippets.SnippetFunctions
Imports
TextSpan
=
Microsoft
.
CodeAnalysis
.
Text
.
TextSpan
Imports
VsTextSpan
=
Microsoft
.
VisualStudio
.
TextManager
.
Interop
.
TextSpan
...
...
@@ -55,7 +51,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets.SnippetFu
Return
False
End
If
Dim
syntaxTree
=
document
.
Get
VisualBasic
SyntaxTreeAsync
(
CancellationToken
.
None
).
WaitAndGetResult
(
CancellationToken
.
None
)
Dim
syntaxTree
=
document
.
GetSyntaxTreeAsync
(
CancellationToken
.
None
).
WaitAndGetResult
(
CancellationToken
.
None
)
Dim
token
=
syntaxTree
.
FindTokenOnRightOfPosition
(
subjectBufferFieldSpan
.
Start
.
Position
,
cancellationToken
)
Dim
expressionNode
=
token
.
FirstAncestorOrSelf
(
Function
(
n
)
n
.
Span
=
subjectBufferFieldSpan
.
Span
.
ToTextSpan
())
...
...
@@ -63,7 +59,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets.SnippetFu
Return
False
End
If
Dim
model
As
SemanticModel
=
document
.
Get
VisualBasic
SemanticModelAsync
(
CancellationToken
.
None
).
WaitAndGetResult
(
CancellationToken
.
None
)
Dim
model
As
SemanticModel
=
document
.
GetSemanticModelAsync
(
CancellationToken
.
None
).
WaitAndGetResult
(
CancellationToken
.
None
)
typeSymbol
=
model
.
GetTypeInfo
(
expressionNode
).
Type
Return
typeSymbol
IsNot
Nothing
...
...
@@ -80,7 +76,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets.SnippetFu
Dim
textWithCaseAdded
=
document
.
GetTextAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
).
WithChanges
(
textChange
)
Dim
documentWithCaseAdded
=
document
.
WithText
(
textWithCaseAdded
)
Dim
syntaxRoot
=
documentWithCaseAdded
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
syntaxRoot
=
documentWithCaseAdded
.
GetSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
nodeToReplace
=
syntaxRoot
.
DescendantNodes
().
FirstOrDefault
(
Function
(
n
)
n
.
Span
=
typeSpanToAnnotate
)
If
nodeToReplace
Is
Nothing
Then
...
...
@@ -91,7 +87,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets.SnippetFu
Dim
documentWithAnnotations
=
documentWithCaseAdded
.
WithSyntaxRoot
(
updatedRoot
)
Dim
simplifiedDocument
=
Simplifier
.
ReduceAsync
(
documentWithAnnotations
,
cancellationToken
:
=
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
simplifiedTypeName
=
simplifiedDocument
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
).
GetAnnotatedNodesAndTokens
(
typeAnnotation
).
Single
().
ToString
()
simplifiedTypeName
=
simplifiedDocument
.
GetSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
).
GetAnnotatedNodesAndTokens
(
typeAnnotation
).
Single
().
ToString
()
Return
True
End
Function
...
...
src/VisualStudio/VisualBasic/Impl/Snippets/SnippetFunctions/SnippetFunctionSimpleTypeName.vb
浏览文件 @
8574eea5
...
...
@@ -4,8 +4,6 @@ Imports System.Threading
Imports
Microsoft.CodeAnalysis
Imports
Microsoft.CodeAnalysis.Simplification
Imports
Microsoft.CodeAnalysis.Text
Imports
Microsoft.CodeAnalysis.VisualBasic.Extensions
Imports
Microsoft.VisualStudio.Editor
Imports
Microsoft.VisualStudio.Text
Imports
Microsoft.VisualStudio.Text.Editor
Imports
Microsoft.VisualStudio.LanguageServices.Implementation.Snippets.SnippetFunctions
...
...
@@ -22,7 +20,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets.SnippetFu
simplifiedTypeName
=
String
.
Empty
Dim
typeAnnotation
=
New
SyntaxAnnotation
()
Dim
syntaxRoot
=
documentWithFullyQualifiedTypeName
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
syntaxRoot
=
documentWithFullyQualifiedTypeName
.
GetSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
Dim
nodeToReplace
=
syntaxRoot
.
DescendantNodes
().
FirstOrDefault
(
Function
(
n
)
n
.
Span
=
updatedTextSpan
)
If
nodeToReplace
Is
Nothing
Then
...
...
@@ -33,7 +31,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets.SnippetFu
Dim
documentWithAnnotations
=
documentWithFullyQualifiedTypeName
.
WithSyntaxRoot
(
updatedRoot
)
Dim
simplifiedDocument
=
Simplifier
.
ReduceAsync
(
documentWithAnnotations
,
cancellationToken
:
=
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
simplifiedTypeName
=
simplifiedDocument
.
Get
VisualBasic
SyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
).
GetAnnotatedNodesAndTokens
(
typeAnnotation
).
Single
().
ToString
()
simplifiedTypeName
=
simplifiedDocument
.
GetSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
).
GetAnnotatedNodesAndTokens
(
typeAnnotation
).
Single
().
ToString
()
Return
True
End
Function
End
Class
...
...
src/Workspaces/VisualBasic/Portable/BasicWorkspace.vbproj
浏览文件 @
8574eea5
...
...
@@ -148,7 +148,6 @@
<Compile
Include=
"Extensions\DirectiveSyntaxExtensions.vb"
/>
<Compile
Include=
"Extensions\ExpressionSyntaxExtensions.vb"
/>
<Compile
Include=
"Extensions\ExpressionSyntaxGeneratorVisitor.vb"
/>
<Compile
Include=
"Extensions\IDocumentExtensions.vb"
/>
<Compile
Include=
"Extensions\IMethodSymbolExtensions.vb"
/>
<Compile
Include=
"Extensions\INamespaceOrTypeSymbolExtensions.vb"
/>
<Compile
Include=
"Extensions\InvocationExpressionSyntaxExtensions.vb"
/>
...
...
src/Workspaces/VisualBasic/Portable/Extensions/IDocumentExtensions.vb
已删除
100644 → 0
浏览文件 @
85854fb4
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports
System.Runtime.CompilerServices
Imports
System.Threading
Imports
System.Threading.Tasks
Imports
Microsoft.CodeAnalysis
Imports
Microsoft.CodeAnalysis.Text
Imports
Microsoft.CodeAnalysis.VisualBasic
Imports
Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace
Microsoft.CodeAnalysis.VisualBasic.Extensions
Friend
Module
IDocumentExtensions
<
Extension
()
>
Public
Async
Function
GetVisualBasicSyntaxTreeAsync
(
document
As
Document
,
Optional
cancellationToken
As
CancellationToken
=
Nothing
)
As
Task
(
Of
SyntaxTree
)
Dim
tree
=
Await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Return
CType
(
tree
,
SyntaxTree
)
End
Function
<
Extension
()
>
Public
Async
Function
GetVisualBasicSemanticModelAsync
(
document
As
Document
,
Optional
cancellationToken
As
CancellationToken
=
Nothing
)
As
Task
(
Of
SemanticModel
)
Dim
model
=
Await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Return
CType
(
model
,
SemanticModel
)
End
Function
<
Extension
()
>
Public
Async
Function
GetVisualBasicSemanticModelForNodeAsync
(
document
As
Document
,
node
As
SyntaxNode
,
Optional
cancellationToken
As
CancellationToken
=
Nothing
)
As
Task
(
Of
SemanticModel
)
Dim
model
=
Await
document
.
GetSemanticModelForNodeAsync
(
node
,
cancellationToken
).
ConfigureAwait
(
False
)
Return
CType
(
model
,
SemanticModel
)
End
Function
<
Extension
()
>
Public
Async
Function
GetVisualBasicSemanticModelForSpanAsync
(
document
As
Document
,
span
As
TextSpan
,
Optional
cancellationToken
As
CancellationToken
=
Nothing
)
As
Task
(
Of
SemanticModel
)
Dim
model
=
Await
document
.
GetSemanticModelForSpanAsync
(
span
,
cancellationToken
).
ConfigureAwait
(
False
)
Return
CType
(
model
,
SemanticModel
)
End
Function
<
Extension
()
>
Public
Async
Function
GetVisualBasicCompilationAsync
(
document
As
Document
,
Optional
cancellationToken
As
CancellationToken
=
Nothing
)
As
Task
(
Of
VisualBasicCompilation
)
Dim
compilation
=
Await
document
.
Project
.
GetCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Return
CType
(
compilation
,
VisualBasicCompilation
)
End
Function
<
Extension
()
>
Public
Async
Function
GetVisualBasicSyntaxRootAsync
(
document
As
Document
,
Optional
cancellationToken
As
CancellationToken
=
Nothing
)
As
Task
(
Of
CompilationUnitSyntax
)
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Return
CType
(
root
,
CompilationUnitSyntax
)
End
Function
End
Module
End
Namespace
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录