1.3.1 Project Files and Folder

The first set of actions creates new files and projects, opens existing projects in the IDE, and enables developers to save, undo, or redo any action. The VS Code tools handle these actions in different ways.

Create New Projects

Table 1-2. Creating New Projects
MPLAB X IDEMPLAB Tools for VS Code

To create a new project in MPLAB X, use either:

  • The File menu, or

  • The New Project… icon on the toolbar

A pop-up window will prompt users to enter the new project details.

Figure 1-5. New Project in MPLAB X IDE

To create or add a new project in the VS Code workspace, use either:

  • The command palette and type >MPLAB: Create New Project, or

  • Open MPLAB Tools from the activity bar and hover over the New Project icon in the Projects window

The command palette will then prompt users to enter the new project details.

Figure 1-6. New Project in MPLAB Tools for VS Code

Refer to this video for a quick tutorial in VS Code: Creating a New MPLAB® Project in Microsoft® VS Code®.

Open Existing Projects

There are various ways of opening existing MPLAB projects in MPLAB X and VS Code. Here are some use cases:

  • From a file browser
    In any file browser, right-click the project folder and select Open with Code. This option will open the project folder in a new VS Code window.
    Figure 1-7. Open with Code
  • From within MPLAB X or VS Code
    Table 1-3. Opening Projects From Within MPLAB X or VS Code
    MPLAB X IDE MPLAB Tools for VS Code

    MPLAB X can add multiple projects within a single instance of the IDE by using either:

    • The File menu, or

    • The Open Project... icon on the toolbar

    Figure 1-8. Open Project in MPLAB X IDE

    If a VS Code window is already open, use the File menu and select either:

    • Open Folder…, or

    • Add Folder to Workspace…

    Figure 1-9. Open Project in MPLAB Tools for VS Code

    The toolbar icons will only work for the project currently set as the Main Project.

    Alternatively, users can right-click any open project to utilize the tools.

    Figure 1-10. Set as Main Project

    Open Folder… reopens the current VS Code window with the selected project folder.

    Figure 1-11. Open Folder in VS Code

    Add Folder to Workspace… allows another project folder to be added to the workspace and does not close or remove any project that is already open in the current workspace.

    Figure 1-12. Add Folder to VS Code Workspace

    If there is more than one project in the workspace, the command palette will prompt users to choose for which project the command will be executed.

  • Importing an MPLAB X IDE Project in VS Code

    MPLAB Tools for VS Code can detect MPLAB X projects. Once an MPLAB X project is identified by opening a folder with a .X extension, users will be prompted to import the project and include related files.

    Figure 1-13. Import MPLAB X Project within VS Code
    Note: MPLAB X projects can be imported into VS Code. However, VS Code MPLAB projects cannot be imported into MPLAB X due to differences in the file format and extensions.

    Refer to these videos for quick tutorials in VS Code:

New File/Folder

To add a new file or folder, use either the File menu or the New File/Folder… icons in the MPLAB X toolbar or the VS Code workspace sidebar. Users can also right-click any folder or container and select New, then select <file type>.

Table 1-4. Adding New Files or Folder
MPLAB X IDE MPLAB Tools for VS Code
Figure 1-14. Add New Files in MPLAB X IDE
Figure 1-15. Add New Files in VS Code

Undo/Redo Actions

To undo or redo any action, use the Edit menu and select the appropriate action. The Edit menu includes common editing actions, with familiar keyboard shortcuts.

Table 1-5. Undo/Redo Actions
MPLAB X IDE MPLAB Tools for VS Code

MPLAB X has Undo and Redo icons on the toolbar.

Figure 1-16. Undo and Redo in MPLAB X IDE
Figure 1-17. Undo and Redo in VS Code