|
| 1 | +--- |
| 2 | +name: interactive-extension-testing |
| 3 | +description: > |
| 4 | + Guide for setting up the multi-root PowerShell VS Code extension/PSES dev |
| 5 | + workspace. Use when asked to open the dev workspace, interactively test the |
| 6 | + extension, set up PSES for F5 debugging, or open pwsh-extension-dev workspace. |
| 7 | +--- |
| 8 | + |
| 9 | +# Interactive Extension Testing |
| 10 | + |
| 11 | +Read [.github/copilot-instructions.md](../../../.github/copilot-instructions.md) |
| 12 | +"Build, Lint, and Test" and "PSES and Cross-Repo Work" first — this skill only |
| 13 | +adds the worktree setup details for hands-on F5 testing. |
| 14 | + |
| 15 | +Use this when the goal is to open `pwsh-extension-dev.code-workspace` and run |
| 16 | +**F5 → Launch Extension** against a locally-built PowerShellEditorServices (PSES). |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +- Follow `.github/copilot-instructions.md` for the repository build dependencies and the |
| 21 | + `modules/` symlink model. |
| 22 | +- Confirm these commands are available: `pwsh`, `dotnet`, `code`, and the PowerShell |
| 23 | + `InvokeBuild` module. |
| 24 | +- Have a PSES checkout that can be used as `<pses-checkout>`. |
| 25 | + |
| 26 | +## Setup |
| 27 | + |
| 28 | +1. **Build PSES first.** In `<pses-checkout>`, run the PSES build task (for example, |
| 29 | + `Invoke-Build Build`) so `<pses-checkout>/module/PowerShellEditorServices/bin` |
| 30 | + exists. Without that directory, the extension `Build` task in |
| 31 | + `vscode-powershell.build.ps1` asserts `Extension requires PSES`. |
| 32 | +2. **Ensure the workspace can resolve the Server root.** The workspace defines |
| 33 | + `Client` as `<extension-repo>` and `Server` as `../PowerShellEditorServices`, so a |
| 34 | + worktree parent may need a sibling link: |
| 35 | + |
| 36 | + ```sh |
| 37 | + ln -s <pses-checkout> <extension-repo-parent>/PowerShellEditorServices |
| 38 | + ``` |
| 39 | + |
| 40 | +3. **Ensure the extension can load the runtime PSES module.** `modules/` is gitignored |
| 41 | + and should point at the built PSES module directory: |
| 42 | + |
| 43 | + ```sh |
| 44 | + ln -s <pses-checkout>/module <extension-repo>/modules |
| 45 | + ``` |
| 46 | + |
| 47 | + In a normal sibling clone, `Invoke-Build RestoreEditorServices` in |
| 48 | + `vscode-powershell.build.ps1` creates this `modules` link and builds PSES. In a |
| 49 | + worktree or fresh checkout, create the sibling link first if `Get-EditorServicesPath` |
| 50 | + cannot resolve `../PowerShellEditorServices/PowerShellEditorServices.build.ps1`. |
| 51 | + |
| 52 | +4. **Open the dev workspace:** |
| 53 | + |
| 54 | + ```sh |
| 55 | + cd <extension-repo> |
| 56 | + code pwsh-extension-dev.code-workspace |
| 57 | + ``` |
| 58 | + |
| 59 | +5. **Launch interactively.** In VS Code, use **F5 → Launch Extension**. The workspace |
| 60 | + also defines `Launch Extension - Temp Profile`; see `pwsh-extension-dev.code-workspace` |
| 61 | + for the current launch/task wiring. |
| 62 | + |
| 63 | +## Verify |
| 64 | + |
| 65 | +```sh |
| 66 | +cd <extension-repo> |
| 67 | +readlink modules |
| 68 | +test -d modules/PowerShellEditorServices/bin |
| 69 | +``` |
| 70 | + |
| 71 | +Then confirm F5 starts the extension host and attaches to PSES. |
| 72 | + |
| 73 | +## Cleanup |
| 74 | + |
| 75 | +Both links are reversible and not under version control: `modules` is gitignored, and the |
| 76 | +sibling `PowerShellEditorServices` link lives outside `<extension-repo>`. Cleanup is just: |
| 77 | + |
| 78 | +```sh |
| 79 | +rm <extension-repo>/modules |
| 80 | +rm <extension-repo-parent>/PowerShellEditorServices |
| 81 | +``` |
| 82 | + |
| 83 | +## How It Resolves |
| 84 | + |
| 85 | +Use `pwsh-extension-dev.code-workspace` as the source of truth for roots and launch |
| 86 | +configs. Use `Get-EditorServicesPath`, `RestoreEditorServices`, and `Build` in |
| 87 | +`vscode-powershell.build.ps1` as the source of truth for how the extension locates, |
| 88 | +links, builds, and asserts the local PSES module. |
0 commit comments