Display help message upon UndefVarError(:help) using REPL.REPLCompletitions.UndefVarError_hint#41754
Conversation
|
Looks like this somehow broke |
|
This new API looks quite a lot like the Line 168 in bdacfa2 In any case, adding a whole new public API for this seems excessive. |
|
That's the first I've heard of My inclination then is to go back to InteractiveUtils and register an error hint from there since having the help message displayed only makes sense when interactive. |
|
The hook is also already registered for REPL and can be extended to add this text for handling "help". See #40545 :) |
|
Just as a remark, Python seems to implement it in a similar way to #41749 |
|
Do we still want to show the error in this specific case of The suggestion hook seems to display after showing the error. |
900ac29 to
8d45134
Compare
|
I've force pushed a new commit that implements a much simpler change in We may want to add a mechanism to suppress the error message in the future, but that is for another pull request. |
|
Looks like all the tests pass this time. |
|
Perhaps I spoke too soon. I'm not sure what's happening with buildbot/package_freebsd64 build, but I'm pretty sure it is unrelated. Any other thoughts or comments in the meantime? |
|
Thanks @mkitti, this will be a very nice usability enhancement. |
This is an alternate implementation of #41749 to display a useful help message when the user types "help" or "help()" into the REPL. Rather than creating a new type in InteractiveUtils, this PR modifies the REPL error display by expanding
REPL.REPLCompletitions.UndefVarError_hintIn contrast to #41749, this allows the user to create a variable named
help. Upon doing so, the help message will not be displayed.This follows the suggestion of @vtjnash to intercept the
UnderVarErrorforhelpand of @DilumAluthge to implement this functionality in the REPL code.As shown above, this iteration still shows
ERROR: UndefVarError: help not definedupon entering "help" and also shows a stacktrace forhelp(). A mechanism to hide the error would be nice, but is beyond the scope of this pull request.