diff --git a/LanguageServer.Framework/LSPCommunicationBase.cs b/LanguageServer.Framework/LSPCommunicationBase.cs index de7635b..e474d4e 100644 --- a/LanguageServer.Framework/LSPCommunicationBase.cs +++ b/LanguageServer.Framework/LSPCommunicationBase.cs @@ -76,20 +76,20 @@ public LSPCommunicationBase AddHandler(IJsonHandler handler) return this; } - public Task SendNotification(NotificationMessage notification) + public virtual Task SendNotification(NotificationMessage notification) { Writer.WriteNotification(notification); return Task.CompletedTask; } - public async Task SendRequest(string method, JsonDocument? @param, CancellationToken token) + public virtual async Task SendRequest(string method, JsonDocument? @param, CancellationToken token) { var request = ServerRequestManager.MakeRequest(method, @param); Writer.WriteRequest(request); return await ServerRequestManager.WaitResponse(request.Id, token).ConfigureAwait(false); } - public Task SendRequestNoWait(string method, JsonDocument? @param) + public virtual Task SendRequestNoWait(string method, JsonDocument? @param) { var request = ServerRequestManager.MakeRequest(method, @param); Writer.WriteRequest(request); diff --git a/LanguageServer.Framework/Protocol/JsonProtocolContext.cs b/LanguageServer.Framework/Protocol/JsonProtocolContext.cs index 8f4d464..644dbe1 100644 --- a/LanguageServer.Framework/Protocol/JsonProtocolContext.cs +++ b/LanguageServer.Framework/Protocol/JsonProtocolContext.cs @@ -54,9 +54,12 @@ using EmmyLua.LanguageServer.Framework.Protocol.Model.TextEdit; using EmmyLua.LanguageServer.Framework.Protocol.Model.Union; using EmmyLua.LanguageServer.Framework.Protocol.Model.WorkDoneProgress; -using FileSystemWatcher = EmmyLua.LanguageServer.Framework.Protocol.Message.WorkspaceWatchedFile.Watch.FileSystemWatcher; +using EmmyLua.LanguageServer.Framework.Protocol.Union; +using EmmyLua.LanguageServer.Framework.Protocol.Supplement; +using FileSystemWatcher = + EmmyLua.LanguageServer.Framework.Protocol.Message.WorkspaceWatchedFile.Watch.FileSystemWatcher; using FoldingRangeKind = EmmyLua.LanguageServer.Framework.Protocol.Message.FoldingRange.FoldingRangeKind; - +using MessageType = EmmyLua.LanguageServer.Framework.Protocol.Message.Client.ShowMessage.MessageType; namespace EmmyLua.LanguageServer.Framework.Protocol; @@ -308,5 +311,31 @@ namespace EmmyLua.LanguageServer.Framework.Protocol; [JsonSerializable(typeof(ConfigurationItem))] [JsonSerializable(typeof(List))] [JsonSerializable(typeof(List))] +[JsonSerializable(typeof(ShowDocumentResult))] +[JsonSerializable(typeof(MessageActionItem))] +[JsonSerializable(typeof(Moniker))] +[JsonSerializable(typeof(ShowDocumentParams))] +[JsonSerializable(typeof(ShowMessageRequestParams))] +[JsonSerializable(typeof(MonikerParams))] +[JsonSerializable(typeof(MonikerKind))] +[JsonSerializable(typeof(UniquenessLevel))] +[JsonSerializable(typeof(ProgressToken))] +[JsonSerializable(typeof(WorkDoneProgressCancelParams))] +[JsonSerializable(typeof(WorkDoneProgressCreateParams))] +[JsonSerializable(typeof(TextDocumentContentParams))] +[JsonSerializable(typeof(TextDocumentContentResult))] +[JsonSerializable(typeof(LogTraceParams))] +[JsonSerializable(typeof(TextDocumentContentRefreshParams))] +[JsonSerializable(typeof(Hover))] +[JsonSerializable(typeof(MarkedString))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(LogMessageParams))] +[JsonSerializable(typeof(MessageType))] +[JsonSerializable(typeof(DidChangeConfigurationParams))] +[JsonSerializable(typeof(SymbolInformation))] +[JsonSerializable(typeof(MarkedStringsOrMarkupContent.InternalMarkedStrings))] +[JsonSerializable(typeof(MarkedStringsOrMarkupContent.InternalMarkupContent))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(PrepareRenameResult))] // ReSharper disable once ClassNeverInstantiated.Global -public partial class JsonProtocolContext: JsonSerializerContext; +public partial class JsonProtocolContext : JsonSerializerContext; diff --git a/LanguageServer.Framework/Protocol/Model/Kind/MonikerKind.cs b/LanguageServer.Framework/Protocol/Model/Kind/MonikerKind.cs new file mode 100644 index 0000000..89881c4 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Model/Kind/MonikerKind.cs @@ -0,0 +1,27 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Model.Kind; + +[JsonConverter(typeof(MonikerKindJsonConverter))] +public readonly record struct MonikerKind(string Kind) +{ + public static readonly MonikerKind Import = new("import"); + public static readonly MonikerKind Export = new("export"); + public static readonly MonikerKind Local = new("local"); + public string Kind { get; } = Kind; +} + +public class MonikerKindJsonConverter : JsonConverter +{ + public override MonikerKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var value = reader.GetString(); + return new MonikerKind(value!); + } + + public override void Write(Utf8JsonWriter writer, MonikerKind value, JsonSerializerOptions options) + { + writer.WriteStringValue(value.Kind); + } +} diff --git a/LanguageServer.Framework/Protocol/Model/Kind/UniquenessLevel.cs b/LanguageServer.Framework/Protocol/Model/Kind/UniquenessLevel.cs new file mode 100644 index 0000000..5ef42a6 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Model/Kind/UniquenessLevel.cs @@ -0,0 +1,29 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Model.Kind; + +[JsonConverter(typeof(UniquenessLevelJsonConverter))] +public readonly record struct UniquenessLevel(string Level) +{ + public static readonly UniquenessLevel Document = new("document"); + public static readonly UniquenessLevel Project = new("project"); + public static readonly UniquenessLevel Group = new("group"); + public static readonly UniquenessLevel Scheme = new("scheme"); + public static readonly UniquenessLevel Global = new("global"); + public string Level { get; } = Level; +} + +public class UniquenessLevelJsonConverter : JsonConverter +{ + public override UniquenessLevel Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var value = reader.GetString(); + return new UniquenessLevel(value!); + } + + public override void Write(Utf8JsonWriter writer, UniquenessLevel value, JsonSerializerOptions options) + { + writer.WriteStringValue(value.Level); + } +} diff --git a/LanguageServer.Framework/Protocol/Model/Union/MarkedStringsOrMarkupContent.cs b/LanguageServer.Framework/Protocol/Model/Union/MarkedStringsOrMarkupContent.cs new file mode 100644 index 0000000..672b0bb --- /dev/null +++ b/LanguageServer.Framework/Protocol/Model/Union/MarkedStringsOrMarkupContent.cs @@ -0,0 +1,53 @@ +using System.Text.Json; +using System.Text.Json.Nodes; +using System.Text.Json.Serialization; +using EmmyLua.LanguageServer.Framework.Protocol.Model.Markup; +using EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Union; + +[JsonConverter(typeof(MarkedStringsOrMarkupContentJsonConverter))] +public abstract record MarkedStringsOrMarkupContent +{ + public sealed record InternalMarkedStrings(List? MarkedStrings) : MarkedStringsOrMarkupContent; + + public sealed record InternalMarkupContent(MarkupContent? Content) : MarkedStringsOrMarkupContent; +} + +public class MarkedStringsOrMarkupContentJsonConverter : JsonConverter +{ + public override MarkedStringsOrMarkupContent? Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) + { + var jsonNode = JsonNode.Parse(ref reader); + if (reader.TokenType == JsonTokenType.StartObject) + { + if (jsonNode?["language"] is not null && jsonNode.Deserialize(options) is { } markedString) + return new MarkedStringsOrMarkupContent.InternalMarkedStrings([markedString]); + + return new MarkedStringsOrMarkupContent.InternalMarkupContent(jsonNode.Deserialize(options)); + } + + if (reader.TokenType == JsonTokenType.StartArray) + + return new MarkedStringsOrMarkupContent.InternalMarkedStrings(jsonNode.Deserialize>(options)); + + + if (reader.TokenType == JsonTokenType.String) + { + return new MarkedStringsOrMarkupContent.InternalMarkedStrings([ + new MarkedString() { Value = reader.GetString() ?? string.Empty } + ]); + } + + return null; + } + + public override void Write(Utf8JsonWriter writer, MarkedStringsOrMarkupContent value, JsonSerializerOptions options) + { + if (value is MarkedStringsOrMarkupContent.InternalMarkedStrings markedStrings) + writer.WriteRawValue(JsonSerializer.Serialize(markedStrings.MarkedStrings, options)); + if (value is MarkedStringsOrMarkupContent.InternalMarkupContent markedContent) + writer.WriteRawValue(JsonSerializer.Serialize(markedContent.Content, options)); + } +} diff --git a/LanguageServer.Framework/Protocol/Supplement/DidChangeConfigurationParams.cs b/LanguageServer.Framework/Protocol/Supplement/DidChangeConfigurationParams.cs new file mode 100644 index 0000000..f7531a5 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/DidChangeConfigurationParams.cs @@ -0,0 +1,15 @@ +using System.Text.Json.Nodes; +using System.Text.Json.Serialization; +using EmmyLua.LanguageServer.Framework.Protocol.Model; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record DidChangeConfigurationParams +{ + /// + /// The actual changed settings + /// + /// + [JsonPropertyName("settings")] + public LSPAny? Settings { get; init; } +} diff --git a/LanguageServer.Framework/Protocol/Supplement/Hover.cs b/LanguageServer.Framework/Protocol/Supplement/Hover.cs new file mode 100644 index 0000000..c62004f --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/Hover.cs @@ -0,0 +1,14 @@ +using System; +using System.Text.Json; +using System.Text.Json.Serialization; +using EmmyLua.LanguageServer.Framework.Protocol.Model; +using EmmyLua.LanguageServer.Framework.Protocol.Model.Markup; +using EmmyLua.LanguageServer.Framework.Protocol.Union; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record Hover +{ + [JsonPropertyName("contents")] public required MarkedStringsOrMarkupContent Contents { get; init; } + [JsonPropertyName("range")] public DocumentRange? Range { get; init; } +} diff --git a/LanguageServer.Framework/Protocol/Supplement/LogMessageParams.cs b/LanguageServer.Framework/Protocol/Supplement/LogMessageParams.cs new file mode 100644 index 0000000..1943392 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/LogMessageParams.cs @@ -0,0 +1,19 @@ +using System.Text.Json.Serialization; +using EmmyLua.LanguageServer.Framework.Protocol.Message.Client.ShowMessage; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record LogMessageParams +{ + /// + /// The message type. See {@link MessageType} + /// + [JsonPropertyName("type")] + public MessageType Type { get; init; } + + /// + /// The actual message + /// + [JsonPropertyName("message")] + public required string Message { get; init; } +} diff --git a/LanguageServer.Framework/Protocol/Supplement/LogTraceParams.cs b/LanguageServer.Framework/Protocol/Supplement/LogTraceParams.cs new file mode 100644 index 0000000..2158b08 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/LogTraceParams.cs @@ -0,0 +1,9 @@ +using System.Text.Json.Serialization; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public class LogTraceParams +{ + [JsonPropertyName("message")] public required string Message { get; init; } + [JsonPropertyName("verbose")] public string? Verbose { get; init; } +} diff --git a/LanguageServer.Framework/Protocol/Supplement/MarkedString.cs b/LanguageServer.Framework/Protocol/Supplement/MarkedString.cs new file mode 100644 index 0000000..4169b9c --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/MarkedString.cs @@ -0,0 +1,72 @@ +using System; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +[JsonConverter(typeof(MarkedStringJsonConverter))] +public class MarkedString +{ + [JsonPropertyName("language")] public string? Language { get; init; } + + [JsonPropertyName("value")] public required string Value { get; init; } +} + +public class MarkedStringJsonConverter : JsonConverter +{ + public override MarkedString? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case JsonTokenType.String: + return new MarkedString { Value = reader.GetString() ?? string.Empty }; + + case JsonTokenType.StartObject: + string? language = null; + string? value = null; + + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var propName = reader.GetString(); + reader.Read(); // Move to value + + switch (propName) + { + case "language": + language = reader.GetString(); + break; + case "value": + value = reader.GetString(); + break; + } + } + } + + return new MarkedString + { + Language = language, + Value = value ?? string.Empty + }; + + default: + return new MarkedString { Value = string.Empty }; + } + } + + public override void Write(Utf8JsonWriter writer, MarkedString value, JsonSerializerOptions options) + { + if (string.IsNullOrWhiteSpace(value.Language)) + { + writer.WriteStringValue(value.Value); + } + else + { + writer.WriteStartObject(); + writer.WriteString("language", value.Language); + writer.WriteString("value", value.Value); + writer.WriteEndObject(); + } + } +} diff --git a/LanguageServer.Framework/Protocol/Supplement/MessageActionItem.cs b/LanguageServer.Framework/Protocol/Supplement/MessageActionItem.cs new file mode 100644 index 0000000..6383a72 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/MessageActionItem.cs @@ -0,0 +1,8 @@ +using System.Text.Json.Serialization; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record MessageActionItem +{ + [JsonPropertyName("title")] public required string Title { get; init; } +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/MessageType.cs b/LanguageServer.Framework/Protocol/Supplement/MessageType.cs new file mode 100644 index 0000000..2248959 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/MessageType.cs @@ -0,0 +1,24 @@ +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public enum MessageType +{ + /// + /// An error message. + /// + Error = 1, + + /// + /// A warning message. + /// + Warning = 2, + + /// + /// An information message. + /// + Info = 3, + + /// + /// A log message. + /// + Log = 4, +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/Moniker.cs b/LanguageServer.Framework/Protocol/Supplement/Moniker.cs new file mode 100644 index 0000000..92644c4 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/Moniker.cs @@ -0,0 +1,33 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using EmmyLua.LanguageServer.Framework.Protocol.Model.Kind; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public class Moniker +{ + /// + /// The scheme of the moniker. For example tsc or .Net + /// + [JsonPropertyName("scheme")] + public required string Scheme { get; init; } + + /// + /// The identifier of the moniker. The value is opaque in LSIF however + /// schema owners are allowed to define the structure if they want. + /// + [JsonPropertyName("identifier")] + public required string Identifier { get; init; } + + /// + /// The scope in which the moniker is unique + /// + [JsonPropertyName("unique")] + public required UniquenessLevel Unique { get; init; } + + /// + /// The moniker kind if known. + /// + [JsonPropertyName("kind")] + public MonikerKind Kind { get; init; } +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/MonikerParams.cs b/LanguageServer.Framework/Protocol/Supplement/MonikerParams.cs new file mode 100644 index 0000000..36b86dd --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/MonikerParams.cs @@ -0,0 +1,10 @@ +using EmmyLua.LanguageServer.Framework.Protocol.Message.Interface; +using EmmyLua.LanguageServer.Framework.Protocol.Model.TextDocument; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public sealed class MonikerParams : TextDocumentPositionParams, IWorkDoneProgressParams, IPartialResultParams +{ + public string? WorkDoneToken { get; set; } + public string? PartialResultToken { get; set; } +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/PrepareRenameResult.cs b/LanguageServer.Framework/Protocol/Supplement/PrepareRenameResult.cs new file mode 100644 index 0000000..02cdb99 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/PrepareRenameResult.cs @@ -0,0 +1,11 @@ +using System.Text.Json.Serialization; +using EmmyLua.LanguageServer.Framework.Protocol.Model; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record PrepareRenameResult +{ + [JsonPropertyName("range")] public required DocumentRange Range { get; init; } + [JsonPropertyName("placeholder")] public string? Placeholder { get; init; } + [JsonPropertyName("defaultBehavior")] public bool DefaultBehavior { get; init; } +} diff --git a/LanguageServer.Framework/Protocol/Supplement/ProgressToken.cs b/LanguageServer.Framework/Protocol/Supplement/ProgressToken.cs new file mode 100644 index 0000000..6a3b126 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/ProgressToken.cs @@ -0,0 +1,42 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using EmmyLua.LanguageServer.Framework.Protocol.Model.Union; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +[JsonConverter(typeof(ProgressTokenJsonConverter))] +public sealed class ProgressToken : StringOrInt +{ + public ProgressToken(string value) : base(value) + { + } + + public ProgressToken(int value) : base(value) + { + } +} + +public class ProgressTokenJsonConverter : JsonConverter +{ + public override ProgressToken Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType == JsonTokenType.Number) + { + return new ProgressToken(reader.GetInt32()); + } + + return new ProgressToken(reader.GetString()!); + } + + public override void Write(Utf8JsonWriter writer, ProgressToken value, JsonSerializerOptions options) + { + if (value.StringValue != null) + { + writer.WriteStringValue(value.StringValue); + } + else + { + writer.WriteNumberValue(value.IntValue); + } + } +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/ShowDocumentParams.cs b/LanguageServer.Framework/Protocol/Supplement/ShowDocumentParams.cs new file mode 100644 index 0000000..0de8758 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/ShowDocumentParams.cs @@ -0,0 +1,40 @@ +using System.Runtime.InteropServices; +using System.Text.Json.Serialization; +using EmmyLua.LanguageServer.Framework.Protocol.Model; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record ShowDocumentParams +{ + /// + /// The document uri to show. + /// + [JsonPropertyName("uri")] + public required DocumentUri Uri { get; init; } + + /// + /// Indicates to show the resource in an external program. + /// To show, for example, `https://code.visualstudio.com/` + /// in the default WEB browser set `external` to `true`. + /// + [JsonPropertyName("external")] + public bool? External { get; init; } + + /// + /// An optional property to indicate whether the editor + /// showing the document should take focus or not. + /// Clients might ignore this property if an external + /// program is started. + /// + [JsonPropertyName("takeFocus")] + public bool? TakeFocus { get; init; } + + /// + /// An optional selection range if the document is a text + /// document. Clients might ignore the property if an + /// external program is started or the file is not a text + /// file. + /// + [JsonPropertyName("selection")] + public Range? Selection { get; init; } +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/ShowDocumentResult.cs b/LanguageServer.Framework/Protocol/Supplement/ShowDocumentResult.cs new file mode 100644 index 0000000..f8de245 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/ShowDocumentResult.cs @@ -0,0 +1,13 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record ShowDocumentResult() +{ + /// + /// A boolean indicating if the show was successful. + /// + [JsonPropertyName("success")] + public bool Success { get; init; } +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/ShowMessageRequestParams.cs b/LanguageServer.Framework/Protocol/Supplement/ShowMessageRequestParams.cs new file mode 100644 index 0000000..b9cc1d4 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/ShowMessageRequestParams.cs @@ -0,0 +1,24 @@ +using System.Text.Json.Serialization; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record ShowMessageRequestParams +{ + /// + /// The message type. See {@link MessageType} + /// + [JsonPropertyName("type")] + public required MessageType Type { get; init; } + + /// + /// The actual message + /// + [JsonPropertyName("message")] + public required string Message { get; init; } + + /// + /// The message action items to present. + /// + [JsonPropertyName("actions")] + public List? Actions { get; init; } +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/SymbolInformation.cs b/LanguageServer.Framework/Protocol/Supplement/SymbolInformation.cs new file mode 100644 index 0000000..7701c02 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/SymbolInformation.cs @@ -0,0 +1,66 @@ +using System.Collections.Generic; +using System.Text.Json.Serialization; +using EmmyLua.LanguageServer.Framework.Protocol.Message.DocumentSymbol; +using EmmyLua.LanguageServer.Framework.Protocol.Model; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +/** + * Represents information about programming constructs like variables, classes, + * interfaces etc. + * + * @deprecated use DocumentSymbol or WorkspaceSymbol instead. + */ +public record SymbolInformation +{ + /** + * The name of this symbol. + */ + [JsonPropertyName("name")] + public required string Name { get; init; } + + /** + * The kind of this symbol. + */ + [JsonPropertyName("kind")] + public required SymbolKind Kind { get; init; } + + /** + * Tags for this symbol. + * + * @since 3.16.0 + */ + [JsonPropertyName("tags")] + public List? Tags { get; init; } + + /** + * Indicates if this symbol is deprecated. + * + * @deprecated Use tags instead + */ + [JsonPropertyName("deprecated")] + public bool? Deprecated { get; init; } + + /** + * The location of this symbol. The location's range is used by a tool + * to reveal the location in the editor. If the symbol is selected in the + * tool the range's start information is used to position the cursor. So + * the range usually spans more then the actual symbol's name and does + * normally include things like visibility modifiers. + * + * The range doesn't have to denote a node range in the sense of an abstract + * syntax tree. It can therefore not be used to re-construct a hierarchy of + * the symbols. + */ + [JsonPropertyName("location")] + public required Location Location { get; init; } + + /** + * The name of the symbol containing this symbol. This information is for + * user interface purposes (e.g. to render a qualifier in the user interface + * if necessary). It can't be used to re-infer a hierarchy for the document + * symbols. + */ + [JsonPropertyName("containerName")] + public string? ContainerName { get; init; } +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/TextDocumentContentParams.cs b/LanguageServer.Framework/Protocol/Supplement/TextDocumentContentParams.cs new file mode 100644 index 0000000..f7b0b2b --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/TextDocumentContentParams.cs @@ -0,0 +1,9 @@ +using System.Text.Json.Serialization; +using EmmyLua.LanguageServer.Framework.Protocol.Model; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record TextDocumentContentParams +{ + [JsonPropertyName("uri")] public required DocumentUri Uri { get; init; } +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/TextDocumentContentRefreshParams.cs b/LanguageServer.Framework/Protocol/Supplement/TextDocumentContentRefreshParams.cs new file mode 100644 index 0000000..9ed0d2e --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/TextDocumentContentRefreshParams.cs @@ -0,0 +1,9 @@ +using System.Text.Json.Serialization; +using EmmyLua.LanguageServer.Framework.Protocol.Model; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record TextDocumentContentRefreshParams() +{ + [JsonPropertyName("uri")] public required DocumentUri Uri { get; init; } +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/TextDocumentContentResult.cs b/LanguageServer.Framework/Protocol/Supplement/TextDocumentContentResult.cs new file mode 100644 index 0000000..f2ee915 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/TextDocumentContentResult.cs @@ -0,0 +1,8 @@ +using System.Text.Json.Serialization; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record TextDocumentContentResult +{ + [JsonPropertyName("text")] public required string Text { get; init; } +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/WorkDoneProgressCancelParams.cs b/LanguageServer.Framework/Protocol/Supplement/WorkDoneProgressCancelParams.cs new file mode 100644 index 0000000..618b5c4 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/WorkDoneProgressCancelParams.cs @@ -0,0 +1,8 @@ +using System.Text.Json.Serialization; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record WorkDoneProgressCancelParams +{ + [JsonPropertyName("token")] public required ProgressToken Token { get; init; } +} \ No newline at end of file diff --git a/LanguageServer.Framework/Protocol/Supplement/WorkDoneProgressCreateParams.cs b/LanguageServer.Framework/Protocol/Supplement/WorkDoneProgressCreateParams.cs new file mode 100644 index 0000000..9bc4b63 --- /dev/null +++ b/LanguageServer.Framework/Protocol/Supplement/WorkDoneProgressCreateParams.cs @@ -0,0 +1,8 @@ +using System.Text.Json.Serialization; + +namespace EmmyLua.LanguageServer.Framework.Protocol.Supplement; + +public record WorkDoneProgressCreateParams +{ + [JsonPropertyName("token")] public required ProgressToken Token { get; init; } +} \ No newline at end of file