Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
19e8457d
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,发现更多精彩内容 >>
提交
19e8457d
编写于
7月 18, 2019
作者:
D
David Barbet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update liveshare callers to specify thread context.
上级
7c1aaf59
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
24 addition
and
5 deletion
+24
-5
src/Features/LanguageServer/Protocol/Handler/IRequestHandler.cs
...atures/LanguageServer/Protocol/Handler/IRequestHandler.cs
+9
-0
src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.cs
src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.cs
+1
-0
src/VisualStudio/LiveShare/Impl/Shims/AbstractLiveShareHandlerShim.cs
...udio/LiveShare/Impl/Shims/AbstractLiveShareHandlerShim.cs
+9
-0
src/VisualStudio/LiveShare/Impl/Shims/FindImplementationsHandlerShim.cs
...io/LiveShare/Impl/Shims/FindImplementationsHandlerShim.cs
+1
-1
src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentHandlerShim.cs
...lStudio/LiveShare/Impl/Shims/FormatDocumentHandlerShim.cs
+1
-1
src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentOnTypeHandlerShim.cs
...o/LiveShare/Impl/Shims/FormatDocumentOnTypeHandlerShim.cs
+1
-1
src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentRangeHandlerShim.cs
...io/LiveShare/Impl/Shims/FormatDocumentRangeHandlerShim.cs
+1
-1
src/VisualStudio/LiveShare/Impl/Shims/RunCodeActionsHandlerShim.cs
...lStudio/LiveShare/Impl/Shims/RunCodeActionsHandlerShim.cs
+1
-1
未找到文件。
src/Features/LanguageServer/Protocol/Handler/IRequestHandler.cs
浏览文件 @
19e8457d
...
...
@@ -15,6 +15,15 @@ internal interface IRequestHandler
internal
interface
IRequestHandler
<
RequestType
,
ResponseType
>
:
IRequestHandler
{
/// <summary>
/// Handles an LSP request.
/// </summary>
/// <param name="solution">the solution to apply the request to.</param>
/// <param name="request">the lsp request.</param>
/// <param name="clientCapabilities">the client capabilities for the request.</param>
/// <param name="cancellationToken">a cancellation token.</param>
/// <param name="keepThreadContext">a value to set if the threading context in the handler should be kept from the caller.</param>
/// <returns>the lps response.</returns>
Task
<
ResponseType
>
HandleRequestAsync
(
Solution
solution
,
RequestType
request
,
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
,
bool
keepThreadContext
=
false
);
}
}
src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.cs
浏览文件 @
19e8457d
...
...
@@ -34,6 +34,7 @@ public async Task<LSP.TextEdit[]> HandleAsync(RunCodeActionParams request, Reque
var
codeActions
=
await
GetCodeActionsAsync
(
solution
,
request
.
CodeActionParams
.
TextDocument
.
Uri
,
request
.
CodeActionParams
.
Range
,
keepThreadContext
:
false
,
cancellationToken
).
ConfigureAwait
(
false
);
var
actionToRun
=
codeActions
?.
FirstOrDefault
(
a
=>
a
.
Title
==
request
.
Title
);
...
...
src/VisualStudio/LiveShare/Impl/Shims/AbstractLiveShareHandlerShim.cs
浏览文件 @
19e8457d
...
...
@@ -28,6 +28,15 @@ public virtual Task<ResponseType> HandleAsync(RequestType param, RequestContext<
return
((
IRequestHandler
<
RequestType
,
ResponseType
>)
LazyRequestHandler
.
Value
).
HandleRequestAsync
(
requestContext
.
Context
,
param
,
requestContext
.
ClientCapabilities
,
cancellationToken
);
}
/// <summary>
/// Certain implementations require that the processing be done on the UI thread.
/// So allow the handler to specifiy that the thread context should be preserved.
/// </summary>
protected
Task
<
ResponseType
>
HandleAsyncPreserveThreadContext
(
RequestType
param
,
RequestContext
<
Solution
>
requestContext
,
CancellationToken
cancellationToken
)
{
return
((
IRequestHandler
<
RequestType
,
ResponseType
>)
LazyRequestHandler
.
Value
).
HandleRequestAsync
(
requestContext
.
Context
,
param
,
requestContext
.
ClientCapabilities
,
cancellationToken
,
keepThreadContext
:
true
);
}
protected
Lazy
<
IRequestHandler
,
IRequestHandlerMetadata
>
GetRequestHandler
(
IEnumerable
<
Lazy
<
IRequestHandler
,
IRequestHandlerMetadata
>>
requestHandlers
,
string
methodName
)
{
return
requestHandlers
.
First
(
handler
=>
handler
.
Metadata
.
MethodName
==
methodName
);
...
...
src/VisualStudio/LiveShare/Impl/Shims/FindImplementationsHandlerShim.cs
浏览文件 @
19e8457d
...
...
@@ -29,7 +29,7 @@ public override async Task<object> HandleAsync(TextDocumentPositionParams param,
{
// TypeScript requires this call to be on the UI thread.
await
_threadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
return
await
base
.
HandleAsync
(
param
,
requestContext
,
cancellationToken
).
ConfigureAwait
(
false
);
return
await
base
.
HandleAsync
PreserveThreadContext
(
param
,
requestContext
,
cancellationToken
).
ConfigureAwait
(
false
);
}
}
}
src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentHandlerShim.cs
浏览文件 @
19e8457d
...
...
@@ -29,7 +29,7 @@ public override async Task<TextEdit[]> HandleAsync(DocumentFormattingParams para
{
// To get the formatting options, TypeScript expects to be called on the UI thread.
await
_threadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
return
await
base
.
HandleAsync
(
param
,
requestContext
,
cancellationToken
).
ConfigureAwait
(
false
);
return
await
base
.
HandleAsync
PreserveThreadContext
(
param
,
requestContext
,
cancellationToken
).
ConfigureAwait
(
false
);
}
}
}
src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentOnTypeHandlerShim.cs
浏览文件 @
19e8457d
...
...
@@ -29,7 +29,7 @@ public override async Task<TextEdit[]> HandleAsync(DocumentOnTypeFormattingParam
{
// To get the formatting options, TypeScript expects to be called on the UI thread.
await
_threadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
return
await
base
.
HandleAsync
(
param
,
requestContext
,
cancellationToken
).
ConfigureAwait
(
false
);
return
await
base
.
HandleAsync
PreserveThreadContext
(
param
,
requestContext
,
cancellationToken
).
ConfigureAwait
(
false
);
}
}
}
src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentRangeHandlerShim.cs
浏览文件 @
19e8457d
...
...
@@ -29,7 +29,7 @@ public override async Task<TextEdit[]> HandleAsync(DocumentRangeFormattingParams
{
// To get the formatting options, TypeScript expects to be called on the UI thread.
await
_threadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
return
await
base
.
HandleAsync
(
param
,
requestContext
,
cancellationToken
).
ConfigureAwait
(
false
);
return
await
base
.
HandleAsync
PreserveThreadContext
(
param
,
requestContext
,
cancellationToken
).
ConfigureAwait
(
false
);
}
}
}
src/VisualStudio/LiveShare/Impl/Shims/RunCodeActionsHandlerShim.cs
浏览文件 @
19e8457d
...
...
@@ -51,7 +51,7 @@ public async override Task<object> HandleAsync(LSP.ExecuteCommandParams request,
{
// Code actions must be applied from the UI thread in the VS context.
await
_threadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
);
return
await
base
.
HandleAsync
(
request
,
requestContext
,
cancellationToken
).
ConfigureAwait
(
tru
e
);
return
await
base
.
HandleAsync
PreserveThreadContext
(
request
,
requestContext
,
cancellationToken
).
ConfigureAwait
(
fals
e
);
}
catch
(
ArgumentException
ex
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录