-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from OmniSharp/latest-lsp
Reacting to latest changes for LSP
- Loading branch information
Showing
22 changed files
with
509 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using OmniSharp.Extensions.JsonRpc; | ||
|
||
namespace OmniSharp.Extensions.LanguageServer | ||
{ | ||
public static class HandlerTypeHelpers | ||
{ | ||
private static readonly Type[] HandlerTypes = { typeof(INotificationHandler), typeof(INotificationHandler<>), typeof(IRequestHandler<>), typeof(IRequestHandler<,>), }; | ||
|
||
private static bool IsValidInterface(Type type) | ||
{ | ||
if (type.GetTypeInfo().IsGenericType) | ||
{ | ||
return HandlerTypes.Contains(type.GetGenericTypeDefinition()); | ||
} | ||
return HandlerTypes.Contains(type); | ||
} | ||
|
||
public static Type GetHandlerInterface(Type type) | ||
{ | ||
return type?.GetTypeInfo() | ||
.ImplementedInterfaces | ||
.First(IsValidInterface); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Serialization; | ||
|
||
namespace OmniSharp.Extensions.LanguageServer.Models | ||
{ | ||
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] | ||
public class TextDocumentEdit | ||
{ | ||
/// <summary> | ||
/// The text document to change. | ||
/// </summary> | ||
public VersionedTextDocumentIdentifier TextDocument { get; set; } | ||
|
||
/// <summary> | ||
/// The edits to be applied. | ||
/// </summary> | ||
public Container<TextEdit> Edits { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using OmniSharp.Extensions.LanguageServer.Models; | ||
|
||
// ReSharper disable CheckNamespace | ||
|
||
namespace OmniSharp.Extensions.LanguageServer.Protocol | ||
{ | ||
public static class CancelRequestExtensions | ||
{ | ||
public static void CancelRequest(this ILanguageServer mediator, CancelParams @params) | ||
{ | ||
mediator.SendNotification<CancelParams>("$/cancelRequest", @params); | ||
} | ||
|
||
public static void CancelRequest(this ILanguageServer mediator, string id) | ||
{ | ||
mediator.SendNotification<CancelParams>("$/cancelRequest", new CancelParams() { Id = id }); | ||
} | ||
|
||
public static void CancelRequest(this ILanguageServer mediator, long id) | ||
{ | ||
mediator.SendNotification<CancelParams>("$/cancelRequest", new CancelParams() { Id = id }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.