If in attribute completion, the attribute being completed
(cursor_offset: int, line: str)
| 145 | |
| 146 | |
| 147 | def current_object_attribute(cursor_offset: int, line: str) -> LinePart | None: |
| 148 | """If in attribute completion, the attribute being completed""" |
| 149 | # TODO replace with more general current_expression_attribute |
| 150 | match = current_word(cursor_offset, line) |
| 151 | if match is None: |
| 152 | return None |
| 153 | matches = _current_object_attribute_re.finditer(match.word) |
| 154 | next(matches) |
| 155 | for m in matches: |
| 156 | if m.start(1) + match.start <= cursor_offset <= m.end(1) + match.start: |
| 157 | return LinePart( |
| 158 | m.start(1) + match.start, m.end(1) + match.start, m.group(1) |
| 159 | ) |
| 160 | return None |
| 161 | |
| 162 | |
| 163 | _current_from_import_from_re = LazyReCompile( |
nothing calls this directly
no test coverage detected