diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2020-11-07 15:44:30 +0100 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2020-11-07 15:44:30 +0100 |
| commit | 6ec424ed8d34cf8a5f51e277a20429741b33ee96 (patch) | |
| tree | 6d0eed732e01d19effbae5cc525a9c2f6e28534f /src/server/types.odin | |
| parent | 3f1027bd4003cdb9fdc80665548181df2fb60810 (diff) | |
complete refractor of the project into packages
Diffstat (limited to 'src/server/types.odin')
| -rw-r--r-- | src/server/types.odin | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/src/server/types.odin b/src/server/types.odin new file mode 100644 index 0000000..262f464 --- /dev/null +++ b/src/server/types.odin @@ -0,0 +1,154 @@ +package server + +import "core:encoding/json" + +import "shared:common" + +/* + General types +*/ + +//TODO(Daniel, move some of the more specific structs to their appropriate place) + +RequestId :: union { + string, + i64, +}; + +ResponseParams :: union { + ResponseInitializeParams, + rawptr, + common.Location, +}; + +ResponseMessage :: struct { + jsonrpc: string, + id: RequestId, + result: ResponseParams, +}; + +ResponseMessageError :: struct { + jsonrpc: string, + id: RequestId, + error: ResponseError, +}; + +ResponseError :: struct { + code: common.Error, + message: string, +}; + +NotificationLoggingParams :: struct { + type: int, + message: string, +}; + +NotificationPublishDiagnosticsParams :: struct { + uri: string, + diagnostics: [] Diagnostic, +}; + +NotificationParams :: union { + NotificationLoggingParams, + NotificationPublishDiagnosticsParams, +}; + +Notification :: struct { + jsonrpc: string, + method: string, + params: NotificationParams +}; + +ResponseInitializeParams :: struct { + capabilities: ServerCapabilities, +}; + +RequestInitializeParams :: struct { + trace: string, + workspaceFolders: [dynamic] common.WorkspaceFolder, + capabilities: ClientCapabilities, +}; + +//Can't really follow the uppercase style for enums when i need to represent it as text as well +MarkupKind :: enum { + Plaintext, + Markdown, +}; + +ServerCapabilities :: struct { + textDocumentSync: int, + definitionProvider: bool, +}; + +CompletionClientCapabilities :: struct { + +}; + +HoverClientCapabilities :: struct { + dynamicRegistration: bool, + contentFormat: [dynamic] MarkupKind, +}; + +TextDocumentClientCapabilities :: struct { + completion: CompletionClientCapabilities, + hover: HoverClientCapabilities, +}; + +ClientCapabilities :: struct { + textDocument: TextDocumentClientCapabilities, +}; + +TextDocumentContentChangeEvent :: struct { + range: common.Range, + text: string, +}; + +Version :: union { + int, + json.Null, +}; + +VersionedTextDocumentIdentifier :: struct { + uri: string, +}; + +TextDocumentIdentifier :: struct { + uri: string, +}; + +TextDocumentItem :: struct { + uri: string, + text: string, +}; + +DiagnosticSeverity :: enum { + Error = 1, + Warning = 2, + Information = 3, + Hint = 4, +}; + +Diagnostic :: struct { + range: common.Range, + severity: DiagnosticSeverity, + code: string, + message: string, +}; + +DidOpenTextDocumentParams :: struct { + textDocument: TextDocumentItem, +}; + +DidChangeTextDocumentParams :: struct { + textDocument: VersionedTextDocumentIdentifier, + contentChanges: [dynamic] TextDocumentContentChangeEvent, +}; + +DidCloseTextDocumentParams :: struct { + textDocument: TextDocumentIdentifier, +}; + +TextDocumentPositionParams :: struct { + textDocument: TextDocumentIdentifier, + position: common.Position, +};
\ No newline at end of file |