Skip to content

Commit b783f6c

Browse files
committed
[FIX] features: fix gotodef location crash
gotodef from XML files where redirected to wrong files, sometimes leading to a crash as rope is not long enough on the other file
1 parent 7fb39d4 commit b783f6c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

server/src/core/symbols/symbol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,7 @@ impl Symbol {
20642064
}
20652065

20662066
pub fn get_file(&self) -> Option<Weak<RefCell<Symbol>>> {
2067-
if self.typ() == SymType::FILE || matches!(self.typ(), SymType::PACKAGE(_)) {
2067+
if self.typ() == SymType::FILE || matches!(self.typ(), SymType::PACKAGE(_)) || self.typ() == SymType::XML_FILE || self.typ() == SymType::CSV_FILE {
20682068
return self.weak_self().clone();
20692069
}
20702070
if self.parent().is_some() {

server/src/features/definition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ impl DefinitionFeature {
265265
_ => session.sync_odoo.get_file_mgr().borrow().std_range_to_range(session, &full_path, &range),
266266
};
267267
let link_range = if link_range.is_some() {
268-
Some(session.sync_odoo.get_file_mgr().borrow().std_range_to_range(session, &full_path, link_range.as_ref().unwrap()))
268+
Some(session.sync_odoo.get_file_mgr().borrow().std_range_to_range(session, file_symbol.borrow().paths().first().as_ref().unwrap(), link_range.as_ref().unwrap()))
269269
} else {
270270
None
271271
};

0 commit comments

Comments
 (0)