Skip to content

Commit

Permalink
Merge pull request #126 from kaste/fine-tune-positions
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste authored Jul 18, 2022
2 parents 3f00493 + f5a794b commit 637f23c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,19 @@ def reposition_match(self, line, col, m, virtual_view):
if code.startswith('E1'):
return (line, 0, col)

if code in ('E262', 'E265'):
txt = virtual_view.select_line(line).rstrip('\n')
match = CAPTURE_WS.match(txt[col + 1:])
if match is not None:
length = len(match.group(1))
return (line, col, col + length + 1)

if code.startswith('E266'):
txt = virtual_view.select_line(line).rstrip('\n')
tail_text = txt[col:]
count_comment_sign = len(tail_text) - len(tail_text.lstrip("#"))
return (line, col, col + count_comment_sign)

if code.startswith('E2'):
txt = virtual_view.select_line(line).rstrip('\n')
match = CAPTURE_WS.match(txt[col:])
Expand Down

0 comments on commit 637f23c

Please sign in to comment.