Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
6d317555
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,发现更多精彩内容 >>
未验证
提交
6d317555
编写于
5月 07, 2020
作者:
T
Tomáš Matoušek
提交者:
GitHub
5月 07, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ActiveStatementTagger Nullable annotations (#44053)
上级
458b0ded
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
31 addition
and
16 deletion
+31
-16
src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTag.cs
...Core/Implementation/EditAndContinue/ActiveStatementTag.cs
+2
-0
src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTagger.cs
...e/Implementation/EditAndContinue/ActiveStatementTagger.cs
+15
-13
src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTaggerProvider.cs
...entation/EditAndContinue/ActiveStatementTaggerProvider.cs
+3
-1
src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTrackingServiceFactory.cs
.../EditAndContinue/ActiveStatementTrackingServiceFactory.cs
+2
-0
src/EditorFeatures/Core/Implementation/EditAndContinue/EditAndContinueErrorTypeDefinition.cs
...ion/EditAndContinue/EditAndContinueErrorTypeDefinition.cs
+3
-1
src/EditorFeatures/Core/Implementation/EditAndContinue/EditAndContinueSaveFileCommandHandler.cs
.../EditAndContinue/EditAndContinueSaveFileCommandHandler.cs
+2
-0
src/Workspaces/Core/Portable/Workspace/Workspace_Registration.cs
...kspaces/Core/Portable/Workspace/Workspace_Registration.cs
+4
-1
未找到文件。
src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTag.cs
浏览文件 @
6d317555
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
Microsoft.VisualStudio.Text.Tagging
;
namespace
Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue
...
...
src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTagger.cs
浏览文件 @
6d317555
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
@@ -20,7 +22,9 @@ internal sealed class ActiveStatementTagger : ForegroundThreadAffinitizedObject,
private
readonly
WorkspaceRegistration
_workspaceRegistration
;
private
readonly
ITextBuffer
_buffer
;
private
IActiveStatementTrackingService
_trackingServiceOpt
;
private
IActiveStatementTrackingService
?
_trackingService
;
public
event
EventHandler
<
SnapshotSpanEventArgs
>?
TagsChanged
;
public
ActiveStatementTagger
(
IThreadingContext
threadingContext
,
ITextBuffer
buffer
)
:
base
(
threadingContext
)
...
...
@@ -35,21 +39,21 @@ public ActiveStatementTagger(IThreadingContext threadingContext, ITextBuffer buf
_buffer
=
buffer
;
}
private
void
OnWorkspaceChanged
(
object
sender
,
EventArgs
e
)
private
void
OnWorkspaceChanged
(
object
?
sender
,
EventArgs
e
)
=>
ConnectToWorkspace
(
_workspaceRegistration
.
Workspace
);
private
void
ConnectToWorkspace
(
Workspace
workspaceOpt
)
private
void
ConnectToWorkspace
(
Workspace
?
workspace
)
{
var
newService
Opt
=
workspaceOpt
?.
Services
.
GetService
<
IActiveStatementTrackingService
>();
if
(
newService
Opt
!=
null
)
var
newService
=
workspace
?.
Services
.
GetService
<
IActiveStatementTrackingService
>();
if
(
newService
!=
null
)
{
newService
Opt
.
TrackingSpansChanged
+=
OnTrackingSpansChanged
;
newService
.
TrackingSpansChanged
+=
OnTrackingSpansChanged
;
}
var
previousService
Opt
=
Interlocked
.
Exchange
(
ref
_trackingServiceOpt
,
newServiceOpt
);
if
(
previousService
Opt
!=
null
)
var
previousService
=
Interlocked
.
Exchange
(
ref
_trackingService
,
newService
);
if
(
previousService
!=
null
)
{
previousService
Opt
.
TrackingSpansChanged
-=
OnTrackingSpansChanged
;
previousService
.
TrackingSpansChanged
-=
OnTrackingSpansChanged
;
}
}
...
...
@@ -58,11 +62,9 @@ public void Dispose()
AssertIsForeground
();
_workspaceRegistration
.
WorkspaceChanged
-=
OnWorkspaceChanged
;
ConnectToWorkspace
(
workspace
Opt
:
null
);
ConnectToWorkspace
(
workspace
:
null
);
}
public
event
EventHandler
<
SnapshotSpanEventArgs
>
TagsChanged
;
private
void
OnTrackingSpansChanged
(
bool
leafChanged
)
{
var
handler
=
TagsChanged
;
...
...
@@ -78,7 +80,7 @@ public IEnumerable<ITagSpan<ITextMarkerTag>> GetTags(NormalizedSnapshotSpanColle
{
AssertIsForeground
();
var
service
=
_trackingService
Opt
;
var
service
=
_trackingService
;
if
(
service
==
null
)
{
yield
break
;
...
...
src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTaggerProvider.cs
浏览文件 @
6d317555
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.ComponentModel.Composition
;
using
Microsoft.CodeAnalysis.Editor.Shared.Utilities
;
...
...
@@ -26,7 +28,7 @@ internal sealed class ActiveStatementTaggerProvider : ITaggerProvider
public
ActiveStatementTaggerProvider
(
IThreadingContext
threadingContext
)
=>
_threadingContext
=
threadingContext
;
public
ITagger
<
T
>
CreateTagger
<
T
>(
ITextBuffer
buffer
)
where
T
:
ITag
public
ITagger
<
T
>
?
CreateTagger
<
T
>(
ITextBuffer
buffer
)
where
T
:
ITag
=>
new
ActiveStatementTagger
(
_threadingContext
,
buffer
)
as
ITagger
<
T
>;
}
}
src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTrackingServiceFactory.cs
浏览文件 @
6d317555
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.Composition
;
using
Microsoft.CodeAnalysis.EditAndContinue
;
...
...
src/EditorFeatures/Core/Implementation/EditAndContinue/EditAndContinueErrorTypeDefinition.cs
浏览文件 @
6d317555
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System.ComponentModel.Composition
;
using
Microsoft.VisualStudio.Text.Adornments
;
using
Microsoft.VisualStudio.Utilities
;
...
...
@@ -14,6 +16,6 @@ internal static class EditAndContinueErrorTypeDefinition
[
Export
(
typeof
(
ErrorTypeDefinition
))]
[
Name
(
Name
)]
internal
static
ErrorTypeDefinition
Definition
;
internal
static
ErrorTypeDefinition
?
Definition
;
}
}
src/EditorFeatures/Core/Implementation/EditAndContinue/EditAndContinueSaveFileCommandHandler.cs
浏览文件 @
6d317555
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.ComponentModel.Composition
;
using
Microsoft.CodeAnalysis.Host.Mef
;
...
...
src/Workspaces/Core/Portable/Workspace/Workspace_Registration.cs
浏览文件 @
6d317555
...
...
@@ -2,7 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.Diagnostics.CodeAnalysis
;
using
System.Runtime.CompilerServices
;
using
Microsoft.CodeAnalysis.Text
;
...
...
@@ -17,7 +20,7 @@ public abstract partial class Workspace
/// <summary>
/// Gets the workspace associated with the specific text container.
/// </summary>
public
static
bool
TryGetWorkspace
(
SourceTextContainer
textContainer
,
out
Workspace
workspace
)
public
static
bool
TryGetWorkspace
(
SourceTextContainer
textContainer
,
[
NotNullWhen
(
true
)]
out
Workspace
?
workspace
)
{
if
(
textContainer
==
null
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录