Code completion (IntelliSense)

Follow the instructions below to add Zato code completion, also known as IntelliSense, to your IDE.

On the one hand, this will let you complete the names of classes or methods that your services use. On the other hand, this will let you apply static typing hints to your code and have your IDE validate them while you edit the source code.

The instructions cover Visual Studio Code and PyCharm. If you use another IDE, follow the general process based on your IDE's documentation - essentially, you need to add Zato's source code to your IDE's list of extra Python paths to let the IDE know how to resolve imports.

Visual Studio Code

  • Clone the Zato repository from https://github.com/zatosource/zato to a local directory. Let's call it /home/user/install/zato the resulting directory with the git clone.

  • Switch to the branch called support/3.3 - this is where the source code for Zato 3.3 is.

  • Open the user settings.json file in your VS Code instance. If you are not sure where it is, you can reach it through File -> Preferences -> Settings -> [search for pythonpath] -> Click "Edit in settings.json".

  • In the settings.json file, add these two new keys, or append new entries to the keys, if they already exist:

    • python.autoComplete.extraPaths
    • python.analysis.extraPaths
  • The keys should read as below. Substitute /home/user/install/zato/code accordingly and use the path that you cloned the git repository to.

    "python.autoComplete.extraPaths": [
        "/home/user/install/zato/code/zato-agent/src",
        "/home/user/install/zato/code/zato-broker/src",
        "/home/user/install/zato/code/zato-cli/src",
        "/home/user/install/zato/code/zato-client/src",
        "/home/user/install/zato/code/zato-common/src",
        "/home/user/install/zato/code/zato-distlock/src",
        "/home/user/install/zato/code/zato-hl7/src",
        "/home/user/install/zato/code/zato-scheduler/src",
        "/home/user/install/zato/code/zato-server/src",
        "/home/user/install/zato/code/zato-sso/src",
        "/home/user/install/zato/code/zato-testing/src",
    ],
    "python.analysis.extraPaths": [
        "/home/user/install/zato/code/zato-agent/src",
        "/home/user/install/zato/code/zato-broker/src",
        "/home/user/install/zato/code/zato-cli/src",
        "/home/user/install/zato/code/zato-client/src",
        "/home/user/install/zato/code/zato-common/src",
        "/home/user/install/zato/code/zato-distlock/src",
        "/home/user/install/zato/code/zato-hl7/src",
        "/home/user/install/zato/code/zato-scheduler/src",
        "/home/user/install/zato/code/zato-server/src",
        "/home/user/install/zato/code/zato-sso/src",
        "/home/user/install/zato/code/zato-testing/src",
    ]
    
  • Now, after restarting your IDE, you will be able to use code completion:

  • Remember to periodically git pull the latest updates from support/3.3 to keep your IDE up to date.

PyCharm

  • Clone the Zato repository from https://github.com/zatosource/zato to a local directory. Let's call it /home/user/install/zato the resulting directory with the git clone.

  • Switch to the branch called support/3.3 - this is where the source code for Zato 3.3 is.

  • Next, add directories with the source code of Zato to your PyCharm project Python interpreter's list of directories that it is looking up extra paths in. Follow the steps below.

  • Go to File -> Settings -> Project <project name> -> Python interpreter.

  • Click the cog icon next to the name of the interpreter that your project uses and choose Show All....

  • This will show a list of interpreters that your project is capable of using. The list may potentially contain more than one interpreter. Select the interpreter that your project uses. Next, click the icon that resembles a tree of directories - it is the rightmost one in the rows of icons below, indicated with the green arrow.

  • A dialog window will pop up showing a list of all the paths that the interpreter uses. For each directory listed below, click the + icon (plus symbol) to add the directory to your interpreter's paths. Substitute the path to your git clone as required.
/home/user/install/zato/code/zato-agent/src
/home/user/install/zato/code/zato-broker/src
/home/user/install/zato/code/zato-cli/src
/home/user/install/zato/code/zato-client/src
/home/user/install/zato/code/zato-common/src
/home/user/install/zato/code/zato-distlock/src
/home/user/install/zato/code/zato-hl7/src
/home/user/install/zato/code/zato-scheduler/src
/home/user/install/zato/code/zato-server/src
/home/user/install/zato/code/zato-sso/src
/home/user/install/zato/code/zato-testing/src

  • Now, after restarting your IDE, you will be able to use code completion:

  • Remember to periodically git pull the latest updates from support/3.3 to keep your IDE up to date.