Skip to content

Commit

Permalink
Merge pull request #126 from OmniSharp/upgrade/latest-lsp
Browse files Browse the repository at this point in the history
Upgrade/latest lsp
  • Loading branch information
david-driscoll authored Mar 16, 2019
2 parents 2bc2687 + 705f295 commit 7a157ab
Show file tree
Hide file tree
Showing 106 changed files with 1,334 additions and 458 deletions.
4 changes: 3 additions & 1 deletion language-server-protocol.sha.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
-- This is the last commit we caught up with https://github.com/Microsoft/language-server-protocol/commits/gh-pages
9e2713d5f1618b8d5e05a91a4e2c637aa51e1ee0
lastSha: 1a69f1270d59cccd7b85e0697450950abd5a0221

https://github.com/Microsoft/language-server-protocol/compare/<lastSha>..<newSha>
5 changes: 5 additions & 0 deletions src/Client/LspErrorCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,10 @@ public static class LspErrorCodes
/// Request was cancelled.
/// </summary>
public const int RequestCancelled = -32800;

/// <summary>
/// Request was cancelled.
/// </summary>
public const int ContentModified = -32801;
}
}
File renamed without changes.
6 changes: 6 additions & 0 deletions src/Protocol/Client/Capabilities/DeclarationCapability.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Server;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
{
public class DeclarationCapability : LinkSupportCapability, ConnectedCapability<IDeclarationHandler> { }
}
2 changes: 1 addition & 1 deletion src/Protocol/Client/Capabilities/DefinitionCapability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
{
public class DefinitionCapability : DynamicCapability, ConnectedCapability<IDefinitionHandler> { }
public class DefinitionCapability : LinkSupportCapability, ConnectedCapability<IDefinitionHandler> { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
{
public class ImplementationCapability : DynamicCapability, ConnectedCapability<IImplementationHandler> {}
public class ImplementationCapability : LinkSupportCapability, ConnectedCapability<IImplementationHandler> {}
}
10 changes: 10 additions & 0 deletions src/Protocol/Client/Capabilities/LinkSupportCapability.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
{
public abstract class LinkSupportCapability : DynamicCapability
{
[Optional]
public bool LinkSupport { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public class SignatureInformationCapability
/// Client supports the follow content formats for the content property. The order describes the preferred format of the client.
/// </summary>
[Optional]
public Container<MarkupKind> ContentFormat { get; set; }
public Container<MarkupKind> DocumentationFormat { get; set; }

[Optional]
public SignatureParameterInformationCapability ParameterInformation { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
{
public class SignatureParameterInformationCapability
{
/// <summary>
/// The client supports processing label offsets instead of a
/// simple label string.
/// </summary>
[Optional]
public bool LabelOffsetSupport { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public class TextDocumentClientCapabilities
/// </summary>
public Supports<DefinitionCapability> Definition { get; set; }

/// <summary>
/// Capabilities specific to the `textDocument/declaration`
/// </summary>
public Supports<DeclarationCapability> Declaration { get; set; }

/// <summary>
/// Capabilities specific to the `textDocument/codeAction`
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
{
public class TypeDefinitionCapability : DynamicCapability, ConnectedCapability<ITypeDefinitionHandler> {}
public class TypeDefinitionCapability : LinkSupportCapability, ConnectedCapability<ITypeDefinitionHandler> {}
}
13 changes: 13 additions & 0 deletions src/Protocol/Client/Capabilities/WorkspaceEditCapability.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
Expand All @@ -11,5 +12,17 @@ public class WorkspaceEditCapability
/// </summary>
[Optional]
public bool DocumentChanges { get; set; }
/// <summary>
/// The resource operations the client supports. Clients should at least
/// support 'create', 'rename' and 'delete' files and folders.
/// </summary>
[Optional]
public ResourceOperationKind[] ResourceOperations { get; set; }
/// <summary>
/// The failure handling strategy of a client if applying the workspace edit
/// fails.
/// </summary>
[Optional]
public FailureHandlingKind? FailureHandling { get; set; }
}
}
17 changes: 17 additions & 0 deletions src/Protocol/Document/Client/DeclarationExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Threading.Tasks;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;

// ReSharper disable CheckNamespace

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client
{
public static class DeclarationExtensions
{
public static Task<LocationOrLocationLinks> Declaration(this ILanguageClientDocument mediator, DeclarationParams @params)
{
return mediator.SendRequest<DeclarationParams, LocationOrLocationLinks>(DocumentNames.Declaration, @params);
}
}
}
4 changes: 2 additions & 2 deletions src/Protocol/Document/Client/DefinitionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Client
{
public static class DefinitionExtensions
{
public static Task<LocationOrLocations> Definition(this ILanguageClientDocument mediator, DefinitionParams @params)
public static Task<LocationOrLocationLinks> Definition(this ILanguageClientDocument mediator, DefinitionParams @params)
{
return mediator.SendRequest<DefinitionParams, LocationOrLocations>(DocumentNames.Definition, @params);
return mediator.SendRequest<DefinitionParams, LocationOrLocationLinks>(DocumentNames.Definition, @params);
}
}
}
4 changes: 2 additions & 2 deletions src/Protocol/Document/Client/DocumentSymbolExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Client
{
public static class DocumentSymbolExtensions
{
public static Task<DocumentSymbolInformationOrDocumentSymbolContainer> DocumentSymbol(this ILanguageClientDocument mediator, DocumentSymbolParams @params)
public static Task<SymbolInformationOrDocumentSymbolContainer> DocumentSymbol(this ILanguageClientDocument mediator, DocumentSymbolParams @params)
{
return mediator.SendRequest<DocumentSymbolParams, DocumentSymbolInformationOrDocumentSymbolContainer>(DocumentNames.DocumentSymbol, @params);
return mediator.SendRequest<DocumentSymbolParams, SymbolInformationOrDocumentSymbolContainer>(DocumentNames.DocumentSymbol, @params);
}
}
}
4 changes: 2 additions & 2 deletions src/Protocol/Document/Client/ImplementationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Client
{
public static class ImplementationExtensions
{
public static Task<LocationOrLocations> Implementation(this ILanguageClientDocument mediator, ImplementationParams @params)
public static Task<LocationOrLocationLinks> Implementation(this ILanguageClientDocument mediator, ImplementationParams @params)
{
return mediator.SendRequest<ImplementationParams, LocationOrLocations>(DocumentNames.Implementation, @params);
return mediator.SendRequest<ImplementationParams, LocationOrLocationLinks>(DocumentNames.Implementation, @params);
}
}
}
4 changes: 2 additions & 2 deletions src/Protocol/Document/Client/TypeDefinitionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Client
{
public static class TypeDefinitionExtensions
{
public static Task<LocationOrLocations> TypeDefinition(this ILanguageClientDocument mediator, TypeDefinitionParams @params)
public static Task<LocationOrLocationLinks> TypeDefinition(this ILanguageClientDocument mediator, TypeDefinitionParams @params)
{
return mediator.SendRequest<TypeDefinitionParams, LocationOrLocations>(DocumentNames.TypeDefinition, @params);
return mediator.SendRequest<TypeDefinitionParams, LocationOrLocationLinks>(DocumentNames.TypeDefinition, @params);
}
}
}
12 changes: 12 additions & 0 deletions src/Protocol/Document/Server/IDeclarationHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;

// ReSharper disable CheckNamespace

namespace OmniSharp.Extensions.LanguageServer.Protocol.Server
{
using static DocumentNames;
[Parallel, Method(Declaration)]
public interface IDeclarationHandler : IJsonRpcRequestHandler<DeclarationParams, LocationOrLocationLinks>, IRegistration<TextDocumentRegistrationOptions>, ICapability<DeclarationCapability> { }
}
2 changes: 1 addition & 1 deletion src/Protocol/Document/Server/IDefinitionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Server
{
using static DocumentNames;
[Parallel, Method(Definition)]
public interface IDefinitionHandler : IJsonRpcRequestHandler<DefinitionParams, LocationOrLocations>, IRegistration<TextDocumentRegistrationOptions>, ICapability<DefinitionCapability> { }
public interface IDefinitionHandler : IJsonRpcRequestHandler<DefinitionParams, LocationOrLocationLinks>, IRegistration<TextDocumentRegistrationOptions>, ICapability<DefinitionCapability> { }
}
2 changes: 1 addition & 1 deletion src/Protocol/Document/Server/IDocumentSymbolHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Server
{
using static DocumentNames;
[Parallel, Method(DocumentSymbol)]
public interface IDocumentSymbolHandler : IJsonRpcRequestHandler<DocumentSymbolParams, DocumentSymbolInformationOrDocumentSymbolContainer>, IRegistration<TextDocumentRegistrationOptions>, ICapability<DocumentSymbolCapability> { }
public interface IDocumentSymbolHandler : IJsonRpcRequestHandler<DocumentSymbolParams, SymbolInformationOrDocumentSymbolContainer>, IRegistration<TextDocumentRegistrationOptions>, ICapability<DocumentSymbolCapability> { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Server
{
using static DocumentNames;
[Parallel, Method(Implementation)]
public interface IImplementationHandler : IJsonRpcRequestHandler<ImplementationParams, LocationOrLocations>, IRegistration<TextDocumentRegistrationOptions>, ICapability<ImplementationCapability> { }
public interface IImplementationHandler : IJsonRpcRequestHandler<ImplementationParams, LocationOrLocationLinks>, IRegistration<TextDocumentRegistrationOptions>, ICapability<ImplementationCapability> { }
}
2 changes: 1 addition & 1 deletion src/Protocol/Document/Server/ITypeDefinitionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Server
{
using static DocumentNames;
[Parallel, Method(TypeDefinition)]
public interface ITypeDefinitionHandler : IJsonRpcRequestHandler<TypeDefinitionParams, LocationOrLocations>, IRegistration<TextDocumentRegistrationOptions>, ICapability<TypeDefinitionCapability> { }
public interface ITypeDefinitionHandler : IJsonRpcRequestHandler<TypeDefinitionParams, LocationOrLocationLinks>, IRegistration<TextDocumentRegistrationOptions>, ICapability<TypeDefinitionCapability> { }
}
1 change: 1 addition & 0 deletions src/Protocol/DocumentNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public static class DocumentNames
public const string Completion = "textDocument/completion";
public const string CompletionResolve = "completionItem/resolve";
public const string Definition = "textDocument/definition";
public const string Declaration = "textDocument/declaration";
public const string DidChange = "textDocument/didChange";
public const string DidClose = "textDocument/didClose";
public const string DidOpen = "textDocument/didOpen";
Expand Down
40 changes: 15 additions & 25 deletions src/Protocol/Models/BooleanNumberString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,49 +27,39 @@ public BooleanNumberString(bool value)
_bool = value;
}

public bool IsLong => this._long.HasValue;
public bool IsLong => _long.HasValue;
public long Long
{
get { return _long ?? 0; }
get => _long ?? 0;
set
{
this.String = null;
this._long = value;
this._bool = null;
String = null;
_long = value;
_bool = null;
}
}

public bool IsString => this._string != null;
public bool IsString => _string != null;
public string String
{
get { return this._string; }
get => _string;
set
{
this._string = value;
this._long = null;
this._bool = null;
_string = value;
_long = null;
_bool = null;
}
}

public bool IsBool => this._bool.HasValue;
public bool IsBool => _bool.HasValue;
public bool Bool
{
get { return this._bool.HasValue && this._bool.Value; }
get => _bool.HasValue && _bool.Value;
set
{
this.String = null;
this._long = null;
this._bool = value;
}
}
public object Value
{
get
{
if (IsBool) return Bool;
if (IsLong) return Long;
if (IsString) return String;
return null;
String = null;
_long = null;
_bool = value;
}
}

Expand Down
25 changes: 8 additions & 17 deletions src/Protocol/Models/BooleanString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,25 @@ public BooleanString(bool value)
_bool = value;
}

public bool IsString => this._string != null;
public bool IsString => _string != null;
public string String
{
get { return this._string; }
get => _string;
set
{
this._string = value;
this._bool = null;
_string = value;
_bool = null;
}
}

public bool IsBool => this._bool.HasValue;
public bool IsBool => _bool.HasValue;
public bool Bool
{
get { return this._bool.HasValue && this._bool.Value; }
get => _bool.HasValue && _bool.Value;
set
{
this.String = null;
this._bool = value;
}
}
public object Value
{
get
{
if (IsBool) return Bool;
if (IsString) return String;
return null;
String = null;
_bool = value;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/Protocol/Models/CodeActionKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,5 @@ public CodeActionKind(string kind)
}

public string Kind { get; }

}
}
24 changes: 24 additions & 0 deletions src/Protocol/Models/CreateFile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Models
{
/// <summary>
/// Create file operation
/// </summary>
public class CreateFile : IFile
{
/// <summary>
/// A create
/// </summary>
public ResourceOperationKind Kind { get; } = ResourceOperationKind.Create;
/// <summary>
/// The resource to create.
/// </summary>
public string Uri { get; set; }
/// <summary>
/// Additional Options
/// </summary>
[Optional]
public CreateFileOptions Options { get; set; }
}
}
21 changes: 21 additions & 0 deletions src/Protocol/Models/CreateFileOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Models
{
/// <summary>
/// Options to create a file.
/// </summary>
public class CreateFileOptions
{
/// <summary>
/// Overwrite existing file. Overwrite wins over `ignoreIfExists`
/// </summary>
[Optional]
public bool Overwrite { get; set; }
/// <summary>
/// Ignore if exists.
/// </summary>
[Optional]
public bool IgnoreIfExists { get; set; }
}
}
Loading

0 comments on commit 7a157ab

Please sign in to comment.