|
| 1 | += Working with Workspaces |
| 2 | +:page-deployment-options: cloud-ide, desktop-ide |
| 3 | + |
| 4 | +include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] |
| 5 | + |
| 6 | +Organize your Mule projects, API specifications, and agent networks in workspaces to ensure all Anypoint Code Builder features work correctly. Workspaces help you manage multiple related projects and avoid build-time and design-time issues. |
| 7 | + |
| 8 | +[[valid-setups]] |
| 9 | +== Valid Setups for Anypoint Code Builder |
| 10 | + |
| 11 | +Anypoint Code Builder requires one of the following project configurations to function properly: |
| 12 | + |
| 13 | +* A single Mule project open at the root of your directory |
| 14 | +* A multi-root workspace pointing directly to one or more Mule projects |
| 15 | + |
| 16 | +If your directory structure doesn't meet these requirements, Anypoint Code Builder displays a message with steps to resolve the issue, such as opening a Mule project or creating a workspace. |
| 17 | + |
| 18 | +[[create-project-workspace]] |
| 19 | +== Create a Project in a Workspace |
| 20 | + |
| 21 | +When you create a new project (API specification, integration, or agent network), add it to a workspace. This setup enables you to add more projects later without restructuring your environment. |
| 22 | + |
| 23 | +To create a project in a workspace: |
| 24 | + |
| 25 | +. Start the project creation process using one of the following methods: |
| 26 | ++ |
| 27 | +** From the *Quick Actions* menu, select the project type |
| 28 | ++ |
| 29 | +For example, *Design an API* or *Develop an Integration*. |
| 30 | +** From the Command Palette, run the appropriate command |
| 31 | ++ |
| 32 | +For example, `MuleSoft: Design an API`. |
| 33 | +** Ask MuleSoft Vibes to create the project using natural language. |
| 34 | + |
| 35 | +. In the project creation form, select *Create in workspace*. |
| 36 | +. Complete the remaining project configuration options. |
| 37 | +. Click *Create Project*. |
| 38 | ++ |
| 39 | +Anypoint Code Builder creates the project and adds it to a workspace. If no workspace is open, a new workspace is created. |
| 40 | + |
| 41 | +[[import-studio-workspace]] |
| 42 | +== Import an Anypoint Studio Workspace |
| 43 | + |
| 44 | +If you have existing projects in Anypoint Studio, you can import your Studio workspace into Anypoint Code Builder. |
| 45 | + |
| 46 | +To import a Studio workspace: |
| 47 | + |
| 48 | +// Pointer to Command Palette |
| 49 | +include::partial$acb-reusable-steps.adoc[tags="open-command-palette"] |
| 50 | +. Select the following command: |
| 51 | ++ |
| 52 | +[source,command] |
| 53 | +---- |
| 54 | +MuleSoft: Import Studio Workspace |
| 55 | +---- |
| 56 | +. Navigate to the location of your Studio workspace and select it. |
| 57 | +. Choose a location to save the new workspace file. |
| 58 | ++ |
| 59 | +Anypoint Code Builder creates a workspace that references your existing Studio projects. Changes made to the original Studio workspace are automatically reflected in Anypoint Code Builder. |
| 60 | + |
| 61 | +[[switch-workspaces]] |
| 62 | +== Open and Switch Between Workspaces |
| 63 | + |
| 64 | +You can open or switch between workspaces using the menu, the Command Palette, or MuleSoft Vibes. |
| 65 | + |
| 66 | +=== Open a Workspace Manually |
| 67 | + |
| 68 | +. Open the workspace file using one of these methods: |
| 69 | ++ |
| 70 | +* From the menu bar, select *File* > *Open Workspace from File...*. |
| 71 | +* From the Command Palette, run the command `File: Open Workspace from File...`. |
| 72 | +. Navigate to your home directory or the location where you saved the `.code-workspace` file, and select it. |
| 73 | ++ |
| 74 | +The projects open in the Explorer view, and the folder name for the workspace includes *(WORKSPACE)* to indicate that you're working in a multi-root workspace: |
| 75 | ++ |
| 76 | +image::imp-local-api-open-workspace.png["A multi-root workspace in Explorer view"] |
| 77 | + |
| 78 | +=== Open a Workspace with MuleSoft Vibes |
| 79 | + |
| 80 | +You can ask MuleSoft Vibes to switch workspaces using natural language prompts, such as: |
| 81 | + |
| 82 | +* "Open my American Flights workspace" |
| 83 | +* "Switch to the `<YourWorkspaceName>` workspace" |
| 84 | + |
| 85 | +[[close-workspace]] |
| 86 | +== Close a Workspace |
| 87 | + |
| 88 | +To close the current workspace: |
| 89 | + |
| 90 | +// Pointer to Command Palette |
| 91 | +include::partial$acb-reusable-steps.adoc[tags="open-command-palette"] |
| 92 | +. Select the following command: |
| 93 | ++ |
| 94 | +[source,command] |
| 95 | +---- |
| 96 | +Workspaces: Close Workspace |
| 97 | +---- |
| 98 | + |
| 99 | +[[actions-in-workspaces]] |
| 100 | +== Actions in Workspaces |
| 101 | + |
| 102 | +Anypoint Code Builder organizes actions based on their scope: |
| 103 | + |
| 104 | +[cols="1,2"] |
| 105 | +|=== |
| 106 | +| Action Type | Location |
| 107 | + |
| 108 | +| *Global actions* |
| 109 | +| Always available from the Command Palette. These actions don't depend on a specific project, such as creating a new project, importing assets from Exchange, or opening ACB settings. |
| 110 | + |
| 111 | +| *Project-specific actions* |
| 112 | +| Available from the context menu (right-click) in the Explorer view. These actions apply to a specific project, such as running, debugging, deploying, or exporting a project. |
| 113 | +|=== |
| 114 | + |
| 115 | +When working with multiple projects in a workspace, select the target project before running project-specific actions. For example, when you run or debug, you must select which project in the workspace to execute. |
| 116 | + |
| 117 | +[[workspace-file]] |
| 118 | +== Workspace File Location |
| 119 | + |
| 120 | +VS Code stores workspace configuration in a file with the `.code-workspace` extension. This file maps the folders for your projects. |
| 121 | + |
| 122 | +[IMPORTANT] |
| 123 | +==== |
| 124 | +The `.code-workspace` file must not reside within any of your project folders. Save it in a separate directory, such as your home directory or a dedicated workspaces folder. |
| 125 | +==== |
| 126 | + |
| 127 | +== See Also |
| 128 | + |
| 129 | +* xref:imp-implement-local-apis.adoc[Iteratively Design and Implement APIs] |
| 130 | +* xref:int-create-integrations.adoc[Creating Integrations] |
| 131 | +* xref:des-create-api-specs.adoc[Creating and Importing API Specifications] |
| 132 | +* https://code.visualstudio.com/docs/editor/multi-root-workspaces[Multi-root Workspaces^] in the VS Code documentation |
0 commit comments