Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
391b5b25
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,发现更多精彩内容 >>
提交
391b5b25
编写于
3月 06, 2020
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Document switches to the main thread
上级
445ebb3b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
0 deletion
+9
-0
src/EditorFeatures/Core.Wpf/Preview/PreviewFactoryService.cs
src/EditorFeatures/Core.Wpf/Preview/PreviewFactoryService.cs
+9
-0
未找到文件。
src/EditorFeatures/Core.Wpf/Preview/PreviewFactoryService.cs
浏览文件 @
391b5b25
...
...
@@ -261,6 +261,7 @@ public Task<DifferenceViewerPreview> CreateAddedDocumentPreviewViewAsync(Documen
private
async
Task
<
DifferenceViewerPreview
>
CreateAddedDocumentPreviewViewCoreAsync
(
ITextBuffer
newBuffer
,
PreviewWorkspace
workspace
,
TextDocument
document
,
double
zoomLevel
,
CancellationToken
cancellationToken
)
{
// IProjectionBufferFactoryService is a Visual Studio API which is not documented as free-threaded
await
ThreadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
var
firstLine
=
string
.
Format
(
EditorFeaturesResources
.
Adding_0_to_1_with_content_colon
,
...
...
@@ -287,6 +288,7 @@ private async Task<DifferenceViewerPreview> CreateAddedDocumentPreviewViewCoreAs
CancellationToken
cancellationToken
)
where
TDocument
:
TextDocument
{
// openTextDocument must be called from the main thread
await
ThreadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
var
newBuffer
=
await
createBufferAsync
(
document
,
cancellationToken
);
...
...
@@ -336,6 +338,7 @@ public Task<DifferenceViewerPreview> CreateRemovedDocumentPreviewViewAsync(Docum
private
async
Task
<
DifferenceViewerPreview
>
CreateRemovedDocumentPreviewViewCoreAsync
(
ITextBuffer
oldBuffer
,
PreviewWorkspace
workspace
,
TextDocument
document
,
double
zoomLevel
,
CancellationToken
cancellationToken
)
{
// IProjectionBufferFactoryService is a Visual Studio API which is not documented as free-threaded
await
ThreadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
var
firstLine
=
string
.
Format
(
EditorFeaturesResources
.
Removing_0_from_1_with_content_colon
,
...
...
@@ -364,6 +367,7 @@ private async Task<DifferenceViewerPreview> CreateRemovedDocumentPreviewViewCore
CancellationToken
cancellationToken
)
where
TDocument
:
TextDocument
{
// openTextDocument must be called from the main thread
await
ThreadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
// Note: We don't use the original buffer that is associated with oldDocument
...
...
@@ -432,6 +436,7 @@ public Task<DifferenceViewerPreview> CreateChangedDocumentPreviewViewAsync(Docum
public
async
Task
<
DifferenceViewerPreview
>
CreateChangedDocumentPreviewViewAsync
(
Document
oldDocument
,
Document
newDocument
,
double
zoomLevel
,
CancellationToken
cancellationToken
)
{
// OpenDocument must be called from the main thread
await
ThreadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
// Note: We don't use the original buffer that is associated with oldDocument
...
...
@@ -532,6 +537,7 @@ public async Task<DifferenceViewerPreview> CreateChangedDocumentPreviewViewAsync
{
Debug
.
Assert
(
oldDocument
.
Kind
==
TextDocumentKind
.
AdditionalDocument
||
oldDocument
.
Kind
==
TextDocumentKind
.
AnalyzerConfigDocument
);
// openTextDocument must be called from the main thread
await
ThreadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
// Note: We don't use the original buffer that is associated with oldDocument
...
...
@@ -616,6 +622,7 @@ public Task<DifferenceViewerPreview> CreateChangedAnalyzerConfigDocumentPreviewV
return
null
;
}
// IProjectionBufferFactoryService is a Visual Studio API which is not documented as free-threaded
await
ThreadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
var
originalBuffer
=
_projectionBufferFactoryService
.
CreateProjectionBufferWithoutIndentation
(
...
...
@@ -661,6 +668,7 @@ private async ValueTask<ITextBuffer> CreateNewBufferAsync(Document document, Can
private
async
ValueTask
<
ITextBuffer
>
CreateNewPlainTextBufferAsync
(
TextDocument
document
,
CancellationToken
cancellationToken
)
{
// ITextBufferFactoryService is a Visual Studio API which is not documented as free-threaded
await
ThreadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
var
contentType
=
_textBufferFactoryService
.
TextContentType
;
...
...
@@ -674,6 +682,7 @@ private async ValueTask<ITextBuffer> CreateNewPlainTextBufferAsync(TextDocument
IProjectionBuffer
originalBuffer
,
IProjectionBuffer
changedBuffer
,
double
zoomLevel
,
CancellationToken
cancellationToken
)
{
// IWpfDifferenceViewerFactoryService is a Visual Studio API which is not documented as free-threaded
await
ThreadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
// leftWorkspace can be null if the change is adding a document.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录