Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Upgrade Omnisharp.Extensions.LanguageServer to 0.16.0 #1754

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion build/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<PackageReference Update="Nuget.ProjectModel" Version="$(NuGetPackageVersion)" />
<PackageReference Update="Nuget.Versioning" Version="$(NuGetPackageVersion)" />

<PackageReference Update="OmniSharp.Extensions.LanguageServer" Version="0.13.1" />
<PackageReference Update="OmniSharp.Extensions.LanguageServer" Version="0.16.0" />

<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 @@ -6,7 +6,6 @@
using Newtonsoft.Json.Linq;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models;
Expand All @@ -19,12 +18,12 @@ internal sealed class OmniSharpCodeLensHandler : CodeLensHandler
{
public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
{
foreach (var (selector, membersAsTreeHandler, findUsagesHandler) in handlers
foreach (var (selector, pm, membersAsTreeHandler, findUsagesHandler) in handlers
.OfType<
Mef.IRequestHandler<MembersTreeRequest, FileMemberTree>,
Mef.IRequestHandler<FindUsagesRequest, QuickFixResponse>>())
{
yield return new OmniSharpCodeLensHandler(membersAsTreeHandler, findUsagesHandler, selector);
yield return new OmniSharpCodeLensHandler(membersAsTreeHandler, findUsagesHandler, selector, pm);
}
}

Expand All @@ -34,12 +33,13 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
public OmniSharpCodeLensHandler(
Mef.IRequestHandler<MembersTreeRequest, FileMemberTree> membersAsTreeHandler,
Mef.IRequestHandler<FindUsagesRequest, QuickFixResponse> findUsagesHandler,
DocumentSelector documentSelector)
DocumentSelector documentSelector,
ProgressManager progressManager)
: base(new CodeLensRegistrationOptions()
{
DocumentSelector = documentSelector,
ResolveProvider = true
})
}, progressManager)
{
_membersAsTreeHandler = membersAsTreeHandler;
_findUsagesHandler = findUsagesHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.AutoComplete;
Expand All @@ -15,10 +15,10 @@ class OmniSharpCompletionHandler : CompletionHandler
public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
{

foreach (var (selector, handler) in handlers
foreach (var (selector, pm, handler) in handlers
.OfType<Mef.IRequestHandler<AutoCompleteRequest, IEnumerable<AutoCompleteResponse>>>())
if (handler != null)
yield return new OmniSharpCompletionHandler(handler, selector);
yield return new OmniSharpCompletionHandler(handler, selector, pm);
}

private readonly Mef.IRequestHandler<AutoCompleteRequest, IEnumerable<AutoCompleteResponse>> _autoCompleteHandler;
Expand Down Expand Up @@ -63,14 +63,14 @@ private static CompletionItemKind GetCompletionItemKind(string key)
return CompletionItemKind.Property;
}

public OmniSharpCompletionHandler(Mef.IRequestHandler<AutoCompleteRequest, IEnumerable<AutoCompleteResponse>> autoCompleteHandler, DocumentSelector documentSelector)
public OmniSharpCompletionHandler(Mef.IRequestHandler<AutoCompleteRequest, IEnumerable<AutoCompleteResponse>> autoCompleteHandler, DocumentSelector documentSelector, ProgressManager pm)
: base(new CompletionRegistrationOptions()
{
DocumentSelector = documentSelector,
// TODO: Come along and add a service for getting autocompletion details after the fact.
ResolveProvider = false,
TriggerCharacters = new[] { ".", },
})
}, pm)
{
_autoCompleteHandler = autoCompleteHandler;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.GotoDefinition;
Expand All @@ -15,18 +15,18 @@ class OmniSharpDefinitionHandler : DefinitionHandler
{
public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
{
foreach (var (selector, handler) in handlers.OfType<Mef.IRequestHandler<GotoDefinitionRequest, GotoDefinitionResponse>>())
foreach (var (selector, pm, handler) in handlers.OfType<Mef.IRequestHandler<GotoDefinitionRequest, GotoDefinitionResponse>>())
if (handler != null)
yield return new OmniSharpDefinitionHandler(handler, selector);
yield return new OmniSharpDefinitionHandler(handler, selector, pm);
}

private readonly Mef.IRequestHandler<GotoDefinitionRequest, GotoDefinitionResponse> _definitionHandler;

public OmniSharpDefinitionHandler(Mef.IRequestHandler<GotoDefinitionRequest, GotoDefinitionResponse> definitionHandler, DocumentSelector documentSelector)
: base(new TextDocumentRegistrationOptions()
public OmniSharpDefinitionHandler(Mef.IRequestHandler<GotoDefinitionRequest, GotoDefinitionResponse> definitionHandler, DocumentSelector documentSelector, ProgressManager pm)
: base(new DefinitionRegistrationOptions()
{
DocumentSelector = documentSelector
})
}, pm)
{
_definitionHandler = definitionHandler;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.Format;
Expand All @@ -14,15 +15,16 @@ internal sealed class OmniSharpDocumentFormatRangeHandler : DocumentRangeFormatt
{
public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
{
foreach (var (selector, handler) in handlers
foreach (var (selector, pm, handler) in handlers
.OfType<Mef.IRequestHandler<FormatRangeRequest, FormatRangeResponse>>())
if (handler != null)
yield return new OmniSharpDocumentFormatRangeHandler(handler, selector);
}

private readonly Mef.IRequestHandler<FormatRangeRequest, FormatRangeResponse> _formatRangeHandler;

public OmniSharpDocumentFormatRangeHandler(Mef.IRequestHandler<FormatRangeRequest, FormatRangeResponse> formatRangeHandler, DocumentSelector documentSelector) : base(new TextDocumentRegistrationOptions()
public OmniSharpDocumentFormatRangeHandler(Mef.IRequestHandler<FormatRangeRequest, FormatRangeResponse> formatRangeHandler, DocumentSelector documentSelector)
: base(new DocumentRangeFormattingRegistrationOptions()
{
DocumentSelector = documentSelector,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ internal sealed class OmniSharpDocumentFormattingHandler : DocumentFormattingHan
{
public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
{
foreach (var (selector, handler) in handlers
foreach (var (selector, pm, handler) in handlers
.OfType<Mef.IRequestHandler<CodeFormatRequest, CodeFormatResponse>>())
if (handler != null)
yield return new OmniSharpDocumentFormattingHandler(handler, selector);
}

private readonly Mef.IRequestHandler<CodeFormatRequest, CodeFormatResponse> _codeFormatHandler;

public OmniSharpDocumentFormattingHandler(Mef.IRequestHandler<CodeFormatRequest, CodeFormatResponse> codeFormatHandler, DocumentSelector documentSelector) : base(new TextDocumentRegistrationOptions()
public OmniSharpDocumentFormattingHandler(Mef.IRequestHandler<CodeFormatRequest, CodeFormatResponse> codeFormatHandler, DocumentSelector documentSelector)
: base(new DocumentFormattingRegistrationOptions()
{
DocumentSelector = documentSelector,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal sealed class OmniSharpDocumentOnTypeFormatHandler : DocumentOnTypeForma
{
public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
{
foreach (var (selector, handler) in handlers
foreach (var (selector, pm, handler) in handlers
.OfType<Mef.IRequestHandler<FormatAfterKeystrokeRequest, FormatRangeResponse>>())
if (handler != null)
yield return new OmniSharpDocumentOnTypeFormatHandler(handler, selector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.MembersTree;
using OmniSharp.Models.V2.CodeStructure;

namespace OmniSharp.LanguageServerProtocol.Handlers
Expand All @@ -16,10 +15,10 @@ internal sealed class OmniSharpDocumentSymbolHandler : DocumentSymbolHandler
{
public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
{
foreach (var (selector, handler) in handlers
foreach (var (selector, pm, handler) in handlers
.OfType<Mef.IRequestHandler<CodeStructureRequest, CodeStructureResponse>>())
if (handler != null)
yield return new OmniSharpDocumentSymbolHandler(handler, selector);
yield return new OmniSharpDocumentSymbolHandler(handler, selector, pm);
}

private readonly Mef.IRequestHandler<CodeStructureRequest, CodeStructureResponse> _codeStructureHandler;
Expand All @@ -44,11 +43,11 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
{ OmniSharp.Models.V2.SymbolKinds.Unknown, SymbolKind.Class },
};

public OmniSharpDocumentSymbolHandler(Mef.IRequestHandler<CodeStructureRequest, CodeStructureResponse> codeStructureHandler, DocumentSelector documentSelector)
: base(new TextDocumentRegistrationOptions()
public OmniSharpDocumentSymbolHandler(Mef.IRequestHandler<CodeStructureRequest, CodeStructureResponse> codeStructureHandler, DocumentSelector documentSelector, ProgressManager pm)
: base(new DocumentSymbolRegistrationOptions()
{
DocumentSelector = documentSelector
})
}, pm)
{
_codeStructureHandler = codeStructureHandler;
}
Expand All @@ -62,7 +61,7 @@ public async override Task<SymbolInformationOrDocumentSymbolContainer> Handle(Do

var omnisharpResponse = await _codeStructureHandler.Handle(omnisharpRequest);

return omnisharpResponse.Elements?.Select(ToDocumentSymbolInformationOrDocumentSymbol).ToArray() ??
return omnisharpResponse?.Elements?.Select(ToDocumentSymbolInformationOrDocumentSymbol).ToArray() ??
Array.Empty<SymbolInformationOrDocumentSymbol>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.TypeLookup;
Expand All @@ -14,7 +13,7 @@ class OmniSharpHoverHandler : HoverHandler
{
public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
{
foreach (var (selector, handler) in handlers
foreach (var (selector, pm, handler) in handlers
.OfType<Mef.IRequestHandler<TypeLookupRequest, TypeLookupResponse>>())
if (handler != null)
yield return new OmniSharpHoverHandler(handler, selector);
Expand All @@ -23,7 +22,7 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
private readonly Mef.IRequestHandler<TypeLookupRequest, TypeLookupResponse> _definitionHandler;

public OmniSharpHoverHandler(Mef.IRequestHandler<TypeLookupRequest, TypeLookupResponse> definitionHandler, DocumentSelector documentSelector)
: base(new TextDocumentRegistrationOptions()
: base(new HoverRegistrationOptions()
{
DocumentSelector = documentSelector
})
Expand All @@ -47,7 +46,10 @@ public async override Task<Hover> Handle(HoverParams request, CancellationToken
{
// TODO: Range? We don't currently have that!
// Range =
Contents = new MarkedStringsOrMarkupContent(new MarkedStringContainer(Helpers.EscapeMarkdown(omnisharpResponse.Type), Helpers.EscapeMarkdown(omnisharpResponse.Documentation)))
Contents = new MarkedStringsOrMarkupContent(
new MarkedString(
Helpers.EscapeMarkdown(omnisharpResponse.Type),
Helpers.EscapeMarkdown(omnisharpResponse.Documentation)))
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models;
Expand All @@ -16,19 +16,19 @@ internal sealed class OmniSharpReferencesHandler : ReferencesHandler
{
public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
{
foreach (var (selector, handler) in handlers
foreach (var (selector, pm, handler) in handlers
.OfType<Mef.IRequestHandler<FindUsagesRequest, QuickFixResponse>>())
if (handler != null)
yield return new OmniSharpReferencesHandler(handler, selector);
yield return new OmniSharpReferencesHandler(handler, selector, pm);
}

private readonly Mef.IRequestHandler<FindUsagesRequest, QuickFixResponse> _findUsagesHandler;

public OmniSharpReferencesHandler(Mef.IRequestHandler<FindUsagesRequest, QuickFixResponse> findUsagesHandler, DocumentSelector documentSelector)
: base(new TextDocumentRegistrationOptions()
public OmniSharpReferencesHandler(Mef.IRequestHandler<FindUsagesRequest, QuickFixResponse> findUsagesHandler, DocumentSelector documentSelector, ProgressManager pm)
: base(new ReferenceRegistrationOptions()
{
DocumentSelector = documentSelector
})
}, pm)
{
_findUsagesHandler = findUsagesHandler;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public OmniSharpRenameHandler(Mef.IRequestHandler<RenameRequest, RenameResponse>

public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
{
foreach (var (selector, handler) in handlers
foreach (var (selector, pm, handler) in handlers
.OfType<Mef.IRequestHandler<RenameRequest, RenameResponse>>())
if (handler != null)
yield return new OmniSharpRenameHandler(handler, selector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public OmniSharpSignatureHelpHandler(Mef.IRequestHandler<SignatureHelpRequest, S

public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
{
foreach (var (selector, handler) in handlers
foreach (var (selector, pm, handler) in handlers
.OfType<Mef.IRequestHandler<SignatureHelpRequest, SignatureHelpResponse>>())
if (handler != null)
yield return new OmniSharpSignatureHelpHandler(handler, selector);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.Embedded.MediatR;
using MediatR;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Extensions.LanguageServer.Protocol.Server.Capabilities;
Expand All @@ -24,7 +22,7 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(
RequestHandlers handlers,
OmniSharpWorkspace workspace)
{
foreach (var (selector, openHandler, closeHandler, bufferHandler) in handlers
foreach (var (selector, pm, openHandler, closeHandler, bufferHandler) in handlers
.OfType<
Mef.IRequestHandler<FileOpenRequest, FileOpenResponse>,
Mef.IRequestHandler<FileCloseRequest, FileCloseResponse>,
Expand Down
Loading