vscode add missing imports

productivity setting to add any missing imports when you save your file in vscode or with an explicit shortcut

November 11, 2024
  • a short cut :keybindings.json
  {
    "key": "ctrl+o",
    "command": "editor.action.sourceAction",
    "args": {
      "kind": "source.addMissingImports",
      "apply": "first"
    }
  },
  • automatically on save : settings.json
  "editor.codeActionsOnSave": { "source.addMissingImports": "always" },