Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
28c15deb
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,发现更多精彩内容 >>
提交
28c15deb
编写于
4月 17, 2020
作者:
D
David Barbet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Thread through razor flag to document request
上级
e4f9f7b7
变更
45
隐藏空白更改
内联
并排
Showing
45 changed file
with
103 addition
and
93 deletion
+103
-93
src/Features/LanguageServer/Protocol/Extensions/Extensions.cs
...Features/LanguageServer/Protocol/Extensions/Extensions.cs
+13
-4
src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionsHandler.cs
...Server/Protocol/Handler/CodeActions/CodeActionsHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionsHandlerBase.cs
...er/Protocol/Handler/CodeActions/CodeActionsHandlerBase.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Commands/ExecuteWorkspaceCommandHandler.cs
...otocol/Handler/Commands/ExecuteWorkspaceCommandHandler.cs
+1
-1
src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs
...geServer/Protocol/Handler/Completion/CompletionHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs
...r/Protocol/Handler/Completion/CompletionResolveHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Definitions/GoToDefinitionHandler.cs
...ver/Protocol/Handler/Definitions/GoToDefinitionHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Definitions/GoToDefinitionHandlerBase.cs
...Protocol/Handler/Definitions/GoToDefinitionHandlerBase.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Definitions/GoToTypeDefinitionHandler.cs
...Protocol/Handler/Definitions/GoToTypeDefinitionHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs
...er/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentHandler.cs
...rver/Protocol/Handler/Formatting/FormatDocumentHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentHandlerBase.cs
.../Protocol/Handler/Formatting/FormatDocumentHandlerBase.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentOnTypeHandler.cs
...rotocol/Handler/Formatting/FormatDocumentOnTypeHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentRangeHandler.cs
...Protocol/Handler/Formatting/FormatDocumentRangeHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Highlights/DocumentHighlightHandler.cs
...r/Protocol/Handler/Highlights/DocumentHighlightHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Hover/HoverHandler.cs
...res/LanguageServer/Protocol/Handler/Hover/HoverHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/IRequestHandler.cs
...atures/LanguageServer/Protocol/Handler/IRequestHandler.cs
+3
-2
src/Features/LanguageServer/Protocol/Handler/Initialize/InitializeHandler.cs
...geServer/Protocol/Handler/Initialize/InitializeHandler.cs
+1
-1
src/Features/LanguageServer/Protocol/Handler/References/FindImplementationsHandler.cs
...Protocol/Handler/References/FindImplementationsHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs
...s/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs
...er/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Symbols/DocumentSymbolsHandler.cs
...Server/Protocol/Handler/Symbols/DocumentSymbolsHandler.cs
+2
-2
src/Features/LanguageServer/Protocol/Handler/Symbols/WorkspaceSymbolsHandler.cs
...erver/Protocol/Handler/Symbols/WorkspaceSymbolsHandler.cs
+1
-1
src/Features/LanguageServer/Protocol/LanguageServerProtocol.cs
...eatures/LanguageServer/Protocol/LanguageServerProtocol.cs
+2
-2
src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs
...eServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionResolveTests.cs
...er/ProtocolUnitTests/Completion/CompletionResolveTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionTests.cs
...ageServer/ProtocolUnitTests/Completion/CompletionTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Definitions/GoToDefinitionTests.cs
...rver/ProtocolUnitTests/Definitions/GoToDefinitionTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Definitions/GoToTypeDefinitionTests.cs
.../ProtocolUnitTests/Definitions/GoToTypeDefinitionTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs
...ver/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentOnTypeTests.cs
...ProtocolUnitTests/Formatting/FormatDocumentOnTypeTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentRangeTests.cs
.../ProtocolUnitTests/Formatting/FormatDocumentRangeTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentTests.cs
...erver/ProtocolUnitTests/Formatting/FormatDocumentTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Highlights/DocumentHighlightTests.cs
...er/ProtocolUnitTests/Highlights/DocumentHighlightTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Hover/HoverTests.cs
...ures/LanguageServer/ProtocolUnitTests/Hover/HoverTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Initialize/InitializeTests.cs
...ageServer/ProtocolUnitTests/Initialize/InitializeTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/References/FindImplementationsTests.cs
.../ProtocolUnitTests/References/FindImplementationsTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Rename/RenameTests.cs
...es/LanguageServer/ProtocolUnitTests/Rename/RenameTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/SignatureHelp/SignatureHelpTests.cs
...ver/ProtocolUnitTests/SignatureHelp/SignatureHelpTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Symbols/DocumentSymbolsTests.cs
...eServer/ProtocolUnitTests/Symbols/DocumentSymbolsTests.cs
+1
-1
src/Features/LanguageServer/ProtocolUnitTests/Symbols/WorkspaceSymbolsTests.cs
...Server/ProtocolUnitTests/Symbols/WorkspaceSymbolsTests.cs
+1
-1
src/VisualStudio/Core/Def/Implementation/LanguageClient/InProcLanguageServer.cs
...Def/Implementation/LanguageClient/InProcLanguageServer.cs
+15
-15
src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.cs
src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.cs
+1
-1
src/VisualStudio/LiveShare/Impl/RunCodeActionsHandler.cs
src/VisualStudio/LiveShare/Impl/RunCodeActionsHandler.cs
+1
-1
src/VisualStudio/LiveShare/Impl/Shims/TypeScriptHandlerShims.cs
...sualStudio/LiveShare/Impl/Shims/TypeScriptHandlerShims.cs
+12
-12
未找到文件。
src/Features/LanguageServer/Protocol/Extensions/Extensions.cs
浏览文件 @
28c15deb
...
...
@@ -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.Linq
;
using
System.Threading
;
...
...
@@ -21,7 +23,7 @@ public static Uri GetURI(this Document document)
return
ProtocolConversions
.
GetUriFromFilePath
(
document
.
FilePath
);
}
public
static
Document
GetDocumentFromURI
(
this
Solution
solution
,
Uri
fileNam
e
)
public
static
Document
?
GetDocumentFromURI
(
this
Solution
solution
,
Uri
fileName
,
bool
supportsRazorFeatures
=
fals
e
)
{
// TODO: we need to normalize this. but for now, we check both absolute and local path
// right now, based on who calls this, solution might has "/" or "\\" as directory
...
...
@@ -31,10 +33,17 @@ public static Document GetDocumentFromURI(this Solution solution, Uri fileName)
var
document
=
solution
.
GetDocument
(
documentId
);
var
documentPropertiesService
=
document
.
Services
.
GetService
<
DocumentPropertiesService
>();
if
(
documentPropertiesService
.
DesignTimeOnly
)
if
(
supportsRazorFeatures
)
{
return
null
;
var
documentPropertiesService
=
document
?.
Services
.
GetService
<
DocumentPropertiesService
>();
// Razor generated documents always have designtimeonly set to true.
// If it's not set, don't return the document as only razor documents should be returned in razor scenarios.
// This workaround should be removed when https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1106064/
// is fixed (so that the razor language server is only asked about razor buffers).
if
(
documentPropertiesService
?.
DesignTimeOnly
!=
true
)
{
return
null
;
}
}
return
document
;
...
...
src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionsHandler.cs
浏览文件 @
28c15deb
...
...
@@ -33,12 +33,12 @@ public CodeActionsHandler(ICodeFixService codeFixService, ICodeRefactoringServic
}
public
async
Task
<
LSP
.
SumType
<
LSP
.
Command
,
LSP
.
CodeAction
>[
]>
HandleRequestAsync
(
Solution
solution
,
LSP
.
CodeActionParams
request
,
LSP
.
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
LSP
.
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
codeActions
=
await
GetCodeActionsAsync
(
solution
,
request
.
TextDocument
.
Uri
,
request
.
Range
,
cancellationToken
).
ConfigureAwait
(
false
);
supportsRazorFeatures
,
cancellationToken
).
ConfigureAwait
(
false
);
// Filter out code actions with options since they'll show dialogs and we can't remote the UI and the options.
codeActions
=
codeActions
.
Where
(
c
=>
!(
c
is
CodeActionWithOptions
));
...
...
src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionsHandlerBase.cs
浏览文件 @
28c15deb
...
...
@@ -28,9 +28,9 @@ public CodeActionsHandlerBase(ICodeFixService codeFixService, ICodeRefactoringSe
_codeRefactoringService
=
codeRefactoringService
??
throw
new
ArgumentNullException
(
nameof
(
codeRefactoringService
));
}
public
async
Task
<
IEnumerable
<
CodeAction
>>
GetCodeActionsAsync
(
Solution
solution
,
Uri
documentUri
,
LSP
.
Range
selection
,
CancellationToken
cancellationToken
)
public
async
Task
<
IEnumerable
<
CodeAction
>>
GetCodeActionsAsync
(
Solution
solution
,
Uri
documentUri
,
LSP
.
Range
selection
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
document
=
solution
.
GetDocumentFromURI
(
documentUri
);
var
document
=
solution
.
GetDocumentFromURI
(
documentUri
,
supportsRazorFeatures
);
if
(
document
==
null
)
{
return
ImmutableArray
<
CodeAction
>.
Empty
;
...
...
src/Features/LanguageServer/Protocol/Handler/Commands/ExecuteWorkspaceCommandHandler.cs
浏览文件 @
28c15deb
...
...
@@ -42,7 +42,7 @@ public ExecuteWorkspaceCommandHandler([ImportMany] IEnumerable<Lazy<IExecuteWork
/// by delegating to a handler for the specific command requested.
/// </summary>
public
Task
<
object
>
HandleRequestAsync
(
Solution
solution
,
LSP
.
ExecuteCommandParams
request
,
LSP
.
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
commandName
=
request
.
Command
;
if
(
string
.
IsNullOrEmpty
(
commandName
)
||
!
_executeCommandHandlers
.
TryGetValue
(
commandName
,
out
var
executeCommandHandler
))
...
...
src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs
浏览文件 @
28c15deb
...
...
@@ -33,9 +33,9 @@ public CompletionHandler()
}
public
async
Task
<
LSP
.
CompletionItem
[
]>
HandleRequestAsync
(
Solution
solution
,
LSP
.
CompletionParams
request
,
LSP
.
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
);
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
);
if
(
document
==
null
)
{
return
Array
.
Empty
<
LSP
.
CompletionItem
>();
...
...
src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs
浏览文件 @
28c15deb
...
...
@@ -30,7 +30,7 @@ public CompletionResolveHandler()
}
public
async
Task
<
LSP
.
CompletionItem
>
HandleRequestAsync
(
Solution
solution
,
LSP
.
CompletionItem
completionItem
,
LSP
.
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
LSP
.
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
CompletionResolveData
data
;
if
(
completionItem
.
Data
is
CompletionResolveData
)
...
...
@@ -44,7 +44,7 @@ public CompletionResolveHandler()
var
request
=
data
.
CompletionParams
;
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
);
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
);
if
(
document
==
null
)
{
return
completionItem
;
...
...
src/Features/LanguageServer/Protocol/Handler/Definitions/GoToDefinitionHandler.cs
浏览文件 @
28c15deb
...
...
@@ -25,9 +25,9 @@ public GoToDefinitionHandler(IMetadataAsSourceFileService metadataAsSourceFileSe
}
public
async
Task
<
LSP
.
Location
[
]>
HandleRequestAsync
(
Solution
solution
,
LSP
.
TextDocumentPositionParams
request
,
LSP
.
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
LSP
.
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
return
await
GetDefinitionAsync
(
solution
,
request
,
typeOnly
:
false
,
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
false
);
return
await
GetDefinitionAsync
(
solution
,
request
,
typeOnly
:
false
,
supportsRazorFeatures
:
supportsRazorFeatures
,
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
false
);
}
}
}
src/Features/LanguageServer/Protocol/Handler/Definitions/GoToDefinitionHandlerBase.cs
浏览文件 @
28c15deb
...
...
@@ -21,11 +21,11 @@ internal class GoToDefinitionHandlerBase
public
GoToDefinitionHandlerBase
(
IMetadataAsSourceFileService
metadataAsSourceFileService
)
=>
_metadataAsSourceFileService
=
metadataAsSourceFileService
;
protected
async
Task
<
LSP
.
Location
[
]>
GetDefinitionAsync
(
Solution
solution
,
LSP
.
TextDocumentPositionParams
request
,
bool
typeOnly
,
CancellationToken
cancellationToken
)
protected
async
Task
<
LSP
.
Location
[
]>
GetDefinitionAsync
(
Solution
solution
,
LSP
.
TextDocumentPositionParams
request
,
bool
typeOnly
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
locations
=
ArrayBuilder
<
LSP
.
Location
>.
GetInstance
();
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
);
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
);
if
(
document
==
null
)
{
return
locations
.
ToArrayAndFree
();
...
...
src/Features/LanguageServer/Protocol/Handler/Definitions/GoToTypeDefinitionHandler.cs
浏览文件 @
28c15deb
...
...
@@ -23,9 +23,9 @@ public GoToTypeDefinitionHandler(IMetadataAsSourceFileService metadataAsSourceFi
}
public
async
Task
<
LSP
.
Location
[
]>
HandleRequestAsync
(
Solution
solution
,
LSP
.
TextDocumentPositionParams
request
,
LSP
.
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
LSP
.
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
return
await
GetDefinitionAsync
(
solution
,
request
,
typeOnly
:
true
,
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
false
);
return
await
GetDefinitionAsync
(
solution
,
request
,
typeOnly
:
true
,
supportsRazorFeatures
:
supportsRazorFeatures
,
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
false
);
}
}
}
src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs
浏览文件 @
28c15deb
...
...
@@ -24,11 +24,11 @@ public FoldingRangesHandler()
}
public
async
Task
<
FoldingRange
[
]>
HandleRequestAsync
(
Solution
solution
,
FoldingRangeParams
request
,
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
foldingRanges
=
ArrayBuilder
<
FoldingRange
>.
GetInstance
();
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
);
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
);
if
(
document
==
null
)
{
return
foldingRanges
.
ToArrayAndFree
();
...
...
src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentHandler.cs
浏览文件 @
28c15deb
...
...
@@ -22,9 +22,9 @@ public FormatDocumentHandler()
}
public
async
Task
<
LSP
.
TextEdit
[
]>
HandleRequestAsync
(
Solution
solution
,
LSP
.
DocumentFormattingParams
request
,
LSP
.
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
return
await
GetTextEditsAsync
(
solution
,
request
.
TextDocument
.
Uri
,
cancellationToken
).
ConfigureAwait
(
false
);
return
await
GetTextEditsAsync
(
solution
,
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
,
cancellationToken
).
ConfigureAwait
(
false
);
}
}
}
src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentHandlerBase.cs
浏览文件 @
28c15deb
...
...
@@ -18,10 +18,10 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
{
internal
abstract
class
FormatDocumentHandlerBase
{
protected
async
Task
<
LSP
.
TextEdit
[
]>
GetTextEditsAsync
(
Solution
solution
,
Uri
documentUri
,
CancellationToken
cancellationToken
,
LSP
.
Range
?
range
=
null
)
protected
async
Task
<
LSP
.
TextEdit
[
]>
GetTextEditsAsync
(
Solution
solution
,
Uri
documentUri
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
,
LSP
.
Range
?
range
=
null
)
{
var
edits
=
new
ArrayBuilder
<
LSP
.
TextEdit
>();
var
document
=
solution
.
GetDocumentFromURI
(
documentUri
);
var
document
=
solution
.
GetDocumentFromURI
(
documentUri
,
supportsRazorFeatures
);
if
(
document
!=
null
)
{
...
...
src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentOnTypeHandler.cs
浏览文件 @
28c15deb
...
...
@@ -30,10 +30,10 @@ public FormatDocumentOnTypeHandler()
}
public
async
Task
<
TextEdit
[
]>
HandleRequestAsync
(
Solution
solution
,
DocumentOnTypeFormattingParams
request
,
ClientCapabilities
?
clientCapabilities
,
CancellationToken
cancellationToken
)
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
edits
=
new
ArrayBuilder
<
TextEdit
>();
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
);
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
);
if
(
document
!=
null
)
{
var
formattingService
=
document
.
Project
.
LanguageServices
.
GetRequiredService
<
IEditorFormattingService
>();
...
...
src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentRangeHandler.cs
浏览文件 @
28c15deb
...
...
@@ -22,9 +22,9 @@ public FormatDocumentRangeHandler()
}
public
async
Task
<
TextEdit
[
]>
HandleRequestAsync
(
Solution
solution
,
DocumentRangeFormattingParams
request
,
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
return
await
GetTextEditsAsync
(
solution
,
request
.
TextDocument
.
Uri
,
cancellationToken
,
range
:
request
.
Range
).
ConfigureAwait
(
false
);
return
await
GetTextEditsAsync
(
solution
,
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
,
cancellationToken
,
range
:
request
.
Range
).
ConfigureAwait
(
false
);
}
}
}
src/Features/LanguageServer/Protocol/Handler/Highlights/DocumentHighlightHandler.cs
浏览文件 @
28c15deb
...
...
@@ -25,9 +25,9 @@ public DocumentHighlightsHandler()
}
public
async
Task
<
DocumentHighlight
[
]>
HandleRequestAsync
(
Solution
solution
,
TextDocumentPositionParams
request
,
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
);
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
);
if
(
document
==
null
)
{
return
Array
.
Empty
<
DocumentHighlight
>();
...
...
src/Features/LanguageServer/Protocol/Handler/Hover/HoverHandler.cs
浏览文件 @
28c15deb
...
...
@@ -24,9 +24,9 @@ public HoverHandler()
}
public
async
Task
<
Hover
>
HandleRequestAsync
(
Solution
solution
,
TextDocumentPositionParams
request
,
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
);
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
);
if
(
document
==
null
)
{
return
null
;
...
...
src/Features/LanguageServer/Protocol/Handler/IRequestHandler.cs
浏览文件 @
28c15deb
...
...
@@ -25,8 +25,9 @@ internal interface IRequestHandler<RequestType, ResponseType> : IRequestHandler
/// <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="
supportsRazorFeatures">whether this request supports razor features
.</param>
/// <returns>the LSP response.</returns>
Task
<
ResponseType
>
HandleRequestAsync
(
Solution
solution
,
RequestType
request
,
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
);
/// <param name="cancellationToken">a cancellation token.</param>
Task
<
ResponseType
>
HandleRequestAsync
(
Solution
solution
,
RequestType
request
,
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
);
}
}
src/Features/LanguageServer/Protocol/Handler/Initialize/InitializeHandler.cs
浏览文件 @
28c15deb
...
...
@@ -31,7 +31,7 @@ public InitializeHandler([ImportMany] IEnumerable<Lazy<CompletionProvider, Compl
.
ToImmutableArray
();
}
public
Task
<
LSP
.
InitializeResult
>
HandleRequestAsync
(
Solution
solution
,
LSP
.
InitializeParams
request
,
LSP
.
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
public
Task
<
LSP
.
InitializeResult
>
HandleRequestAsync
(
Solution
solution
,
LSP
.
InitializeParams
request
,
LSP
.
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
triggerCharacters
=
_completionProviders
.
SelectMany
(
lz
=>
GetTriggerCharacters
(
lz
.
Value
)).
Distinct
().
Select
(
c
=>
c
.
ToString
()).
ToArray
();
...
...
src/Features/LanguageServer/Protocol/Handler/References/FindImplementationsHandler.cs
浏览文件 @
28c15deb
...
...
@@ -27,11 +27,11 @@ public FindImplementationsHandler()
}
public
async
Task
<
LSP
.
Location
[
]>
HandleRequestAsync
(
Solution
solution
,
LSP
.
TextDocumentPositionParams
request
,
LSP
.
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
LSP
.
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
locations
=
ArrayBuilder
<
LSP
.
Location
>.
GetInstance
();
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
);
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
);
if
(
document
==
null
)
{
return
locations
.
ToArrayAndFree
();
...
...
src/Features/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs
浏览文件 @
28c15deb
...
...
@@ -24,10 +24,10 @@ public RenameHandler()
{
}
public
async
Task
<
WorkspaceEdit
>
HandleRequestAsync
(
Solution
solution
,
RenameParams
request
,
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
public
async
Task
<
WorkspaceEdit
>
HandleRequestAsync
(
Solution
solution
,
RenameParams
request
,
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
WorkspaceEdit
workspaceEdit
=
null
;
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
);
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
);
if
(
document
!=
null
)
{
var
renameService
=
document
.
Project
.
LanguageServices
.
GetService
<
IEditorInlineRenameService
>();
...
...
src/Features/LanguageServer/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs
浏览文件 @
28c15deb
...
...
@@ -29,9 +29,9 @@ public SignatureHelpHandler([ImportMany] IEnumerable<Lazy<ISignatureHelpProvider
=>
_allProviders
=
allProviders
;
public
async
Task
<
LSP
.
SignatureHelp
>
HandleRequestAsync
(
Solution
solution
,
LSP
.
TextDocumentPositionParams
request
,
LSP
.
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
LSP
.
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
);
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
);
if
(
document
==
null
)
{
return
new
LSP
.
SignatureHelp
();
...
...
src/Features/LanguageServer/Protocol/Handler/Symbols/DocumentSymbolsHandler.cs
浏览文件 @
28c15deb
...
...
@@ -30,9 +30,9 @@ public DocumentSymbolsHandler()
}
public
async
Task
<
object
[
]>
HandleRequestAsync
(
Solution
solution
,
DocumentSymbolParams
request
,
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
);
var
document
=
solution
.
GetDocumentFromURI
(
request
.
TextDocument
.
Uri
,
supportsRazorFeatures
);
if
(
document
==
null
)
{
return
Array
.
Empty
<
SymbolInformation
>();
...
...
src/Features/LanguageServer/Protocol/Handler/Symbols/WorkspaceSymbolsHandler.cs
浏览文件 @
28c15deb
...
...
@@ -25,7 +25,7 @@ public WorkspaceSymbolsHandler()
}
public
async
Task
<
SymbolInformation
[
]>
HandleRequestAsync
(
Solution
solution
,
WorkspaceSymbolParams
request
,
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
{
var
searchTasks
=
Task
.
WhenAll
(
solution
.
Projects
.
Select
(
project
=>
SearchProjectAsync
(
project
,
request
,
cancellationToken
)));
return
(
await
searchTasks
.
ConfigureAwait
(
false
)).
SelectMany
(
s
=>
s
).
ToArray
();
...
...
src/Features/LanguageServer/Protocol/LanguageServerProtocol.cs
浏览文件 @
28c15deb
...
...
@@ -44,7 +44,7 @@ public LanguageServerProtocol([ImportMany] IEnumerable<Lazy<IRequestHandler, IRe
}
public
Task
<
ResponseType
>
ExecuteRequestAsync
<
RequestType
,
ResponseType
>(
string
methodName
,
Solution
solution
,
RequestType
request
,
LSP
.
ClientCapabilities
clientCapabilities
,
CancellationToken
cancellationToken
)
where
RequestType
:
class
LSP
.
ClientCapabilities
clientCapabilities
,
bool
supportsRazorFeatures
,
CancellationToken
cancellationToken
)
where
RequestType
:
class
{
Contract
.
ThrowIfNull
(
solution
);
Contract
.
ThrowIfNull
(
request
);
...
...
@@ -53,7 +53,7 @@ public LanguageServerProtocol([ImportMany] IEnumerable<Lazy<IRequestHandler, IRe
var
handler
=
(
IRequestHandler
<
RequestType
,
ResponseType
>?)
_requestHandlers
[
methodName
]?.
Value
;
Contract
.
ThrowIfNull
(
handler
,
string
.
Format
(
"Request handler not found for method {0}"
,
methodName
));
return
handler
.
HandleRequestAsync
(
solution
,
request
,
clientCapabilities
,
cancellationToken
);
return
handler
.
HandleRequestAsync
(
solution
,
request
,
clientCapabilities
,
supportsRazorFeatures
,
cancellationToken
);
}
}
}
src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs
浏览文件 @
28c15deb
...
...
@@ -38,7 +38,7 @@ void M()
private
static
async
Task
<
LSP
.
Command
[
]>
RunGetCodeActionsAsync
(
Solution
solution
,
LSP
.
Location
caret
,
LSP
.
ClientCapabilities
clientCapabilities
=
null
)
{
var
results
=
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
CodeActionParams
,
LSP
.
SumType
<
LSP
.
Command
,
LSP
.
CodeAction
>[
]>
(
LSP
.
Methods
.
TextDocumentCodeActionName
,
solution
,
CreateCodeActionParams
(
caret
),
clientCapabilities
,
CancellationToken
.
None
);
solution
,
CreateCodeActionParams
(
caret
),
clientCapabilities
,
false
,
CancellationToken
.
None
);
return
results
.
Select
(
r
=>
(
LSP
.
Command
)
r
).
ToArray
();
}
...
...
src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionResolveTests.cs
浏览文件 @
28c15deb
...
...
@@ -40,7 +40,7 @@ void M()
private
static
async
Task
<
object
>
RunResolveCompletionItemAsync
(
Solution
solution
,
LSP
.
CompletionItem
completionItem
,
LSP
.
ClientCapabilities
clientCapabilities
=
null
)
=>
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
CompletionItem
,
LSP
.
CompletionItem
>(
LSP
.
Methods
.
TextDocumentCompletionResolveName
,
solution
,
completionItem
,
clientCapabilities
,
CancellationToken
.
None
);
solution
,
completionItem
,
clientCapabilities
,
false
,
CancellationToken
.
None
);
private
static
LSP
.
VSCompletionItem
CreateResolvedCompletionItem
(
string
text
,
LSP
.
CompletionItemKind
kind
,
string
[]
tags
,
LSP
.
CompletionParams
requestParameters
,
ClassifiedTextElement
description
,
string
detail
,
string
documentation
)
...
...
src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionTests.cs
浏览文件 @
28c15deb
...
...
@@ -62,6 +62,6 @@ void M()
private
static
async
Task
<
LSP
.
CompletionItem
[
]>
RunGetCompletionsAsync
(
Solution
solution
,
LSP
.
Location
caret
,
LSP
.
ClientCapabilities
clientCapabilities
=
null
)
=>
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
CompletionParams
,
LSP
.
CompletionItem
[
]>
(
LSP
.
Methods
.
TextDocumentCompletionName
,
solution
,
CreateCompletionParams
(
caret
),
clientCapabilities
,
CancellationToken
.
None
);
solution
,
CreateCompletionParams
(
caret
),
clientCapabilities
,
false
,
CancellationToken
.
None
);
}
}
src/Features/LanguageServer/ProtocolUnitTests/Definitions/GoToDefinitionTests.cs
浏览文件 @
28c15deb
...
...
@@ -77,6 +77,6 @@ void M()
private
static
async
Task
<
LSP
.
Location
[
]>
RunGotoDefinitionAsync
(
Solution
solution
,
LSP
.
Location
caret
)
=>
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
TextDocumentPositionParams
,
LSP
.
Location
[
]>
(
LSP
.
Methods
.
TextDocumentDefinitionName
,
solution
,
CreateTextDocumentPositionParams
(
caret
),
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
CreateTextDocumentPositionParams
(
caret
),
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
}
}
src/Features/LanguageServer/ProtocolUnitTests/Definitions/GoToTypeDefinitionTests.cs
浏览文件 @
28c15deb
...
...
@@ -76,6 +76,6 @@ class B
private
static
async
Task
<
LSP
.
Location
[
]>
RunGotoTypeDefinitionAsync
(
Solution
solution
,
LSP
.
Location
caret
)
=>
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
TextDocumentPositionParams
,
LSP
.
Location
[
]>
(
LSP
.
Methods
.
TextDocumentTypeDefinitionName
,
solution
,
CreateTextDocumentPositionParams
(
caret
),
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
CreateTextDocumentPositionParams
(
caret
),
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
}
}
src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs
浏览文件 @
28c15deb
...
...
@@ -70,7 +70,7 @@ private static async Task<LSP.FoldingRange[]> RunGetFoldingRangeAsync(Solution s
};
return
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
FoldingRangeParams
,
LSP
.
FoldingRange
[
]>
(
LSP
.
Methods
.
TextDocumentFoldingRangeName
,
solution
,
request
,
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
request
,
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
}
private
static
LSP
.
FoldingRange
CreateFoldingRange
(
LSP
.
FoldingRangeKind
kind
,
LSP
.
Range
range
)
...
...
src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentOnTypeTests.cs
浏览文件 @
28c15deb
...
...
@@ -47,7 +47,7 @@ void M()
private
static
async
Task
<
LSP
.
TextEdit
[
]>
RunFormatDocumentOnTypeAsync
(
Solution
solution
,
string
characterTyped
,
LSP
.
Location
locationTyped
)
=>
await
GetLanguageServer
(
solution
)
.
ExecuteRequestAsync
<
LSP
.
DocumentOnTypeFormattingParams
,
LSP
.
TextEdit
[
]>
(
LSP
.
Methods
.
TextDocumentOnTypeFormattingName
,
solution
,
CreateDocumentOnTypeFormattingParams
(
characterTyped
,
locationTyped
),
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
CreateDocumentOnTypeFormattingParams
(
characterTyped
,
locationTyped
),
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
private
static
LSP
.
DocumentOnTypeFormattingParams
CreateDocumentOnTypeFormattingParams
(
string
characterTyped
,
LSP
.
Location
locationTyped
)
=>
new
LSP
.
DocumentOnTypeFormattingParams
()
...
...
src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentRangeTests.cs
浏览文件 @
28c15deb
...
...
@@ -43,7 +43,7 @@ void M()
private
static
async
Task
<
LSP
.
TextEdit
[
]>
RunFormatDocumentRangeAsync
(
Solution
solution
,
LSP
.
Location
location
)
=>
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
DocumentRangeFormattingParams
,
LSP
.
TextEdit
[
]>
(
LSP
.
Methods
.
TextDocumentRangeFormattingName
,
solution
,
CreateDocumentRangeFormattingParams
(
location
),
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
CreateDocumentRangeFormattingParams
(
location
),
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
private
static
LSP
.
DocumentRangeFormattingParams
CreateDocumentRangeFormattingParams
(
LSP
.
Location
location
)
=>
new
LSP
.
DocumentRangeFormattingParams
()
...
...
src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentTests.cs
浏览文件 @
28c15deb
...
...
@@ -44,7 +44,7 @@ void M()
private
static
async
Task
<
LSP
.
TextEdit
[
]>
RunFormatDocumentAsync
(
Solution
solution
,
Uri
uri
)
=>
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
DocumentFormattingParams
,
LSP
.
TextEdit
[
]>
(
LSP
.
Methods
.
TextDocumentFormattingName
,
solution
,
CreateDocumentFormattingParams
(
uri
),
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
CreateDocumentFormattingParams
(
uri
),
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
private
static
LSP
.
DocumentFormattingParams
CreateDocumentFormattingParams
(
Uri
uri
)
=>
new
LSP
.
DocumentFormattingParams
()
...
...
src/Features/LanguageServer/ProtocolUnitTests/Highlights/DocumentHighlightTests.cs
浏览文件 @
28c15deb
...
...
@@ -62,7 +62,7 @@ void M()
private
static
async
Task
<
LSP
.
DocumentHighlight
[
]>
RunGetDocumentHighlightAsync
(
Solution
solution
,
LSP
.
Location
caret
)
{
var
results
=
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
TextDocumentPositionParams
,
LSP
.
DocumentHighlight
[
]>
(
LSP
.
Methods
.
TextDocumentDocumentHighlightName
,
solution
,
CreateTextDocumentPositionParams
(
caret
),
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
CreateTextDocumentPositionParams
(
caret
),
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
Array
.
Sort
(
results
,
(
h1
,
h2
)
=>
{
var
compareKind
=
h1
.
Kind
.
CompareTo
(
h2
.
Kind
);
...
...
src/Features/LanguageServer/ProtocolUnitTests/Hover/HoverTests.cs
浏览文件 @
28c15deb
...
...
@@ -138,7 +138,7 @@ private string Method(int i)
private
static
async
Task
<
LSP
.
Hover
>
RunGetHoverAsync
(
Solution
solution
,
LSP
.
Location
caret
)
=>
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
TextDocumentPositionParams
,
LSP
.
Hover
>(
LSP
.
Methods
.
TextDocumentHoverName
,
solution
,
CreateTextDocumentPositionParams
(
caret
),
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
CreateTextDocumentPositionParams
(
caret
),
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
private
static
LSP
.
Hover
CreateHover
(
LSP
.
Location
location
,
string
text
)
=>
new
LSP
.
Hover
()
...
...
src/Features/LanguageServer/ProtocolUnitTests/Initialize/InitializeTests.cs
浏览文件 @
28c15deb
...
...
@@ -24,7 +24,7 @@ public async Task TestInitializeAsync()
private
static
async
Task
<
LSP
.
InitializeResult
>
RunInitializeAsync
(
Solution
solution
,
LSP
.
InitializeParams
request
)
=>
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
InitializeParams
,
LSP
.
InitializeResult
>(
LSP
.
Methods
.
InitializeName
,
solution
,
request
,
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
request
,
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
private
static
void
AssertServerCapabilities
(
LSP
.
ServerCapabilities
actual
)
{
...
...
src/Features/LanguageServer/ProtocolUnitTests/References/FindImplementationsTests.cs
浏览文件 @
28c15deb
...
...
@@ -81,6 +81,6 @@ void M()
private
static
async
Task
<
LSP
.
Location
[
]>
RunFindImplementationAsync
(
Solution
solution
,
LSP
.
Location
caret
)
=>
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
TextDocumentPositionParams
,
LSP
.
Location
[
]>
(
LSP
.
Methods
.
TextDocumentImplementationName
,
solution
,
CreateTextDocumentPositionParams
(
caret
),
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
CreateTextDocumentPositionParams
(
caret
),
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
}
}
src/Features/LanguageServer/ProtocolUnitTests/Rename/RenameTests.cs
浏览文件 @
28c15deb
...
...
@@ -46,6 +46,6 @@ private static LSP.RenameParams CreateRenameParams(LSP.Location location, string
private
static
async
Task
<
WorkspaceEdit
>
RunRenameAsync
(
Solution
solution
,
LSP
.
Location
renameLocation
,
string
renamevalue
)
=>
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
RenameParams
,
LSP
.
WorkspaceEdit
>(
LSP
.
Methods
.
TextDocumentRenameName
,
solution
,
CreateRenameParams
(
renameLocation
,
renamevalue
),
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
CreateRenameParams
(
renameLocation
,
renamevalue
),
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
}
}
src/Features/LanguageServer/ProtocolUnitTests/SignatureHelp/SignatureHelpTests.cs
浏览文件 @
28c15deb
...
...
@@ -46,7 +46,7 @@ int M2(string a)
private
static
async
Task
<
LSP
.
SignatureHelp
>
RunGetSignatureHelpAsync
(
Solution
solution
,
LSP
.
Location
caret
)
=>
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
TextDocumentPositionParams
,
LSP
.
SignatureHelp
>(
LSP
.
Methods
.
TextDocumentSignatureHelpName
,
solution
,
CreateTextDocumentPositionParams
(
caret
),
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
CreateTextDocumentPositionParams
(
caret
),
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
private
static
LSP
.
SignatureInformation
CreateSignatureInformation
(
string
methodLabal
,
string
methodDocumentation
,
string
parameterLabel
,
string
parameterDocumentation
)
=>
new
LSP
.
SignatureInformation
()
...
...
src/Features/LanguageServer/ProtocolUnitTests/Symbols/DocumentSymbolsTests.cs
浏览文件 @
28c15deb
...
...
@@ -103,7 +103,7 @@ private static async Task<object[]> RunGetDocumentSymbolsAsync(Solution solution
};
return
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
DocumentSymbolParams
,
object
[
]>
(
LSP
.
Methods
.
TextDocumentDocumentSymbolName
,
solution
,
request
,
clientCapabilities
,
CancellationToken
.
None
);
solution
,
request
,
clientCapabilities
,
false
,
CancellationToken
.
None
);
}
private
static
void
AssertDocumentSymbolEquals
(
LSP
.
DocumentSymbol
expected
,
LSP
.
DocumentSymbol
actual
)
...
...
src/Features/LanguageServer/ProtocolUnitTests/Symbols/WorkspaceSymbolsTests.cs
浏览文件 @
28c15deb
...
...
@@ -157,7 +157,7 @@ private static async Task<LSP.SymbolInformation[]> RunGetWorkspaceSymbolsAsync(S
};
return
await
GetLanguageServer
(
solution
).
ExecuteRequestAsync
<
LSP
.
WorkspaceSymbolParams
,
LSP
.
SymbolInformation
[
]>
(
LSP
.
Methods
.
WorkspaceSymbolName
,
solution
,
request
,
new
LSP
.
ClientCapabilities
(),
CancellationToken
.
None
);
solution
,
request
,
new
LSP
.
ClientCapabilities
(),
false
,
CancellationToken
.
None
);
}
}
}
src/VisualStudio/Core/Def/Implementation/LanguageClient/InProcLanguageServer.cs
浏览文件 @
28c15deb
...
...
@@ -92,7 +92,7 @@ public async Task<InitializeResult> InitializeAsync(JToken input, CancellationTo
// to avoid losing them.
_clientCapabilities
=
input
[
"capabilities"
].
ToObject
<
VSClientCapabilities
>(
JsonSerializer
);
var
serverCapabilities
=
await
_protocol
.
ExecuteRequestAsync
<
InitializeParams
,
InitializeResult
>(
Methods
.
InitializeName
,
_workspace
.
CurrentSolution
,
input
.
ToObject
<
InitializeParams
>(
JsonSerializer
),
_clientCapabilities
,
cancellationToken
).
ConfigureAwait
(
false
);
_workspace
.
CurrentSolution
,
input
.
ToObject
<
InitializeParams
>(
JsonSerializer
),
_clientCapabilities
,
false
,
cancellationToken
).
ConfigureAwait
(
false
);
// As soon as LSP supports classifications in hover, we can remove this and always advertise hover support.
// Tracking - https://devdiv.visualstudio.com/DevDiv/_workitems/edit/918138/
...
...
@@ -129,7 +129,7 @@ public Task<LSP.Location[]> GetTextDocumentDefinitionAsync(JToken input, Cancell
{
var
textDocumentPositionParams
=
input
.
ToObject
<
TextDocumentPositionParams
>(
JsonSerializer
);
return
_protocol
.
ExecuteRequestAsync
<
TextDocumentPositionParams
,
LSP
.
Location
[
]>
(
Methods
.
TextDocumentDefinitionName
,
_workspace
.
CurrentSolution
,
textDocumentPositionParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
textDocumentPositionParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
TextDocumentRenameName
)]
...
...
@@ -137,7 +137,7 @@ public Task<WorkspaceEdit> GetTextDocumentRenameAsync(JToken input, Cancellation
{
var
renameParams
=
input
.
ToObject
<
RenameParams
>(
JsonSerializer
);
return
_protocol
.
ExecuteRequestAsync
<
RenameParams
,
WorkspaceEdit
>(
Methods
.
TextDocumentRenameName
,
_workspace
.
CurrentSolution
,
renameParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
renameParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
TextDocumentReferencesName
)]
...
...
@@ -145,7 +145,7 @@ public Task<VSReferenceItem[]> GetTextDocumentReferencesAsync(JToken input, Canc
{
var
referencesParams
=
input
.
ToObject
<
ReferenceParams
>(
JsonSerializer
);
return
_protocol
.
ExecuteRequestAsync
<
ReferenceParams
,
VSReferenceItem
[
]>
(
Methods
.
TextDocumentReferencesName
,
_workspace
.
CurrentSolution
,
referencesParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
referencesParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
TextDocumentCompletionName
)]
...
...
@@ -153,7 +153,7 @@ public Task<CompletionItem[]> GetTextDocumentCompletionAsync(JToken input, Cance
{
var
completionParams
=
input
.
ToObject
<
CompletionParams
>(
JsonSerializer
);
return
_protocol
.
ExecuteRequestAsync
<
CompletionParams
,
CompletionItem
[
]>
(
Methods
.
TextDocumentCompletionName
,
_workspace
.
CurrentSolution
,
completionParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
completionParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
TextDocumentCompletionResolveName
)]
...
...
@@ -161,7 +161,7 @@ public Task<CompletionItem> ResolveCompletionItemAsync(JToken input, Cancellatio
{
var
completionItem
=
input
.
ToObject
<
CompletionItem
>(
JsonSerializer
);
return
_protocol
.
ExecuteRequestAsync
<
CompletionItem
,
CompletionItem
>(
Methods
.
TextDocumentCompletionResolveName
,
_workspace
.
CurrentSolution
,
completionItem
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
completionItem
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
TextDocumentDocumentHighlightName
)]
...
...
@@ -169,7 +169,7 @@ public Task<DocumentHighlight[]> GetTextDocumentDocumentHighlightsAsync(JToken i
{
var
textDocumentPositionParams
=
input
.
ToObject
<
TextDocumentPositionParams
>(
JsonSerializer
);
return
_protocol
.
ExecuteRequestAsync
<
TextDocumentPositionParams
,
DocumentHighlight
[
]>
(
Methods
.
TextDocumentDocumentHighlightName
,
_workspace
.
CurrentSolution
,
textDocumentPositionParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
textDocumentPositionParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
TextDocumentHoverName
)]
...
...
@@ -177,7 +177,7 @@ public Task<Hover> GetTextDocumentDocumentHoverAsync(JToken input, CancellationT
{
var
textDocumentPositionParams
=
input
.
ToObject
<
TextDocumentPositionParams
>();
return
_protocol
.
ExecuteRequestAsync
<
TextDocumentPositionParams
,
Hover
>(
Methods
.
TextDocumentHoverName
,
_workspace
.
CurrentSolution
,
textDocumentPositionParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
textDocumentPositionParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
TextDocumentDocumentSymbolName
)]
...
...
@@ -185,7 +185,7 @@ public Task<object[]> GetTextDocumentDocumentSymbolsAsync(JToken input, Cancella
{
var
documentSymbolParams
=
input
.
ToObject
<
DocumentSymbolParams
>(
JsonSerializer
);
return
_protocol
.
ExecuteRequestAsync
<
DocumentSymbolParams
,
object
[
]>
(
Methods
.
TextDocumentDocumentSymbolName
,
_workspace
.
CurrentSolution
,
documentSymbolParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
documentSymbolParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
TextDocumentFormattingName
)]
...
...
@@ -193,7 +193,7 @@ public Task<TextEdit[]> GetTextDocumentFormattingAsync(JToken input, Cancellatio
{
var
documentFormattingParams
=
input
.
ToObject
<
DocumentFormattingParams
>(
JsonSerializer
);
return
_protocol
.
ExecuteRequestAsync
<
DocumentFormattingParams
,
TextEdit
[
]>
(
Methods
.
TextDocumentFormattingName
,
_workspace
.
CurrentSolution
,
documentFormattingParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
documentFormattingParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
TextDocumentOnTypeFormattingName
)]
...
...
@@ -201,7 +201,7 @@ public Task<TextEdit[]> GetTextDocumentFormattingOnTypeAsync(JToken input, Cance
{
var
documentOnTypeFormattingParams
=
input
.
ToObject
<
DocumentOnTypeFormattingParams
>(
JsonSerializer
);
return
_protocol
.
ExecuteRequestAsync
<
DocumentOnTypeFormattingParams
,
TextEdit
[
]>
(
Methods
.
TextDocumentOnTypeFormattingName
,
_workspace
.
CurrentSolution
,
documentOnTypeFormattingParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
documentOnTypeFormattingParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
TextDocumentImplementationName
)]
...
...
@@ -209,7 +209,7 @@ public Task<LSP.Location[]> GetTextDocumentImplementationsAsync(JToken input, Ca
{
var
textDocumentPositionParams
=
input
.
ToObject
<
TextDocumentPositionParams
>();
return
_protocol
.
ExecuteRequestAsync
<
TextDocumentPositionParams
,
LSP
.
Location
[
]>
(
Methods
.
TextDocumentImplementationName
,
_workspace
.
CurrentSolution
,
textDocumentPositionParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
textDocumentPositionParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
TextDocumentRangeFormattingName
)]
...
...
@@ -217,7 +217,7 @@ public Task<TextEdit[]> GetTextDocumentRangeFormattingAsync(JToken input, Cancel
{
var
documentRangeFormattingParams
=
input
.
ToObject
<
DocumentRangeFormattingParams
>(
JsonSerializer
);
return
_protocol
.
ExecuteRequestAsync
<
DocumentRangeFormattingParams
,
TextEdit
[
]>
(
Methods
.
TextDocumentRangeFormattingName
,
_workspace
.
CurrentSolution
,
documentRangeFormattingParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
documentRangeFormattingParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
TextDocumentSignatureHelpName
)]
...
...
@@ -225,7 +225,7 @@ public Task<SignatureHelp> GetTextDocumentSignatureHelpAsync(JToken input, Cance
{
var
textDocumentPositionParams
=
input
.
ToObject
<
TextDocumentPositionParams
>(
JsonSerializer
);
return
_protocol
.
ExecuteRequestAsync
<
TextDocumentPositionParams
,
SignatureHelp
>(
Methods
.
TextDocumentSignatureHelpName
,
_workspace
.
CurrentSolution
,
textDocumentPositionParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
textDocumentPositionParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
[
JsonRpcMethod
(
Methods
.
WorkspaceSymbolName
)]
...
...
@@ -233,7 +233,7 @@ public Task<SymbolInformation[]> GetWorkspaceSymbolsAsync(JToken input, Cancella
{
var
workspaceSymbolParams
=
input
.
ToObject
<
WorkspaceSymbolParams
>(
JsonSerializer
);
return
_protocol
.
ExecuteRequestAsync
<
WorkspaceSymbolParams
,
SymbolInformation
[
]>
(
Methods
.
WorkspaceSymbolName
,
_workspace
.
CurrentSolution
,
workspaceSymbolParams
,
_clientCapabilities
,
cancellationToken
);
_workspace
.
CurrentSolution
,
workspaceSymbolParams
,
_clientCapabilities
,
_supportsRazorFeatures
,
cancellationToken
);
}
#pragma warning disable VSTHRD100 // Avoid async void methods
...
...
src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.cs
浏览文件 @
28c15deb
...
...
@@ -32,7 +32,7 @@ public async Task<LSP.TextEdit[]> HandleAsync(RunCodeActionParams request, Reque
var
codeActions
=
await
GetCodeActionsAsync
(
solution
,
request
.
CodeActionParams
.
TextDocument
.
Uri
,
request
.
CodeActionParams
.
Range
,
cancellationToken
).
ConfigureAwait
(
false
);
false
,
cancellationToken
).
ConfigureAwait
(
false
);
var
actionToRun
=
codeActions
?.
FirstOrDefault
(
a
=>
a
.
Title
==
request
.
Title
);
...
...
src/VisualStudio/LiveShare/Impl/RunCodeActionsHandler.cs
浏览文件 @
28c15deb
...
...
@@ -51,7 +51,7 @@ public async Task<object> HandleAsync(LSP.ExecuteCommandParams request, RequestC
var
codeActions
=
await
GetCodeActionsAsync
(
requestContext
.
Context
,
runRequest
.
CodeActionParams
.
TextDocument
.
Uri
,
runRequest
.
CodeActionParams
.
Range
,
cancellationToken
).
ConfigureAwait
(
false
);
false
,
cancellationToken
).
ConfigureAwait
(
false
);
var
actionToRun
=
codeActions
?.
FirstOrDefault
(
a
=>
a
.
Title
==
runRequest
.
Title
);
...
...
src/VisualStudio/LiveShare/Impl/Shims/TypeScriptHandlerShims.cs
浏览文件 @
28c15deb
...
...
@@ -44,7 +44,7 @@ public Task<LanguageServer.Protocol.CompletionItem[]> HandleAsync(object input,
// However, this is not yet supported through Live Share, so deserialization fails on the IProgress<T> property.
// https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1043376 tracks Live Share support for this (committed for 16.6).
var
request
=
((
JObject
)
input
).
ToObject
<
CompletionParams
>(
InProcLanguageServer
.
JsonSerializer
);
return
base
.
HandleRequestAsync
(
requestContext
.
Context
,
request
,
requestContext
.
GetClientCapabilities
(),
cancellationToken
);
return
base
.
HandleRequestAsync
(
requestContext
.
Context
,
request
,
requestContext
.
GetClientCapabilities
(),
false
,
cancellationToken
);
}
}
...
...
@@ -58,7 +58,7 @@ public TypeScriptCompletionResolverHandlerShim()
}
public
Task
<
LanguageServer
.
Protocol
.
CompletionItem
>
HandleAsync
(
LanguageServer
.
Protocol
.
CompletionItem
param
,
RequestContext
<
Solution
>
requestContext
,
CancellationToken
cancellationToken
)
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
param
,
requestContext
.
GetClientCapabilities
(),
cancellationToken
);
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
param
,
requestContext
.
GetClientCapabilities
(),
false
,
cancellationToken
);
}
[
ExportLspRequestHandler
(
LiveShareConstants
.
TypeScriptContractName
,
Methods
.
TextDocumentDocumentHighlightName
)]
...
...
@@ -71,7 +71,7 @@ public TypeScriptDocumentHighlightHandlerShim()
}
public
Task
<
DocumentHighlight
[
]>
HandleAsync
(
TextDocumentPositionParams
param
,
RequestContext
<
Solution
>
requestContext
,
CancellationToken
cancellationToken
)
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
param
,
requestContext
.
GetClientCapabilities
(),
cancellationToken
);
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
param
,
requestContext
.
GetClientCapabilities
(),
false
,
cancellationToken
);
}
[
ExportLspRequestHandler
(
LiveShareConstants
.
TypeScriptContractName
,
Methods
.
TextDocumentDocumentSymbolName
)]
...
...
@@ -92,7 +92,7 @@ public async Task<SymbolInformation[]> HandleAsync(DocumentSymbolParams param, R
clientCapabilities
.
TextDocument
.
DocumentSymbol
.
HierarchicalDocumentSymbolSupport
=
false
;
}
var
response
=
await
base
.
HandleRequestAsync
(
requestContext
.
Context
,
param
,
clientCapabilities
,
cancellationToken
).
ConfigureAwait
(
false
);
var
response
=
await
base
.
HandleRequestAsync
(
requestContext
.
Context
,
param
,
clientCapabilities
,
false
,
cancellationToken
).
ConfigureAwait
(
false
);
// Since hierarchicalSupport will never be true, it is safe to cast the response to SymbolInformation[]
return
response
.
Cast
<
SymbolInformation
>().
ToArray
();
...
...
@@ -110,7 +110,7 @@ public TypeScriptFormatDocumentHandlerShim(IThreadingContext threadingContext)
=>
_threadingContext
=
threadingContext
;
public
Task
<
TextEdit
[
]>
HandleAsync
(
DocumentFormattingParams
request
,
RequestContext
<
Solution
>
requestContext
,
CancellationToken
cancellationToken
)
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
request
,
requestContext
.
GetClientCapabilities
(),
cancellationToken
);
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
request
,
requestContext
.
GetClientCapabilities
(),
false
,
cancellationToken
);
protected
override
async
Task
<
IList
<
TextChange
>>
GetFormattingChangesAsync
(
IEditorFormattingService
formattingService
,
Document
document
,
TextSpan
?
textSpan
,
CancellationToken
cancellationToken
)
{
...
...
@@ -131,7 +131,7 @@ public TypeScriptFormatDocumentRangeHandlerShim(IThreadingContext threadingConte
=>
_threadingContext
=
threadingContext
;
public
Task
<
TextEdit
[
]>
HandleAsync
(
DocumentRangeFormattingParams
request
,
RequestContext
<
Solution
>
requestContext
,
CancellationToken
cancellationToken
)
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
request
,
requestContext
.
GetClientCapabilities
(),
cancellationToken
);
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
request
,
requestContext
.
GetClientCapabilities
(),
false
,
cancellationToken
);
protected
override
async
Task
<
IList
<
TextChange
>>
GetFormattingChangesAsync
(
IEditorFormattingService
formattingService
,
Document
document
,
TextSpan
?
textSpan
,
CancellationToken
cancellationToken
)
{
...
...
@@ -152,7 +152,7 @@ public TypeScriptFormatDocumentOnTypeHandlerShim(IThreadingContext threadingCont
=>
_threadingContext
=
threadingContext
;
public
Task
<
TextEdit
[
]>
HandleAsync
(
DocumentOnTypeFormattingParams
request
,
RequestContext
<
Solution
>
requestContext
,
CancellationToken
cancellationToken
)
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
request
,
requestContext
?.
ClientCapabilities
?.
ToObject
<
ClientCapabilities
>(),
cancellationToken
);
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
request
,
requestContext
?.
ClientCapabilities
?.
ToObject
<
ClientCapabilities
>(),
false
,
cancellationToken
);
protected
override
async
Task
<
IList
<
TextChange
>?>
GetFormattingChangesAsync
(
IEditorFormattingService
formattingService
,
Document
document
,
char
typedChar
,
int
position
,
CancellationToken
cancellationToken
)
{
...
...
@@ -180,7 +180,7 @@ public TypeScriptFindImplementationsHandlerShim(IThreadingContext threadingConte
=>
_threadingContext
=
threadingContext
;
public
Task
<
LanguageServer
.
Protocol
.
Location
[
]>
HandleAsync
(
TextDocumentPositionParams
request
,
RequestContext
<
Solution
>
requestContext
,
CancellationToken
cancellationToken
)
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
request
,
requestContext
.
GetClientCapabilities
(),
cancellationToken
);
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
request
,
requestContext
.
GetClientCapabilities
(),
false
,
cancellationToken
);
protected
override
async
Task
FindImplementationsAsync
(
IFindUsagesService
findUsagesService
,
Document
document
,
int
position
,
SimpleFindUsagesContext
context
)
{
...
...
@@ -201,7 +201,7 @@ public TypeScriptInitializeHandlerShim([ImportMany] IEnumerable<Lazy<CompletionP
public
async
Task
<
InitializeResult
>
HandleAsync
(
InitializeParams
param
,
RequestContext
<
Solution
>
requestContext
,
CancellationToken
cancellationToken
)
{
var
initializeResult
=
await
base
.
HandleRequestAsync
(
requestContext
.
Context
,
param
,
requestContext
.
GetClientCapabilities
(),
cancellationToken
).
ConfigureAwait
(
false
);
var
initializeResult
=
await
base
.
HandleRequestAsync
(
requestContext
.
Context
,
param
,
requestContext
.
GetClientCapabilities
(),
false
,
cancellationToken
).
ConfigureAwait
(
false
);
initializeResult
.
Capabilities
.
Experimental
=
new
RoslynExperimentalCapabilities
{
SyntacticLspProvider
=
true
};
return
initializeResult
;
}
...
...
@@ -217,7 +217,7 @@ public TypeScriptSignatureHelpHandlerShim([ImportMany] IEnumerable<Lazy<ISignatu
}
public
Task
<
SignatureHelp
>
HandleAsync
(
TextDocumentPositionParams
param
,
RequestContext
<
Solution
>
requestContext
,
CancellationToken
cancellationToken
)
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
param
,
requestContext
.
GetClientCapabilities
(),
cancellationToken
);
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
param
,
requestContext
.
GetClientCapabilities
(),
false
,
cancellationToken
);
}
[
ExportLspRequestHandler
(
LiveShareConstants
.
TypeScriptContractName
,
Methods
.
TextDocumentRenameName
)]
...
...
@@ -230,7 +230,7 @@ public TypeScriptRenameHandlerShim()
}
public
Task
<
WorkspaceEdit
>
HandleAsync
(
RenameParams
param
,
RequestContext
<
Solution
>
requestContext
,
CancellationToken
cancellationToken
)
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
param
,
requestContext
.
GetClientCapabilities
(),
cancellationToken
);
=>
base
.
HandleRequestAsync
(
requestContext
.
Context
,
param
,
requestContext
.
GetClientCapabilities
(),
false
,
cancellationToken
);
}
[
ExportLspRequestHandler
(
LiveShareConstants
.
TypeScriptContractName
,
Methods
.
WorkspaceSymbolName
)]
...
...
@@ -248,7 +248,7 @@ public Task<SymbolInformation[]> HandleAsync(object input, RequestContext<Soluti
// However, this is not yet supported through Live Share, so deserialization fails on the IProgress<T> property.
// https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1043376 tracks Live Share support for this (committed for 16.6).
var
request
=
((
JObject
)
input
).
ToObject
<
WorkspaceSymbolParams
>(
InProcLanguageServer
.
JsonSerializer
);
return
base
.
HandleRequestAsync
(
requestContext
.
Context
,
request
,
requestContext
.
GetClientCapabilities
(),
cancellationToken
);
return
base
.
HandleRequestAsync
(
requestContext
.
Context
,
request
,
requestContext
.
GetClientCapabilities
(),
false
,
cancellationToken
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录