summaryrefslogtreecommitdiff
path: root/ide-definitions.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-30 11:38:00 -0500
committerpommicket <pommicket@gmail.com>2022-12-30 11:38:00 -0500
commit65cbe00bc124bdc1bd83bcd42ad5fbed521412b2 (patch)
tree7b4c617e427681fd58700ba0cc06286a38a90539 /ide-definitions.c
parent4232df89b50754779814a97f374451fce2e36447 (diff)
parse workspace/symbol response
Diffstat (limited to 'ide-definitions.c')
-rw-r--r--ide-definitions.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/ide-definitions.c b/ide-definitions.c
index a748173..e63e977 100644
--- a/ide-definitions.c
+++ b/ide-definitions.c
@@ -1,3 +1,49 @@
+
+static SymbolKind 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;
+}
+
void definition_goto(Ted *ted, LSP *lsp, const char *name, LSPDocumentPosition position) {
Definitions *defs = &ted->definitions;
if (lsp) {