Commit 45b91d2e authored by Christian Hergert's avatar Christian Hergert

langserv: add decode helpers for langserv symbol protocol

parent 20fd2390
......@@ -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 \
......
......@@ -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"
......
/* 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;
}
/* 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 */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment