mirror of
https://github.com/godotengine/godot.git
synced 2025-10-22 17:33:33 +00:00
Style: Convert namespaces to PascalCase
This commit is contained in:
parent
0595bb8a42
commit
1cb3cfaa8e
40 changed files with 509 additions and 509 deletions
|
@ -44,8 +44,8 @@ int get_indent_size() {
|
|||
}
|
||||
}
|
||||
|
||||
lsp::Position GodotPosition::to_lsp(const Vector<String> &p_lines) const {
|
||||
lsp::Position res;
|
||||
LSP::Position GodotPosition::to_lsp(const Vector<String> &p_lines) const {
|
||||
LSP::Position res;
|
||||
|
||||
// Special case: `line = 0` -> root class (range covers everything).
|
||||
if (line <= 0) {
|
||||
|
@ -89,7 +89,7 @@ lsp::Position GodotPosition::to_lsp(const Vector<String> &p_lines) const {
|
|||
return res;
|
||||
}
|
||||
|
||||
GodotPosition GodotPosition::from_lsp(const lsp::Position p_pos, const Vector<String> &p_lines) {
|
||||
GodotPosition GodotPosition::from_lsp(const LSP::Position p_pos, const Vector<String> &p_lines) {
|
||||
GodotPosition res(p_pos.line + 1, p_pos.character + 1);
|
||||
|
||||
// Line outside of actual text is valid (-> pos/cursor at end of text).
|
||||
|
@ -113,14 +113,14 @@ GodotPosition GodotPosition::from_lsp(const lsp::Position p_pos, const Vector<St
|
|||
return res;
|
||||
}
|
||||
|
||||
lsp::Range GodotRange::to_lsp(const Vector<String> &p_lines) const {
|
||||
lsp::Range res;
|
||||
LSP::Range GodotRange::to_lsp(const Vector<String> &p_lines) const {
|
||||
LSP::Range res;
|
||||
res.start = start.to_lsp(p_lines);
|
||||
res.end = end.to_lsp(p_lines);
|
||||
return res;
|
||||
}
|
||||
|
||||
GodotRange GodotRange::from_lsp(const lsp::Range &p_range, const Vector<String> &p_lines) {
|
||||
GodotRange GodotRange::from_lsp(const LSP::Range &p_range, const Vector<String> &p_lines) {
|
||||
GodotPosition start = GodotPosition::from_lsp(p_range.start, p_lines);
|
||||
GodotPosition end = GodotPosition::from_lsp(p_range.end, p_lines);
|
||||
return GodotRange(start, end);
|
||||
|
@ -131,13 +131,13 @@ void ExtendGDScriptParser::update_diagnostics() {
|
|||
|
||||
const List<ParserError> &parser_errors = get_errors();
|
||||
for (const ParserError &error : parser_errors) {
|
||||
lsp::Diagnostic diagnostic;
|
||||
diagnostic.severity = lsp::DiagnosticSeverity::Error;
|
||||
LSP::Diagnostic diagnostic;
|
||||
diagnostic.severity = LSP::DiagnosticSeverity::Error;
|
||||
diagnostic.message = error.message;
|
||||
diagnostic.source = "gdscript";
|
||||
diagnostic.code = -1;
|
||||
lsp::Range range;
|
||||
lsp::Position pos;
|
||||
LSP::Range range;
|
||||
LSP::Position pos;
|
||||
const PackedStringArray line_array = get_lines();
|
||||
int line = CLAMP(LINE_NUMBER_TO_INDEX(error.line), 0, line_array.size() - 1);
|
||||
const String &line_text = line_array[line];
|
||||
|
@ -152,13 +152,13 @@ void ExtendGDScriptParser::update_diagnostics() {
|
|||
|
||||
const List<GDScriptWarning> &parser_warnings = get_warnings();
|
||||
for (const GDScriptWarning &warning : parser_warnings) {
|
||||
lsp::Diagnostic diagnostic;
|
||||
diagnostic.severity = lsp::DiagnosticSeverity::Warning;
|
||||
LSP::Diagnostic diagnostic;
|
||||
diagnostic.severity = LSP::DiagnosticSeverity::Warning;
|
||||
diagnostic.message = "(" + warning.get_name() + "): " + warning.get_message();
|
||||
diagnostic.source = "gdscript";
|
||||
diagnostic.code = warning.code;
|
||||
lsp::Range range;
|
||||
lsp::Position pos;
|
||||
LSP::Range range;
|
||||
LSP::Position pos;
|
||||
int line = LINE_NUMBER_TO_INDEX(warning.start_line);
|
||||
const String &line_text = get_lines()[line];
|
||||
pos.line = line;
|
||||
|
@ -178,14 +178,14 @@ void ExtendGDScriptParser::update_symbols() {
|
|||
parse_class_symbol(gdclass, class_symbol);
|
||||
|
||||
for (int i = 0; i < class_symbol.children.size(); i++) {
|
||||
const lsp::DocumentSymbol &symbol = class_symbol.children[i];
|
||||
const LSP::DocumentSymbol &symbol = class_symbol.children[i];
|
||||
members.insert(symbol.name, &symbol);
|
||||
|
||||
// Cache level one inner classes.
|
||||
if (symbol.kind == lsp::SymbolKind::Class) {
|
||||
if (symbol.kind == LSP::SymbolKind::Class) {
|
||||
ClassMembers inner_class;
|
||||
for (int j = 0; j < symbol.children.size(); j++) {
|
||||
const lsp::DocumentSymbol &s = symbol.children[j];
|
||||
const LSP::DocumentSymbol &s = symbol.children[j];
|
||||
inner_class.insert(s.name, &s);
|
||||
}
|
||||
inner_classes.insert(symbol.name, inner_class);
|
||||
|
@ -215,7 +215,7 @@ void ExtendGDScriptParser::update_document_links(const String &p_code) {
|
|||
}
|
||||
if (exists) {
|
||||
String value = const_val;
|
||||
lsp::DocumentLink link;
|
||||
LSP::DocumentLink link;
|
||||
link.target = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_uri(scr_path);
|
||||
link.range = GodotRange(GodotPosition(token.start_line, token.start_column), GodotPosition(token.end_line, token.end_column)).to_lsp(lines);
|
||||
document_links.push_back(link);
|
||||
|
@ -225,13 +225,13 @@ void ExtendGDScriptParser::update_document_links(const String &p_code) {
|
|||
}
|
||||
}
|
||||
|
||||
lsp::Range ExtendGDScriptParser::range_of_node(const GDScriptParser::Node *p_node) const {
|
||||
LSP::Range ExtendGDScriptParser::range_of_node(const GDScriptParser::Node *p_node) const {
|
||||
GodotPosition start(p_node->start_line, p_node->start_column);
|
||||
GodotPosition end(p_node->end_line, p_node->end_column);
|
||||
return GodotRange(start, end).to_lsp(lines);
|
||||
}
|
||||
|
||||
void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p_class, lsp::DocumentSymbol &r_symbol) {
|
||||
void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p_class, LSP::DocumentSymbol &r_symbol) {
|
||||
const String uri = get_uri();
|
||||
|
||||
r_symbol.uri = uri;
|
||||
|
@ -241,7 +241,7 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
|
|||
if (r_symbol.name.is_empty()) {
|
||||
r_symbol.name = path.get_file();
|
||||
}
|
||||
r_symbol.kind = lsp::SymbolKind::Class;
|
||||
r_symbol.kind = LSP::SymbolKind::Class;
|
||||
r_symbol.deprecated = false;
|
||||
r_symbol.range = range_of_node(p_class);
|
||||
if (p_class->identifier) {
|
||||
|
@ -276,9 +276,9 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
|
|||
|
||||
switch (m.type) {
|
||||
case ClassNode::Member::VARIABLE: {
|
||||
lsp::DocumentSymbol symbol;
|
||||
LSP::DocumentSymbol symbol;
|
||||
symbol.name = m.variable->identifier->name;
|
||||
symbol.kind = m.variable->property == VariableNode::PROP_NONE ? lsp::SymbolKind::Variable : lsp::SymbolKind::Property;
|
||||
symbol.kind = m.variable->property == VariableNode::PROP_NONE ? LSP::SymbolKind::Variable : LSP::SymbolKind::Property;
|
||||
symbol.deprecated = false;
|
||||
symbol.range = range_of_node(m.variable);
|
||||
symbol.selectionRange = range_of_node(m.variable->identifier);
|
||||
|
@ -299,20 +299,20 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
|
|||
|
||||
if (m.variable->initializer && m.variable->initializer->type == GDScriptParser::Node::LAMBDA) {
|
||||
GDScriptParser::LambdaNode *lambda_node = (GDScriptParser::LambdaNode *)m.variable->initializer;
|
||||
lsp::DocumentSymbol lambda;
|
||||
LSP::DocumentSymbol lambda;
|
||||
parse_function_symbol(lambda_node->function, lambda);
|
||||
// Merge lambda into current variable.
|
||||
symbol.children.append_array(lambda.children);
|
||||
}
|
||||
|
||||
if (m.variable->getter && m.variable->getter->type == GDScriptParser::Node::FUNCTION) {
|
||||
lsp::DocumentSymbol get_symbol;
|
||||
LSP::DocumentSymbol get_symbol;
|
||||
parse_function_symbol(m.variable->getter, get_symbol);
|
||||
get_symbol.local = true;
|
||||
symbol.children.push_back(get_symbol);
|
||||
}
|
||||
if (m.variable->setter && m.variable->setter->type == GDScriptParser::Node::FUNCTION) {
|
||||
lsp::DocumentSymbol set_symbol;
|
||||
LSP::DocumentSymbol set_symbol;
|
||||
parse_function_symbol(m.variable->setter, set_symbol);
|
||||
set_symbol.local = true;
|
||||
symbol.children.push_back(set_symbol);
|
||||
|
@ -321,10 +321,10 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
|
|||
r_symbol.children.push_back(symbol);
|
||||
} break;
|
||||
case ClassNode::Member::CONSTANT: {
|
||||
lsp::DocumentSymbol symbol;
|
||||
LSP::DocumentSymbol symbol;
|
||||
|
||||
symbol.name = m.constant->identifier->name;
|
||||
symbol.kind = lsp::SymbolKind::Constant;
|
||||
symbol.kind = LSP::SymbolKind::Constant;
|
||||
symbol.deprecated = false;
|
||||
symbol.range = range_of_node(m.constant);
|
||||
symbol.selectionRange = range_of_node(m.constant->identifier);
|
||||
|
@ -361,9 +361,9 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
|
|||
r_symbol.children.push_back(symbol);
|
||||
} break;
|
||||
case ClassNode::Member::SIGNAL: {
|
||||
lsp::DocumentSymbol symbol;
|
||||
LSP::DocumentSymbol symbol;
|
||||
symbol.name = m.signal->identifier->name;
|
||||
symbol.kind = lsp::SymbolKind::Event;
|
||||
symbol.kind = LSP::SymbolKind::Event;
|
||||
symbol.deprecated = false;
|
||||
symbol.range = range_of_node(m.signal);
|
||||
symbol.selectionRange = range_of_node(m.signal->identifier);
|
||||
|
@ -380,9 +380,9 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
|
|||
symbol.detail += ")";
|
||||
|
||||
for (GDScriptParser::ParameterNode *param : m.signal->parameters) {
|
||||
lsp::DocumentSymbol param_symbol;
|
||||
LSP::DocumentSymbol param_symbol;
|
||||
param_symbol.name = param->identifier->name;
|
||||
param_symbol.kind = lsp::SymbolKind::Variable;
|
||||
param_symbol.kind = LSP::SymbolKind::Variable;
|
||||
param_symbol.deprecated = false;
|
||||
param_symbol.local = true;
|
||||
param_symbol.range = range_of_node(param);
|
||||
|
@ -398,10 +398,10 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
|
|||
r_symbol.children.push_back(symbol);
|
||||
} break;
|
||||
case ClassNode::Member::ENUM_VALUE: {
|
||||
lsp::DocumentSymbol symbol;
|
||||
LSP::DocumentSymbol symbol;
|
||||
|
||||
symbol.name = m.enum_value.identifier->name;
|
||||
symbol.kind = lsp::SymbolKind::EnumMember;
|
||||
symbol.kind = LSP::SymbolKind::EnumMember;
|
||||
symbol.deprecated = false;
|
||||
symbol.range.start = GodotPosition(m.enum_value.line, m.enum_value.leftmost_column).to_lsp(lines);
|
||||
symbol.range.end = GodotPosition(m.enum_value.line, m.enum_value.rightmost_column).to_lsp(lines);
|
||||
|
@ -415,9 +415,9 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
|
|||
r_symbol.children.push_back(symbol);
|
||||
} break;
|
||||
case ClassNode::Member::ENUM: {
|
||||
lsp::DocumentSymbol symbol;
|
||||
LSP::DocumentSymbol symbol;
|
||||
symbol.name = m.m_enum->identifier->name;
|
||||
symbol.kind = lsp::SymbolKind::Enum;
|
||||
symbol.kind = LSP::SymbolKind::Enum;
|
||||
symbol.range = range_of_node(m.m_enum);
|
||||
symbol.selectionRange = range_of_node(m.m_enum->identifier);
|
||||
symbol.documentation = m.m_enum->doc_data.description;
|
||||
|
@ -434,10 +434,10 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
|
|||
symbol.detail += "}";
|
||||
|
||||
for (GDScriptParser::EnumNode::Value value : m.m_enum->values) {
|
||||
lsp::DocumentSymbol child;
|
||||
LSP::DocumentSymbol child;
|
||||
|
||||
child.name = value.identifier->name;
|
||||
child.kind = lsp::SymbolKind::EnumMember;
|
||||
child.kind = LSP::SymbolKind::EnumMember;
|
||||
child.deprecated = false;
|
||||
child.range.start = GodotPosition(value.line, value.leftmost_column).to_lsp(lines);
|
||||
child.range.end = GodotPosition(value.line, value.rightmost_column).to_lsp(lines);
|
||||
|
@ -454,12 +454,12 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
|
|||
r_symbol.children.push_back(symbol);
|
||||
} break;
|
||||
case ClassNode::Member::FUNCTION: {
|
||||
lsp::DocumentSymbol symbol;
|
||||
LSP::DocumentSymbol symbol;
|
||||
parse_function_symbol(m.function, symbol);
|
||||
r_symbol.children.push_back(symbol);
|
||||
} break;
|
||||
case ClassNode::Member::CLASS: {
|
||||
lsp::DocumentSymbol symbol;
|
||||
LSP::DocumentSymbol symbol;
|
||||
parse_class_symbol(m.m_class, symbol);
|
||||
r_symbol.children.push_back(symbol);
|
||||
} break;
|
||||
|
@ -471,13 +471,13 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
|
|||
}
|
||||
}
|
||||
|
||||
void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionNode *p_func, lsp::DocumentSymbol &r_symbol) {
|
||||
void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionNode *p_func, LSP::DocumentSymbol &r_symbol) {
|
||||
const String uri = get_uri();
|
||||
|
||||
bool is_named = p_func->identifier != nullptr;
|
||||
|
||||
r_symbol.name = is_named ? p_func->identifier->name : "";
|
||||
r_symbol.kind = (p_func->is_static || p_func->source_lambda != nullptr) ? lsp::SymbolKind::Function : lsp::SymbolKind::Method;
|
||||
r_symbol.kind = (p_func->is_static || p_func->source_lambda != nullptr) ? LSP::SymbolKind::Function : LSP::SymbolKind::Method;
|
||||
r_symbol.detail = "func";
|
||||
if (is_named) {
|
||||
r_symbol.detail += " " + String(p_func->identifier->name);
|
||||
|
@ -570,9 +570,9 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN
|
|||
const GDScriptParser::SuiteNode *suite_node = N->get();
|
||||
for (int i = 0; i < suite_node->locals.size(); i++) {
|
||||
const SuiteNode::Local &local = suite_node->locals[i];
|
||||
lsp::DocumentSymbol symbol;
|
||||
LSP::DocumentSymbol symbol;
|
||||
symbol.name = local.name;
|
||||
symbol.kind = local.type == SuiteNode::Local::CONSTANT ? lsp::SymbolKind::Constant : lsp::SymbolKind::Variable;
|
||||
symbol.kind = local.type == SuiteNode::Local::CONSTANT ? LSP::SymbolKind::Constant : LSP::SymbolKind::Variable;
|
||||
switch (local.type) {
|
||||
case SuiteNode::Local::CONSTANT:
|
||||
symbol.range = range_of_node(local.constant);
|
||||
|
@ -583,7 +583,7 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN
|
|||
symbol.selectionRange = range_of_node(local.variable->identifier);
|
||||
if (local.variable->initializer && local.variable->initializer->type == GDScriptParser::Node::LAMBDA) {
|
||||
GDScriptParser::LambdaNode *lambda_node = (GDScriptParser::LambdaNode *)local.variable->initializer;
|
||||
lsp::DocumentSymbol lambda;
|
||||
LSP::DocumentSymbol lambda;
|
||||
parse_function_symbol(lambda_node->function, lambda);
|
||||
// Merge lambda into current variable.
|
||||
// -> Only interested in new variables, not lambda itself.
|
||||
|
@ -629,7 +629,7 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN
|
|||
}
|
||||
}
|
||||
|
||||
String ExtendGDScriptParser::get_text_for_completion(const lsp::Position &p_cursor) const {
|
||||
String ExtendGDScriptParser::get_text_for_completion(const LSP::Position &p_cursor) const {
|
||||
String longthing;
|
||||
int len = lines.size();
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
@ -649,7 +649,7 @@ String ExtendGDScriptParser::get_text_for_completion(const lsp::Position &p_curs
|
|||
return longthing;
|
||||
}
|
||||
|
||||
String ExtendGDScriptParser::get_text_for_lookup_symbol(const lsp::Position &p_cursor, const String &p_symbol, bool p_func_required) const {
|
||||
String ExtendGDScriptParser::get_text_for_lookup_symbol(const LSP::Position &p_cursor, const String &p_symbol, bool p_func_required) const {
|
||||
String longthing;
|
||||
int len = lines.size();
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
@ -687,7 +687,7 @@ String ExtendGDScriptParser::get_text_for_lookup_symbol(const lsp::Position &p_c
|
|||
return longthing;
|
||||
}
|
||||
|
||||
String ExtendGDScriptParser::get_identifier_under_position(const lsp::Position &p_position, lsp::Range &r_range) const {
|
||||
String ExtendGDScriptParser::get_identifier_under_position(const LSP::Position &p_position, LSP::Range &r_range) const {
|
||||
ERR_FAIL_INDEX_V(p_position.line, lines.size(), "");
|
||||
String line = lines[p_position.line];
|
||||
if (line.is_empty()) {
|
||||
|
@ -709,7 +709,7 @@ String ExtendGDScriptParser::get_identifier_under_position(const lsp::Position &
|
|||
// -> Move position to previous character if:
|
||||
// * Position not on valid identifier char.
|
||||
// * Prev position is valid identifier char.
|
||||
lsp::Position pos = p_position;
|
||||
LSP::Position pos = p_position;
|
||||
if (
|
||||
pos.character >= line.length() // Cursor at end of line.
|
||||
|| (!is_ascii_identifier_char(line[pos.character]) // Not on valid identifier char.
|
||||
|
@ -753,8 +753,8 @@ String ExtendGDScriptParser::get_uri() const {
|
|||
return GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_uri(path);
|
||||
}
|
||||
|
||||
const lsp::DocumentSymbol *ExtendGDScriptParser::search_symbol_defined_at_line(int p_line, const lsp::DocumentSymbol &p_parent, const String &p_symbol_name) const {
|
||||
const lsp::DocumentSymbol *ret = nullptr;
|
||||
const LSP::DocumentSymbol *ExtendGDScriptParser::search_symbol_defined_at_line(int p_line, const LSP::DocumentSymbol &p_parent, const String &p_symbol_name) const {
|
||||
const LSP::DocumentSymbol *ret = nullptr;
|
||||
if (p_line < p_parent.range.start.line) {
|
||||
return ret;
|
||||
} else if (p_parent.range.start.line == p_line && (p_symbol_name.is_empty() || p_parent.name == p_symbol_name)) {
|
||||
|
@ -770,7 +770,7 @@ const lsp::DocumentSymbol *ExtendGDScriptParser::search_symbol_defined_at_line(i
|
|||
return ret;
|
||||
}
|
||||
|
||||
Error ExtendGDScriptParser::get_left_function_call(const lsp::Position &p_position, lsp::Position &r_func_pos, int &r_arg_index) const {
|
||||
Error ExtendGDScriptParser::get_left_function_call(const LSP::Position &p_position, LSP::Position &r_func_pos, int &r_arg_index) const {
|
||||
ERR_FAIL_INDEX_V(p_position.line, lines.size(), ERR_INVALID_PARAMETER);
|
||||
|
||||
int bracket_stack = 0;
|
||||
|
@ -814,22 +814,22 @@ Error ExtendGDScriptParser::get_left_function_call(const lsp::Position &p_positi
|
|||
return ERR_METHOD_NOT_FOUND;
|
||||
}
|
||||
|
||||
const lsp::DocumentSymbol *ExtendGDScriptParser::get_symbol_defined_at_line(int p_line, const String &p_symbol_name) const {
|
||||
const LSP::DocumentSymbol *ExtendGDScriptParser::get_symbol_defined_at_line(int p_line, const String &p_symbol_name) const {
|
||||
if (p_line <= 0) {
|
||||
return &class_symbol;
|
||||
}
|
||||
return search_symbol_defined_at_line(p_line, class_symbol, p_symbol_name);
|
||||
}
|
||||
|
||||
const lsp::DocumentSymbol *ExtendGDScriptParser::get_member_symbol(const String &p_name, const String &p_subclass) const {
|
||||
const LSP::DocumentSymbol *ExtendGDScriptParser::get_member_symbol(const String &p_name, const String &p_subclass) const {
|
||||
if (p_subclass.is_empty()) {
|
||||
const lsp::DocumentSymbol *const *ptr = members.getptr(p_name);
|
||||
const LSP::DocumentSymbol *const *ptr = members.getptr(p_name);
|
||||
if (ptr) {
|
||||
return *ptr;
|
||||
}
|
||||
} else {
|
||||
if (const ClassMembers *_class = inner_classes.getptr(p_subclass)) {
|
||||
const lsp::DocumentSymbol *const *ptr = _class->getptr(p_name);
|
||||
const LSP::DocumentSymbol *const *ptr = _class->getptr(p_name);
|
||||
if (ptr) {
|
||||
return *ptr;
|
||||
}
|
||||
|
@ -839,15 +839,15 @@ const lsp::DocumentSymbol *ExtendGDScriptParser::get_member_symbol(const String
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const List<lsp::DocumentLink> &ExtendGDScriptParser::get_document_links() const {
|
||||
const List<LSP::DocumentLink> &ExtendGDScriptParser::get_document_links() const {
|
||||
return document_links;
|
||||
}
|
||||
|
||||
const Array &ExtendGDScriptParser::get_member_completions() {
|
||||
if (member_completions.is_empty()) {
|
||||
for (const KeyValue<String, const lsp::DocumentSymbol *> &E : members) {
|
||||
const lsp::DocumentSymbol *symbol = E.value;
|
||||
lsp::CompletionItem item = symbol->make_completion_item();
|
||||
for (const KeyValue<String, const LSP::DocumentSymbol *> &E : members) {
|
||||
const LSP::DocumentSymbol *symbol = E.value;
|
||||
LSP::CompletionItem item = symbol->make_completion_item();
|
||||
item.data = JOIN_SYMBOLS(path, E.key);
|
||||
member_completions.push_back(item.to_json());
|
||||
}
|
||||
|
@ -855,9 +855,9 @@ const Array &ExtendGDScriptParser::get_member_completions() {
|
|||
for (const KeyValue<String, ClassMembers> &E : inner_classes) {
|
||||
const ClassMembers *inner_class = &E.value;
|
||||
|
||||
for (const KeyValue<String, const lsp::DocumentSymbol *> &F : *inner_class) {
|
||||
const lsp::DocumentSymbol *symbol = F.value;
|
||||
lsp::CompletionItem item = symbol->make_completion_item();
|
||||
for (const KeyValue<String, const LSP::DocumentSymbol *> &F : *inner_class) {
|
||||
const LSP::DocumentSymbol *symbol = F.value;
|
||||
LSP::CompletionItem item = symbol->make_completion_item();
|
||||
item.data = JOIN_SYMBOLS(path, JOIN_SYMBOLS(E.key, F.key));
|
||||
member_completions.push_back(item.to_json());
|
||||
}
|
||||
|
@ -883,7 +883,7 @@ Dictionary ExtendGDScriptParser::dump_function_api(const GDScriptParser::Functio
|
|||
}
|
||||
parameters.push_back(arg);
|
||||
}
|
||||
if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(p_func->start_line))) {
|
||||
if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(p_func->start_line))) {
|
||||
func["signature"] = symbol->detail;
|
||||
func["description"] = symbol->documentation;
|
||||
}
|
||||
|
@ -906,7 +906,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode
|
|||
class_api["extends_file"] = String(p_class->extends_path);
|
||||
class_api["icon"] = String(p_class->icon_path);
|
||||
|
||||
if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(p_class->start_line))) {
|
||||
if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(p_class->start_line))) {
|
||||
class_api["signature"] = symbol->detail;
|
||||
class_api["description"] = symbol->documentation;
|
||||
}
|
||||
|
@ -929,7 +929,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode
|
|||
api["name"] = m.constant->identifier->name;
|
||||
api["value"] = m.constant->initializer->reduced_value;
|
||||
api["data_type"] = m.constant->get_datatype().to_string();
|
||||
if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.constant->start_line))) {
|
||||
if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.constant->start_line))) {
|
||||
api["signature"] = symbol->detail;
|
||||
api["description"] = symbol->documentation;
|
||||
}
|
||||
|
@ -940,7 +940,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode
|
|||
api["name"] = m.enum_value.identifier->name;
|
||||
api["value"] = m.enum_value.value;
|
||||
api["data_type"] = m.get_datatype().to_string();
|
||||
if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.enum_value.line))) {
|
||||
if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.enum_value.line))) {
|
||||
api["signature"] = symbol->detail;
|
||||
api["description"] = symbol->documentation;
|
||||
}
|
||||
|
@ -956,7 +956,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode
|
|||
api["name"] = m.m_enum->identifier->name;
|
||||
api["value"] = enum_dict;
|
||||
api["data_type"] = m.get_datatype().to_string();
|
||||
if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.m_enum->start_line))) {
|
||||
if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.m_enum->start_line))) {
|
||||
api["signature"] = symbol->detail;
|
||||
api["description"] = symbol->documentation;
|
||||
}
|
||||
|
@ -970,7 +970,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode
|
|||
api["setter"] = m.variable->setter ? ("@" + String(m.variable->identifier->name) + "_setter") : (m.variable->setter_pointer != nullptr ? String(m.variable->setter_pointer->name) : String());
|
||||
api["getter"] = m.variable->getter ? ("@" + String(m.variable->identifier->name) + "_getter") : (m.variable->getter_pointer != nullptr ? String(m.variable->getter_pointer->name) : String());
|
||||
api["export"] = m.variable->exported;
|
||||
if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.variable->start_line))) {
|
||||
if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.variable->start_line))) {
|
||||
api["signature"] = symbol->detail;
|
||||
api["description"] = symbol->documentation;
|
||||
}
|
||||
|
@ -984,7 +984,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode
|
|||
pars.append(String(m.signal->parameters[j]->identifier->name));
|
||||
}
|
||||
api["arguments"] = pars;
|
||||
if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.signal->start_line))) {
|
||||
if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.signal->start_line))) {
|
||||
api["signature"] = symbol->detail;
|
||||
api["description"] = symbol->documentation;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue