diff options
author | pommicket <pommicket@gmail.com> | 2023-01-04 13:09:18 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-01-04 13:09:18 -0500 |
commit | 7d4f4b04d642a8e454a773cde0a00be11fe624cf (patch) | |
tree | 933c21b0e7bb9c18dec414985f03138f98bd901c | |
parent | 4293f5284971473afaa43b83075d4d985b976622 (diff) |
remove support for "extended json"
-rw-r--r-- | lsp-json.c | 8 | ||||
-rw-r--r-- | main.c | 5 |
2 files changed, 9 insertions, 4 deletions
@@ -1,6 +1,5 @@ // JSON parser for LSP // provides FAST(ish) parsing but SLOW lookup for large objects -// this actually supports "extended json", where objects can have arbitrary values as keys. #define LSP_INTERNAL 1 #include "lsp.h" @@ -182,6 +181,10 @@ static bool json_parse_object(JSON *json, u32 *p_index, JSONObject *object) { JSONValue name = {0}, value = {0}; if (!json_parse_value(json, &index, &name)) return false; + if (name.type != JSON_STRING) { + strbuf_printf(json->error, "object key is not a string"); + return false; + } SKIP_WHITESPACE; if (text[index] != ':') { strbuf_printf(json->error, "stuff after name in object"); @@ -396,7 +399,8 @@ JSONValue json_object_get(const JSON *json, JSONObject object, const char *name) const JSONValue *items = &json->values[object.items]; for (u32 i = 0; i < object.len; ++i) { const JSONValue *this_name = items++; - if (this_name->type == JSON_STRING && json_streq(json, &this_name->val.string, name)) { + assert(this_name->type == JSON_STRING); + if (json_streq(json, &this_name->val.string, name)) { return json->values[object.items + object.len + i]; } } @@ -17,8 +17,6 @@ - some way of opening + closing all C files in directory for clangd textDocument/references to work? - maybe it can be done with the clangd config instead. -- CSS highlighting -- styles ([color] sections) - more documentation generally (development.md or something?) - rename buffer->filename to buffer->path - make buffer->path NULL for untitled buffers & fix resulting mess @@ -28,7 +26,10 @@ - clangd bug report: - textDocumemt/definition on ted.h declarations just gives you the declaration FUTURE FEATURES: +- CSS highlighting +- styles ([color] sections) - make go-to-definition/hover/highlight modifier key configurable +- option for separate colors for read/write highlights - return to previous location in buffer - font setting & support for multiple fonts to cover more characters - comment-start & comment-end settings |