Skip to content

Remove engine from files and namespaces #1048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ docs/metadata/
*.zip

# Generated build info file
src/PowerShellEditorServices.Engine/Hosting/BuildInfo.cs
src/PowerShellEditorServices/Hosting/BuildInfo.cs

# quickbuild.exe
/VersionGeneratingLogs/
Expand Down
12 changes: 6 additions & 6 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $script:ModuleBinPath = "$PSScriptRoot/module/PowerShellEditorServices/bin/"
$script:VSCodeModuleBinPath = "$PSScriptRoot/module/PowerShellEditorServices.VSCode/bin/"
$script:WindowsPowerShellFrameworkTarget = 'net461'
$script:NetFrameworkPlatformId = 'win'
$script:BuildInfoPath = [System.IO.Path]::Combine($PSScriptRoot, "src", "PowerShellEditorServices.Engine", "Hosting", "BuildInfo.cs")
$script:BuildInfoPath = [System.IO.Path]::Combine($PSScriptRoot, "src", "PowerShellEditorServices", "Hosting", "BuildInfo.cs")

$script:PSCoreModulePath = $null

Expand All @@ -50,16 +50,16 @@ Schema is:
#>
$script:RequiredBuildAssets = @{
$script:ModuleBinPath = @{
'PowerShellEditorServices.Engine' = @(
'PowerShellEditorServices' = @(
'publish/Microsoft.Extensions.DependencyInjection.Abstractions.dll',
'publish/Microsoft.Extensions.DependencyInjection.dll',
'publish/Microsoft.Extensions.FileSystemGlobbing.dll',
'publish/Microsoft.Extensions.Logging.Abstractions.dll',
'publish/Microsoft.Extensions.Logging.dll',
'publish/Microsoft.Extensions.Options.dll',
'publish/Microsoft.Extensions.Primitives.dll',
'publish/Microsoft.PowerShell.EditorServices.Engine.dll',
'publish/Microsoft.PowerShell.EditorServices.Engine.pdb',
'publish/Microsoft.PowerShell.EditorServices.dll',
'publish/Microsoft.PowerShell.EditorServices.pdb',
'publish/Newtonsoft.Json.dll',
'publish/OmniSharp.Extensions.JsonRpc.dll',
'publish/OmniSharp.Extensions.LanguageProtocol.dll',
Expand Down Expand Up @@ -304,7 +304,7 @@ task CreateBuildInfo -Before Build {
[string]$buildTime = [datetime]::Now.ToString("s", [System.Globalization.CultureInfo]::InvariantCulture)

$buildInfoContents = @"
namespace Microsoft.PowerShell.EditorServices.Engine.Hosting
namespace Microsoft.PowerShell.EditorServices.Hosting
{
public static class BuildInfo
{
Expand All @@ -319,7 +319,7 @@ namespace Microsoft.PowerShell.EditorServices.Engine.Hosting
}

task Build {
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices.Engine\PowerShellEditorServices.Engine.csproj -f $script:TargetPlatform }
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:TargetPlatform }
exec { & $script:dotnetExe build -c $Configuration .\src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj $script:TargetFrameworksParam }
}

Expand Down
2 changes: 1 addition & 1 deletion PowerShellEditorServices.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.Te
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.VSCode", "src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj", "{3B38E8DA-8BFF-4264-AF16-47929E6398A3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerShellEditorServices.Engine", "src\PowerShellEditorServices.Engine\PowerShellEditorServices.Engine.csproj", "{29EEDF03-0990-45F4-846E-2616970D1FA2}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerShellEditorServices", "src\PowerShellEditorServices\PowerShellEditorServices.csproj", "{29EEDF03-0990-45F4-846E-2616970D1FA2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerShellEditorServices.Test.E2E", "test\PowerShellEditorServices.Test.E2E\PowerShellEditorServices.Test.E2E.csproj", "{2561F253-8F72-436A-BCC3-AA63AB82EDC0}"
EndProject
Expand Down
2 changes: 1 addition & 1 deletion docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ the PowerShell debugger.
Use the @Microsoft.PowerShell.EditorServices.Console.ConsoleService to provide interactive
console support in the user's editor.

Use the @Microsoft.PowerShell.EditorServices.Engine.Services.ExtensionService to allow
Use the @Microsoft.PowerShell.EditorServices.Services.ExtensionService to allow
the user to extend the host editor with new capabilities using PowerShell code.

The core of all the services is the @Microsoft.PowerShell.EditorServices.PowerShellContext
Expand Down
12 changes: 6 additions & 6 deletions docs/guide/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ uses PowerShell Editor Services.
### Introducing `$psEditor`

The entry point for the PowerShell Editor Services extensibility model is the `$psEditor`
object of the type @Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorObject. For
object of the type @Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorObject. For
those familiar with the PowerShell ISE's `$psISE` object, the `$psEditor` object is very
similar. The primary difference is that this model has been generalized to work against
any editor which leverages PowerShell Editor Services for its PowerShell editing experience.
Expand All @@ -19,7 +19,7 @@ any editor which leverages PowerShell Editor Services for its PowerShell editing
> please file an issue on our GitHub page.

This object gives access to all of the high-level services in the current
editing session. For example, the @Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorObject.Workspace
editing session. For example, the @Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorObject.Workspace
property gives access to the editor's workspace, allowing you to create or open files
in the editor.

Expand Down Expand Up @@ -79,17 +79,17 @@ Register-EditorCommand `
-ScriptBlock { Write-Output "My command's script block was invoked!" }
```

### The @Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext parameter
### The @Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorContext parameter

Your function, cmdlet, or ScriptBlock can optionally accept a single parameter
of type @Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext which provides
of type @Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorContext which provides
information about the state of the host editor at the time your command was
invoked. With this object you can easily perform operations like manipulatin the
state of the user's active editor buffer or changing the current selection.

The usual convention is that a `$context` parameter is added to your editor
command's function. For now it is recommended that you fully specify the
type of the @Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext object
type of the @Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorContext object
so that you get full IntelliSense on your context parameter.

Here is an example of using the `$context` parameter:
Expand All @@ -99,7 +99,7 @@ Register-EditorCommand `
-Name "MyModule.MyEditorCommandWithContext" `
-DisplayName "My command with context usage" `
-ScriptBlock {
param([Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext]$context)
param([Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorContext]$context)
Write-Output "The user's cursor is on line $($context.CursorPosition.Line)!"
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Register-EditorCommand `
-DisplayName 'Open Editor Profile' `
-SuppressOutput `
-ScriptBlock {
param([Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext]$context)
param([Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorContext]$context)
If (!(Test-Path -Path $Profile)) { New-Item -Path $Profile -ItemType File }
$psEditor.Workspace.OpenFile($Profile)
}
Expand All @@ -13,7 +13,7 @@ Register-EditorCommand `
-DisplayName 'Open Profile from List (Current User)' `
-SuppressOutput `
-ScriptBlock {
param([Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext]$context)
param([Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorContext]$context)

$Current = Split-Path -Path $profile -Leaf
$List = @($Current,'Microsoft.VSCode_profile.ps1','Microsoft.PowerShell_profile.ps1','Microsoft.PowerShellISE_profile.ps1','Profile.ps1') | Select-Object -Unique
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Register-EditorCommand {
$commandArgs += $Function
}

$editorCommand = New-Object Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommand -ArgumentList $commandArgs
$editorCommand = New-Object Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorCommand -ArgumentList $commandArgs
if ($psEditor.RegisterCommand($editorCommand))
{
Write-Verbose "Registered new command '$Name'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function Import-EditorCommand {
<#
.EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
#>
[OutputType([Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommand])]
[OutputType([Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorCommand])]
[CmdletBinding(DefaultParameterSetName='ByCommand')]
param(
[Parameter(Position=0,
Expand Down Expand Up @@ -75,7 +75,7 @@ function Import-EditorCommand {
$commands = $Command | Get-Command -ErrorAction SilentlyContinue
}
}
$attributeType = [Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommandAttribute]
$attributeType = [Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorCommandAttribute]
foreach ($aCommand in $commands) {
# Get the attribute from our command to get name info.
$details = $aCommand.ScriptBlock.Attributes | Where-Object TypeId -eq $attributeType
Expand All @@ -99,7 +99,7 @@ function Import-EditorCommand {
}
# Check for a context parameter.
$contextParameter = $aCommand.Parameters.Values |
Where-Object ParameterType -eq ([Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext])
Where-Object ParameterType -eq ([Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorContext])

# If one is found then add a named argument. Otherwise call the command directly.
if ($contextParameter) {
Expand All @@ -109,7 +109,7 @@ function Import-EditorCommand {
$scriptBlock = [scriptblock]::Create($aCommand.Name)
}

$editorCommand = New-Object Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommand @(
$editorCommand = New-Object Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorCommand @(
<# commandName: #> $details.Name,
<# displayName: #> $details.DisplayName,
<# suppressOutput: #> $details.SuppressOutput,
Expand Down
24 changes: 12 additions & 12 deletions module/PowerShellEditorServices/PowerShellEditorServices.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if ($PSEdition -eq 'Desktop') {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/System.Security.Principal.Windows.dll"
}

Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.Engine.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.dll"

function Start-EditorServicesHost {
[CmdletBinding()]
Expand Down Expand Up @@ -91,13 +91,13 @@ function Start-EditorServicesHost {

$editorServicesHost = $null
$hostDetails =
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Engine.Hosting.HostDetails @(
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Hosting.HostDetails @(
$HostName,
$HostProfileId,
(Microsoft.PowerShell.Utility\New-Object System.Version @($HostVersion)))

$editorServicesHost =
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Engine.Hosting.EditorServicesHost @(
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Hosting.EditorServicesHost @(
$hostDetails,
$BundledModulesPath,
$EnableConsoleRepl.IsPresent,
Expand All @@ -108,40 +108,40 @@ function Start-EditorServicesHost {

# Build the profile paths using the root paths of the current $profile variable
$profilePaths =
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Engine.Hosting.ProfilePaths @(
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Hosting.ProfilePaths @(
$hostDetails.ProfileId,
[System.IO.Path]::GetDirectoryName($profile.AllUsersAllHosts),
[System.IO.Path]::GetDirectoryName($profile.CurrentUserAllHosts))

$editorServicesHost.StartLogging($LogPath, $LogLevel);

$languageServiceConfig =
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Engine.Hosting.EditorServiceTransportConfig
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Hosting.EditorServiceTransportConfig

$debugServiceConfig =
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Engine.Hosting.EditorServiceTransportConfig
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Hosting.EditorServiceTransportConfig

switch ($PSCmdlet.ParameterSetName) {
"Stdio" {
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Engine.Hosting.EditorServiceTransportType]::Stdio
$debugServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Engine.Hosting.EditorServiceTransportType]::Stdio
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Hosting.EditorServiceTransportType]::Stdio
$debugServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Hosting.EditorServiceTransportType]::Stdio
break
}
"NamedPipe" {
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Engine.Hosting.EditorServiceTransportType]::NamedPipe
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Hosting.EditorServiceTransportType]::NamedPipe
$languageServiceConfig.InOutPipeName = "$LanguageServiceNamedPipe"
if ($DebugServiceNamedPipe) {
$debugServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Engine.Hosting.EditorServiceTransportType]::NamedPipe
$debugServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Hosting.EditorServiceTransportType]::NamedPipe
$debugServiceConfig.InOutPipeName = "$DebugServiceNamedPipe"
}
break
}
"NamedPipeSimplex" {
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Engine.Hosting.EditorServiceTransportType]::NamedPipe
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Hosting.EditorServiceTransportType]::NamedPipe
$languageServiceConfig.InPipeName = $LanguageServiceInNamedPipe
$languageServiceConfig.OutPipeName = $LanguageServiceOutNamedPipe
if ($DebugServiceInNamedPipe -and $DebugServiceOutNamedPipe) {
$debugServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Engine.Hosting.EditorServiceTransportType]::NamedPipe
$debugServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Hosting.EditorServiceTransportType]::NamedPipe
$debugServiceConfig.InPipeName = $DebugServiceInNamedPipe
$debugServiceConfig.OutPipeName = $DebugServiceOutNamedPipe
}
Expand Down
6 changes: 3 additions & 3 deletions module/docs/Import-EditorCommand.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The Import-EditorCommand function will search the specified module for functions

Alternatively, you can specify command info objects (like those from the Get-Command cmdlet) to be processed directly.

To tag a command as an editor command, attach the attribute 'Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommandAttribute' to the function like you would with 'CmdletBindingAttribute'. The attribute accepts the named parameters 'Name', 'DisplayName', and 'SuppressOutput'.
To tag a command as an editor command, attach the attribute 'Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorCommandAttribute' to the function like you would with 'CmdletBindingAttribute'. The attribute accepts the named parameters 'Name', 'DisplayName', and 'SuppressOutput'.

## EXAMPLES

Expand All @@ -55,7 +55,7 @@ Registers all editor commands that contain "Editor" in the name and return all s
```powershell
function Invoke-MyEditorCommand {
[CmdletBinding()]
[Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommand(DisplayName='My Command', SuppressOutput)]
[Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorCommand(DisplayName='My Command', SuppressOutput)]
param()
end {
ConvertTo-ScriptExtent -Offset 0 | Set-ScriptExtent -Text 'My Command!'
Expand Down Expand Up @@ -145,7 +145,7 @@ You can pass commands to register as editor commands.

## OUTPUTS

### Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommand
### Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorCommand

If the "PassThru" parameter is specified editor commands that were successfully registered
will be returned. This function does not output to the pipeline otherwise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Management.Automation;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext;
using Microsoft.PowerShell.EditorServices.Services.PowerShellContext;
using Microsoft.PowerShell.EditorServices.VSCode.CustomViews;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\PowerShellEditorServices.Engine\PowerShellEditorServices.Engine.csproj" />
<ProjectReference Include="..\PowerShellEditorServices\PowerShellEditorServices.csproj" />
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.PowerShell.EditorServices.Engine.Server;
using Microsoft.PowerShell.EditorServices.Engine.Services;
using Microsoft.PowerShell.EditorServices.Server;
using Microsoft.PowerShell.EditorServices.Services;
using Microsoft.PowerShell.EditorServices.Utility;
using Serilog;

namespace Microsoft.PowerShell.EditorServices.Engine.Hosting
namespace Microsoft.PowerShell.EditorServices.Hosting
{
public enum EditorServicesHostStatus
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

using System;

namespace Microsoft.PowerShell.EditorServices.Engine.Hosting
namespace Microsoft.PowerShell.EditorServices.Hosting
{
/// <summary>
/// Contains details about the current host application (most
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.IO;
using System.Linq;

namespace Microsoft.PowerShell.EditorServices.Engine.Hosting
namespace Microsoft.PowerShell.EditorServices.Hosting
{
/// <summary>
/// Provides profile path resolution behavior relative to the name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

using Microsoft.Extensions.Logging;

namespace Microsoft.PowerShell.EditorServices.Engine.Hosting
namespace Microsoft.PowerShell.EditorServices.Hosting
{
public enum PsesLogLevel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Runtime.CompilerServices;
using Microsoft.Extensions.Logging;

namespace Microsoft.PowerShell.EditorServices.Engine.Logging
namespace Microsoft.PowerShell.EditorServices.Logging
{
internal static class LoggerExtensions
{
Expand Down
Loading