[gnome-builder] langserv: add decode helpers for langserv symbol protocol
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] langserv: add decode helpers for langserv symbol protocol
- Date: Tue, 4 Apr 2017 21:57:13 +0000 (UTC)
commit 45b91d2eae9acae4b6ab687a6730d3e6149a6c91
Author: Christian Hergert <chergert redhat com>
Date: Tue Apr 4 14:55:57 2017 -0700
langserv: add decode helpers for langserv symbol protocol
libide/Makefile.am | 2 +
libide/ide.h | 1 +
libide/langserv/ide-langserv-util.c | 78 +++++++++++++++++++++++++++++++++++
libide/langserv/ide-langserv-util.h | 31 ++++++++++++++
4 files changed, 112 insertions(+), 0 deletions(-)
---
diff --git a/libide/Makefile.am b/libide/Makefile.am
index fe17c3c..76e3bac 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -87,6 +87,7 @@ libide_1_0_la_public_headers = \
langserv/ide-langserv-symbol-node.h \
langserv/ide-langserv-symbol-resolver.h \
langserv/ide-langserv-symbol-tree.h \
+ langserv/ide-langserv-util.h \
local/ide-local-device.h \
logging/ide-log.h \
plugins/ide-extension-adapter.h \
@@ -275,6 +276,7 @@ libide_1_0_la_public_sources = \
langserv/ide-langserv-symbol-resolver.c \
langserv/ide-langserv-symbol-tree.c \
langserv/ide-langserv-symbol-tree-private.h \
+ langserv/ide-langserv-util.c \
local/ide-local-device.c \
logging/ide-log.c \
plugins/ide-extension-adapter.c \
diff --git a/libide/ide.h b/libide/ide.h
index a05ac0c..e9e8d3d 100644
--- a/libide/ide.h
+++ b/libide/ide.h
@@ -87,6 +87,7 @@ G_BEGIN_DECLS
#include "langserv/ide-langserv-diagnostic-provider.h"
#include "langserv/ide-langserv-rename-provider.h"
#include "langserv/ide-langserv-symbol-resolver.h"
+#include "langserv/ide-langserv-util.h"
#include "local/ide-local-device.h"
#include "logging/ide-log.h"
#include "preferences/ide-preferences.h"
diff --git a/libide/langserv/ide-langserv-util.c b/libide/langserv/ide-langserv-util.c
new file mode 100644
index 0000000..0c59b0c
--- /dev/null
+++ b/libide/langserv/ide-langserv-util.c
@@ -0,0 +1,78 @@
+/* ide-langserv-util.c
+ *
+ * Copyright (C) 2017 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ide-langserv-util.h"
+
+IdeSymbolKind
+ide_langserv_decode_symbol_kind (guint kind)
+{
+ switch (kind)
+ {
+ case 1: kind = IDE_SYMBOL_FILE; break;
+ case 2: kind = IDE_SYMBOL_MODULE; break;
+ case 3: kind = IDE_SYMBOL_NAMESPACE; break;
+ case 4: kind = IDE_SYMBOL_PACKAGE; break;
+ case 5: kind = IDE_SYMBOL_CLASS; break;
+ case 6: kind = IDE_SYMBOL_METHOD; break;
+ case 7: kind = IDE_SYMBOL_PROPERTY; break;
+ case 8: kind = IDE_SYMBOL_FIELD; break;
+ case 9: kind = IDE_SYMBOL_CONSTRUCTOR; break;
+ case 10: kind = IDE_SYMBOL_ENUM; break;
+ case 11: kind = IDE_SYMBOL_INTERFACE; break;
+ case 12: kind = IDE_SYMBOL_FUNCTION; break;
+ case 13: kind = IDE_SYMBOL_VARIABLE; break;
+ case 14: kind = IDE_SYMBOL_CONSTANT; break;
+ case 15: kind = IDE_SYMBOL_STRING; break;
+ case 16: kind = IDE_SYMBOL_NUMBER; break;
+ case 17: kind = IDE_SYMBOL_BOOLEAN; break;
+ case 18: kind = IDE_SYMBOL_ARRAY; break;
+ default: kind = IDE_SYMBOL_NONE; break;
+ }
+
+ return kind;
+}
+
+IdeSymbolKind
+ide_langserv_decode_completion_kind (guint kind)
+{
+ switch (kind)
+ {
+ case 1: kind = IDE_SYMBOL_STRING; break;
+ case 2: kind = IDE_SYMBOL_METHOD; break;
+ case 3: kind = IDE_SYMBOL_FUNCTION; break;
+ case 4: kind = IDE_SYMBOL_CONSTRUCTOR; break;
+ case 5: kind = IDE_SYMBOL_FIELD; break;
+ case 6: kind = IDE_SYMBOL_VARIABLE; break;
+ case 7: kind = IDE_SYMBOL_CLASS; break;
+ case 8: kind = IDE_SYMBOL_INTERFACE; break;
+ case 9: kind = IDE_SYMBOL_MODULE; break;
+ case 10: kind = IDE_SYMBOL_PROPERTY; break;
+ case 11: kind = IDE_SYMBOL_NUMBER; break;
+ case 12: kind = IDE_SYMBOL_SCALAR; break;
+ case 13: kind = IDE_SYMBOL_ENUM_VALUE; break;
+ case 14: kind = IDE_SYMBOL_KEYWORD; break;
+ case 17: kind = IDE_SYMBOL_FILE; break;
+
+ case 15: /* Snippet */
+ case 16: /* Color */
+ case 18: /* Reference */
+ default: kind = IDE_SYMBOL_NONE; break;
+ }
+
+ return kind;
+}
diff --git a/libide/langserv/ide-langserv-util.h b/libide/langserv/ide-langserv-util.h
new file mode 100644
index 0000000..98aad89
--- /dev/null
+++ b/libide/langserv/ide-langserv-util.h
@@ -0,0 +1,31 @@
+/* ide-langserv-util.h
+ *
+ * Copyright (C) 2017 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_LANGSERV_UTIL_H
+#define IDE_LANGSERV_UTIL_H
+
+#include "symbols/ide-symbol.h"
+
+G_BEGIN_DECLS
+
+IdeSymbolKind ide_langserv_decode_symbol_kind (guint kind);
+IdeSymbolKind ide_langserv_decode_completion_kind (guint kind);
+
+G_END_DECLS
+
+#endif /* IDE_LANGSERV_UTIL_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]