VS Code

Learn how to setup VS Code including recommended VS Code extensions for Ansible engineering tasks.

Extensies

Linter

Linter  by Nando Vieira. This extensions supports linters for several languages including YAML.

Trailing Spaces

Trailing Spaces  by Shardul Mahadik. Visualizes “trailing spaces” by making them red. Configure this extension to automatically removed “extra” spaces every time you press save with the following steps:

  1. Cntrl Shift p en selecteer Preferences: Open User Settings.
  2. Filter on trailing spaces.
  3. Enable Trim on Save.

Git commit (no verify)

Git commit(no verify)  by DevEscalus. Allows you to skip the pre-commit hook and perform a “no-verify” commit. After installation you first have to enable this option via settings.

Markdown All in One

Markdown All in One  by Yu Zhang.

Git Graph

Git Graph  by mhutchie. Visualizes Git history and allows you to start Git operations directly from the history e.g. for “cherry picking”.

Black Formatter

Black Formatter  by Microsoft. Opinionated formatter for Python code that can automatically format your Python code. Enable via JSON User Settings as follows:

    "[python]": {
        "editor.formatOnType": true,
        "editor.defaultFormatter": "ms-python.black-formatter",
        "editor.formatOnSave": true
    },

Tips

Multiple Cursor Selection

  • Alt + Click: Create a new cursor at the location of your click.
  • Ctrl + Alt + Up/Down: Create a new cursor above or below the current cursor.
  • Ctrl + Shift + L: Create multiple cursors at all occurrences of the current selected text.
  • Ctrl + Alt + Shift + I: Create multiple cursors at the beginning of each line of the selected text.
  • Ctrl + D: Select the next occurrence of the current selected text and create a cursor. Repeat to continue selecting next occurrences.
  • Shift + Alt + Click: Add another cursor at the location of your click, allowing you to edit multiple places at once.

You can also use the command palette (Ctrl+Shift+P) and type “Create cursor” to see all the options available. Please note that the above shortcuts are based on Windows and Linux, If you are using Mac, please use cmd instead of ctrl

Font size

Cntrl Shift + and Cntrl -.

Comment / uncomment

Cntrl \