| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 400d7e2 commit ec79bd8
9 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | # The MIT License | |
| 2 | 2 | # | |
| 3 | 3 | # Copyright (c) 2009-2015 the bpython authors. | |
| 4 | + # Copyright (c) 2015-2020 Sebastian Ramacher | ||
| 4 | 5 | # | |
| 5 | 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | 7 | # of this software and associated documentation files (the "Software"), to deal | |
@@ -34,7 +35,6 @@ | |||
| 34 | 35 | ||
| 35 | 36 | from enum import Enum | |
| 36 | 37 | from . import inspection | |
| 37 | - from . import importcompletion | ||
| 38 | 38 | from . import line as lineparts | |
| 39 | 39 | from .line import LinePart | |
| 40 | 40 | from .lazyre import LazyReCompile | |
@@ -285,8 +285,12 @@ def matches(self, cursor_offset, line, **kwargs): | |||
| 285 | 285 | ||
| 286 | 286 | ||
| 287 | 287 | class ImportCompletion(BaseCompletionType): | |
| 288 | + def __init__(self, module_gatherer, mode=AutocompleteModes.SIMPLE): | ||
| 289 | + super().__init__(False, mode) | ||
| 290 | + self.module_gatherer = module_gatherer | ||
| 291 | + | ||
| 288 | 292 | def matches(self, cursor_offset, line, **kwargs): | |
| 289 | - return importcompletion.complete(cursor_offset, line) | ||
| 293 | + return self.module_gatherer.complete(cursor_offset, line) | ||
| 290 | 294 | ||
| 291 | 295 | def locate(self, current_offset, line): | |
| 292 | 296 | return lineparts.current_word(current_offset, line) | |
@@ -656,10 +660,10 @@ def get_completer(completers, cursor_offset, line, **kwargs): | |||
| 656 | 660 | return [], None | |
| 657 | 661 | ||
| 658 | 662 | ||
| 659 | - def get_default_completer(mode=AutocompleteModes.SIMPLE): | ||
| 663 | + def get_default_completer(mode=AutocompleteModes.SIMPLE, module_gatherer=None): | ||
| 660 | 664 | return ( | |
| 661 | 665 | DictKeyCompletion(mode=mode), | |
| 662 | - ImportCompletion(mode=mode), | ||
| 666 | + ImportCompletion(module_gatherer, mode=mode), | ||
| 663 | 667 | FilenameCompletion(mode=mode), | |
| 664 | 668 | MagicMethodCompletion(mode=mode), | |
| 665 | 669 | MultilineJediCompletion(mode=mode), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -66,9 +66,6 @@ | |||
| 66 | 66 | from pygments.token import Token | |
| 67 | 67 | from .formatter import BPythonFormatter | |
| 68 | 68 | ||
| 69 | - # This for completion | ||
| 70 | - from . import importcompletion | ||
| 71 | - | ||
| 72 | 69 | # This for config | |
| 73 | 70 | from .config import Struct, getpreferredencoding | |
| 74 | 71 | ||
@@ -1784,7 +1781,7 @@ def idle(caller): | |||
| 1784 | 1781 | sure it happens conveniently.""" | |
| 1785 | 1782 | global DO_RESIZE | |
| 1786 | 1783 | ||
| 1787 | - if importcompletion.find_coroutine() or caller.paste_mode: | ||
| 1784 | + if caller.module_gatherer.find_coroutine() or caller.paste_mode: | ||
| 1788 | 1785 | caller.scr.nodelay(True) | |
| 1789 | 1786 | key = caller.scr.getch() | |
| 1790 | 1787 | caller.scr.nodelay(False) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,6 @@ | |||
| 13 | 13 | from . import args as bpargs | |
| 14 | 14 | from . import translations | |
| 15 | 15 | from .translations import _ | |
| 16 | - from .importcompletion import find_coroutine | ||
| 17 | 16 | from .curtsiesfrontend import events as bpythonevents | |
| 18 | 17 | from . import inspection | |
| 19 | 18 | from .repl import extract_exit_value | |
@@ -113,7 +112,7 @@ def mainloop(self, interactive=True, paste=None): | |||
| 113 | 112 | # do a display before waiting for first event | |
| 114 | 113 | self.process_event_and_paint(None) | |
| 115 | 114 | inputs = combined_events(self.input_generator) | |
| 116 | - while find_coroutine(): | ||
| 115 | + while self.module_gatherer.find_coroutine(): | ||
| 117 | 116 | e = inputs.send(0) | |
| 118 | 117 | if e is not None: | |
| 119 | 118 | self.process_event_and_paint(e) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments