summaryrefslogtreecommitdiff
path: root/lsp.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-22 21:23:54 -0500
committerpommicket <pommicket@gmail.com>2022-12-22 21:23:54 -0500
commitc58f2247a9f9aaea86e461c176e4757e4d17292f (patch)
treeed453ed66b5e576c0029539faa0982c6c26cf31a /lsp.c
parent91ff61cc22c08e2c247b6b689561e6d18cf276e7 (diff)
symbol kind
Diffstat (limited to 'lsp.c')
-rw-r--r--lsp.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/lsp.c b/lsp.c
index 281ec17..9d02d34 100644
--- a/lsp.c
+++ b/lsp.c
@@ -323,3 +323,91 @@ void lsp_document_changed(LSP *lsp, const char *document, LSPDocumentChangeEvent
arr_add(c->changes, change);
lsp_send_request(lsp, &request);
}
+
+SymbolKind lsp_symbol_kind_to_ted(LSPSymbolKind kind) {
+ switch (kind) {
+ case LSP_SYMBOL_OTHER:
+ case LSP_SYMBOL_FILE:
+ case LSP_SYMBOL_MODULE:
+ case LSB_SYMBOL_NAMESPACE:
+ case LSP_SYMBOL_PACKAGE:
+ return SYMBOL_OTHER;
+
+ case LSP_SYMBOL_CLASS:
+ case LSP_SYMBOL_TYPEPARAMETER:
+ case LSP_SYMBOL_ENUM:
+ case LSP_SYMBOL_INTERFACE:
+ case LSP_SYMBOL_STRUCT:
+ case LSP_SYMBOL_EVENT: // i have no clue what this is. let's say it's a type.
+ return SYMBOL_TYPE;
+
+ case LSP_SYMBOL_PROPERTY:
+ case LSP_SYMBOL_FIELD:
+ case LSP_SYMBOL_KEY:
+ return SYMBOL_FIELD;
+
+ case LSP_SYMBOL_CONSTRUCTOR:
+ case LSP_SYMBOL_FUNCTION:
+ case LSP_SYMBOL_OPERATOR:
+ case LSP_SYMBOL_METHOD:
+ return SYMBOL_FUNCTION;
+
+ case LSP_SYMBOL_VARIABLE:
+ return SYMBOL_VARIABLE;
+
+ case LSP_SYMBOL_CONSTANT:
+ case LSP_SYMBOL_STRING:
+ case LSP_SYMBOL_NUMBER:
+ case LSP_SYMBOL_BOOLEAN:
+ case LSP_SYMBOL_ARRAY:
+ case LSP_SYMBOL_OBJECT:
+ case LSP_SYMBOL_ENUMMEMBER:
+ case LSP_SYMBOL_NULL:
+ return SYMBOL_CONSTANT;
+ }
+
+ return SYMBOL_OTHER;
+}
+
+SymbolKind lsp_completion_kind_to_ted(LSPCompletionKind kind) {
+ switch (kind) {
+ case LSP_COMPLETION_TEXT:
+ case LSP_COMPLETION_MODULE:
+ case LSP_COMPLETION_UNIT:
+ case LSP_COMPLETION_COLOR:
+ case LSP_COMPLETION_FILE:
+ case LSP_COMPLETION_REFERENCE:
+ case LSP_COMPLETION_FOLDER:
+ case LSP_COMPLETION_OPERATOR:
+ return SYMBOL_OTHER;
+
+ case LSP_COMPLETION_METHOD:
+ case LSP_COMPLETION_FUNCTION:
+ case LSP_COMPLETION_CONSTRUCTOR:
+ return SYMBOL_FUNCTION;
+
+ case LSP_COMPLETION_FIELD:
+ case LSP_COMPLETION_PROPERTY:
+ return SYMBOL_FIELD;
+
+ case LSP_COMPLETION_VARIABLE:
+ return SYMBOL_VARIABLE;
+
+ case LSP_COMPLETION_CLASS:
+ case LSP_COMPLETION_INTERFACE:
+ case LSP_COMPLETION_ENUM:
+ case LSP_COMPLETION_STRUCT:
+ case LSP_COMPLETION_EVENT:
+ case LSP_COMPLETION_TYPEPARAMETER:
+ return SYMBOL_TYPE;
+
+ case LSP_COMPLETION_VALUE:
+ case LSP_COMPLETION_ENUMMEMBER:
+ case LSP_COMPLETION_CONSTANT:
+ return SYMBOL_CONSTANT;
+
+ case LSP_COMPLETION_KEYWORD:
+ case LSP_COMPLETION_SNIPPET:
+ return SYMBOL_KEYWORD;
+ }
+}