1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

lsp: Send godot class tree to clients

This commit is contained in:
Geequlim
2019-10-09 13:29:29 +08:00
parent bb41f0b0cb
commit 1ab34bc3c2
2 changed files with 52 additions and 1 deletions

View File

@@ -31,7 +31,9 @@
#ifndef GODOT_LSP_H
#define GODOT_LSP_H
#include "core/variant.h"
#include "core/class_db.h"
#include "core/list.h"
#include "editor/doc/doc_data.h"
namespace lsp {
@@ -1567,6 +1569,39 @@ struct InitializeResult {
}
};
struct GodotNativeClassInfo {
String name;
const DocData::ClassDoc *class_doc = NULL;
const ClassDB::ClassInfo *class_info = NULL;
Dictionary to_json() {
Dictionary dict;
dict["name"] = name;
dict["inherits"] = class_doc->inherits;
return dict;
}
};
/** Features not included in the standart lsp specifications */
struct GodotCapabilities {
/**
* Native class list
*/
List<GodotNativeClassInfo> native_classes;
Dictionary to_json() {
Dictionary dict;
Array classes;
for (List<GodotNativeClassInfo>::Element *E = native_classes.front(); E; E = E->next()) {
classes.push_back(E->get().to_json());
}
dict["native_classes"] = classes;
return dict;
}
};
/** Format BBCode documentation from DocData to markdown */
static String marked_documentation(const String &p_bbcode) {