diff options
| author | Albert Cervin <albert@acervin.com> | 2024-09-17 08:47:03 +0200 |
|---|---|---|
| committer | Albert Cervin <albert@acervin.com> | 2025-11-01 22:11:14 +0100 |
| commit | 4459b8b3aa9d73895391785a99dcc87134e80601 (patch) | |
| tree | a5204f447a0b2b05f63504c7fe958ef9bbf1918a /src/dged/jsonrpc.h | |
| parent | 4689f3f38277bb64981fc960e8e384e2d065d659 (diff) | |
| download | dged-4459b8b3aa9d73895391785a99dcc87134e80601.tar.gz dged-4459b8b3aa9d73895391785a99dcc87134e80601.tar.xz dged-4459b8b3aa9d73895391785a99dcc87134e80601.zip | |
More lsp support
This makes the LSP support complete for now:
- Completion
- Diagnostics
- Goto implementation/declaration
- Rename
- Documentation
- Find references
Diffstat (limited to 'src/dged/jsonrpc.h')
| -rw-r--r-- | src/dged/jsonrpc.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/dged/jsonrpc.h b/src/dged/jsonrpc.h new file mode 100644 index 0000000..2ac2787 --- /dev/null +++ b/src/dged/jsonrpc.h @@ -0,0 +1,58 @@ +#ifndef _JSONRPC_H +#define _JSONRPC_H + +#include <stdint.h> + +#include "json.h" +#include "s8.h" + +enum jsonrpc_type { + Jsonrpc_Request, + Jsonrpc_Response, + Jsonrpc_Notification, +}; + +struct jsonrpc_request { + struct json_value id; + struct s8 method; + struct json_value params; +}; + +struct jsonrpc_error { + int code; + struct s8 message; + struct json_value data; +}; + +struct jsonrpc_notification { + struct s8 method; + struct json_value params; +}; + +struct jsonrpc_response { + struct json_value id; + bool ok; + union jsonrpc_value { + struct json_value result; + struct jsonrpc_error error; + } value; +}; + +struct jsonrpc_message { + enum jsonrpc_type type; + union jsonrpc_msg { + struct jsonrpc_request request; + struct jsonrpc_response response; + struct jsonrpc_notification notification; + } message; + + struct json_value document; +}; + +struct jsonrpc_message jsonrpc_parse(const uint8_t *buf, uint64_t size); +struct s8 jsonrpc_format_request(struct json_value id, struct s8 method, + struct s8 params); +struct s8 jsonrpc_format_response(struct json_value id, struct s8 result); +struct s8 jsonrpc_format_notification(struct s8 method, struct s8 params); + +#endif |
