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/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/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..1bd80051c 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/ColorConfiguration.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/ColorConfiguration.cs @@ -1,6 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Text; +// 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 fc13a54b6..277faace1 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleReadLine.cs @@ -1,22 +1,18 @@ -// -// 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; +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.Diagnostics; - 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/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 3e1afb44c..c8c05b73b 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Console/IReadLine.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Console/IReadLine.cs @@ -1,9 +1,9 @@ -using System; -using System.Collections.Generic; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; 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..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; @@ -16,7 +14,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/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 9e028463a..9a31bf629 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellContextFrame.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellContextFrame.cs @@ -1,7 +1,9 @@ -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 System.Threading; using SMA = System.Management.Automation; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Context 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/Context/PowerShellVersionDetails.cs b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellVersionDetails.cs index 64d848b2c..2b1980cc1 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellVersionDetails.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellVersionDetails.cs @@ -2,15 +2,13 @@ // Licensed under the MIT License. using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility; using System; using System.Collections; using System.Linq; -using System.Threading.Tasks; 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/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..780992b97 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs @@ -1,14 +1,16 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +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/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 5e678e83a..4965e3415 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/ExecutionOptions.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/ExecutionOptions.cs @@ -1,4 +1,5 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution { diff --git a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs index 3ff4b676f..343f930eb 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs @@ -1,5 +1,7 @@ -using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Context; +// 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..4511fb1f5 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs @@ -1,6 +1,10 @@ -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 Microsoft.PowerShell.EditorServices.Utility; using System; using System.Collections.Generic; using System.Collections.ObjectModel; 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/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/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 ed6a3aa5c..b145d0299 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHost.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHost.cs @@ -1,9 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + 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/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..0ea856fc9 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; @@ -8,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 { @@ -114,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; } @@ -250,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)); @@ -259,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)); @@ -322,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); @@ -358,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) @@ -376,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/IPowerShellExecutionService.cs b/src/PowerShellEditorServices/Services/PowerShell/IPowerShellExecutionService.cs index 81011b124..31a75728f 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/IPowerShellExecutionService.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/IPowerShellExecutionService.cs @@ -1,12 +1,8 @@ -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; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; 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/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 8f44e3e5d..401d0deab 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceInfo.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/IRunspaceInfo.cs @@ -1,6 +1,7 @@ - +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + 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..5d889ba1c 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceChangedEventArgs.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceChangedEventArgs.cs @@ -1,7 +1,7 @@ -using Microsoft.PowerShell.EditorServices.Utility; -using System; -using System.Collections.Generic; -using System.Text; +// 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..c9b4d247c 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceInfo.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/RunspaceInfo.cs @@ -1,15 +1,18 @@ -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; +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 f21f521bd..2683e1992 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Runspace/SessionDetails.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Runspace/SessionDetails.cs @@ -2,14 +2,12 @@ // Licensed under the MIT License. using System; -using System.Management.Automation; using System.Collections; -using Microsoft.PowerShell.EditorServices.Utility; +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/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/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/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 deleted file mode 100644 index 33bb20280..000000000 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/PSCommandExtensions.cs +++ /dev/null @@ -1,73 +0,0 @@ -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 bf026238a..5724776d5 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/PowerShellExtensions.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Utility/PowerShellExtensions.cs @@ -1,14 +1,18 @@ -using System; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; 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/Services/PowerShell/Utility/RunspaceExtensions.cs b/src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs index f91ac11a8..0a5076e57 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs @@ -1,4 +1,6 @@ -using Microsoft.PowerShell.EditorServices.Utility; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + using System; using System.Linq.Expressions; using System.Management.Automation; 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..31c1a95d0 100644 --- a/src/PowerShellEditorServices/Utility/IdempotentLatch.cs +++ b/src/PowerShellEditorServices/Utility/IdempotentLatch.cs @@ -1,6 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Text; +// 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 { 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; 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; + } } }