If in dictionary completion, return the current key
(cursor_offset: int, line: str)
| 76 | |
| 77 | |
| 78 | def current_dict_key(cursor_offset: int, line: str) -> LinePart | None: |
| 79 | """If in dictionary completion, return the current key""" |
| 80 | for m in _current_dict_key_re.finditer(line): |
| 81 | if m.start(1) <= cursor_offset <= m.end(1): |
| 82 | return LinePart(m.start(1), m.end(1), m.group(1)) |
| 83 | return None |
| 84 | |
| 85 | |
| 86 | # capture valid identifier name if followed by `[` character |