Skip to content

Commit aabf092

Browse files
SeeminglySciencedaviwil
authored andcommitted
Help and manifest fixes
- Added online link to markdown help. - Converted comment based help of Register-EditorCommand and UnregisterEditorCommand to markdown. - Fixed psedit not being exported. - Added cleanup of generated MAML file to build script.
1 parent 828f677 commit aabf092

16 files changed

+261
-71
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ PowerShellEditorServices.sln.ide/edb.chk
5959
PowerShellEditorServices.sln.ide/edbres00001.jrs
6060
PowerShellEditorServices.sln.ide/storage.ide
6161
*.jrs
62+
63+
# Don't include PlatyPS generated MAML
64+
module/PowerShellEditorServices/Commands/en-US/*-help.xml

PowerShellEditorServices.build.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ task Clean {
100100
Remove-Item .\module\PowerShellEditorServices\bin -Recurse -Force -ErrorAction Ignore
101101
Get-ChildItem -Recurse src\*.nupkg | Remove-Item -Force -ErrorAction Ignore
102102
Get-ChildItem .\module\PowerShellEditorServices\*.zip | Remove-Item -Force -ErrorAction Ignore
103+
Get-ChildItem .\module\PowerShellEditorServices\Commands\en-US\*-help.xml | Remove-Item -Force -ErrorAction Ignore
103104
}
104105

105106
task GetProductVersion -Before PackageNuGet, PackageModule, UploadArtifacts {

module/PowerShellEditorServices/Commands/PowerShellEditorServices.Commands.psd1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Description = 'Provides internal commands for PowerShell Editor Services that on
5757
# ScriptsToProcess = @()
5858

5959
# Type files (.ps1xml) to be loaded when importing this module
60-
# TypesToProcess = @()
60+
TypesToProcess = @('PowerShellEditorServices.Commands.types.ps1xml')
6161

6262
# Format files (.ps1xml) to be loaded when importing this module
6363
# FormatsToProcess = @()
@@ -74,7 +74,9 @@ FunctionsToExport = @('Register-EditorCommand',
7474
'ConvertFrom-ScriptExtent',
7575
'ConvertTo-ScriptExtent',
7676
'Get-Token',
77-
'Join-ScriptExtent')
77+
'Join-ScriptExtent',
78+
'Test-ScriptExtent',
79+
'psedit')
7880

7981
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
8082
CmdletsToExport = @()

module/PowerShellEditorServices/Commands/PowerShellEditorServices.Commands.psm1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ Import-LocalizedData -BindingVariable Strings -FileName Strings
33
Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 | ForEach-Object {
44
. $PSItem.FullName
55
}
6+
7+
Export-ModuleMember -Function *-*
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Types>
3+
<Type>
4+
<Name>Microsoft.PowerShell.EditorServices.FullScriptExtent</Name>
5+
<Members>
6+
<MemberSet>
7+
<Name>PSStandardMembers</Name>
8+
<Members>
9+
<PropertySet>
10+
<Name>DefaultDisplayPropertySet</Name>
11+
<ReferencedProperties>
12+
<Name>File</Name>
13+
<Name>StartScriptPosition</Name>
14+
<Name>EndScriptPosition</Name>
15+
<Name>StartLineNumber</Name>
16+
<Name>StartColumnNumber</Name>
17+
<Name>EndLineNumber</Name>
18+
<Name>EndColumnNumber</Name>
19+
<Name>StartOffset</Name>
20+
<Name>EndOffset</Name>
21+
<Name>Text</Name>
22+
</ReferencedProperties>
23+
</PropertySet>
24+
</Members>
25+
</MemberSet>
26+
</Members>
27+
</Type>
28+
</Types>

module/PowerShellEditorServices/Commands/Public/CmdletInterface.ps1

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,5 @@
11
<#
2-
.SYNOPSIS
3-
Registers a command which can be executed in the host editor.
4-
5-
.DESCRIPTION
6-
Registers a command which can be executed in the host editor. This
7-
command will be shown to the user either in a menu or command palette.
8-
Upon invoking this command, either a function/cmdlet or ScriptBlock will
9-
be executed depending on whether the -Function or -ScriptBlock parameter
10-
was used when the command was registered.
11-
12-
This command can be run multiple times for the same command so that its
13-
details can be updated. However, re-registration of commands should only
14-
be used for development purposes, not for dynamic behavior.
15-
16-
.PARAMETER Name
17-
Specifies a unique name which can be used to identify this command.
18-
This name is not displayed to the user.
19-
20-
.PARAMETER DisplayName
21-
Specifies a display name which is displayed to the user.
22-
23-
.PARAMETER Function
24-
Specifies a function or cmdlet name which will be executed when the user
25-
invokes this command. This function may take a parameter called $context
26-
which will be populated with an EditorContext object containing information
27-
about the host editor's state at the time the command was executed.
28-
29-
.PARAMETER ScriptBlock
30-
Specifies a ScriptBlock which will be executed when the user invokes this
31-
command. This ScriptBlock may take a parameter called $context
32-
which will be populated with an EditorContext object containing information
33-
about the host editor's state at the time the command was executed.
34-
35-
.PARAMETER SuppressOutput
36-
If provided, causes the output of the editor command to be suppressed when
37-
it is run. Errors that occur while running this command will still be
38-
written to the host.
39-
40-
.EXAMPLE
41-
PS> Register-EditorCommand -Name "MyModule.MyFunctionCommand" -DisplayName "My function command" -Function Invoke-MyCommand -SuppressOutput
42-
43-
.EXAMPLE
44-
PS> Register-EditorCommand -Name "MyModule.MyScriptBlockCommand" -DisplayName "My ScriptBlock command" -ScriptBlock { Write-Output "Hello from my command!" }
45-
46-
.LINK
47-
Unregister-EditorCommand
2+
.EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
483
#>
494
function Register-EditorCommand {
505
[CmdletBinding()]
@@ -100,21 +55,7 @@ function Register-EditorCommand {
10055
}
10156

10257
<#
103-
.SYNOPSIS
104-
Unregisters a command which has already been registered in the host editor.
105-
106-
.DESCRIPTION
107-
Unregisters a command which has already been registered in the host editor.
108-
An error will be thrown if the specified Name is unknown.
109-
110-
.PARAMETER Name
111-
Specifies a unique name which identifies a command which has already been registered.
112-
113-
.EXAMPLE
114-
PS> Unregister-EditorCommand -Name "MyModule.MyFunctionCommand"
115-
116-
.LINK
117-
Register-EditorCommand
58+
.EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
11859
#>
11960
function Unregister-EditorCommand {
12061
[CmdletBinding()]
@@ -138,3 +79,4 @@ function psedit {
13879
$psEditor.Workspace.OpenFile($_.FullName)
13980
}
14081
}
82+
Export-ModuleMember -Function psedit

module/docs/ConvertFrom-ScriptExtent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
external help file: PowerShellEditorServices.Commands-help.xml
3-
online version:
3+
online version: https://github.com/PowerShell/PowerShellEditorServices/tree/master/module/docs/ConvertFrom-ScriptExtent.md
44
schema: 2.0.0
55
---
66

module/docs/ConvertTo-ScriptExtent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
external help file: PowerShellEditorServices.Commands-help.xml
3-
online version:
3+
online version: https://github.com/PowerShell/PowerShellEditorServices/tree/master/module/docs/ConvertTo-ScriptExtent.md
44
schema: 2.0.0
55
---
66

module/docs/Find-Ast.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
external help file: PowerShellEditorServices.Commands-help.xml
3-
online version:
3+
online version: https://github.com/PowerShell/PowerShellEditorServices/tree/master/module/docs/Find-Ast.md
44
schema: 2.0.0
55
---
66

module/docs/Get-Token.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
external help file: PowerShellEditorServices.Commands-help.xml
3-
online version:
3+
online version: https://github.com/PowerShell/PowerShellEditorServices/tree/master/module/docs/Get-Token.md
44
schema: 2.0.0
55
---
66

0 commit comments

Comments
 (0)