Servicehost cleanup (#1)

Merge some code clean ups.  Find+Replace 'PowerShell' with 'SQL Tools'.
Enable logger in ServiceHost project.
This commit is contained in:
Karl Burtram
2016-07-15 20:48:31 -07:00
committed by GitHub
parent 790825cfab
commit c78292a680
108 changed files with 347 additions and 340 deletions

View File

@@ -3,13 +3,13 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
// using Microsoft.PowerShell.EditorServices.Console;
// using Microsoft.PowerShell.EditorServices.Extensions;
using Microsoft.PowerShell.EditorServices.Session;
// using Microsoft.PowerShell.EditorServices.Utility;
// using Microsoft.SqlTools.EditorServices.Console;
// using Microsoft.SqlTools.EditorServices.Extensions;
using Microsoft.SqlTools.EditorServices.Session;
// using Microsoft.SqlTools.EditorServices.Utility;
// using System.IO;
namespace Microsoft.PowerShell.EditorServices
namespace Microsoft.SqlTools.EditorServices
{
/// <summary>
/// Manages a single session for all editor services. This
@@ -29,9 +29,9 @@ namespace Microsoft.PowerShell.EditorServices
public Workspace Workspace { get; private set; }
/// <summary>
/// Gets the PowerShellContext instance for this session.
/// Gets the SqlToolsContext instance for this session.
/// </summary>
public PowerShellContext PowerShellContext { get; private set; }
public SqlToolsContext SqlToolsContext { get; private set; }
/// <summary>
/// Gets the LanguageService instance for this session.
@@ -75,16 +75,16 @@ namespace Microsoft.PowerShell.EditorServices
public void StartSession(HostDetails hostDetails, ProfilePaths profilePaths)
{
// Initialize all services
this.PowerShellContext = new PowerShellContext(hostDetails, profilePaths);
this.LanguageService = new LanguageService(this.PowerShellContext);
this.DebugService = new DebugService(this.PowerShellContext);
this.ConsoleService = new ConsoleService(this.PowerShellContext);
this.ExtensionService = new ExtensionService(this.PowerShellContext);
this.SqlToolsContext = new SqlToolsContext(hostDetails, profilePaths);
this.LanguageService = new LanguageService(this.SqlToolsContext);
this.DebugService = new DebugService(this.SqlToolsContext);
this.ConsoleService = new ConsoleService(this.SqlToolsContext);
this.ExtensionService = new ExtensionService(this.SqlToolsContext);
this.InstantiateAnalysisService();
// Create a workspace to contain open files
this.Workspace = new Workspace(this.PowerShellContext.PowerShellVersion);
this.Workspace = new Workspace(this.SqlToolsContext.SqlToolsVersion);
}
/// <summary>
@@ -99,20 +99,20 @@ namespace Microsoft.PowerShell.EditorServices
internal void InstantiateAnalysisService(string settingsPath = null)
{
// Only enable the AnalysisService if the machine has PowerShell
// v5 installed. Script Analyzer works on earlier PowerShell
// Only enable the AnalysisService if the machine has SqlTools
// v5 installed. Script Analyzer works on earlier SqlTools
// versions but our hard dependency on their binaries complicates
// the deployment and assembly loading since we would have to
// conditionally load the binaries for v3/v4 support. This problem
// will be solved in the future by using Script Analyzer as a
// module rather than an assembly dependency.
if (this.PowerShellContext.PowerShellVersion.Major >= 5)
if (this.SqlToolsContext.SqlToolsVersion.Major >= 5)
{
// AnalysisService will throw FileNotFoundException if
// Script Analyzer binaries are not included.
try
{
this.AnalysisService = new AnalysisService(this.PowerShellContext.ConsoleHost, settingsPath);
this.AnalysisService = new AnalysisService(this.SqlToolsContext.ConsoleHost, settingsPath);
}
catch (FileNotFoundException)
{
@@ -125,8 +125,8 @@ namespace Microsoft.PowerShell.EditorServices
{
Logger.Write(
LogLevel.Normal,
"Script Analyzer cannot be loaded due to unsupported PowerShell version " +
this.PowerShellContext.PowerShellVersion.ToString());
"Script Analyzer cannot be loaded due to unsupported SqlTools version " +
this.SqlToolsContext.SqlToolsVersion.ToString());
}
}
@@ -146,10 +146,10 @@ namespace Microsoft.PowerShell.EditorServices
this.AnalysisService = null;
}
if (this.PowerShellContext != null)
if (this.SqlToolsContext != null)
{
this.PowerShellContext.Dispose();
this.PowerShellContext = null;
this.SqlToolsContext.Dispose();
this.SqlToolsContext = null;
}
}

View File

@@ -5,7 +5,7 @@
using System;
namespace Microsoft.PowerShell.EditorServices.Session
namespace Microsoft.SqlTools.EditorServices.Session
{
/// <summary>
/// Contains details about the current host application (most
@@ -16,19 +16,19 @@ namespace Microsoft.PowerShell.EditorServices.Session
#region Constants
/// <summary>
/// The default host name for PowerShell Editor Services. Used
/// The default host name for SqlTools Editor Services. Used
/// if no host name is specified by the host application.
/// </summary>
public const string DefaultHostName = "PowerShell Editor Services Host";
public const string DefaultHostName = "SqlTools Editor Services Host";
/// <summary>
/// The default host ID for PowerShell Editor Services. Used
/// The default host ID for SqlTools Editor Services. Used
/// for the host-specific profile path if no host ID is specified.
/// </summary>
public const string DefaultHostProfileId = "Microsoft.PowerShellEditorServices";
public const string DefaultHostProfileId = "Microsoft.SqlToolsEditorServices";
/// <summary>
/// The default host version for PowerShell Editor Services. If
/// The default host version for SqlTools Editor Services. If
/// no version is specified by the host application, we use 0.0.0
/// to indicate a lack of version.
/// </summary>
@@ -71,7 +71,7 @@ namespace Microsoft.PowerShell.EditorServices.Session
/// "[Application Name] Host".
/// </param>
/// <param name="profileId">
/// The identifier of the PowerShell host to use for its profile path.
/// The identifier of the SqlTools host to use for its profile path.
/// loaded. Used to resolve a profile path of the form 'X_profile.ps1'
/// where 'X' represents the value of hostProfileId. If null, a default
/// will be used.

View File

@@ -3,7 +3,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.PowerShell.EditorServices
namespace Microsoft.SqlTools.EditorServices
{
/// <summary>
/// Enumerates the types of output lines that will be sent
@@ -34,7 +34,7 @@ namespace Microsoft.PowerShell.EditorServices
/// <summary>
/// An error output line, written with the Write-Error cmdlet or
/// as a result of some error during PowerShell pipeline execution.
/// as a result of some error during SqlTools pipeline execution.
/// </summary>
Error
}

View File

@@ -5,11 +5,11 @@
using System;
namespace Microsoft.PowerShell.EditorServices
namespace Microsoft.SqlTools.EditorServices
{
/// <summary>
/// Provides details about output that has been written to the
/// PowerShell host.
/// SqlTools host.
/// </summary>
public class OutputWrittenEventArgs
{

View File

@@ -8,11 +8,11 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Microsoft.PowerShell.EditorServices.Session
namespace Microsoft.SqlTools.EditorServices.Session
{
/// <summary>
/// Provides profile path resolution behavior relative to the name
/// of a particular PowerShell host.
/// of a particular SqlTools host.
/// </summary>
public class ProfilePaths
{