2020-04-27 21:38:35 +01:00
|
|
|
const std = @import("std");
|
2021-10-02 23:15:08 +01:00
|
|
|
const string = []const u8;
|
2021-10-02 23:13:22 +01:00
|
|
|
|
2020-11-06 08:08:20 +00:00
|
|
|
// LSP types
|
2022-09-30 05:04:27 +01:00
|
|
|
// https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/
|
2020-04-27 21:38:35 +01:00
|
|
|
|
|
|
|
pub const Position = struct {
|
2022-09-16 01:33:49 +01:00
|
|
|
line: u32,
|
|
|
|
character: u32,
|
2020-04-27 21:38:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
pub const Range = struct {
|
2020-07-05 23:32:14 +01:00
|
|
|
start: Position,
|
|
|
|
end: Position,
|
2020-04-27 21:38:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
pub const Location = struct {
|
2021-10-02 23:15:08 +01:00
|
|
|
uri: string,
|
2020-11-06 08:08:20 +00:00
|
|
|
range: Range,
|
2020-04-27 21:38:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Id of a request
|
|
|
|
pub const RequestId = union(enum) {
|
2021-10-02 23:15:08 +01:00
|
|
|
String: string,
|
2022-09-30 05:04:27 +01:00
|
|
|
Integer: i32,
|
2020-05-25 23:51:50 +01:00
|
|
|
};
|
|
|
|
|
2020-04-27 21:38:35 +01:00
|
|
|
/// Params of a response (result)
|
|
|
|
pub const ResponseParams = union(enum) {
|
2021-04-02 18:49:01 +01:00
|
|
|
SignatureHelp: SignatureHelp,
|
2020-05-18 21:19:23 +01:00
|
|
|
CompletionList: CompletionList,
|
|
|
|
Location: Location,
|
2020-05-25 23:51:50 +01:00
|
|
|
Hover: Hover,
|
2020-06-13 19:20:04 +01:00
|
|
|
DocumentSymbols: []DocumentSymbol,
|
2022-09-30 05:04:27 +01:00
|
|
|
SemanticTokensFull: SemanticTokens,
|
2022-07-24 12:38:13 +01:00
|
|
|
InlayHint: []InlayHint,
|
2020-06-16 20:02:31 +01:00
|
|
|
TextEdits: []TextEdit,
|
2020-07-05 23:32:14 +01:00
|
|
|
Locations: []Location,
|
2020-06-27 01:16:14 +01:00
|
|
|
WorkspaceEdit: WorkspaceEdit,
|
2020-11-06 08:08:20 +00:00
|
|
|
InitializeResult: InitializeResult,
|
2021-12-17 01:41:21 +00:00
|
|
|
ConfigurationParams: ConfigurationParams,
|
2022-07-11 14:45:31 +01:00
|
|
|
RegistrationParams: RegistrationParams,
|
2022-05-08 04:03:40 +01:00
|
|
|
DocumentHighlight: []DocumentHighlight,
|
2022-09-24 20:29:24 +01:00
|
|
|
CodeAction: []CodeAction,
|
|
|
|
ApplyEdit: ApplyWorkspaceEditParams,
|
2022-10-25 15:35:16 +01:00
|
|
|
FoldingRange: []FoldingRange,
|
2020-04-27 21:38:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
pub const Response = struct {
|
2021-10-02 23:15:08 +01:00
|
|
|
jsonrpc: string = "2.0",
|
2020-04-27 21:38:35 +01:00
|
|
|
id: RequestId,
|
|
|
|
result: ResponseParams,
|
|
|
|
};
|
|
|
|
|
2021-12-17 01:41:21 +00:00
|
|
|
pub const Request = struct {
|
|
|
|
jsonrpc: string = "2.0",
|
2022-07-11 14:45:31 +01:00
|
|
|
id: RequestId,
|
2021-12-17 01:41:21 +00:00
|
|
|
method: []const u8,
|
|
|
|
params: ?ResponseParams,
|
|
|
|
};
|
|
|
|
|
2022-09-30 05:04:27 +01:00
|
|
|
pub const ResponseError = struct {
|
|
|
|
code: i32,
|
|
|
|
message: string,
|
|
|
|
data: std.json.Value,
|
|
|
|
};
|
|
|
|
|
|
|
|
pub const ErrorCodes = enum(i32) {
|
|
|
|
// Defined by JSON-RPC
|
|
|
|
ParseError = -32700,
|
|
|
|
InvalidRequest = -32600,
|
|
|
|
MethodNotFound = -32601,
|
|
|
|
InvalidParams = -32602,
|
|
|
|
InternalError = -32603,
|
|
|
|
|
|
|
|
// JSON-RPC reserved error codes
|
|
|
|
ServerNotInitialized = -32002,
|
|
|
|
UnknownErrorCode = -3200,
|
|
|
|
|
|
|
|
// LSP reserved error codes
|
|
|
|
RequestFailed = -32803,
|
|
|
|
ServerCancelled = -32802,
|
|
|
|
ContentModified = -32801,
|
|
|
|
RequestCancelled = -32800,
|
|
|
|
};
|
|
|
|
|
|
|
|
pub const Notification = struct {
|
|
|
|
jsonrpc: string = "2.0",
|
|
|
|
method: string,
|
|
|
|
params: NotificationParams,
|
|
|
|
};
|
|
|
|
|
|
|
|
pub const NotificationParams = union(enum) {
|
|
|
|
LogMessage: struct {
|
|
|
|
type: MessageType,
|
|
|
|
message: string,
|
|
|
|
},
|
|
|
|
PublishDiagnostics: struct {
|
|
|
|
uri: string,
|
|
|
|
diagnostics: []Diagnostic,
|
|
|
|
},
|
|
|
|
ShowMessage: struct {
|
|
|
|
type: MessageType,
|
|
|
|
message: string,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-04-27 21:38:35 +01:00
|
|
|
/// Type of a debug message
|
2020-11-06 08:08:20 +00:00
|
|
|
pub const MessageType = enum(i64) {
|
2020-04-27 21:38:35 +01:00
|
|
|
Error = 1,
|
|
|
|
Warning = 2,
|
|
|
|
Info = 3,
|
|
|
|
Log = 4,
|
|
|
|
|
2021-10-01 02:45:45 +01:00
|
|
|
pub fn jsonStringify(value: MessageType, options: std.json.StringifyOptions, out_stream: anytype) !void {
|
|
|
|
try std.json.stringify(@enumToInt(value), options, out_stream);
|
2020-04-27 21:38:35 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-11-06 08:08:20 +00:00
|
|
|
pub const DiagnosticSeverity = enum(i64) {
|
2020-04-27 21:38:35 +01:00
|
|
|
Error = 1,
|
|
|
|
Warning = 2,
|
|
|
|
Information = 3,
|
|
|
|
Hint = 4,
|
|
|
|
|
2021-10-01 02:47:19 +01:00
|
|
|
pub fn jsonStringify(value: DiagnosticSeverity, options: std.json.StringifyOptions, out_stream: anytype) !void {
|
|
|
|
try std.json.stringify(@enumToInt(value), options, out_stream);
|
2020-04-27 21:38:35 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-09-01 01:48:42 +01:00
|
|
|
pub const DiagnosticRelatedInformation = struct {
|
|
|
|
location: Location,
|
|
|
|
message: string,
|
|
|
|
};
|
|
|
|
|
2020-04-27 21:38:35 +01:00
|
|
|
pub const Diagnostic = struct {
|
|
|
|
range: Range,
|
2022-09-25 00:01:31 +01:00
|
|
|
severity: ?DiagnosticSeverity,
|
|
|
|
code: ?string,
|
|
|
|
source: ?string,
|
2021-10-02 23:15:08 +01:00
|
|
|
message: string,
|
2022-09-30 05:04:55 +01:00
|
|
|
relatedInformation: ?[]DiagnosticRelatedInformation = null,
|
2020-04-27 21:38:35 +01:00
|
|
|
};
|
|
|
|
|
2020-06-27 01:16:14 +01:00
|
|
|
pub const WorkspaceEdit = struct {
|
2022-08-29 20:28:05 +01:00
|
|
|
changes: std.StringHashMapUnmanaged(std.ArrayListUnmanaged(TextEdit)),
|
2020-06-27 01:16:14 +01:00
|
|
|
|
2021-10-01 01:51:51 +01:00
|
|
|
pub fn jsonStringify(self: WorkspaceEdit, options: std.json.StringifyOptions, writer: anytype) @TypeOf(writer).Error!void {
|
2022-08-29 20:28:05 +01:00
|
|
|
try writer.writeAll("{\"changes\": {");
|
|
|
|
var it = self.changes.iterator();
|
|
|
|
var idx: usize = 0;
|
|
|
|
while (it.next()) |entry| : (idx += 1) {
|
|
|
|
if (idx != 0) try writer.writeAll(", ");
|
|
|
|
|
|
|
|
try writer.writeByte('"');
|
|
|
|
try writer.writeAll(entry.key_ptr.*);
|
|
|
|
try writer.writeAll("\":");
|
|
|
|
try std.json.stringify(entry.value_ptr.items, options, writer);
|
2020-06-27 01:16:14 +01:00
|
|
|
}
|
2022-08-29 20:28:05 +01:00
|
|
|
try writer.writeAll("}}");
|
2020-06-27 01:16:14 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-04-27 21:38:35 +01:00
|
|
|
pub const TextEdit = struct {
|
|
|
|
range: Range,
|
2021-10-02 23:15:08 +01:00
|
|
|
newText: string,
|
2020-05-02 17:43:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
pub const MarkupContent = struct {
|
2020-11-06 08:08:20 +00:00
|
|
|
pub const Kind = enum(u1) {
|
|
|
|
PlainText = 0,
|
|
|
|
Markdown = 1,
|
|
|
|
|
2021-10-01 02:45:45 +01:00
|
|
|
pub fn jsonStringify(value: Kind, options: std.json.StringifyOptions, out_stream: anytype) !void {
|
2020-11-06 08:08:20 +00:00
|
|
|
const str = switch (value) {
|
|
|
|
.PlainText => "plaintext",
|
|
|
|
.Markdown => "markdown",
|
|
|
|
};
|
2021-10-01 02:45:45 +01:00
|
|
|
try std.json.stringify(str, options, out_stream);
|
2020-11-06 08:08:20 +00:00
|
|
|
}
|
|
|
|
};
|
2020-04-27 21:38:35 +01:00
|
|
|
|
2020-11-06 08:08:20 +00:00
|
|
|
kind: Kind = .Markdown,
|
2021-10-02 23:15:08 +01:00
|
|
|
value: string,
|
2020-11-06 08:08:20 +00:00
|
|
|
};
|
2020-04-27 21:38:35 +01:00
|
|
|
|
|
|
|
pub const CompletionList = struct {
|
2020-11-06 08:08:20 +00:00
|
|
|
isIncomplete: bool,
|
2020-05-07 12:36:40 +01:00
|
|
|
items: []const CompletionItem,
|
2020-04-27 21:38:35 +01:00
|
|
|
};
|
|
|
|
|
2020-11-06 08:08:20 +00:00
|
|
|
pub const InsertTextFormat = enum(i64) {
|
2020-04-28 03:59:28 +01:00
|
|
|
PlainText = 1,
|
|
|
|
Snippet = 2,
|
|
|
|
|
2021-10-01 02:47:19 +01:00
|
|
|
pub fn jsonStringify(value: InsertTextFormat, options: std.json.StringifyOptions, out_stream: anytype) !void {
|
|
|
|
try std.json.stringify(@enumToInt(value), options, out_stream);
|
2020-04-28 03:59:28 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-09-30 05:04:27 +01:00
|
|
|
pub const Hover = struct {
|
|
|
|
contents: MarkupContent,
|
|
|
|
};
|
|
|
|
|
|
|
|
pub const SemanticTokens = struct {
|
|
|
|
data: []const u32,
|
|
|
|
};
|
|
|
|
|
2020-04-27 21:38:35 +01:00
|
|
|
pub const CompletionItem = struct {
|
2022-06-23 15:43:23 +01:00
|
|
|
pub const Kind = enum(i64) {
|
2020-11-06 08:08:20 +00:00
|
|
|
Text = 1,
|
|
|
|
Method = 2,
|
|
|
|
Function = 3,
|
|
|
|
Constructor = 4,
|
|
|
|
Field = 5,
|
|
|
|
Variable = 6,
|
|
|
|
Class = 7,
|
|
|
|
Interface = 8,
|
|
|
|
Module = 9,
|
|
|
|
Property = 10,
|
|
|
|
Unit = 11,
|
|
|
|
Value = 12,
|
|
|
|
Enum = 13,
|
|
|
|
Keyword = 14,
|
|
|
|
Snippet = 15,
|
|
|
|
Color = 16,
|
|
|
|
File = 17,
|
|
|
|
Reference = 18,
|
|
|
|
Folder = 19,
|
|
|
|
EnumMember = 20,
|
|
|
|
Constant = 21,
|
|
|
|
Struct = 22,
|
|
|
|
Event = 23,
|
|
|
|
Operator = 24,
|
|
|
|
TypeParameter = 25,
|
|
|
|
|
2021-10-01 02:47:19 +01:00
|
|
|
pub fn jsonStringify(value: Kind, options: std.json.StringifyOptions, out_stream: anytype) !void {
|
|
|
|
try std.json.stringify(@enumToInt(value), options, out_stream);
|
2020-11-06 08:08:20 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-10-02 23:15:08 +01:00
|
|
|
label: string,
|
2022-06-23 15:43:23 +01:00
|
|
|
labelDetails: ?CompletionItemLabelDetails = null,
|
2020-11-06 08:08:20 +00:00
|
|
|
kind: Kind,
|
2022-06-23 15:43:23 +01:00
|
|
|
detail: ?string = null,
|
|
|
|
|
|
|
|
sortText: ?string = null,
|
2021-10-02 23:15:08 +01:00
|
|
|
filterText: ?string = null,
|
2022-06-23 15:43:23 +01:00
|
|
|
insertText: ?string = null,
|
|
|
|
|
2020-11-06 08:08:20 +00:00
|
|
|
insertTextFormat: ?InsertTextFormat = .PlainText,
|
2020-07-08 02:05:44 +01:00
|
|
|
documentation: ?MarkupContent = null,
|
2022-07-08 08:25:26 +01:00
|
|
|
|
2022-06-23 15:43:23 +01:00
|
|
|
// FIXME: i commented this out, because otherwise the vscode client complains about *ranges*
|
|
|
|
// and breaks code completion entirely
|
2022-06-24 12:37:24 +01:00
|
|
|
// see: https://github.com/zigtools/zls-vscode/pull/33
|
2022-07-08 08:25:26 +01:00
|
|
|
// textEdit: ?TextEdit = null,
|
2022-06-23 15:43:23 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
pub const CompletionItemLabelDetails = struct {
|
|
|
|
detail: ?string,
|
|
|
|
description: ?string,
|
2022-06-22 01:22:13 +01:00
|
|
|
sortText: ?string = null,
|
2020-05-28 01:39:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
pub const DocumentSymbol = struct {
|
2021-06-24 11:38:01 +01:00
|
|
|
const Kind = enum(u32) {
|
2020-11-06 08:08:20 +00:00
|
|
|
File = 1,
|
|
|
|
Module = 2,
|
|
|
|
Namespace = 3,
|
|
|
|
Package = 4,
|
|
|
|
Class = 5,
|
|
|
|
Method = 6,
|
|
|
|
Property = 7,
|
|
|
|
Field = 8,
|
|
|
|
Constructor = 9,
|
|
|
|
Enum = 10,
|
|
|
|
Interface = 11,
|
|
|
|
Function = 12,
|
|
|
|
Variable = 13,
|
|
|
|
Constant = 14,
|
|
|
|
String = 15,
|
|
|
|
Number = 16,
|
|
|
|
Boolean = 17,
|
|
|
|
Array = 18,
|
|
|
|
Object = 19,
|
|
|
|
Key = 20,
|
|
|
|
Null = 21,
|
|
|
|
EnumMember = 22,
|
|
|
|
Struct = 23,
|
|
|
|
Event = 24,
|
|
|
|
Operator = 25,
|
|
|
|
TypeParameter = 26,
|
|
|
|
|
2021-10-01 02:47:19 +01:00
|
|
|
pub fn jsonStringify(value: Kind, options: std.json.StringifyOptions, out_stream: anytype) !void {
|
|
|
|
try std.json.stringify(@enumToInt(value), options, out_stream);
|
2020-11-06 08:08:20 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-10-02 23:15:08 +01:00
|
|
|
name: string,
|
|
|
|
detail: ?string = null,
|
2020-11-06 08:08:20 +00:00
|
|
|
kind: Kind,
|
2020-06-29 23:34:21 +01:00
|
|
|
deprecated: bool = false,
|
|
|
|
range: Range,
|
|
|
|
selectionRange: Range,
|
2020-07-07 09:57:02 +01:00
|
|
|
children: []const DocumentSymbol = &[_]DocumentSymbol{},
|
2020-05-28 01:39:36 +01:00
|
|
|
};
|
2020-06-08 23:18:12 +01:00
|
|
|
|
2020-11-06 08:08:20 +00:00
|
|
|
pub const WorkspaceFolder = struct {
|
2021-10-02 23:15:08 +01:00
|
|
|
uri: string,
|
|
|
|
name: string,
|
2020-06-29 23:34:21 +01:00
|
|
|
};
|
|
|
|
|
2021-04-01 12:14:49 +01:00
|
|
|
pub const SignatureInformation = struct {
|
|
|
|
pub const ParameterInformation = struct {
|
|
|
|
// TODO Can also send a pair of encoded offsets
|
2021-10-02 23:15:08 +01:00
|
|
|
label: string,
|
2021-04-01 12:14:49 +01:00
|
|
|
documentation: ?MarkupContent,
|
|
|
|
};
|
|
|
|
|
2021-10-02 23:15:08 +01:00
|
|
|
label: string,
|
2021-04-01 12:14:49 +01:00
|
|
|
documentation: ?MarkupContent,
|
|
|
|
parameters: ?[]const ParameterInformation,
|
|
|
|
activeParameter: ?u32,
|
|
|
|
};
|
|
|
|
|
|
|
|
pub const SignatureHelp = struct {
|
|
|
|
signatures: ?[]const SignatureInformation,
|
|
|
|
activeSignature: ?u32,
|
|
|
|
activeParameter: ?u32,
|
|
|
|
};
|
|
|
|
|
2022-07-24 12:38:13 +01:00
|
|
|
pub const InlayHint = struct {
|
|
|
|
position: Position,
|
|
|
|
label: string,
|
|
|
|
kind: InlayHintKind,
|
|
|
|
tooltip: MarkupContent,
|
|
|
|
paddingLeft: bool,
|
|
|
|
paddingRight: bool,
|
|
|
|
|
|
|
|
// appends a colon to the label and reduces the output size
|
|
|
|
pub fn jsonStringify(value: InlayHint, options: std.json.StringifyOptions, writer: anytype) @TypeOf(writer).Error!void {
|
|
|
|
try writer.writeAll("{\"position\":");
|
|
|
|
try std.json.stringify(value.position, options, writer);
|
|
|
|
try writer.writeAll(",\"label\":\"");
|
|
|
|
try writer.writeAll(value.label);
|
|
|
|
try writer.writeAll(":\",\"kind\":");
|
|
|
|
try std.json.stringify(value.kind, options, writer);
|
|
|
|
if (value.tooltip.value.len != 0) {
|
|
|
|
try writer.writeAll(",\"tooltip\":");
|
|
|
|
try std.json.stringify(value.tooltip, options, writer);
|
|
|
|
}
|
|
|
|
if (value.paddingLeft) try writer.writeAll(",\"paddingLeft\":true");
|
|
|
|
if (value.paddingRight) try writer.writeAll(",\"paddingRight\":true");
|
|
|
|
try writer.writeByte('}');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
pub const InlayHintKind = enum(i64) {
|
|
|
|
Type = 1,
|
|
|
|
Parameter = 2,
|
|
|
|
|
|
|
|
pub fn jsonStringify(value: InlayHintKind, options: std.json.StringifyOptions, out_stream: anytype) !void {
|
|
|
|
try std.json.stringify(@enumToInt(value), options, out_stream);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-09-24 20:29:24 +01:00
|
|
|
pub const CodeActionKind = enum {
|
|
|
|
Empty,
|
|
|
|
QuickFix,
|
|
|
|
Refactor,
|
|
|
|
RefactorExtract,
|
|
|
|
RefactorInline,
|
|
|
|
RefactorRewrite,
|
|
|
|
Source,
|
|
|
|
SourceOrganizeImports,
|
|
|
|
SourceFixAll,
|
|
|
|
|
|
|
|
pub fn jsonStringify(value: CodeActionKind, options: std.json.StringifyOptions, out_stream: anytype) !void {
|
|
|
|
const name = switch (value) {
|
|
|
|
.Empty => "",
|
|
|
|
.QuickFix => "quickfix",
|
|
|
|
.Refactor => "refactor",
|
|
|
|
.RefactorExtract => "refactor.extract",
|
|
|
|
.RefactorInline => "refactor.inline",
|
|
|
|
.RefactorRewrite => "refactor.rewrite",
|
|
|
|
.Source => "source",
|
|
|
|
.SourceOrganizeImports => "source.organizeImports",
|
|
|
|
.SourceFixAll => "source.fixAll",
|
|
|
|
};
|
|
|
|
try std.json.stringify(name, options, out_stream);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
pub const CodeAction = struct {
|
|
|
|
title: string,
|
|
|
|
kind: CodeActionKind,
|
|
|
|
// diagnostics: []Diagnostic,
|
|
|
|
isPreferred: bool,
|
|
|
|
edit: WorkspaceEdit,
|
|
|
|
};
|
|
|
|
|
|
|
|
pub const ApplyWorkspaceEditParams = struct {
|
|
|
|
label: string,
|
|
|
|
edit: WorkspaceEdit,
|
|
|
|
};
|
|
|
|
|
2022-09-16 01:33:49 +01:00
|
|
|
pub const PositionEncodingKind = enum {
|
|
|
|
utf8,
|
|
|
|
utf16,
|
|
|
|
utf32,
|
|
|
|
|
|
|
|
pub fn jsonStringify(value: PositionEncodingKind, options: std.json.StringifyOptions, out_stream: anytype) !void {
|
|
|
|
const str = switch (value) {
|
|
|
|
.utf8 => "utf-8",
|
|
|
|
.utf16 => "utf-16",
|
|
|
|
.utf32 => "utf-32",
|
|
|
|
};
|
|
|
|
try std.json.stringify(str, options, out_stream);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-09-28 17:07:24 +01:00
|
|
|
const TextDocumentSyncKind = enum(u32) {
|
|
|
|
None = 0,
|
|
|
|
Full = 1,
|
|
|
|
Incremental = 2,
|
|
|
|
|
|
|
|
pub fn jsonStringify(value: @This(), options: std.json.StringifyOptions, out_stream: anytype) !void {
|
|
|
|
try std.json.stringify(@enumToInt(value), options, out_stream);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-11-06 08:08:20 +00:00
|
|
|
// Only includes options we set in our initialize result.
|
|
|
|
const InitializeResult = struct {
|
|
|
|
capabilities: struct {
|
2022-09-30 05:04:27 +01:00
|
|
|
positionEncoding: PositionEncodingKind,
|
2020-11-06 08:08:20 +00:00
|
|
|
signatureHelpProvider: struct {
|
2021-10-02 23:15:08 +01:00
|
|
|
triggerCharacters: []const string,
|
|
|
|
retriggerCharacters: []const string,
|
2020-11-06 08:08:20 +00:00
|
|
|
},
|
2022-09-28 17:07:24 +01:00
|
|
|
textDocumentSync: struct {
|
|
|
|
openClose: bool,
|
|
|
|
change: TextDocumentSyncKind,
|
|
|
|
save: bool,
|
2020-11-06 08:08:20 +00:00
|
|
|
},
|
|
|
|
renameProvider: bool,
|
|
|
|
completionProvider: struct {
|
|
|
|
resolveProvider: bool,
|
2021-10-02 23:15:08 +01:00
|
|
|
triggerCharacters: []const string,
|
2022-06-23 15:43:23 +01:00
|
|
|
completionItem: struct { labelDetailsSupport: bool },
|
2020-11-06 08:08:20 +00:00
|
|
|
},
|
|
|
|
documentHighlightProvider: bool,
|
|
|
|
hoverProvider: bool,
|
|
|
|
codeActionProvider: bool,
|
|
|
|
declarationProvider: bool,
|
|
|
|
definitionProvider: bool,
|
|
|
|
typeDefinitionProvider: bool,
|
|
|
|
implementationProvider: bool,
|
|
|
|
referencesProvider: bool,
|
|
|
|
documentSymbolProvider: bool,
|
|
|
|
colorProvider: bool,
|
|
|
|
documentFormattingProvider: bool,
|
|
|
|
documentRangeFormattingProvider: bool,
|
|
|
|
foldingRangeProvider: bool,
|
|
|
|
selectionRangeProvider: bool,
|
|
|
|
workspaceSymbolProvider: bool,
|
|
|
|
rangeProvider: bool,
|
|
|
|
documentProvider: bool,
|
2021-03-29 10:28:52 +01:00
|
|
|
workspace: ?struct {
|
|
|
|
workspaceFolders: ?struct {
|
2020-11-06 08:08:20 +00:00
|
|
|
supported: bool,
|
|
|
|
changeNotifications: bool,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
semanticTokensProvider: struct {
|
2020-11-06 13:55:00 +00:00
|
|
|
full: bool,
|
|
|
|
range: bool,
|
2020-11-06 08:08:20 +00:00
|
|
|
legend: struct {
|
2021-10-02 23:15:08 +01:00
|
|
|
tokenTypes: []const string,
|
|
|
|
tokenModifiers: []const string,
|
2020-11-06 08:08:20 +00:00
|
|
|
},
|
|
|
|
},
|
2022-07-24 12:38:13 +01:00
|
|
|
inlayHintProvider: bool,
|
2020-11-06 08:08:20 +00:00
|
|
|
},
|
|
|
|
serverInfo: struct {
|
2021-10-02 23:15:08 +01:00
|
|
|
name: string,
|
|
|
|
version: ?string = null,
|
2020-11-06 08:08:20 +00:00
|
|
|
},
|
2020-06-08 23:18:12 +01:00
|
|
|
};
|
2021-12-17 01:41:21 +00:00
|
|
|
|
|
|
|
pub const ConfigurationParams = struct {
|
|
|
|
items: []const ConfigurationItem,
|
|
|
|
|
|
|
|
pub const ConfigurationItem = struct {
|
|
|
|
section: ?[]const u8,
|
|
|
|
};
|
|
|
|
};
|
2022-07-11 14:45:31 +01:00
|
|
|
|
|
|
|
pub const RegistrationParams = struct {
|
|
|
|
registrations: []const Registration,
|
|
|
|
|
|
|
|
pub const Registration = struct {
|
|
|
|
id: string,
|
|
|
|
method: string,
|
|
|
|
|
|
|
|
// registerOptions?: LSPAny;
|
|
|
|
};
|
|
|
|
};
|
2022-05-08 04:03:40 +01:00
|
|
|
|
|
|
|
pub const DocumentHighlightKind = enum(u8) {
|
|
|
|
Text = 1,
|
|
|
|
Read = 2,
|
|
|
|
Write = 3,
|
|
|
|
|
|
|
|
pub fn jsonStringify(value: DocumentHighlightKind, options: std.json.StringifyOptions, out_stream: anytype) !void {
|
|
|
|
try std.json.stringify(@enumToInt(value), options, out_stream);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
pub const DocumentHighlight = struct {
|
|
|
|
range: Range,
|
|
|
|
kind: ?DocumentHighlightKind,
|
|
|
|
};
|
2022-10-25 15:35:16 +01:00
|
|
|
|
|
|
|
pub const FoldingRange = struct {
|
|
|
|
startLine: usize,
|
|
|
|
endLine: usize,
|
|
|
|
};
|