From b2e452f4b07a79277875bc37ac2e9679dac83378 Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Mon, 11 Oct 2021 17:57:14 -0700 Subject: [PATCH 1/3] Remove unused using statements --- .../Extensions/Api/EditorExtensionServiceProvider.cs | 1 - .../Extensions/Api/ExtensionCommandService.cs | 1 - .../Extensions/Api/LanguageServerService.cs | 1 - .../Extensions/Api/WorkspaceService.cs | 1 - src/PowerShellEditorServices/Extensions/EditorContext.cs | 1 - .../Extensions/EditorWorkspace.cs | 2 -- .../Hosting/EditorServicesServerFactory.cs | 1 - .../Logging/HostLoggerAdapter.cs | 2 -- src/PowerShellEditorServices/Server/PsesDebugServer.cs | 5 ----- .../Server/PsesLanguageServer.cs | 3 --- .../Server/PsesServiceCollectionExtensions.cs | 3 --- .../Services/DebugAdapter/BreakpointService.cs | 1 - .../DebugAdapter/Debugging/DebuggerStoppedEventArgs.cs | 1 - .../DebugAdapter/Debugging/VariableDetailsBase.cs | 1 - .../Services/DebugAdapter/Handlers/DisconnectHandler.cs | 2 -- .../DebugAdapter/Handlers/LaunchAndAttachHandler.cs | 3 --- .../Services/DebugAdapter/Handlers/SetVariableHandler.cs | 3 --- .../Services/DebugAdapter/Handlers/VariablesHandler.cs | 1 - .../Extension/Handlers/InvokeExtensionCommandHandler.cs | 1 - .../Services/PowerShell/Console/ColorConfiguration.cs | 2 -- .../Services/PowerShell/Console/ConsoleReadLine.cs | 1 - .../Services/PowerShell/Console/IReadLine.cs | 3 --- .../Services/PowerShell/Console/PSReadLineProxy.cs | 1 - .../PowerShell/Context/PowerShellContextFrame.cs | 1 - .../PowerShell/Context/PowerShellVersionDetails.cs | 2 -- .../Services/PowerShell/Execution/ExecutionOptions.cs | 4 +--- .../PowerShell/Execution/SynchronousDelegateTask.cs | 1 - .../Services/PowerShell/Handlers/ExpandAliasHandler.cs | 2 -- .../Services/PowerShell/Handlers/GetCommandHandler.cs | 2 -- .../Services/PowerShell/Handlers/GetVersionHandler.cs | 3 --- .../Handlers/PSHostProcessAndRunspaceHandlers.cs | 3 --- .../Services/PowerShell/Handlers/ShowHelpHandler.cs | 1 - .../PowerShell/Host/EditorServicesConsolePSHost.cs | 3 --- .../Services/PowerShell/IPowerShellExecutionService.cs | 9 +-------- .../Services/PowerShell/Runspace/IRunspaceInfo.cs | 1 - .../PowerShell/Runspace/RunspaceChangedEventArgs.cs | 3 --- .../Services/PowerShell/Runspace/SessionDetails.cs | 2 -- .../Services/PowerShell/Utility/CommandHelpers.cs | 1 - .../Services/PowerShell/Utility/RunspaceExtensions.cs | 3 +-- .../Services/Symbols/ScriptDocumentSymbolProvider.cs | 2 -- .../Services/Symbols/SymbolsService.cs | 1 - .../Services/Symbols/Vistors/AstOperations.cs | 2 -- .../Services/Symbols/Vistors/FindSymbolsVisitor2.cs | 3 --- .../Services/Template/Handlers/TemplateHandlers.cs | 1 - .../Services/TextDocument/Handlers/FormattingHandlers.cs | 2 -- .../Services/Workspace/Handlers/ConfigurationHandler.cs | 1 - src/PowerShellEditorServices/Utility/IdempotentLatch.cs | 5 +---- src/PowerShellEditorServices/Utility/LspDebugUtils.cs | 1 - 48 files changed, 4 insertions(+), 96 deletions(-) diff --git a/src/PowerShellEditorServices/Extensions/Api/EditorExtensionServiceProvider.cs b/src/PowerShellEditorServices/Extensions/Api/EditorExtensionServiceProvider.cs index f59ff7a61..73e8e209e 100644 --- a/src/PowerShellEditorServices/Extensions/Api/EditorExtensionServiceProvider.cs +++ b/src/PowerShellEditorServices/Extensions/Api/EditorExtensionServiceProvider.cs @@ -5,7 +5,6 @@ using System.Linq.Expressions; using System.Reflection; using Microsoft.Extensions.DependencyInjection; -using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Services.Extension; using Microsoft.PowerShell.EditorServices.Utility; using OmniSharp.Extensions.LanguageServer.Protocol.Server; diff --git a/src/PowerShellEditorServices/Extensions/Api/ExtensionCommandService.cs b/src/PowerShellEditorServices/Extensions/Api/ExtensionCommandService.cs index 55c7c693d..64435154f 100644 --- a/src/PowerShellEditorServices/Extensions/Api/ExtensionCommandService.cs +++ b/src/PowerShellEditorServices/Extensions/Api/ExtensionCommandService.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Services.Extension; using System; using System.Collections.Generic; diff --git a/src/PowerShellEditorServices/Extensions/Api/LanguageServerService.cs b/src/PowerShellEditorServices/Extensions/Api/LanguageServerService.cs index 466e6b106..1a5254319 100644 --- a/src/PowerShellEditorServices/Extensions/Api/LanguageServerService.cs +++ b/src/PowerShellEditorServices/Extensions/Api/LanguageServerService.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using MediatR; using OmniSharp.Extensions.LanguageServer.Protocol.Server; using System.Threading; using System.Threading.Tasks; diff --git a/src/PowerShellEditorServices/Extensions/Api/WorkspaceService.cs b/src/PowerShellEditorServices/Extensions/Api/WorkspaceService.cs index 98eb9f06e..dc1300e00 100644 --- a/src/PowerShellEditorServices/Extensions/Api/WorkspaceService.cs +++ b/src/PowerShellEditorServices/Extensions/Api/WorkspaceService.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Management.Automation.Language; -using System.Threading.Tasks; namespace Microsoft.PowerShell.EditorServices.Extensions.Services { diff --git a/src/PowerShellEditorServices/Extensions/EditorContext.cs b/src/PowerShellEditorServices/Extensions/EditorContext.cs index f8e65f472..a844febe3 100644 --- a/src/PowerShellEditorServices/Extensions/EditorContext.cs +++ b/src/PowerShellEditorServices/Extensions/EditorContext.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System; using Microsoft.PowerShell.EditorServices.Services.TextDocument; namespace Microsoft.PowerShell.EditorServices.Extensions diff --git a/src/PowerShellEditorServices/Extensions/EditorWorkspace.cs b/src/PowerShellEditorServices/Extensions/EditorWorkspace.cs index 02d0be68f..6a5c07bc2 100644 --- a/src/PowerShellEditorServices/Extensions/EditorWorkspace.cs +++ b/src/PowerShellEditorServices/Extensions/EditorWorkspace.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System.Threading.Tasks; - namespace Microsoft.PowerShell.EditorServices.Extensions { /// diff --git a/src/PowerShellEditorServices/Hosting/EditorServicesServerFactory.cs b/src/PowerShellEditorServices/Hosting/EditorServicesServerFactory.cs index 48c10f1ee..ff827646e 100644 --- a/src/PowerShellEditorServices/Hosting/EditorServicesServerFactory.cs +++ b/src/PowerShellEditorServices/Hosting/EditorServicesServerFactory.cs @@ -8,7 +8,6 @@ using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Logging; using Microsoft.PowerShell.EditorServices.Server; -using Microsoft.PowerShell.EditorServices.Services; using Serilog; using Serilog.Events; using OmniSharp.Extensions.LanguageServer.Protocol.Server; diff --git a/src/PowerShellEditorServices/Logging/HostLoggerAdapter.cs b/src/PowerShellEditorServices/Logging/HostLoggerAdapter.cs index 802d6c762..41026a5f1 100644 --- a/src/PowerShellEditorServices/Logging/HostLoggerAdapter.cs +++ b/src/PowerShellEditorServices/Logging/HostLoggerAdapter.cs @@ -3,8 +3,6 @@ using Microsoft.Extensions.Logging; using System; -using System.Collections.Generic; -using System.Text; namespace Microsoft.PowerShell.EditorServices.Logging { diff --git a/src/PowerShellEditorServices/Server/PsesDebugServer.cs b/src/PowerShellEditorServices/Server/PsesDebugServer.cs index 30aaa0ca6..0d45df793 100644 --- a/src/PowerShellEditorServices/Server/PsesDebugServer.cs +++ b/src/PowerShellEditorServices/Server/PsesDebugServer.cs @@ -3,18 +3,13 @@ using System; using System.IO; -using System.Management.Automation; -using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Handlers; using Microsoft.PowerShell.EditorServices.Services; -using Microsoft.PowerShell.EditorServices.Services.PowerShell; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Debugging; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace; -using Microsoft.PowerShell.EditorServices.Utility; using OmniSharp.Extensions.DebugAdapter.Server; using OmniSharp.Extensions.LanguageServer.Server; diff --git a/src/PowerShellEditorServices/Server/PsesLanguageServer.cs b/src/PowerShellEditorServices/Server/PsesLanguageServer.cs index 2014414c4..86eceac43 100644 --- a/src/PowerShellEditorServices/Server/PsesLanguageServer.cs +++ b/src/PowerShellEditorServices/Server/PsesLanguageServer.cs @@ -3,7 +3,6 @@ using System; using System.IO; -using System.Management.Automation; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -11,8 +10,6 @@ using Microsoft.PowerShell.EditorServices.Hosting; using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Services.Extension; -using Microsoft.PowerShell.EditorServices.Services.PowerShell; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; using Microsoft.PowerShell.EditorServices.Services.Template; using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Server; diff --git a/src/PowerShellEditorServices/Server/PsesServiceCollectionExtensions.cs b/src/PowerShellEditorServices/Server/PsesServiceCollectionExtensions.cs index 1d8620442..55f440a07 100644 --- a/src/PowerShellEditorServices/Server/PsesServiceCollectionExtensions.cs +++ b/src/PowerShellEditorServices/Server/PsesServiceCollectionExtensions.cs @@ -2,10 +2,7 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Management.Automation.Host; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Hosting; using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Services.Extension; diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/BreakpointService.cs b/src/PowerShellEditorServices/Services/DebugAdapter/BreakpointService.cs index f64bed806..1718c3168 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/BreakpointService.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/BreakpointService.cs @@ -11,7 +11,6 @@ using Microsoft.PowerShell.EditorServices.Logging; using Microsoft.PowerShell.EditorServices.Services.DebugAdapter; using Microsoft.PowerShell.EditorServices.Services.PowerShell; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; namespace Microsoft.PowerShell.EditorServices.Services diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/DebuggerStoppedEventArgs.cs b/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/DebuggerStoppedEventArgs.cs index 87dfd860f..25942c7c9 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/DebuggerStoppedEventArgs.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/DebuggerStoppedEventArgs.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace; using Microsoft.PowerShell.EditorServices.Utility; using System.Management.Automation; diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/VariableDetailsBase.cs b/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/VariableDetailsBase.cs index badaff9bc..51e613f2c 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/VariableDetailsBase.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/VariableDetailsBase.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Utility; namespace Microsoft.PowerShell.EditorServices.Services.DebugAdapter { diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DisconnectHandler.cs b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DisconnectHandler.cs index 9fddc371f..704312d48 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DisconnectHandler.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DisconnectHandler.cs @@ -10,8 +10,6 @@ using Microsoft.PowerShell.EditorServices.Server; using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Services.PowerShell; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace; using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs index d59ad94e9..c2d0e34f8 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Management.Automation; -using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; @@ -18,9 +17,7 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Server; using Microsoft.PowerShell.EditorServices.Services.PowerShell; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Context; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; namespace Microsoft.PowerShell.EditorServices.Handlers { diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/SetVariableHandler.cs b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/SetVariableHandler.cs index 5ce610ead..2eeb2fef6 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/SetVariableHandler.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/SetVariableHandler.cs @@ -2,15 +2,12 @@ // Licensed under the MIT License. using System; -using System.Linq; using System.Management.Automation; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Services.DebugAdapter; -using Microsoft.PowerShell.EditorServices.Utility; -using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.JsonRpc; diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/VariablesHandler.cs b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/VariablesHandler.cs index 494bfc2c0..a97232c06 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/VariablesHandler.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/VariablesHandler.cs @@ -9,7 +9,6 @@ using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Services.DebugAdapter; using Microsoft.PowerShell.EditorServices.Utility; -using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; namespace Microsoft.PowerShell.EditorServices.Handlers diff --git a/src/PowerShellEditorServices/Services/Extension/Handlers/InvokeExtensionCommandHandler.cs b/src/PowerShellEditorServices/Services/Extension/Handlers/InvokeExtensionCommandHandler.cs index ae65bfae9..1a50779cc 100644 --- a/src/PowerShellEditorServices/Services/Extension/Handlers/InvokeExtensionCommandHandler.cs +++ b/src/PowerShellEditorServices/Services/Extension/Handlers/InvokeExtensionCommandHandler.cs @@ -5,7 +5,6 @@ using System.Threading.Tasks; using MediatR; using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Extensions; namespace Microsoft.PowerShell.EditorServices.Services.Extension diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/ColorConfiguration.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/ColorConfiguration.cs index da885c41d..7cad3721e 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/ColorConfiguration.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/ColorConfiguration.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Console { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs index fc13a54b6..e8f5d86ac 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs @@ -12,7 +12,6 @@ namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Console using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; using System; using System.Collections.Generic; - using System.Diagnostics; using System.Management.Automation; using System.Management.Automation.Language; using System.Security; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/IReadLine.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/IReadLine.cs index 3e1afb44c..59724bcec 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/IReadLine.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/IReadLine.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; using System.Security; -using System.Text; using System.Threading; -using System.Threading.Tasks; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Console { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/PSReadLineProxy.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/PSReadLineProxy.cs index c529d5da7..09bcda3ae 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/PSReadLineProxy.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/PSReadLineProxy.cs @@ -16,7 +16,6 @@ namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Console { - using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using System.Management.Automation.Runspaces; internal class PSReadLineProxy diff --git a/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellContextFrame.cs b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellContextFrame.cs index 9e028463a..fb7421af5 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellContextFrame.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellContextFrame.cs @@ -1,7 +1,6 @@ using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace; using System; -using System.Threading; using SMA = System.Management.Automation; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Context diff --git a/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellVersionDetails.cs b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellVersionDetails.cs index 64d848b2c..b18c3ac04 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellVersionDetails.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellVersionDetails.cs @@ -2,11 +2,9 @@ // Licensed under the MIT License. using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; using System; using System.Collections; using System.Linq; -using System.Threading.Tasks; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Context { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Execution/ExecutionOptions.cs b/src/PowerShellEditorServices/Services/PowerShell/Execution/ExecutionOptions.cs index 5e678e83a..dae155171 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/ExecutionOptions.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/ExecutionOptions.cs @@ -1,6 +1,4 @@ -using System; - -namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution +namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution { public enum ExecutionPriority { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs index 3ff4b676f..7995a2587 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs @@ -1,5 +1,4 @@ using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Context; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; using System; using System.Threading; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Handlers/ExpandAliasHandler.cs b/src/PowerShellEditorServices/Services/PowerShell/Handlers/ExpandAliasHandler.cs index 90d144bf5..44ba1bfe7 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Handlers/ExpandAliasHandler.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Handlers/ExpandAliasHandler.cs @@ -6,10 +6,8 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Services; using MediatR; using OmniSharp.Extensions.JsonRpc; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; using Microsoft.PowerShell.EditorServices.Services.PowerShell; namespace Microsoft.PowerShell.EditorServices.Handlers diff --git a/src/PowerShellEditorServices/Services/PowerShell/Handlers/GetCommandHandler.cs b/src/PowerShellEditorServices/Services/PowerShell/Handlers/GetCommandHandler.cs index c15a37a7c..6db8a898a 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Handlers/GetCommandHandler.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Handlers/GetCommandHandler.cs @@ -6,11 +6,9 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Services; using MediatR; using OmniSharp.Extensions.JsonRpc; using Microsoft.PowerShell.EditorServices.Services.PowerShell; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; namespace Microsoft.PowerShell.EditorServices.Handlers { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Handlers/GetVersionHandler.cs b/src/PowerShellEditorServices/Services/PowerShell/Handlers/GetVersionHandler.cs index 34d86b7f5..f8a6d5521 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Handlers/GetVersionHandler.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Handlers/GetVersionHandler.cs @@ -3,15 +3,12 @@ using System; using System.Management.Automation; -using System.Runtime.CompilerServices; -using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Services.PowerShell; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace; using Microsoft.PowerShell.EditorServices.Utility; using OmniSharp.Extensions.LanguageServer.Protocol.Models; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Handlers/PSHostProcessAndRunspaceHandlers.cs b/src/PowerShellEditorServices/Services/PowerShell/Handlers/PSHostProcessAndRunspaceHandlers.cs index a36a24b8c..e4f5586bb 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Handlers/PSHostProcessAndRunspaceHandlers.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Handlers/PSHostProcessAndRunspaceHandlers.cs @@ -3,16 +3,13 @@ using System.Collections.Generic; using System.Management.Automation.Runspaces; -using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Services; namespace Microsoft.PowerShell.EditorServices.Handlers { using Microsoft.PowerShell.EditorServices.Services.PowerShell; - using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; using System.Management.Automation; internal class PSHostProcessAndRunspaceHandlers : IGetPSHostProcessesHandler, IGetRunspaceHandler diff --git a/src/PowerShellEditorServices/Services/PowerShell/Handlers/ShowHelpHandler.cs b/src/PowerShellEditorServices/Services/PowerShell/Handlers/ShowHelpHandler.cs index 3e0f0a903..5e13a5f8b 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Handlers/ShowHelpHandler.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Handlers/ShowHelpHandler.cs @@ -5,7 +5,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Services; using MediatR; using OmniSharp.Extensions.JsonRpc; using Microsoft.PowerShell.EditorServices.Services.PowerShell; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHost.cs b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHost.cs index ed6a3aa5c..d60a66857 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHost.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHost.cs @@ -1,9 +1,6 @@ using System; using System.Globalization; using System.Management.Automation.Host; -using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Hosting; -using OmniSharp.Extensions.LanguageServer.Protocol.Server; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Host { diff --git a/src/PowerShellEditorServices/Services/PowerShell/IPowerShellExecutionService.cs b/src/PowerShellEditorServices/Services/PowerShell/IPowerShellExecutionService.cs index 81011b124..bea1fa902 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/IPowerShellExecutionService.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/IPowerShellExecutionService.cs @@ -1,12 +1,5 @@ -using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Hosting; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Console; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Context; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Debugging; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace; -using OmniSharp.Extensions.LanguageServer.Protocol.Server; using System; using System.Collections.Generic; using System.Management.Automation; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceInfo.cs b/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceInfo.cs index 8f44e3e5d..d8b1bbc8e 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceInfo.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceInfo.cs @@ -1,6 +1,5 @@  using Microsoft.PowerShell.EditorServices.Services.PowerShell.Context; -using System.Threading.Tasks; using SMA = System.Management.Automation.Runspaces; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace diff --git a/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceChangedEventArgs.cs b/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceChangedEventArgs.cs index 04d590c33..044fded99 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceChangedEventArgs.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceChangedEventArgs.cs @@ -1,7 +1,4 @@ using Microsoft.PowerShell.EditorServices.Utility; -using System; -using System.Collections.Generic; -using System.Text; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Runspace/SessionDetails.cs b/src/PowerShellEditorServices/Services/PowerShell/Runspace/SessionDetails.cs index f21f521bd..02322a111 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/SessionDetails.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/SessionDetails.cs @@ -2,9 +2,7 @@ // Licensed under the MIT License. using System; -using System.Management.Automation; using System.Collections; -using Microsoft.PowerShell.EditorServices.Utility; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Utility/CommandHelpers.cs b/src/PowerShellEditorServices/Services/PowerShell/Utility/CommandHelpers.cs index a7264edac..15f6845ae 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/CommandHelpers.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Utility/CommandHelpers.cs @@ -7,7 +7,6 @@ using System.Management.Automation; using System.Threading; using System.Threading.Tasks; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace; using Microsoft.PowerShell.EditorServices.Utility; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs b/src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs index f91ac11a8..0d3685290 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs @@ -1,5 +1,4 @@ -using Microsoft.PowerShell.EditorServices.Utility; -using System; +using System; using System.Linq.Expressions; using System.Management.Automation; using System.Reflection; diff --git a/src/PowerShellEditorServices/Services/Symbols/ScriptDocumentSymbolProvider.cs b/src/PowerShellEditorServices/Services/Symbols/ScriptDocumentSymbolProvider.cs index 89e5f5837..8399b943b 100644 --- a/src/PowerShellEditorServices/Services/Symbols/ScriptDocumentSymbolProvider.cs +++ b/src/PowerShellEditorServices/Services/Symbols/ScriptDocumentSymbolProvider.cs @@ -1,9 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Management.Automation.Language; using Microsoft.PowerShell.EditorServices.Services.TextDocument; diff --git a/src/PowerShellEditorServices/Services/Symbols/SymbolsService.cs b/src/PowerShellEditorServices/Services/Symbols/SymbolsService.cs index 84220d7c8..2da5ec251 100644 --- a/src/PowerShellEditorServices/Services/Symbols/SymbolsService.cs +++ b/src/PowerShellEditorServices/Services/Symbols/SymbolsService.cs @@ -16,7 +16,6 @@ using Microsoft.PowerShell.EditorServices.CodeLenses; using Microsoft.PowerShell.EditorServices.Logging; using Microsoft.PowerShell.EditorServices.Services.PowerShell; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility; using Microsoft.PowerShell.EditorServices.Services.Symbols; diff --git a/src/PowerShellEditorServices/Services/Symbols/Vistors/AstOperations.cs b/src/PowerShellEditorServices/Services/Symbols/Vistors/AstOperations.cs index 7108f8f52..f312352f1 100644 --- a/src/PowerShellEditorServices/Services/Symbols/Vistors/AstOperations.cs +++ b/src/PowerShellEditorServices/Services/Symbols/Vistors/AstOperations.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Linq; using System.Linq.Expressions; using System.Management.Automation; @@ -15,7 +14,6 @@ using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Services.PowerShell; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; -using Microsoft.PowerShell.EditorServices.Utility; namespace Microsoft.PowerShell.EditorServices.Services.Symbols { diff --git a/src/PowerShellEditorServices/Services/Symbols/Vistors/FindSymbolsVisitor2.cs b/src/PowerShellEditorServices/Services/Symbols/Vistors/FindSymbolsVisitor2.cs index 545d56ebb..b7949b096 100644 --- a/src/PowerShellEditorServices/Services/Symbols/Vistors/FindSymbolsVisitor2.cs +++ b/src/PowerShellEditorServices/Services/Symbols/Vistors/FindSymbolsVisitor2.cs @@ -1,9 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System.Collections.Generic; -using System.Management.Automation.Language; - namespace Microsoft.PowerShell.EditorServices.Services.Symbols { // TODO: Restore this when we figure out how to support multiple diff --git a/src/PowerShellEditorServices/Services/Template/Handlers/TemplateHandlers.cs b/src/PowerShellEditorServices/Services/Template/Handlers/TemplateHandlers.cs index 58b4e6a78..57f7552ce 100644 --- a/src/PowerShellEditorServices/Services/Template/Handlers/TemplateHandlers.cs +++ b/src/PowerShellEditorServices/Services/Template/Handlers/TemplateHandlers.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Logging; -using Microsoft.PowerShell.EditorServices.Services; namespace Microsoft.PowerShell.EditorServices.Services.Template { diff --git a/src/PowerShellEditorServices/Services/TextDocument/Handlers/FormattingHandlers.cs b/src/PowerShellEditorServices/Services/TextDocument/Handlers/FormattingHandlers.cs index 8f80350d1..c62c9f5db 100644 --- a/src/PowerShellEditorServices/Services/TextDocument/Handlers/FormattingHandlers.cs +++ b/src/PowerShellEditorServices/Services/TextDocument/Handlers/FormattingHandlers.cs @@ -6,11 +6,9 @@ using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Utility; -using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -using OmniSharp.Extensions.LanguageServer.Protocol.Server; namespace Microsoft.PowerShell.EditorServices.Handlers { diff --git a/src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs b/src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs index d50c1363e..48f7dacab 100644 --- a/src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs +++ b/src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs @@ -12,7 +12,6 @@ using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Services.Configuration; using Newtonsoft.Json.Linq; -using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Protocol.Window; diff --git a/src/PowerShellEditorServices/Utility/IdempotentLatch.cs b/src/PowerShellEditorServices/Utility/IdempotentLatch.cs index 1f4b965bf..596f377ee 100644 --- a/src/PowerShellEditorServices/Utility/IdempotentLatch.cs +++ b/src/PowerShellEditorServices/Utility/IdempotentLatch.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading; +using System.Threading; namespace Microsoft.PowerShell.EditorServices.Utility { diff --git a/src/PowerShellEditorServices/Utility/LspDebugUtils.cs b/src/PowerShellEditorServices/Utility/LspDebugUtils.cs index fadf8719e..254bc41a6 100644 --- a/src/PowerShellEditorServices/Utility/LspDebugUtils.cs +++ b/src/PowerShellEditorServices/Utility/LspDebugUtils.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System; using Microsoft.PowerShell.EditorServices.Services.DebugAdapter; using OmniSharp.Extensions.DebugAdapter.Protocol.Models; From 08e2f696e8d9a3f8fa5240717582443321677d22 Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Mon, 11 Oct 2021 18:14:47 -0700 Subject: [PATCH 2/3] Add copyright headers --- .../Services/PowerShell/Console/ColorConfiguration.cs | 5 ++++- .../Services/PowerShell/Console/ConsoleProxy.cs | 4 +--- .../Services/PowerShell/Console/ConsoleReadLine.cs | 4 +--- .../Services/PowerShell/Console/IConsoleOperations.cs | 2 -- .../Services/PowerShell/Console/IReadLine.cs | 5 ++++- .../Services/PowerShell/Console/PSReadLineProxy.cs | 4 +--- .../Services/PowerShell/Console/ReadLineProvider.cs | 5 ++++- .../Services/PowerShell/Console/UnixConsoleOperations.cs | 4 +--- .../Services/PowerShell/Console/WindowsConsoleOperations.cs | 4 +--- .../Services/PowerShell/Context/PowerShellContextFrame.cs | 5 ++++- .../Services/PowerShell/Context/PowerShellFrameType.cs | 5 ++++- .../PowerShell/Debugging/DebuggerResumingEventArgs.cs | 5 ++++- .../PowerShell/Debugging/DscBreakpointCapability.cs | 6 ++---- .../PowerShell/Debugging/IPowerShellDebugContext.cs | 5 ++++- .../Services/PowerShell/Debugging/PowerShellDebugContext.cs | 5 ++++- .../PowerShell/Execution/BlockingConcurrentDeque.cs | 5 ++++- .../Services/PowerShell/Execution/ExecutionOptions.cs | 5 ++++- .../PowerShell/Execution/SynchronousDelegateTask.cs | 5 ++++- .../PowerShell/Execution/SynchronousPowerShellTask.cs | 5 ++++- .../Services/PowerShell/Execution/SynchronousTask.cs | 5 ++++- .../Services/PowerShell/Host/ConsoleColorProxy.cs | 4 +--- .../Services/PowerShell/Host/EditorServicesConsolePSHost.cs | 3 +++ .../Host/EditorServicesConsolePSHostRawUserInterface.cs | 5 ++++- .../Host/EditorServicesConsolePSHostUserInterface.cs | 5 ++++- .../Services/PowerShell/Host/HostStartOptions.cs | 4 +++- .../Services/PowerShell/Host/PsesInternalHost.cs | 5 ++++- .../Services/PowerShell/IPowerShellExecutionService.cs | 5 ++++- .../Services/PowerShell/Runspace/IRunspaceContext.cs | 4 +++- .../Services/PowerShell/Runspace/IRunspaceInfo.cs | 4 +++- .../PowerShell/Runspace/RunspaceChangedEventArgs.cs | 5 ++++- .../Services/PowerShell/Runspace/RunspaceInfo.cs | 5 ++++- .../Services/PowerShell/Utility/CancellationContext.cs | 5 ++++- .../Services/PowerShell/Utility/ErrorRecordExtensions.cs | 5 ++++- .../Services/PowerShell/Utility/PSCommandExtensions.cs | 5 ++++- .../Services/PowerShell/Utility/PowerShellExtensions.cs | 5 ++++- .../Services/PowerShell/Utility/RunspaceExtensions.cs | 5 ++++- src/PowerShellEditorServices/Utility/IdempotentLatch.cs | 5 ++++- src/PowerShellEditorServices/Utility/IsExternalInit.cs | 5 ++++- 38 files changed, 124 insertions(+), 53 deletions(-) diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/ColorConfiguration.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/ColorConfiguration.cs index 7cad3721e..1bd80051c 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/ColorConfiguration.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/ColorConfiguration.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Console { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleProxy.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleProxy.cs index 22892b445..c73e4f916 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleProxy.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleProxy.cs @@ -1,7 +1,5 @@ -// // Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// +// Licensed under the MIT license. using System; using System.Runtime.InteropServices; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs index e8f5d86ac..12a917a6b 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs @@ -1,7 +1,5 @@ -// -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -// using System.Text; using System.Threading; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/IConsoleOperations.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/IConsoleOperations.cs index 6efe2d26e..4972f23a0 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/IConsoleOperations.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/IConsoleOperations.cs @@ -1,7 +1,5 @@ -// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -// using System; using System.Threading; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/IReadLine.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/IReadLine.cs index 59724bcec..c8c05b73b 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/IReadLine.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/IReadLine.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; using System.Security; using System.Threading; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/PSReadLineProxy.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/PSReadLineProxy.cs index 09bcda3ae..7633435ac 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/PSReadLineProxy.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/PSReadLineProxy.cs @@ -1,7 +1,5 @@ -// // Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// +// Licensed under the MIT license. using System; using System.IO; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/ReadLineProvider.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/ReadLineProvider.cs index 312da2b05..c85c92097 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/ReadLineProvider.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/ReadLineProvider.cs @@ -1,4 +1,7 @@ -using Microsoft.Extensions.Logging; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.Extensions.Logging; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Console { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/UnixConsoleOperations.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/UnixConsoleOperations.cs index 464dd69ad..e1c39536d 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/UnixConsoleOperations.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/UnixConsoleOperations.cs @@ -1,7 +1,5 @@ -// // Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// +// Licensed under the MIT license. using System; using System.Threading; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/WindowsConsoleOperations.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/WindowsConsoleOperations.cs index e4568b65b..20bc886ce 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/WindowsConsoleOperations.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/WindowsConsoleOperations.cs @@ -1,7 +1,5 @@ -// // Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// +// Licensed under the MIT license. using System; using System.Threading; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellContextFrame.cs b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellContextFrame.cs index fb7421af5..9a31bf629 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellContextFrame.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellContextFrame.cs @@ -1,4 +1,7 @@ -using Microsoft.Extensions.Logging; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace; using System; using SMA = System.Management.Automation; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellFrameType.cs b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellFrameType.cs index 4b07fb164..cb20ff8ff 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellFrameType.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellFrameType.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Context { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Debugging/DebuggerResumingEventArgs.cs b/src/PowerShellEditorServices/Services/PowerShell/Debugging/DebuggerResumingEventArgs.cs index 94ecaac73..59c8cc902 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Debugging/DebuggerResumingEventArgs.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Debugging/DebuggerResumingEventArgs.cs @@ -1,4 +1,7 @@ -using System.Management.Automation; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System.Management.Automation; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Debugging { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Debugging/DscBreakpointCapability.cs b/src/PowerShellEditorServices/Services/PowerShell/Debugging/DscBreakpointCapability.cs index 744905a41..0ad294bd0 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Debugging/DscBreakpointCapability.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Debugging/DscBreakpointCapability.cs @@ -1,7 +1,5 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. using System.Linq; using System.Threading.Tasks; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Debugging/IPowerShellDebugContext.cs b/src/PowerShellEditorServices/Services/PowerShell/Debugging/IPowerShellDebugContext.cs index d0f9b1e18..bf78d80b1 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Debugging/IPowerShellDebugContext.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Debugging/IPowerShellDebugContext.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; using System.Management.Automation; using System.Threading; using System.Threading.Tasks; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs b/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs index f72f2a32b..bbe12a0f5 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; using System.Management.Automation; using System.Threading; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Execution/BlockingConcurrentDeque.cs b/src/PowerShellEditorServices/Services/PowerShell/Execution/BlockingConcurrentDeque.cs index afaf59cc9..e57bfd570 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/BlockingConcurrentDeque.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/BlockingConcurrentDeque.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; using System.Collections.Concurrent; using System.Threading; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Execution/ExecutionOptions.cs b/src/PowerShellEditorServices/Services/PowerShell/Execution/ExecutionOptions.cs index dae155171..4965e3415 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/ExecutionOptions.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/ExecutionOptions.cs @@ -1,4 +1,7 @@ -namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution { public enum ExecutionPriority { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs index 7995a2587..343f930eb 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs @@ -1,4 +1,7 @@ -using Microsoft.Extensions.Logging; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; using System; using System.Threading; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs index 085d1bd6b..a0c3082f0 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs @@ -1,4 +1,7 @@ -using Microsoft.Extensions.Logging; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility; using System; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousTask.cs b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousTask.cs index a2b0ae51d..93ca9aac6 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousTask.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousTask.cs @@ -1,4 +1,7 @@ -using Microsoft.Extensions.Logging; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.Extensions.Logging; using System; using System.Runtime.ExceptionServices; using System.Threading; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Host/ConsoleColorProxy.cs b/src/PowerShellEditorServices/Services/PowerShell/Host/ConsoleColorProxy.cs index 1814b2816..75b1bb4be 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Host/ConsoleColorProxy.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Host/ConsoleColorProxy.cs @@ -1,7 +1,5 @@ -// -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -// /* using System; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHost.cs b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHost.cs index d60a66857..b145d0299 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHost.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHost.cs @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + using System; using System.Globalization; using System.Management.Automation.Host; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostRawUserInterface.cs b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostRawUserInterface.cs index defaa0f7e..de69ff6c3 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostRawUserInterface.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostRawUserInterface.cs @@ -1,4 +1,7 @@ -using Microsoft.Extensions.Logging; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Console; using System; using System.Management.Automation; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostUserInterface.cs b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostUserInterface.cs index 9a386abae..cab60cfff 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostUserInterface.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostUserInterface.cs @@ -1,4 +1,7 @@ -using Microsoft.Extensions.Logging; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Console; using System; using System.Collections.Generic; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Host/HostStartOptions.cs b/src/PowerShellEditorServices/Services/PowerShell/Host/HostStartOptions.cs index 7c71d446e..2a1fdfd2f 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Host/HostStartOptions.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Host/HostStartOptions.cs @@ -1,4 +1,6 @@ - +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Host { internal struct HostStartOptions diff --git a/src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs b/src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs index 12fbbfdb7..ae4487d89 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs @@ -1,4 +1,7 @@ -using Microsoft.Extensions.Logging; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Hosting; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Console; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Context; diff --git a/src/PowerShellEditorServices/Services/PowerShell/IPowerShellExecutionService.cs b/src/PowerShellEditorServices/Services/PowerShell/IPowerShellExecutionService.cs index bea1fa902..31a75728f 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/IPowerShellExecutionService.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/IPowerShellExecutionService.cs @@ -1,4 +1,7 @@ -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace; using System; using System.Collections.Generic; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceContext.cs b/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceContext.cs index f8f77f707..c9232d7d5 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceContext.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceContext.cs @@ -1,4 +1,6 @@ - +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace { internal interface IRunspaceContext diff --git a/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceInfo.cs b/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceInfo.cs index d8b1bbc8e..401d0deab 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceInfo.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceInfo.cs @@ -1,4 +1,6 @@ - +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + using Microsoft.PowerShell.EditorServices.Services.PowerShell.Context; using SMA = System.Management.Automation.Runspaces; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceChangedEventArgs.cs b/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceChangedEventArgs.cs index 044fded99..5d889ba1c 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceChangedEventArgs.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceChangedEventArgs.cs @@ -1,4 +1,7 @@ -using Microsoft.PowerShell.EditorServices.Utility; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.PowerShell.EditorServices.Utility; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceInfo.cs b/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceInfo.cs index 5013e09ba..723796619 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceInfo.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceInfo.cs @@ -1,4 +1,7 @@ -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Context; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Context; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Debugging; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace diff --git a/src/PowerShellEditorServices/Services/PowerShell/Utility/CancellationContext.cs b/src/PowerShellEditorServices/Services/PowerShell/Utility/CancellationContext.cs index 81e6c1f3d..b9e33fe49 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/CancellationContext.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Utility/CancellationContext.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; using System.Collections.Concurrent; using System.Threading; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Utility/ErrorRecordExtensions.cs b/src/PowerShellEditorServices/Services/PowerShell/Utility/ErrorRecordExtensions.cs index da8d4cf2d..031a24749 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/ErrorRecordExtensions.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Utility/ErrorRecordExtensions.cs @@ -1,4 +1,7 @@ -using Microsoft.PowerShell.EditorServices.Utility; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.PowerShell.EditorServices.Utility; using System; using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Utility/PSCommandExtensions.cs b/src/PowerShellEditorServices/Services/PowerShell/Utility/PSCommandExtensions.cs index 33bb20280..fc32d4523 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/PSCommandExtensions.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Utility/PSCommandExtensions.cs @@ -1,4 +1,7 @@ -using System.Management.Automation; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System.Management.Automation; using System.Management.Automation.Runspaces; using System.Text; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Utility/PowerShellExtensions.cs b/src/PowerShellEditorServices/Services/PowerShell/Utility/PowerShellExtensions.cs index bf026238a..feda5d9b2 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/PowerShellExtensions.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Utility/PowerShellExtensions.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; using System.Collections.ObjectModel; using System.Reflection; using System.Text; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs b/src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs index 0d3685290..0a5076e57 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; using System.Linq.Expressions; using System.Management.Automation; using System.Reflection; diff --git a/src/PowerShellEditorServices/Utility/IdempotentLatch.cs b/src/PowerShellEditorServices/Utility/IdempotentLatch.cs index 596f377ee..31c1a95d0 100644 --- a/src/PowerShellEditorServices/Utility/IdempotentLatch.cs +++ b/src/PowerShellEditorServices/Utility/IdempotentLatch.cs @@ -1,4 +1,7 @@ -using System.Threading; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System.Threading; namespace Microsoft.PowerShell.EditorServices.Utility { diff --git a/src/PowerShellEditorServices/Utility/IsExternalInit.cs b/src/PowerShellEditorServices/Utility/IsExternalInit.cs index ff74defa3..7d336fdc2 100644 --- a/src/PowerShellEditorServices/Utility/IsExternalInit.cs +++ b/src/PowerShellEditorServices/Utility/IsExternalInit.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System.ComponentModel; namespace System.Runtime.CompilerServices { From de18309695f57a179a947c85af429acf52b91396 Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Mon, 11 Oct 2021 18:30:17 -0700 Subject: [PATCH 3/3] Remove unneeded internal usings --- .../Handlers/ConfigurationDoneHandler.cs | 12 +-- .../PowerShell/Console/ConsoleReadLine.cs | 15 ++-- .../Context/PowerShellVersionDetails.cs | 2 +- .../Debugging/PowerShellDebugContext.cs | 9 +-- .../Execution/SynchronousPowerShellTask.cs | 1 + .../PowerShell/Host/PsesInternalHost.cs | 33 ++++---- .../PowerShell/Runspace/RunspaceInfo.cs | 12 +-- .../PowerShell/Runspace/SessionDetails.cs | 4 +- .../PowerShell/Utility/PSCommandExtensions.cs | 76 ------------------- .../Utility/PowerShellExtensions.cs | 9 ++- .../Utility/PSCommandExtensions.cs | 67 +++++++++++++++- 11 files changed, 114 insertions(+), 126 deletions(-) delete mode 100644 src/PowerShellEditorServices/Services/PowerShell/Utility/PSCommandExtensions.cs diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/ConfigurationDoneHandler.cs b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/ConfigurationDoneHandler.cs index 719e2d682..71cc5d3c5 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/ConfigurationDoneHandler.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/ConfigurationDoneHandler.cs @@ -1,12 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System.Collections.Generic; -using System.Management.Automation; -using System.Management.Automation.Language; -using System.Text; -using System.Threading; -using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Services.DebugAdapter; @@ -19,6 +13,12 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Events; using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.DebugAdapter.Protocol.Server; +using System.Collections.Generic; +using System.Management.Automation; +using System.Management.Automation.Language; +using System.Text; +using System.Threading; +using System.Threading.Tasks; namespace Microsoft.PowerShell.EditorServices.Handlers { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs b/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs index 12a917a6b..277faace1 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs @@ -3,17 +3,16 @@ using System.Text; using System.Threading; +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; +using System; +using System.Collections.Generic; +using System.Management.Automation; +using System.Management.Automation.Language; +using System.Security; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Console { - using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; - using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; - using System; - using System.Collections.Generic; - using System.Management.Automation; - using System.Management.Automation.Language; - using System.Security; - internal class ConsoleReadLine : IReadLine { private readonly PSReadLineProxy _psrlProxy; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellVersionDetails.cs b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellVersionDetails.cs index b18c3ac04..2b1980cc1 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellVersionDetails.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellVersionDetails.cs @@ -2,13 +2,13 @@ // Licensed under the MIT License. using Microsoft.Extensions.Logging; +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility; using System; using System.Collections; using System.Linq; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Context { - using Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility; using System.Management.Automation; /// diff --git a/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs b/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs index bbe12a0f5..780992b97 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs @@ -4,14 +4,13 @@ using System; using System.Management.Automation; using System.Threading; +using Microsoft.Extensions.Logging; +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; +using OmniSharp.Extensions.LanguageServer.Protocol.Server; +using System.Threading.Tasks; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Debugging { - using Microsoft.Extensions.Logging; - using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; - using OmniSharp.Extensions.LanguageServer.Protocol.Server; - using System.Threading.Tasks; - /// /// Handles the state of the PowerShell debugger. /// diff --git a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs index a0c3082f0..4511fb1f5 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility; +using Microsoft.PowerShell.EditorServices.Utility; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs b/src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs index ae4487d89..0ea856fc9 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs @@ -11,21 +11,20 @@ using System.Collections.Generic; using System.Globalization; using System.Management.Automation.Host; -using SMA = System.Management.Automation; +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Debugging; +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility; +using Microsoft.PowerShell.EditorServices.Utility; +using System.IO; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Threading.Tasks; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Host { - using Microsoft.PowerShell.EditorServices.Services.PowerShell.Debugging; - using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; - using Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility; - using Microsoft.PowerShell.EditorServices.Utility; - using System.IO; using System.Management.Automation; using System.Management.Automation.Runspaces; - using System.Reflection; - using System.Text; - using System.Threading; - using System.Threading.Tasks; internal class PsesInternalHost : PSHost, IHostSupportsInteractiveSession, IRunspaceContext, IInternalPowerShellExecutionService { @@ -117,7 +116,7 @@ public PsesInternalHost( public RunspaceInfo CurrentRunspace => CurrentFrame.RunspaceInfo; - public SMA.PowerShell CurrentPowerShell => CurrentFrame.PowerShell; + public PowerShell CurrentPowerShell => CurrentFrame.PowerShell; public EditorServicesConsolePSHost PublicHost { get; } @@ -253,7 +252,7 @@ public void CancelCurrentTask() public Task ExecuteDelegateAsync( string representation, ExecutionOptions executionOptions, - Func func, + Func func, CancellationToken cancellationToken) { return InvokeTaskOnPipelineThreadAsync(new SynchronousPSDelegateTask(_logger, this, representation, executionOptions ?? ExecutionOptions.Default, func, cancellationToken)); @@ -262,7 +261,7 @@ public Task ExecuteDelegateAsync( public Task ExecuteDelegateAsync( string representation, ExecutionOptions executionOptions, - Action action, + Action action, CancellationToken cancellationToken) { return InvokeTaskOnPipelineThreadAsync(new SynchronousPSDelegateTask(_logger, this, representation, executionOptions ?? ExecutionOptions.Default, action, cancellationToken)); @@ -325,13 +324,13 @@ public IReadOnlyList InvokePSCommand(PSCommand psCommand, Powe public void InvokePSCommand(PSCommand psCommand, PowerShellExecutionOptions executionOptions, CancellationToken cancellationToken) => InvokePSCommand(psCommand, executionOptions, cancellationToken); - public TResult InvokePSDelegate(string representation, ExecutionOptions executionOptions, Func func, CancellationToken cancellationToken) + public TResult InvokePSDelegate(string representation, ExecutionOptions executionOptions, Func func, CancellationToken cancellationToken) { var task = new SynchronousPSDelegateTask(_logger, this, representation, executionOptions, func, cancellationToken); return task.ExecuteAndGetResult(cancellationToken); } - public void InvokePSDelegate(string representation, ExecutionOptions executionOptions, Action action, CancellationToken cancellationToken) + public void InvokePSDelegate(string representation, ExecutionOptions executionOptions, Action action, CancellationToken cancellationToken) { var task = new SynchronousPSDelegateTask(_logger, this, representation, executionOptions, action, cancellationToken); task.ExecuteAndGetResult(cancellationToken); @@ -361,7 +360,7 @@ private void Run() return (pwsh, localRunspaceInfo); } - private void PushPowerShellAndRunLoop(SMA.PowerShell pwsh, PowerShellFrameType frameType, RunspaceInfo newRunspaceInfo = null) + private void PushPowerShellAndRunLoop(PowerShell pwsh, PowerShellFrameType frameType, RunspaceInfo newRunspaceInfo = null) { // TODO: Improve runspace origin detection here if (newRunspaceInfo is null) @@ -379,7 +378,7 @@ private void PushPowerShellAndRunLoop(SMA.PowerShell pwsh, PowerShellFrameType f PushPowerShellAndRunLoop(new PowerShellContextFrame(pwsh, newRunspaceInfo, frameType)); } - private RunspaceInfo GetRunspaceInfoForPowerShell(SMA.PowerShell pwsh, out bool isNewRunspace, out RunspaceFrame oldRunspaceFrame) + private RunspaceInfo GetRunspaceInfoForPowerShell(PowerShell pwsh, out bool isNewRunspace, out RunspaceFrame oldRunspaceFrame) { oldRunspaceFrame = null; diff --git a/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceInfo.cs b/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceInfo.cs index 723796619..c9b4d247c 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceInfo.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceInfo.cs @@ -3,16 +3,16 @@ using Microsoft.PowerShell.EditorServices.Services.PowerShell.Context; using Microsoft.PowerShell.EditorServices.Services.PowerShell.Debugging; +using Microsoft.Extensions.Logging; +using System.Threading.Tasks; +using System.Threading; +using System; +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace { - using System.Management.Automation.Runspaces; using System.Management.Automation; - using Microsoft.Extensions.Logging; - using System.Threading.Tasks; - using System.Threading; - using System; - using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; + using System.Management.Automation.Runspaces; internal class RunspaceInfo : IRunspaceInfo { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Runspace/SessionDetails.cs b/src/PowerShellEditorServices/Services/PowerShell/Runspace/SessionDetails.cs index 02322a111..2683e1992 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/SessionDetails.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/SessionDetails.cs @@ -3,11 +3,11 @@ using System; using System.Collections; +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility; +using System.Linq; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace { - using Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility; - using System.Linq; using System.Management.Automation; /// diff --git a/src/PowerShellEditorServices/Services/PowerShell/Utility/PSCommandExtensions.cs b/src/PowerShellEditorServices/Services/PowerShell/Utility/PSCommandExtensions.cs deleted file mode 100644 index fc32d4523..000000000 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/PSCommandExtensions.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using System.Management.Automation; -using System.Management.Automation.Runspaces; -using System.Text; - -namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility -{ - internal static class PSCommandExtensions - { - public static PSCommand AddOutputCommand(this PSCommand psCommand) - { - return psCommand.MergePipelineResults() - .AddCommand("Out-Default", useLocalScope: true); - } - - public static PSCommand AddDebugOutputCommand(this PSCommand psCommand) - { - return psCommand.MergePipelineResults() - .AddCommand("Out-String", useLocalScope: true) - .AddParameter("Stream"); - } - - public static PSCommand MergePipelineResults(this PSCommand psCommand) - { - // We need to do merge errors and output before rendering with an Out- cmdlet - Command lastCommand = psCommand.Commands[psCommand.Commands.Count - 1]; - lastCommand.MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output); - lastCommand.MergeMyResults(PipelineResultTypes.Information, PipelineResultTypes.Output); - return psCommand; - } - - /// - /// Get a representation of the PSCommand, for logging purposes. - /// - public static string GetInvocationText(this PSCommand command) - { - Command currentCommand = command.Commands[0]; - var sb = new StringBuilder().AddCommandText(command.Commands[0]); - - for (int i = 1; i < command.Commands.Count; i++) - { - sb.Append(currentCommand.IsEndOfStatement ? "; " : " | "); - currentCommand = command.Commands[i]; - sb.AddCommandText(currentCommand); - } - - return sb.ToString(); - } - - private static StringBuilder AddCommandText(this StringBuilder sb, Command command) - { - sb.Append(command.CommandText); - if (command.Parameters != null) - { - foreach (CommandParameter parameter in command.Parameters) - { - if (parameter.Name != null) - { - sb.Append(" -").Append(parameter.Name); - } - - if (parameter.Value != null) - { - // This isn't going to get PowerShell's string form of the value, - // but it's good enough, and not as complex or expensive - sb.Append(' ').Append(parameter.Value); - } - } - } - - return sb; - } - } -} diff --git a/src/PowerShellEditorServices/Services/PowerShell/Utility/PowerShellExtensions.cs b/src/PowerShellEditorServices/Services/PowerShell/Utility/PowerShellExtensions.cs index feda5d9b2..5724776d5 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/PowerShellExtensions.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Utility/PowerShellExtensions.cs @@ -5,13 +5,14 @@ using System.Collections.ObjectModel; using System.Reflection; using System.Text; +using Microsoft.Extensions.Logging; +using Microsoft.PowerShell.EditorServices.Hosting; +using Microsoft.PowerShell.EditorServices.Utility; +using System.Collections.Generic; +using System.IO; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility { - using Microsoft.Extensions.Logging; - using Microsoft.PowerShell.EditorServices.Hosting; - using System.Collections.Generic; - using System.IO; using System.Management.Automation; internal static class PowerShellExtensions diff --git a/src/PowerShellEditorServices/Utility/PSCommandExtensions.cs b/src/PowerShellEditorServices/Utility/PSCommandExtensions.cs index d283d215a..55c8eed20 100644 --- a/src/PowerShellEditorServices/Utility/PSCommandExtensions.cs +++ b/src/PowerShellEditorServices/Utility/PSCommandExtensions.cs @@ -6,6 +6,7 @@ using System.Management.Automation; using System.Management.Automation.Runspaces; using System.Reflection; +using System.Text; namespace Microsoft.PowerShell.EditorServices.Utility { @@ -32,10 +33,74 @@ static PSCommandExtensions() // PowerShell's missing an API for us to AddCommand using a CommandInfo. // An issue was filed here: https://github.com/PowerShell/PowerShell/issues/12295 // This works around this by creating a `Command` and passing it into PSCommand.AddCommand(Command command) - internal static PSCommand AddCommand(this PSCommand command, CommandInfo commandInfo) + public static PSCommand AddCommand(this PSCommand command, CommandInfo commandInfo) { var rsCommand = s_commandCtor(commandInfo); return command.AddCommand(rsCommand); } + + public static PSCommand AddOutputCommand(this PSCommand psCommand) + { + return psCommand.MergePipelineResults() + .AddCommand("Out-Default", useLocalScope: true); + } + + public static PSCommand AddDebugOutputCommand(this PSCommand psCommand) + { + return psCommand.MergePipelineResults() + .AddCommand("Out-String", useLocalScope: true) + .AddParameter("Stream"); + } + + public static PSCommand MergePipelineResults(this PSCommand psCommand) + { + // We need to do merge errors and output before rendering with an Out- cmdlet + Command lastCommand = psCommand.Commands[psCommand.Commands.Count - 1]; + lastCommand.MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output); + lastCommand.MergeMyResults(PipelineResultTypes.Information, PipelineResultTypes.Output); + return psCommand; + } + + /// + /// Get a representation of the PSCommand, for logging purposes. + /// + public static string GetInvocationText(this PSCommand command) + { + Command currentCommand = command.Commands[0]; + var sb = new StringBuilder().AddCommandText(command.Commands[0]); + + for (int i = 1; i < command.Commands.Count; i++) + { + sb.Append(currentCommand.IsEndOfStatement ? "; " : " | "); + currentCommand = command.Commands[i]; + sb.AddCommandText(currentCommand); + } + + return sb.ToString(); + } + + private static StringBuilder AddCommandText(this StringBuilder sb, Command command) + { + sb.Append(command.CommandText); + if (command.Parameters != null) + { + foreach (CommandParameter parameter in command.Parameters) + { + if (parameter.Name != null) + { + sb.Append(" -").Append(parameter.Name); + } + + if (parameter.Value != null) + { + // This isn't going to get PowerShell's string form of the value, + // but it's good enough, and not as complex or expensive + sb.Append(' ').Append(parameter.Value); + } + } + } + + return sb; + } } }