mongo icon indicating copy to clipboard operation
mongo copied to clipboard

Improve introspection and completion capabilities of entry point registries.

Open amcgregor opened this issue 6 years ago • 1 comments

Currently there is some either unacceptable behaviour (only Registry attributes are listed in completions) or erroneous behaviour (exceptions in REPL shells upon typing . and triggering completion). Depending on the IDE or editor's mechanism of collecting identifiers, this will also prohibit their own symbol indexing.

Attempting tab completion (or equivalent) or performing introspection (via dir() and friends) should list the available plugins, accounting for optional requirements.

amcgregor avatar Sep 20 '17 01:09 amcgregor

Initial improvements are in via 79034c0. Updates include:

  • Provides module-typical __all__ attribute which is a calculated list of only the available plugin names.
  • Overrides __dir__ (dir()) behaviour to include the results of __all__ in queries.

This corrects REPL shell behaviour for ptipython from a lengthy chain of explosions culminating in LookupError: Unknown plugin "__objclass__"; found: …:

screen shot 2017-09-19 at 21 45 29

With:

screen shot 2017-09-19 at 20 57 41

Requires tests.

amcgregor avatar Sep 20 '17 01:09 amcgregor