Skip to content

VSCode Setting Guideline

Tong Lam edited this page Mar 19, 2024 · 2 revisions

Overall

Following the conventions for linting and formatting before starting development is crucial for smooth collaboration within an agile development team. Before beginning your tasks, please ensure that all the tools used in this project are installed and configured properly. We may use a GitHub action to check the linting and formatting later. At that point, any code that doesn't adhere to the rules will fail the checking pipeline and cannot be merged into the main branch.

Pylint

  1. Install the Pylint extension from the VSCode extensions marketplace.
  2. Pylint will automatically check your code when you open a python file.

Isort

  1. Install the Isort extension from the VSCode extensions marketplace.
  2. Once this extension is installed in Visual Studio Code, isort is automatically registered as an import organizer. You can use Shift + Alt + O to trigger the organize imports editor action. You can also trigger this from the quick fix available when imports are not organized.
  3. You can enable import sorting on save for Python files by changing the editor.codeActionsOnSave setting. It also works alongside the VS Code Black formatter extension if you set the following settings:
"[python]": {
    "editor.defaultFormatter": "ms-python.black-formatter",
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
        "source.organizeImports": "explicit"
    },
  },
  "isort.args":["--profile", "black"],

Prettier

To change this setting, press COMMAND + , on macOS or CTRL + , on Windows to open the Settings menu. Once the menu is open, search for Editor: Format On Save and make sure that option is checked: image Once this is set, you can write your code as usual and it will be automatically formatted when you save the file.

Clone this wiki locally