Repository: spyder-ide/spyder

Issue:
Add "Show help for current object" option to Editor context menu
_From [vbgunz](https://code.google.com/u/vbgunz/) on 2012-03-27T08:38:23Z_

Current options are "Source: Console" and "Source: Editor". Is it possible to ask for a third "Source: Cursor"? It would behave by automatically updating the "Object Inspector" to wherever the cursor is in real time.

It would be nice to have an immediate reference to a member without having to ask for it. An always updating "Object Inspector" should make re/familiarizing oneself with any well documented module easier without the developer having to break their work-flow to Google, read docs, sift through source, switch windows, play with options, etc.

At least, hopefully it'll keep a developer from breaking more often.

The last request is linking back to the "Online help" from the "Object Inspector". A good example is os.path.abspath. The OI shows immediate information about _abspath_ but doesn't provide a way to jump to modules _path_ OR _os_.

The main points of the above feature requests is making "Learning" an integral part of "Coding". This is why I personally picked Python and IDE's really need to catch up with this concept. This is why when I first tried Spyder (yesterday), it showed promise in this area unlike any other Python IDE.

I hope the request is feasible. Thank you for the opportunity to share it with you.

_Original issue: http://code.google.com/p/spyderlib/issues/detail?id=978_



Discussion:
_From [ccordoba12](https://code.google.com/u/ccordoba12/) on 2013-02-13T09:16:03Z_

On my plans for 2.3.

**Status:** Accepted  
  **Owner:** ccordoba12  
  **Labels:** -Cat-Miscelleneous Cat-ObjectInspector MS-v2.3  

_From [pierre.raybaut](https://code.google.com/u/pierre.raybaut/) on 2013-05-11T06:00:49Z_

**Labels:** -MS-v2.3 MS-v2.4  

I don't know about real time, that could get distracting, but it would be nice to have a menu item/shortcut for "show the object under the cursor in the object inspector"

I think that's what `Ctrl+I` is used for, isn't it?

Ah, cool, yep, that works. But there's no corresponding menu item, so there's no easy way to discover that.

Please read the _Usage_ message shown in the Object Inspector every time Spyder is started.

What we could do is adding an entry in the context menu of both the Editor and the Consoles called _Show help for the current object_ that has the same effect. What about that?

Heh. I never noticed that :P 

Yeah, context menu would be great. It might also go well in the 'source' menu.


Resolving patch:
diff --git a/spyder/plugins/editor/widgets/codeeditor.py b/spyder/plugins/editor/widgets/codeeditor.py
--- a/spyder/plugins/editor/widgets/codeeditor.py
+++ b/spyder/plugins/editor/widgets/codeeditor.py
@@ -4419,6 +4419,12 @@ def setup_context_menu(self):
             shortcut=CONF.get_shortcut('editor', 'go to definition'),
             triggered=self.go_to_definition_from_cursor)
 
+        self.inspect_current_object_action = create_action(
+            self, _("Inspect current object"),
+            icon=ima.icon('MessageBoxInformation'),
+            shortcut=CONF.get_shortcut('editor', 'inspect current object'),
+            triggered=self.sig_show_object_info.emit)
+
         # Run actions
         self.run_cell_action = create_action(
             self, _("Run cell"), icon=ima.icon('run_cell'),
@@ -4490,7 +4496,8 @@ def setup_context_menu(self):
         actions_1 = [self.run_cell_action, self.run_cell_and_advance_action,
                      self.re_run_last_cell_action, self.run_selection_action,
                      self.run_to_line_action, self.run_from_line_action,
-                     self.gotodef_action, None, self.undo_action,
+                     self.gotodef_action, self.inspect_current_object_action,
+                     None, self.undo_action,
                      self.redo_action, None, self.cut_action,
                      self.copy_action, self.paste_action, selectall_action]
         actions_2 = [None, zoom_in_action, zoom_out_action, zoom_reset_action,


Test patch: