| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9a25c69 commit d36c30d
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -447,27 +447,6 @@ def locate(self, current_offset, line): | |||
| 447 | 447 | return lineparts.current_word(current_offset, line) | |
| 448 | 448 | ||
| 449 | 449 | ||
| 450 | - class StringLiteralAttrCompletion(BaseCompletionType): | ||
| 451 | - | ||
| 452 | - def matches(self, cursor_offset, line, **kwargs): | ||
| 453 | - r = self.locate(cursor_offset, line) | ||
| 454 | - if r is None: | ||
| 455 | - return None | ||
| 456 | - | ||
| 457 | - attrs = dir('') | ||
| 458 | - if not py3: | ||
| 459 | - # decode attributes | ||
| 460 | - attrs = (att.decode('ascii') for att in attrs) | ||
| 461 | - | ||
| 462 | - matches = set(att for att in attrs if att.startswith(r.word)) | ||
| 463 | - if not r.word.startswith('_'): | ||
| 464 | - return set(match for match in matches if not match.startswith('_')) | ||
| 465 | - return matches | ||
| 466 | - | ||
| 467 | - def locate(self, current_offset, line): | ||
| 468 | - return lineparts.current_string_literal_attr(current_offset, line) | ||
| 469 | - | ||
| 470 | - | ||
| 471 | 450 | class ExpressionAttributeCompletion(AttrCompletion): | |
| 472 | 451 | # could replace attr completion as a more general case with some work | |
| 473 | 452 | def locate(self, current_offset, line): | |
@@ -608,7 +587,6 @@ def get_completer(completers, cursor_offset, line, **kwargs): | |||
| 608 | 587 | def get_default_completer(mode=SIMPLE): | |
| 609 | 588 | return ( | |
| 610 | 589 | DictKeyCompletion(mode=mode), | |
| 611 | - StringLiteralAttrCompletion(mode=mode), | ||
| 612 | 590 | ImportCompletion(mode=mode), | |
| 613 | 591 | FilenameCompletion(mode=mode), | |
| 614 | 592 | MagicMethodCompletion(mode=mode), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -216,21 +216,6 @@ def current_dotted_attribute(cursor_offset, line): | |||
| 216 | 216 | return LinePart(start, end, word) | |
| 217 | 217 | ||
| 218 | 218 | ||
| 219 | - current_string_literal_attr_re = LazyReCompile( | ||
| 220 | - "('''" + | ||
| 221 | - r'''|"""|'|")''' + | ||
| 222 | - r'''((?:(?=([^"'\\]+|\\.|(?!\1)["']))\3)*)\1[.]([a-zA-Z_]?[\w]*)''') | ||
| 223 | - | ||
| 224 | - | ||
| 225 | - def current_string_literal_attr(cursor_offset, line): | ||
| 226 | - """The attribute following a string literal""" | ||
| 227 | - matches = current_string_literal_attr_re.finditer(line) | ||
| 228 | - for m in matches: | ||
| 229 | - if m.start(4) <= cursor_offset and m.end(4) >= cursor_offset: | ||
| 230 | - return LinePart(m.start(4), m.end(4), m.group(4)) | ||
| 231 | - return None | ||
| 232 | - | ||
| 233 | - | ||
| 234 | 219 | current_expression_attribute_re = LazyReCompile(r'[.]\s*((?:[\w_][\w0-9_]*)|(?:))') | |
| 235 | 220 | ||
| 236 | 221 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ | |||
| 5 | 5 | current_string, current_object, current_object_attribute, \ | |
| 6 | 6 | current_from_import_from, current_from_import_import, current_import, \ | |
| 7 | 7 | current_method_definition_name, current_single_word, \ | |
| 8 | - current_string_literal_attr, current_expression_attribute | ||
| 8 | + current_expression_attribute | ||
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | 11 | def cursor(s): | |
@@ -293,19 +293,6 @@ def test_simple(self): | |||
| 293 | 293 | self.assertAccess(' <foo|>') | |
| 294 | 294 | ||
| 295 | 295 | ||
| 296 | - class TestCurrentStringLiteral(LineTestCase): | ||
| 297 | - def setUp(self): | ||
| 298 | - self.func = current_string_literal_attr | ||
| 299 | - | ||
| 300 | - def test_simple(self): | ||
| 301 | - self.assertAccess('"hey".<a|>') | ||
| 302 | - self.assertAccess('"hey"|') | ||
| 303 | - self.assertAccess('"hey"|.a') | ||
| 304 | - self.assertAccess('"hey".<a|b>') | ||
| 305 | - self.assertAccess('"hey".asdf d|') | ||
| 306 | - self.assertAccess('"hey".<|>') | ||
| 307 | - | ||
| 308 | - | ||
| 309 | 296 | class TestCurrentExpressionAttribute(LineTestCase): | |
| 310 | 297 | def setUp(self): | |
| 311 | 298 | self.func = current_expression_attribute | |
@@ -340,5 +327,14 @@ def test_indexing(self): | |||
| 340 | 327 | self.assertAccess('abc[def].gh |i') | |
| 341 | 328 | self.assertAccess('abc[def]|') | |
| 342 | 329 | ||
| 330 | + def test_strings(self): | ||
| 331 | + self.assertAccess('"hey".<a|>') | ||
| 332 | + self.assertAccess('"hey"|') | ||
| 333 | + self.assertAccess('"hey"|.a') | ||
| 334 | + self.assertAccess('"hey".<a|b>') | ||
| 335 | + self.assertAccess('"hey".asdf d|') | ||
| 336 | + self.assertAccess('"hey".<|>') | ||
| 337 | + | ||
| 338 | + | ||
| 343 | 339 | if __name__ == '__main__': | |
| 344 | 340 | unittest.main() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments