Skip to content

Commit

Permalink
Added elpy-goto-assignment to the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
galaunay committed Mar 29, 2020
1 parent da09215 commit fc54812
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
22 changes: 20 additions & 2 deletions docs/customization_tips.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ For example to use black:
An alternative to ``elpy-goto-definition``
==========================================
Alternatives to ``elpy-goto-definition``
========================================

Fallback to rgrep
-----------------

You may sometimes find when you try to navigate to a function/class definition with elpy-goto-definition_ (``M-.``), that instead of jumping to the definition, you get the message "No definition found". If you see this error often (because of the nature of the code you work on), you can use the following function instead of/in addition to ``elpy-goto-definition``:

Expand All @@ -80,6 +83,21 @@ This function will try to find the definition of the symbol at point using ``elp
.. _elpy-rgrep-symbol: http://elpy.readthedocs.org/en/latest/ide.html#command-elpy-rgrep-symbol

Jumping to assignment
---------------------

As an alternative to `elpy-goto-definition`, Elpy also provides the function elpy-goto-assignment_ that jumps to the line where the symbol at point has been assigned.
For functions and classes, it behaves roughly like `elpy-goto-definition` but has some advantages in certain situations (like if you want to jump to a decorated function).
You can try this alternative with the following code:


.. code-block:: elisp
(define-key map (kbd "M-.") 'elpy-goto-assignment
(define-key map (kbd "C-x 4 M-.") 'elpy-goto-assignment-other-window)
.. _elpy-goto-assignment: http://elpy.readthedocs.org/en/latest/ide.html#command-elpy-goto-assignment


Enable full font locking of inputs in the python shell
======================================================
Expand Down
7 changes: 7 additions & 0 deletions docs/ide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ Elpy supports advanced navigation features.

Search the buffer for a list of definitions of classes and functions.

.. command:: elpy-goto-assignment

Go to the location where the identifier at point is assigned.
It is not bound by default, so you will have to bind it manually.
You can also use it as a replacement to ``elpy-goto-definition`` (see `Jumping to assignment`_).

.. _Jumping to assignment: http://elpy.readthedocs.org/en/latest/customization_tips.html#jumping-to-assignment

If you use an Emacs version superior to 25, Elpy will define the
necessary backends for the `xref`_ package.
Expand Down

0 comments on commit fc54812

Please sign in to comment.