Fix LSP reporting wrong types

This commit is contained in:
Francois Belair 2021-07-24 16:39:11 -04:00
parent caf7cbd871
commit 41ef9cf789
2 changed files with 31 additions and 31 deletions

View File

@ -150,9 +150,9 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
} }
r_symbol.kind = lsp::SymbolKind::Class; r_symbol.kind = lsp::SymbolKind::Class;
r_symbol.deprecated = false; r_symbol.deprecated = false;
r_symbol.range.start.line = LINE_NUMBER_TO_INDEX(p_class->start_line); r_symbol.range.start.line = p_class->start_line;
r_symbol.range.start.character = LINE_NUMBER_TO_INDEX(p_class->start_column); r_symbol.range.start.character = p_class->start_column;
r_symbol.range.end.line = LINE_NUMBER_TO_INDEX(p_class->end_line); r_symbol.range.end.line = lines.size();
r_symbol.selectionRange.start.line = r_symbol.range.start.line; r_symbol.selectionRange.start.line = r_symbol.range.start.line;
r_symbol.detail = "class " + r_symbol.name; r_symbol.detail = "class " + r_symbol.name;
bool is_root_class = &r_symbol == &class_symbol; bool is_root_class = &r_symbol == &class_symbol;
@ -165,7 +165,7 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
case ClassNode::Member::VARIABLE: { case ClassNode::Member::VARIABLE: {
lsp::DocumentSymbol symbol; lsp::DocumentSymbol symbol;
symbol.name = m.variable->identifier->name; symbol.name = m.variable->identifier->name;
symbol.kind = lsp::SymbolKind::Variable; symbol.kind = m.variable->property == VariableNode::PropertyStyle::PROP_NONE ? lsp::SymbolKind::Variable : lsp::SymbolKind::Property;
symbol.deprecated = false; symbol.deprecated = false;
symbol.range.start.line = LINE_NUMBER_TO_INDEX(m.variable->start_line); symbol.range.start.line = LINE_NUMBER_TO_INDEX(m.variable->start_line);
symbol.range.start.character = LINE_NUMBER_TO_INDEX(m.variable->start_column); symbol.range.start.character = LINE_NUMBER_TO_INDEX(m.variable->start_column);
@ -317,7 +317,7 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN
const String uri = get_uri(); const String uri = get_uri();
r_symbol.name = p_func->identifier->name; r_symbol.name = p_func->identifier->name;
r_symbol.kind = lsp::SymbolKind::Function; r_symbol.kind = p_func->is_static ? lsp::SymbolKind::Function : lsp::SymbolKind::Method;
r_symbol.detail = "func " + String(p_func->identifier->name) + "("; r_symbol.detail = "func " + String(p_func->identifier->name) + "(";
r_symbol.deprecated = false; r_symbol.deprecated = false;
r_symbol.range.start.line = LINE_NUMBER_TO_INDEX(p_func->start_line); r_symbol.range.start.line = LINE_NUMBER_TO_INDEX(p_func->start_line);

View File

@ -1018,32 +1018,32 @@ struct CompletionList {
* A symbol kind. * A symbol kind.
*/ */
namespace SymbolKind { namespace SymbolKind {
static const int File = 0; static const int File = 1;
static const int Module = 1; static const int Module = 2;
static const int Namespace = 2; static const int Namespace = 3;
static const int Package = 3; static const int Package = 4;
static const int Class = 4; static const int Class = 5;
static const int Method = 5; static const int Method = 6;
static const int Property = 6; static const int Property = 7;
static const int Field = 7; static const int Field = 8;
static const int Constructor = 8; static const int Constructor = 9;
static const int Enum = 9; static const int Enum = 10;
static const int Interface = 10; static const int Interface = 11;
static const int Function = 11; static const int Function = 12;
static const int Variable = 12; static const int Variable = 13;
static const int Constant = 13; static const int Constant = 14;
static const int String = 14; static const int String = 15;
static const int Number = 15; static const int Number = 16;
static const int Boolean = 16; static const int Boolean = 17;
static const int Array = 17; static const int Array = 18;
static const int Object = 18; static const int Object = 19;
static const int Key = 19; static const int Key = 20;
static const int Null = 20; static const int Null = 21;
static const int EnumMember = 21; static const int EnumMember = 22;
static const int Struct = 22; static const int Struct = 23;
static const int Event = 23; static const int Event = 24;
static const int Operator = 24; static const int Operator = 25;
static const int TypeParameter = 25; static const int TypeParameter = 26;
}; // namespace SymbolKind }; // namespace SymbolKind
/** /**