Skip to content

Instantly share code, notes, and snippets.

@pinuke
Last active October 31, 2022 17:37
Show Gist options
  • Save pinuke/1959ec985968358be20219abe49fdf97 to your computer and use it in GitHub Desktop.
Save pinuke/1959ec985968358be20219abe49fdf97 to your computer and use it in GitHub Desktop.
Start-EditorServices Unofficial Documentation

Start-EditorServices Unofficial Documentation

Syntax:

(Summarized from the bootstrapper source code)

Start-EditorServices
      #Common to Every Parameter Set:
      [-HostName <string, mandatory,="" not="" null="" or="" empty="">]
      [-HostProfileId <string, mandatory,="" not="" null="" or="" empty="">]
      [-HostVersion <string, mandatory,="" not="" null="" or="" empty="">]
      [-BundledModulesPath <string, not="" null="" or="" empty="">]
      [-LogPath <not null="" or="" empty="">]
      [-LogLevel <string: "diagnostic",="" "verbose",="" "normal",="" "warning",="" "error"]="" [-sessiondetailspath="" <string,="" mandatory,="" not="" null="" or="" empty="">]
      [-EnableConsoleRepl <switch>]
      [-UseLegacyReadLine <switch>]
      [-DebugServiceOnly <switch>]
      [-LanguageServiceOnly <switch>]
      [-AdditionalModules <string[]>]
      [-FeatureFlags <string[]>]
      [-WaitForDebugger <switch>]
      [-ConfirmInstall <switch>]

      #NamedPipe Parameter Set (Default):
      [-LanguageServicePipeName = $null <string>]
      [-DebugServicePipeName = $null <string>]

      #Stdio Parameter Set:
      [-Stdio <switch>]

      #NamedPipeSimplex Parameter Set:
      [-SplitInOutPipes <switch>]
      [-LanguageServiceInPipeName <string>]
      [-LanguageServiceOutPipeName <string>]
      [-DebugServiceInPipeName = $null <string>]
      [-DebugServiceOutPipeName = $null <string>]

Details:

Synopsis (Also from the bootstrapper source code):

Starts the language and debug services from the PowerShellEditorServices module.

Description (Again, bootstrapper):

PowerShell Editor Services Bootstrapper Script:

This script contains startup logic for the PowerShell Editor Services module when launched by an editor. It handles the following tasks:

  • Verifying the existence of dependencies like PowerShellGet
  • Verifying that the expected version of the PowerShellEditorServices module is installed
  • Installing the PowerShellEditorServices module if confirmed by the user
  • Creating named pipes for the language and debug services to use (if using named pipes)
  • Starting the language and debug services from the PowerShellEditorServices module

Developer/Contributor Details:

Assembly (Loaded by PowerShellEditorServices.psd1, the PSES module)

  • When run by PowerShell Core, this is loaded:
    • 'bin/Core/Microsoft.PowerShell.EditorServices.Hosting.dll'
  • On any other PowerShell:
    • 'bin/Desktop/Microsoft.PowerShell.EditorServices.Hosting.dll'

Assembly Source Code:

Omnisharp Source Code:

Parameters:

HostName (Breakdown):

  • Hostname is used primarily to generate Runspaces using a C# PShost object. This object abstractly represents the PowerShell host. The PShost.name field (Hostname) is a reader-friendly string, which can be used identify the PSHost object.
    • Default Value: "PowerShell Editor Services Host" (set by HostStartupInfo then pulled into PSHost.name during PSInternalHost construction)
    • **PSHost objects can be used to list runspaces under the PowerShell host and identify the host's appdomain
  • It's secondary purpose is for logging

HostProfileId (Breakdown):

  • HostProfileId is a filename-prefix used to identify the profile.ps1 file used by PowerShell Editor Services.
    • Default Value: Microsoft.PowerShellEditorServices
    • The profile script used can be found/created in:
      • AllUsersAllHosts:
        • "$( $profile.AllUsersAllHosts )/$( $HostProfileId )_profile.ps1"
      • AllUsersCurrentHost:
        • "$( $profile.AllUsersCurrentHost )/$( $HostProfileId )_profile.ps1"
      • CurrentUserAllHosts:
        • "$( $profile.CurrentUserAllHosts )/$( $HostProfileId )_profile.ps1"
      • CurrentUserCurrentHost:
        • "$( $profile.CurrentUserCurrentHost )/$( $HostProfileId )_profile.ps1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment