Skip to content

Commit

Permalink
Fix relative import offset calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
rdbisme committed Feb 9, 2021
1 parent d24f6bc commit 2318497
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rope/base/worder.py
Expand Up @@ -225,6 +225,11 @@ def _find_primary_start(self, offset):
prev = self._find_last_non_space_char(offset - 1)
if offset <= 0 or self.code[prev] != '.':
break

# If prev -1 is a space, we're dealing with relative imports
if self.code[prev - 1].isspace():
break

offset = self._find_primary_without_dot_start(prev - 1)
if not self._is_id_char(offset):
break
Expand Down

0 comments on commit 2318497

Please sign in to comment.