Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Upgraded lsp to 0.18.3 #1998

Merged
merged 4 commits into from
Nov 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ insert_final_newline = true
indent_style = space
indent_size = 4

dotnet_diagnostic.VSTHRD002.severity = none
dotnet_diagnostic.VSTHRD003.severity = none
dotnet_diagnostic.VSTHRD105.severity = none
dotnet_diagnostic.VSTHRD110.severity = none
dotnet_diagnostic.VSTHRD200.severity = none

[*.cs]
indent_size = 4

Expand Down
4 changes: 2 additions & 2 deletions build/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
<PackageReference Update="NuGet.ProjectModel" Version="$(NuGetPackageVersion)" />
<PackageReference Update="NuGet.Versioning" Version="$(NuGetPackageVersion)" />

<PackageReference Update="OmniSharp.Extensions.LanguageServer" Version="0.18.0-beta0081" />
<PackageReference Update="OmniSharp.Extensions.LanguageProtocol.Testing" Version="0.18.0-beta0081" />
<PackageReference Update="OmniSharp.Extensions.LanguageServer" Version="0.18.2" />
<PackageReference Update="OmniSharp.Extensions.LanguageProtocol.Testing" Version="0.18.2" />

<PackageReference Update="SQLitePCLRaw.bundle_green" Version="1.1.2" />
<PackageReference Update="System.Collections.Immutable" Version="1.4.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace OmniSharp.LanguageServerProtocol.Handlers
{
internal sealed class OmniSharpCodeActionHandler : CodeActionHandler, IExecuteCommandHandler
internal sealed class OmniSharpCodeActionHandler : CodeActionHandlerBase, IExecuteCommandHandler
{
public static IEnumerable<IJsonRpcHandler> Enumerate(
RequestHandlers handlers,
Expand Down Expand Up @@ -116,6 +116,11 @@ public override async Task<CommandOrCodeActionContainer> Handle(CodeActionParams
codeActions.Select(ca => new CommandOrCodeAction(ca)));
}

public override Task<CodeAction> Handle(CodeAction request, CancellationToken cancellationToken)
{
return Task.FromResult(request);
}

public async Task<Unit> Handle(ExecuteCommandParams request, CancellationToken cancellationToken)
{
Debug.Assert(request.Command == "omnisharp/executeCodeAction");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static LanguageProtocolInteropHandler Factory(
public class LanguageProtocolInteropHandler<TRequest, TResponse> : LanguageProtocolInteropHandler
{
private readonly IPredicateHandler _languagePredicateHandler;
private readonly Lazy<Task<Dictionary<string, IRequestHandler<TRequest, TResponse>[]>>> _exports;
private readonly Lazy<Dictionary<string, IRequestHandler<TRequest, TResponse>[]>> _exports;
private readonly bool _hasLanguageProperty;
private readonly bool _hasFileNameProperty;
private readonly bool _canBeAggregated;
Expand All @@ -60,11 +60,10 @@ public LanguageProtocolInteropHandler(IPredicateHandler languagePredicateHandler
_canBeAggregated = typeof(IAggregateResponse).IsAssignableFrom(metadata.ResponseType);
_updateBufferHandler = updateBufferHandler;

_exports = new Lazy<Task<Dictionary<string, IRequestHandler<TRequest, TResponse>[]>>>(() =>
LoadExportHandlers(handlers));
_exports = new Lazy<Dictionary<string, IRequestHandler<TRequest, TResponse>[]>>(() =>LoadExportHandlers(handlers));
}

private Task<Dictionary<string, IRequestHandler<TRequest, TResponse>[]>> LoadExportHandlers(
private Dictionary<string, IRequestHandler<TRequest, TResponse>[]> LoadExportHandlers(
IEnumerable<Lazy<IRequestHandler, OmniSharpRequestHandlerMetadata>> handlers)
{
var interfaceHandlers = handlers
Expand All @@ -76,12 +75,12 @@ private Task<Dictionary<string, IRequestHandler<TRequest, TResponse>[]>> LoadExp
// .Select(plugin => (plugin.Config.Language, plugin));

// Group handlers by language and sort each group for consistency
return Task.FromResult(interfaceHandlers
return interfaceHandlers
// .Concat(plugins)
.GroupBy(export => export.Language, StringComparer.OrdinalIgnoreCase)
.ToDictionary(
group => group.Key,
group => group.OrderBy(g => g.Handler).Select(z => z.Handler).ToArray()));
group => group.OrderBy(g => g.Handler).Select(z => z.Handler).ToArray());
}

public string EndpointName { get; }
Expand Down Expand Up @@ -207,7 +206,7 @@ private async Task<object> GetFirstNotEmptyResponseFromHandlers(IRequestHandler<

private async Task<object> HandleRequestForLanguage(string language, TRequest request)
{
var exports = await _exports.Value;
var exports = _exports.Value;
if (exports.TryGetValue(language, out var handlers))
{
if (_canBeAggregated)
Expand All @@ -229,7 +228,7 @@ private async Task<object> HandleAllRequest(TRequest request)
$"Must be able aggregate the response to spread them out across all plugins for {EndpointName}");
}

var exports = await _exports.Value;
var exports = _exports.Value;

IAggregateResponse aggregateResponse = null;
var responses = new List<Task<IAggregateResponse>>();
Expand Down