Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
b4f3e30c
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,发现更多精彩内容 >>
提交
b4f3e30c
编写于
6月 30, 2020
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename method
上级
c86bde90
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
11 addition
and
11 deletion
+11
-11
src/EditorFeatures/CSharpTest/TypeInferrer/TypeInferrerTests.cs
...itorFeatures/CSharpTest/TypeInferrer/TypeInferrerTests.cs
+1
-1
src/EditorFeatures/VisualBasicTest/TypeInferrer/TypeInferrerTests.vb
...eatures/VisualBasicTest/TypeInferrer/TypeInferrerTests.vb
+2
-2
src/VisualStudio/CSharp/Impl/LanguageService/CSharpHelpContextService.cs
...o/CSharp/Impl/LanguageService/CSharpHelpContextService.cs
+1
-1
src/Workspaces/Core/Portable/CaseCorrection/AbstractCaseCorrectionService.cs
.../Portable/CaseCorrection/AbstractCaseCorrectionService.cs
+1
-1
src/Workspaces/Core/Portable/Classification/Classifier.cs
src/Workspaces/Core/Portable/Classification/Classifier.cs
+1
-1
src/Workspaces/Core/Portable/Classification/SyntaxClassification/AbstractSyntaxClassificationService.cs
...ntaxClassification/AbstractSyntaxClassificationService.cs
+1
-1
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs
...xtensions/Workspace/Core/Extensions/DocumentExtensions.cs
+2
-2
src/Workspaces/VisualBasic/Portable/CodeCleanup/Providers/AddMissingTokensCodeCleanupProvider.vb
...eCleanup/Providers/AddMissingTokensCodeCleanupProvider.vb
+1
-1
src/Workspaces/VisualBasic/Portable/CodeCleanup/Providers/FixIncorrectTokensCodeCleanupProvider.vb
...leanup/Providers/FixIncorrectTokensCodeCleanupProvider.vb
+1
-1
未找到文件。
src/EditorFeatures/CSharpTest/TypeInferrer/TypeInferrerTests.cs
浏览文件 @
b4f3e30c
...
...
@@ -38,7 +38,7 @@ protected override async Task TestWorkerAsync(Document document, TextSpan textSp
}
else
{
inferredType
=
typeInference
.
InferType
(
await
document
.
GetSemanticModelForSpan
Async
(
node
?.
Span
??
textSpan
,
CancellationToken
.
None
),
node
,
objectAsDefault
:
true
,
cancellationToken
:
CancellationToken
.
None
);
inferredType
=
typeInference
.
InferType
(
await
document
.
ReuseExistingSpeculativeModel
Async
(
node
?.
Span
??
textSpan
,
CancellationToken
.
None
),
node
,
objectAsDefault
:
true
,
cancellationToken
:
CancellationToken
.
None
);
}
var
typeSyntax
=
inferredType
.
GenerateTypeSyntax
().
NormalizeWhitespace
();
...
...
src/EditorFeatures/VisualBasicTest/TypeInferrer/TypeInferrerTests.vb
浏览文件 @
b4f3e30c
...
...
@@ -27,9 +27,9 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.TypeInferrer
Dim
inferredType
As
ITypeSymbol
If
testMode
=
TestMode
.
Position
Then
inferredType
=
typeInference
.
InferType
(
Await
document
.
GetSemanticModelForSpan
Async
(
New
TextSpan
(
node
.
SpanStart
,
0
),
CancellationToken
.
None
),
node
.
SpanStart
,
objectAsDefault
:
=
True
,
cancellationToken
:
=
CancellationToken
.
None
)
inferredType
=
typeInference
.
InferType
(
Await
document
.
ReuseExistingSpeculativeModel
Async
(
New
TextSpan
(
node
.
SpanStart
,
0
),
CancellationToken
.
None
),
node
.
SpanStart
,
objectAsDefault
:
=
True
,
cancellationToken
:
=
CancellationToken
.
None
)
Else
inferredType
=
typeInference
.
InferType
(
Await
document
.
GetSemanticModelForSpan
Async
(
node
.
Span
,
CancellationToken
.
None
),
node
,
objectAsDefault
:
=
True
,
cancellationToken
:
=
CancellationToken
.
None
)
inferredType
=
typeInference
.
InferType
(
Await
document
.
ReuseExistingSpeculativeModel
Async
(
node
.
Span
,
CancellationToken
.
None
),
node
,
objectAsDefault
:
=
True
,
cancellationToken
:
=
CancellationToken
.
None
)
End
If
Dim
typeSyntax
=
inferredType
.
GenerateTypeSyntax
().
NormalizeWhitespace
()
...
...
src/VisualStudio/CSharp/Impl/LanguageService/CSharpHelpContextService.cs
浏览文件 @
b4f3e30c
...
...
@@ -61,7 +61,7 @@ public override async Task<string> GetHelpTermAsync(Document document, TextSpan
if
(
IsValid
(
token
,
span
))
{
var
semanticModel
=
await
document
.
GetSemanticModelForSpan
Async
(
span
,
cancellationToken
).
ConfigureAwait
(
false
);
var
semanticModel
=
await
document
.
ReuseExistingSpeculativeModel
Async
(
span
,
cancellationToken
).
ConfigureAwait
(
false
);
var
result
=
TryGetText
(
token
,
semanticModel
,
document
,
syntaxFacts
,
cancellationToken
);
if
(
string
.
IsNullOrEmpty
(
result
))
...
...
src/Workspaces/Core/Portable/CaseCorrection/AbstractCaseCorrectionService.cs
浏览文件 @
b4f3e30c
...
...
@@ -34,7 +34,7 @@ public async Task<Document> CaseCorrectAsync(Document document, ImmutableArray<T
throw
new
NotSupportedException
(
WorkspacesResources
.
Document_does_not_support_syntax_trees
);
}
var
semanticModel
=
await
document
.
GetSemanticModelForSpan
Async
(
spans
.
Collapse
(),
cancellationToken
).
ConfigureAwait
(
false
);
var
semanticModel
=
await
document
.
ReuseExistingSpeculativeModel
Async
(
spans
.
Collapse
(),
cancellationToken
).
ConfigureAwait
(
false
);
var
newRoot
=
CaseCorrect
(
semanticModel
,
root
,
spans
,
document
.
Project
.
Solution
.
Workspace
,
cancellationToken
);
return
(
root
==
newRoot
)
?
document
:
document
.
WithSyntaxRoot
(
newRoot
);
...
...
src/Workspaces/Core/Portable/Classification/Classifier.cs
浏览文件 @
b4f3e30c
...
...
@@ -24,7 +24,7 @@ public static class Classifier
TextSpan
textSpan
,
CancellationToken
cancellationToken
=
default
)
{
var
semanticModel
=
await
document
.
GetSemanticModelForSpan
Async
(
textSpan
,
cancellationToken
).
ConfigureAwait
(
false
);
var
semanticModel
=
await
document
.
ReuseExistingSpeculativeModel
Async
(
textSpan
,
cancellationToken
).
ConfigureAwait
(
false
);
return
GetClassifiedSpans
(
semanticModel
,
textSpan
,
document
.
Project
.
Solution
.
Workspace
,
cancellationToken
);
}
...
...
src/Workspaces/Core/Portable/Classification/SyntaxClassification/AbstractSyntaxClassificationService.cs
浏览文件 @
b4f3e30c
...
...
@@ -37,7 +37,7 @@ protected AbstractSyntaxClassificationService()
{
try
{
var
semanticModel
=
await
document
.
GetSemanticModelForSpan
Async
(
textSpan
,
cancellationToken
).
ConfigureAwait
(
false
);
var
semanticModel
=
await
document
.
ReuseExistingSpeculativeModel
Async
(
textSpan
,
cancellationToken
).
ConfigureAwait
(
false
);
AddSemanticClassifications
(
semanticModel
,
textSpan
,
document
.
Project
.
Solution
.
Workspace
,
getNodeClassifiers
,
getTokenClassifiers
,
result
,
cancellationToken
);
}
catch
(
Exception
e
)
when
(
FatalError
.
ReportUnlessCanceled
(
e
))
...
...
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs
浏览文件 @
b4f3e30c
...
...
@@ -75,7 +75,7 @@ public static bool IsOpen(this Document document)
/// As a speculative semantic model may be returned, location based information provided by it may be innacurate.
/// </summary>
public
static
Task
<
SemanticModel
>
ReuseExistingSpeculativeModelAsync
(
this
Document
document
,
int
position
,
CancellationToken
cancellationToken
)
=>
GetSemanticModelForSpan
Async
(
document
,
new
TextSpan
(
position
,
0
),
cancellationToken
);
=>
ReuseExistingSpeculativeModel
Async
(
document
,
new
TextSpan
(
position
,
0
),
cancellationToken
);
/// <summary>
/// This will return either regular semantic model or speculative semantic based on context. any feature that is
...
...
@@ -87,7 +87,7 @@ public static Task<SemanticModel> ReuseExistingSpeculativeModelAsync(this Docume
/// <para/>
/// As a speculative semantic model may be returned, location based information provided by it may be innacurate.
/// </summary>
public
static
async
Task
<
SemanticModel
>
GetSemanticModelForSpan
Async
(
this
Document
document
,
TextSpan
span
,
CancellationToken
cancellationToken
)
public
static
async
Task
<
SemanticModel
>
ReuseExistingSpeculativeModel
Async
(
this
Document
document
,
TextSpan
span
,
CancellationToken
cancellationToken
)
{
Contract
.
ThrowIfFalse
(
document
.
SupportsSemanticModel
);
...
...
src/Workspaces/VisualBasic/Portable/CodeCleanup/Providers/AddMissingTokensCodeCleanupProvider.vb
浏览文件 @
b4f3e30c
...
...
@@ -44,7 +44,7 @@ Namespace Microsoft.CodeAnalysis.CodeCleanup.Providers
Public
Shared
Async
Function
CreateAsync
(
document
As
Document
,
spans
As
ImmutableArray
(
Of
TextSpan
),
cancellationToken
As
CancellationToken
)
As
Task
(
Of
AddMissingTokensRewriter
)
Dim
modifiedSpan
=
spans
.
Collapse
()
Dim
semanticModel
=
If
(
document
Is
Nothing
,
Nothing
,
Await
document
.
GetSemanticModelForSpan
Async
(
modifiedSpan
,
cancellationToken
).
ConfigureAwait
(
False
))
Await
document
.
ReuseExistingSpeculativeModel
Async
(
modifiedSpan
,
cancellationToken
).
ConfigureAwait
(
False
))
Return
New
AddMissingTokensRewriter
(
semanticModel
,
spans
,
cancellationToken
)
End
Function
...
...
src/Workspaces/VisualBasic/Portable/CodeCleanup/Providers/FixIncorrectTokensCodeCleanupProvider.vb
浏览文件 @
b4f3e30c
...
...
@@ -56,7 +56,7 @@ Namespace Microsoft.CodeAnalysis.CodeCleanup.Providers
Dim
modifiedSpan
=
spans
.
Collapse
()
Dim
semanticModel
=
If
(
document
Is
Nothing
,
Nothing
,
Await
document
.
GetSemanticModelForSpan
Async
(
modifiedSpan
,
cancellationToken
).
ConfigureAwait
(
False
))
Await
document
.
ReuseExistingSpeculativeModel
Async
(
modifiedSpan
,
cancellationToken
).
ConfigureAwait
(
False
))
Return
New
FixIncorrectTokensRewriter
(
semanticModel
,
spans
,
cancellationToken
)
End
Function
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录