@@ -181,9 +181,10 @@ impl DefinitionFeature {
181181 SymType :: PACKAGE ( _) => PathBuf :: from ( path) . join ( format ! ( "__init__.py{}" , file. upgrade( ) . unwrap( ) . borrow( ) . as_package( ) . i_ext( ) ) ) . sanitize ( ) ,
182182 _ => path. clone ( )
183183 } ;
184- let range = match symbol. borrow ( ) . typ ( ) {
185- SymType :: PACKAGE ( _) | SymType :: FILE | SymType :: NAMESPACE | SymType :: DISK_DIR => Range :: default ( ) ,
186- _ => session. sync_odoo . get_file_mgr ( ) . borrow ( ) . text_range_to_range ( session, & full_path, & symbol. borrow ( ) . range ( ) ) ,
184+ let range = if symbol. borrow ( ) . has_range ( ) {
185+ session. sync_odoo . get_file_mgr ( ) . borrow ( ) . text_range_to_range ( session, & full_path, & symbol. borrow ( ) . range ( ) )
186+ } else {
187+ Range :: default ( )
187188 } ;
188189 links. push ( LocationLink {
189190 origin_selection_range : None ,
@@ -223,9 +224,10 @@ impl DefinitionFeature {
223224 SymType :: PACKAGE ( _) => PathBuf :: from ( path) . join ( format ! ( "__init__.py{}" , file. upgrade( ) . unwrap( ) . borrow( ) . as_package( ) . i_ext( ) ) ) . sanitize ( ) ,
224225 _ => path. clone ( )
225226 } ;
226- let range = match s. borrow ( ) . typ ( ) {
227- SymType :: PACKAGE ( _) | SymType :: FILE | SymType :: NAMESPACE | SymType :: DISK_DIR => Range :: default ( ) ,
228- _ => session. sync_odoo . get_file_mgr ( ) . borrow ( ) . text_range_to_range ( session, & full_path, & s. borrow ( ) . range ( ) ) ,
227+ let range = if s. borrow ( ) . has_range ( ) {
228+ session. sync_odoo . get_file_mgr ( ) . borrow ( ) . text_range_to_range ( session, & full_path, & s. borrow ( ) . range ( ) )
229+ } else {
230+ Range :: default ( )
229231 } ;
230232 let link_range = if link_range. is_some ( ) {
231233 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