• [PyCharm IDE]
 

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Wiki Markup
You have already met code completion in the [Getting Started Guide|http://confluence.jetbrains.com/display/PYH/Getting+Started+with+PyCharm]. Let's explore this feature in more detail.

...


*Code completion* shows a list of words (a suggestion list), which are relevant to the current location in the given visibility scope.

...



In this brief tutorial, we'll learn about:

...

Table of Contents

Invoking code completion

To show code completion at any time, press

span
classshortcut
Ctrl+Space
.

Actually, by default the suggestion list pops up automatically. whenever you start typing. It is also triggered by typing a dot after a symbol name. As you go on typing, the suggestion list shrinks and shows the matching entries only. Note also, that the suggestion list is smart enough, and recognizes the names when only their parts, regardless of their position, are entered:

Image Removed

If you are crossed with the list popping up when you do not want to see it, you can disable this feature by clearing the check box Autopopup code completion in (ms) (

span
classshortcut
Ctrl+Alt+S
span
classshortcut
Settings → Editor → Code Completion
). In this case you have to invoke code completion explicitly.

Completing selection

Use your mouse pointer or the up and down arrow keys to choose the desired variant.

Image Removed

(By the way, you can use the right and left arrow keys to make the suggestion list narrower or wider.)

When ready, you have to insert the selected symbol. PyCharm suggests two ways to do it.

  • First, press
    span
    classshortcut
    Enter
    - the selected variant is added at the insertion point:

Image Removed

  • Second, press
    span
    classshortcut
    Tab
    - in this case, the selected variant replaces the string to the right of the insertion point:

Image Removed

How to change completion behavior?

Press

span
classshortcut
Ctrl+Alt+S
to open the Settings dialog, expand the Editor node, and click Code Completion page:

Image Removed

As you can see, PyCharm allows to change all the behaviors of code completion to fit your requirements. Press the "Help" button if you're not sure about some particular option.

To learn more about code completion, follow this link.

Other topics of this tutorial

Page Tree
reversetrue
rootPYH:Editing with PyCharm

...



{toc}

h2. Invoking code completion

To show code completion at any time, press {span:class=shortcut}Ctrl+Space{span}.

Actually, by default the suggestion list pops up automatically. whenever you start typing. It is also triggered by typing a dot after a symbol name. As you go on typing, the suggestion list shrinks and shows the matching entries only. Note also, that the suggestion list is smart enough, and recognizes the names when only their parts, regardless of their position, are entered:


!code_completion3.png!


If you are crossed with the list popping up when you do not want to see it, you can disable this feature by clearing the check box *Autopopup code completion in (ms)* ({span:class=shortcut}Ctrl+Alt+S{span} → {span:class=shortcut}Settings → Editor → Code Completion{span}). In this case you have to invoke code completion explicitly.

h2. Completing selection

Use your mouse pointer or the up and down arrow keys to choose the desired variant.

!code_completion4.png!

(By the way, you can use the right and left arrow keys to make the suggestion list narrower or wider.)

When ready, you have to insert the selected symbol. PyCharm suggests two ways to do it.

* First, press {span:class=shortcut}Enter{span} \- the selected variant is added at the insertion point:

!code_completion5.png!

* Second, press {span:class=shortcut}Tab{span} \- in this case, the selected variant replaces the string to the right of the insertion point:


!code_completion6.png!

h2. How to change completion behavior?

Press {span:class=shortcut}Ctrl+Alt+S{span} to open the *Settings* dialog, expand the *Editor* node, and click [Code Completion|http://www.jetbrains.com/pycharm/webhelp/editor-code-completion.html] page:

!code_completion2.png!

As you can see, PyCharm allows to change all the behaviors of code completion to fit your requirements. Press the "Help" button if you're not sure about some particular option.

To learn more about code completion, follow [this link|http://www.jetbrains.com/pycharm/webhelp/auto-completing-code.html].

h2. Other topics of this tutorial
{pagetree:root=Editing with PyCharm|reverse=true}\\  {rate}