@@ -254,9 +254,10 @@ impl DefinitionFeature {
254254 SymType :: PACKAGE ( _) => PathBuf :: from ( path) . join ( format ! ( "__init__.py{}" , file. upgrade( ) . unwrap( ) . borrow( ) . as_package( ) . i_ext( ) ) ) . sanitize ( ) ,
255255 _ => path. clone ( )
256256 } ;
257- let range = match symbol. borrow ( ) . typ ( ) {
258- SymType :: PACKAGE ( _) | SymType :: FILE | SymType :: NAMESPACE | SymType :: DISK_DIR => Range :: default ( ) ,
259- _ => session. sync_odoo . get_file_mgr ( ) . borrow ( ) . text_range_to_range ( session, & full_path, & symbol. borrow ( ) . range ( ) ) ,
257+ let range = if symbol. borrow ( ) . has_range ( ) {
258+ session. sync_odoo . get_file_mgr ( ) . borrow ( ) . text_range_to_range ( session, & full_path, & symbol. borrow ( ) . range ( ) )
259+ } else {
260+ Range :: default ( )
260261 } ;
261262 links. push ( LocationLink {
262263 origin_selection_range : None ,
@@ -296,9 +297,10 @@ impl DefinitionFeature {
296297 SymType :: PACKAGE ( _) => PathBuf :: from ( path) . join ( format ! ( "__init__.py{}" , file. upgrade( ) . unwrap( ) . borrow( ) . as_package( ) . i_ext( ) ) ) . sanitize ( ) ,
297298 _ => path. clone ( )
298299 } ;
299- let range = match s. borrow ( ) . typ ( ) {
300- SymType :: PACKAGE ( _) | SymType :: FILE | SymType :: NAMESPACE | SymType :: DISK_DIR => Range :: default ( ) ,
301- _ => session. sync_odoo . get_file_mgr ( ) . borrow ( ) . text_range_to_range ( session, & full_path, & s. borrow ( ) . range ( ) ) ,
300+ let range = if s. borrow ( ) . has_range ( ) {
301+ session. sync_odoo . get_file_mgr ( ) . borrow ( ) . text_range_to_range ( session, & full_path, & s. borrow ( ) . range ( ) )
302+ } else {
303+ Range :: default ( )
302304 } ;
303305 let link_range = if link_range. is_some ( ) {
304306 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 ( ) ) )
0 commit comments