Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
shell: pwsh
run: |
Import-Module .\Build\Modules\InvokeBuild\5.14.23\InvokeBuild.psd1 -Force
Install-Module PlatyPS -Scope CurrentUser -Force
Install-Module Microsoft.PowerShell.PlatyPS -RequiredVersion 1.0.1 -Scope CurrentUser -Force -AllowClobber
Invoke-Build -File .\vscode\vscode.build.ps1
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
shell: pwsh
run: |
Import-Module .\Build\Modules\InvokeBuild\5.14.23\InvokeBuild.psd1 -Force
Install-Module PlatyPS -Scope CurrentUser -Force
Install-Module Microsoft.PowerShell.PlatyPS -RequiredVersion 1.0.1 -Scope CurrentUser -Force -AllowClobber
Invoke-Build -File .\vscode\vscode.build.ps1
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Prefer targeted validation for the component you changed.
- Build the VS Code extension as CI does:
```powershell
Import-Module .\Build\Modules\InvokeBuild\5.14.23\InvokeBuild.psd1 -Force
Install-Module PlatyPS -Scope CurrentUser -Force
Install-Module Microsoft.PowerShell.PlatyPS -RequiredVersion 1.0.1 -Scope CurrentUser -Force -AllowClobber
Invoke-Build -File .\vscode\vscode.build.ps1
```
- For VS Code-only TypeScript changes, use the lighter commands from `vscode\powershellprotools`:
Expand Down
38 changes: 38 additions & 0 deletions HostInjection/CreateHelp.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
param(
[string]$HelpPath = (Join-Path $PSScriptRoot "Help"),
[string]$OutputPath = (Join-Path $PSScriptRoot "en-US")
)

$platyps = Import-Module Microsoft.PowerShell.PlatyPS -RequiredVersion 1.0.1 -PassThru -ErrorAction SilentlyContinue
if ($null -eq $platyps) {
Install-Module Microsoft.PowerShell.PlatyPS -RequiredVersion 1.0.1 -Scope CurrentUser -Force -AllowClobber
Import-Module Microsoft.PowerShell.PlatyPS -RequiredVersion 1.0.1
}

$commandHelp = Import-MarkdownCommandHelp -Path (Join-Path $HelpPath "*.md")
$externalHelpFiles = $commandHelp | Select-Object -ExpandProperty ExternalHelpFile -Unique
Export-MamlCommandHelp -CommandHelp $commandHelp -OutputFolder $OutputPath -Force | Out-Null

Get-ChildItem $OutputPath -Filter "*-Help.xml" -Recurse |
Where-Object { $_.DirectoryName -ne (Resolve-Path $OutputPath).Path } |
Where-Object { $externalHelpFiles -contains $_.Name } |
ForEach-Object {
Copy-Item $_.FullName -Destination (Join-Path $OutputPath $_.Name) -Force
}

Get-ChildItem $OutputPath -Directory | Remove-Item -Recurse -Force

$utf8NoBom = New-Object System.Text.UTF8Encoding $false
Get-ChildItem $OutputPath -Filter "*-Help.xml" | ForEach-Object {
if ($externalHelpFiles -notcontains $_.Name) {
return
}

$content = [System.IO.File]::ReadAllText($_.FullName)
$lines = $content -split "\r?\n" | ForEach-Object { $_ -replace "\s+$", "" }
$content = ($lines | Where-Object { $null -ne $_ }) -join "`n"
if (-not $content.EndsWith("`n")) {
$content += "`n"
}
[System.IO.File]::WriteAllText($_.FullName, $content, $utf8NoBom)
}
178 changes: 178 additions & 0 deletions HostInjection/Help/Add-VSCodeTextDocumentText.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
---
document type: cmdlet
external help file: PowerShellProTools.VSCode.dll-Help.xml
HelpUri: ''
Locale: en-US
Module Name: PowerShellProTools.VSCode
ms.date: 07-21-2026
PlatyPS schema version: 2024-05-01
title: Add-VSCodeTextDocumentText
---

# Add-VSCodeTextDocumentText

## SYNOPSIS

Adds text to a Visual Studio Code text document.

## SYNTAX

### __AllParameterSets

```
Add-VSCodeTextDocumentText -TextDocument <VsCodeTextDocument> -Position <VsCodePosition>
-Text <string> [-Wait] [-ResponseTimeout <int>] [<CommonParameters>]
```

## ALIASES

This cmdlet has no aliases.

## DESCRIPTION

Adds text to a Visual Studio Code text document at the specified position. Use this command when automating editor changes from PowerShell running inside the PowerShell Pro Tools host.

## EXAMPLES

### Example 1

```powershell
$document = Get-VSCodeTextDocument
$position = New-VSCodePosition -Line 0 -Character 0
Add-VSCodeTextDocumentText -TextDocument $document -Position $position -Text '# Header'
```
Adds text to the beginning of the active document.

## PARAMETERS

### -Position

The position where text is inserted.

```yaml
Type: PowerShellToolsPro.Cmdlets.VSCode.VsCodePosition
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### -ResponseTimeout

The number of milliseconds to wait for a response from Visual Studio Code.

```yaml
Type: System.Int32
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### -Text

The text to insert or send.

```yaml
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### -TextDocument

The text document to read or update.

```yaml
Type: PowerShellToolsPro.Cmdlets.VSCode.VsCodeTextDocument
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: true
ValueFromPipeline: true
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### -Wait

Waits for the VS Code command response before returning.

```yaml
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### PowerShellToolsPro.Cmdlets.VSCode.VsCodeTextDocument

This command returns objects described by the section heading.

## OUTPUTS

### System.Object

This command returns objects described by the section heading.

## NOTES

This command is intended for use with PowerShell Pro Tools automation.

## RELATED LINKS

https://docs.poshtools.com/sitemap.md
129 changes: 129 additions & 0 deletions HostInjection/Help/Clear-VSCodeDecoration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
---
document type: cmdlet
external help file: PowerShellProTools.VSCode.dll-Help.xml
HelpUri: ''
Locale: en-US
Module Name: PowerShellProTools.VSCode
ms.date: 07-21-2026
PlatyPS schema version: 2024-05-01
title: Clear-VSCodeDecoration
---

# Clear-VSCodeDecoration

## SYNOPSIS

Clears a text editor decoration in Visual Studio Code.

## SYNTAX

### __AllParameterSets

```
Clear-VSCodeDecoration [-Key <string>] [-Wait] [-ResponseTimeout <int>] [<CommonParameters>]
```

## ALIASES

This cmdlet has no aliases.

## DESCRIPTION

Clears a decoration that was previously created with Set-VSCodeTextEditorDecoration. The key identifies which decoration registration to remove.

## EXAMPLES

### Example 1

```powershell
Clear-VSCodeDecoration -Key 'search-highlight'
```
Clears the decoration identified by the key.

## PARAMETERS

### -Key

The unique key used to identify a decoration.

```yaml
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### -ResponseTimeout

The number of milliseconds to wait for a response from Visual Studio Code.

```yaml
Type: System.Int32
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### -Wait

Waits for the VS Code command response before returning.

```yaml
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

### System.Object

This command returns objects described by the section heading.

## NOTES

This command is intended for use with PowerShell Pro Tools automation.

## RELATED LINKS

https://docs.poshtools.com/sitemap.md
Loading
Loading