summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/language_server
diff options
context:
space:
mode:
authorSpartan322 <Megacake1234@gmail.com>2024-11-27 13:52:25 -0500
committerSpartan322 <Megacake1234@gmail.com>2024-11-27 13:52:25 -0500
commit721f53fde47c2727d99e3ecccdb789a67df36de0 (patch)
tree55ec5bfa061a5c27272b831e697b78ed1b756a70 /modules/gdscript/language_server
parentb06d20bf39d15ec736d08d4e4fcb32e0c3c1ce1e (diff)
parentf128f383e892865379cb8b14e7bcc9858efe2973 (diff)
downloadredot-engine-721f53fde47c2727d99e3ecccdb789a67df36de0.tar.gz
Merge commit godotengine/godot@f128f383e892865379cb8b14e7bcc9858efe2973
Diffstat (limited to 'modules/gdscript/language_server')
-rw-r--r--modules/gdscript/language_server/gdscript_extend_parser.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp
index d61c97eabf..5732a3372b 100644
--- a/modules/gdscript/language_server/gdscript_extend_parser.cpp
+++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp
@@ -59,6 +59,12 @@ lsp::Position GodotPosition::to_lsp(const Vector<String> &p_lines) const {
return res;
}
res.line = line - 1;
+
+ // Special case: `column = 0` -> Starts at beginning of line.
+ if (column <= 0) {
+ return res;
+ }
+
// Note: character outside of `pos_line.length()-1` is valid.
res.character = column - 1;
@@ -240,9 +246,12 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
r_symbol.kind = lsp::SymbolKind::Class;
r_symbol.deprecated = false;
r_symbol.range = range_of_node(p_class);
- r_symbol.range.start.line = MAX(r_symbol.range.start.line, 0);
if (p_class->identifier) {
r_symbol.selectionRange = range_of_node(p_class->identifier);
+ } else {
+ // No meaningful `selectionRange`, but we must ensure that it is inside of `range`.
+ r_symbol.selectionRange.start = r_symbol.range.start;
+ r_symbol.selectionRange.end = r_symbol.range.start;
}
r_symbol.detail = "class " + r_symbol.name;
{