This project has moved. For the latest updates, please go here.


Provide completions after "raise " for known exception types


After typing "raise " the user is almost certainly going to type an exception type - we should pop intellisense and provide completions for known exception types.

file attachments

Closed Jul 10, 2012 at 6:57 PM by weidongh


Zooba wrote Jan 21, 2012 at 11:48 PM

I've written a patch for this, but the simplest/quickest way I can see to restrict the completions is simply to filter to classes with "Error" or "Exception" in the name (and add StopIteration and GeneratorExit manually). Base class information doesn't seem to exist or be easy to get at through the analysis--is there a way to get at it without hurting the response time too much?

In terms of behaviour, completions appear after typing "raise " and "except " or Ctrl+Space immediately after the statement, but if you've started typing a name/open-paren then it reverts to normal completions.

Zooba wrote Jan 22, 2012 at 12:09 AM

Add "KeyboardInterrupt" and "SystemExit" to the list. "*Warning"s are omitted because they shouldn't be raised by users, but only by the warnings package (when the treat-as-error setting is set).

Zooba wrote Jan 22, 2012 at 12:42 AM

I've attached the patch file. Feel free to review/apply it directly, or if you really want a pull request I can set one up.

dinov wrote Jan 23, 2012 at 10:24 PM

This approach seems alright for now. We do track the subclasses for user defined types but we don't currently do it for built-in types. We probably could, but making sure to get the lifetime management of the user defined types right might be tricky.