diff options
author | Geequlim <geequlim@gmail.com> | 2019-06-25 12:12:41 +0800 |
---|---|---|
committer | geequlim <geequlim@gmail.com> | 2019-08-11 13:30:15 +0800 |
commit | b2f02317fabe284220c74c21229e4cad6ab74e93 (patch) | |
tree | 71817f93ffe84e92eed24accf2420bdfc41a2679 /modules/gdscript/language_server/gdscript_extend_parser.h | |
parent | 76c9e4ceb73b02bd95ab0512e27229516208dc60 (diff) | |
download | redot-engine-b2f02317fabe284220c74c21229e4cad6ab74e93.tar.gz |
Improve symbol resolve for inner classes
Only level one inner classes would be resolved currently but it sould cover most real world use case
Improve documation parseing for const values
Improve documation format for native symbols
Diffstat (limited to 'modules/gdscript/language_server/gdscript_extend_parser.h')
-rw-r--r-- | modules/gdscript/language_server/gdscript_extend_parser.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.h b/modules/gdscript/language_server/gdscript_extend_parser.h index d20dca59cf..3710b92993 100644 --- a/modules/gdscript/language_server/gdscript_extend_parser.h +++ b/modules/gdscript/language_server/gdscript_extend_parser.h @@ -39,8 +39,12 @@ #define LINE_NUMBER_TO_INDEX(p_line) ((p_line)-1) #endif +#ifndef SYMBOL_SEPERATOR +#define SYMBOL_SEPERATOR "::" +#endif + #ifndef JOIN_SYMBOLS -#define JOIN_SYMBOLS(p_path, name) ((p_path) + "." + (name)) +#define JOIN_SYMBOLS(p_path, name) ((p_path) + SYMBOL_SEPERATOR + (name)) #endif typedef HashMap<String, const lsp::DocumentSymbol *> ClassMembers; @@ -54,6 +58,7 @@ class ExtendGDScriptParser : public GDScriptParser { lsp::DocumentSymbol class_symbol; Vector<lsp::Diagnostic> diagnostics; ClassMembers members; + HashMap<String, ClassMembers> inner_classes; void update_diagnostics(); @@ -61,7 +66,7 @@ class ExtendGDScriptParser : public GDScriptParser { void parse_class_symbol(const GDScriptParser::ClassNode *p_class, lsp::DocumentSymbol &r_symbol); void parse_function_symbol(const GDScriptParser::FunctionNode *p_func, lsp::DocumentSymbol &r_symbol); - String parse_documentation(int p_line); + String parse_documentation(int p_line, bool p_docs_down = false); const lsp::DocumentSymbol *search_symbol_defined_at_line(int p_line, const lsp::DocumentSymbol &p_parent) const; Array member_completions; @@ -73,6 +78,7 @@ public: _FORCE_INLINE_ const lsp::DocumentSymbol &get_symbols() const { return class_symbol; } _FORCE_INLINE_ const Vector<lsp::Diagnostic> &get_diagnostics() const { return diagnostics; } _FORCE_INLINE_ const ClassMembers &get_members() const { return members; } + _FORCE_INLINE_ const HashMap<String, ClassMembers> &get_inner_classes() const { return inner_classes; } String get_text_for_completion(const lsp::Position &p_cursor) const; String get_text_for_lookup_symbol(const lsp::Position &p_cursor, const String &p_symbol = "", bool p_func_requred = false) const; @@ -80,7 +86,7 @@ public: String get_uri() const; const lsp::DocumentSymbol *get_symbol_defined_at_line(int p_line) const; - const lsp::DocumentSymbol *get_member_symbol(const String &p_name) const; + const lsp::DocumentSymbol *get_member_symbol(const String &p_name, const String &p_subclass = "") const; const Array &get_member_completions(); |