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

@@ -5,7 +5,7 @@
using System.Diagnostics;
namespace Microsoft.PowerShell.EditorServices
namespace Microsoft.SqlTools.EditorServices
{
/// <summary>
/// Provides details about a position in a file buffer. All

View File

@@ -6,7 +6,7 @@
using System;
using System.Diagnostics;
namespace Microsoft.PowerShell.EditorServices
namespace Microsoft.SqlTools.EditorServices
{
/// <summary>
/// Provides details about a range between two positions in

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>
/// Contains details relating to a content change in an open file.

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>
/// Provides details and operations for a buffer position in a

View File

@@ -3,7 +3,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Utility;
using Microsoft.SqlTools.EditorServices.Utility;
using System;
using System.Collections.Generic;
using System.IO;
@@ -11,7 +11,7 @@ using System.Linq;
//using System.Management.Automation;
//using System.Management.Automation.Language;
namespace Microsoft.PowerShell.EditorServices
namespace Microsoft.SqlTools.EditorServices
{
/// <summary>
/// Contains the details and contents of an open script file.
@@ -22,7 +22,7 @@ namespace Microsoft.PowerShell.EditorServices
#region Private Fields
private Token[] scriptTokens;
private Version powerShellVersion;
private Version SqlToolsVersion;
#endregion
@@ -134,18 +134,18 @@ namespace Microsoft.PowerShell.EditorServices
/// <param name="filePath">The path at which the script file resides.</param>
/// <param name="clientFilePath">The path which the client uses to identify the file.</param>
/// <param name="textReader">The TextReader to use for reading the file's contents.</param>
/// <param name="powerShellVersion">The version of PowerShell for which the script is being parsed.</param>
/// <param name="SqlToolsVersion">The version of SqlTools for which the script is being parsed.</param>
public ScriptFile(
string filePath,
string clientFilePath,
TextReader textReader,
Version powerShellVersion)
Version SqlToolsVersion)
{
this.FilePath = filePath;
this.ClientFilePath = clientFilePath;
this.IsAnalysisEnabled = true;
this.IsInMemory = Workspace.IsPathInMemory(filePath);
this.powerShellVersion = powerShellVersion;
this.SqlToolsVersion = SqlToolsVersion;
this.SetFileContents(textReader.ReadToEnd());
}
@@ -156,17 +156,17 @@ namespace Microsoft.PowerShell.EditorServices
/// <param name="filePath">The path at which the script file resides.</param>
/// <param name="clientFilePath">The path which the client uses to identify the file.</param>
/// <param name="initialBuffer">The initial contents of the script file.</param>
/// <param name="powerShellVersion">The version of PowerShell for which the script is being parsed.</param>
/// <param name="SqlToolsVersion">The version of SqlTools for which the script is being parsed.</param>
public ScriptFile(
string filePath,
string clientFilePath,
string initialBuffer,
Version powerShellVersion)
Version SqlToolsVersion)
{
this.FilePath = filePath;
this.ClientFilePath = clientFilePath;
this.IsAnalysisEnabled = true;
this.powerShellVersion = powerShellVersion;
this.SqlToolsVersion = SqlToolsVersion;
this.SetFileContents(initialBuffer);
}
@@ -498,10 +498,10 @@ namespace Microsoft.PowerShell.EditorServices
try
{
#if PowerShellv5r2
#if SqlToolsv5r2
// This overload appeared with Windows 10 Update 1
if (this.powerShellVersion.Major >= 5 &&
this.powerShellVersion.Build >= 10586)
if (this.SqlToolsVersion.Major >= 5 &&
this.SqlToolsVersion.Build >= 10586)
{
// Include the file path so that module relative
// paths are evaluated correctly

View File

@@ -3,15 +3,15 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Utility;
using Microsoft.SqlTools.EditorServices.Utility;
using System;
//using System.Management.Automation.Language;
#if ScriptAnalyzer
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
using Microsoft.Windows.SqlTools.ScriptAnalyzer.Generic;
#endif
namespace Microsoft.PowerShell.EditorServices
namespace Microsoft.SqlTools.EditorServices
{
/// <summary>
/// Defines the message level of a script file marker.

View File

@@ -5,7 +5,7 @@
//using System.Management.Automation.Language;
namespace Microsoft.PowerShell.EditorServices
namespace Microsoft.SqlTools.EditorServices
{
/// <summary>
/// Contains details about a specific region of text in script file.

View File

@@ -3,14 +3,14 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Utility;
using Microsoft.SqlTools.EditorServices.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
namespace Microsoft.PowerShell.EditorServices
namespace Microsoft.SqlTools.EditorServices
{
/// <summary>
/// Manages a "workspace" of script files that are open for a particular
@@ -21,7 +21,7 @@ namespace Microsoft.PowerShell.EditorServices
#if false
#region Private Fields
private Version powerShellVersion;
private Version SqlToolsVersion;
private Dictionary<string, ScriptFile> workspaceFiles = new Dictionary<string, ScriptFile>();
#endregion
@@ -40,10 +40,10 @@ namespace Microsoft.PowerShell.EditorServices
/// <summary>
/// Creates a new instance of the Workspace class.
/// </summary>
/// <param name="powerShellVersion">The version of PowerShell for which scripts will be parsed.</param>
public Workspace(Version powerShellVersion)
/// <param name="SqlToolsVersion">The version of SqlTools for which scripts will be parsed.</param>
public Workspace(Version SqlToolsVersion)
{
this.powerShellVersion = powerShellVersion;
this.SqlToolsVersion = SqlToolsVersion;
}
#endregion
@@ -83,7 +83,7 @@ namespace Microsoft.PowerShell.EditorServices
resolvedFilePath,
filePath,
streamReader,
this.powerShellVersion);
this.SqlToolsVersion);
this.workspaceFiles.Add(keyName, scriptFile);
}
@@ -118,7 +118,7 @@ namespace Microsoft.PowerShell.EditorServices
resolvedFilePath,
filePath,
initialBuffer,
this.powerShellVersion);
this.SqlToolsVersion);
this.workspaceFiles.Add(keyName, scriptFile);
@@ -239,8 +239,8 @@ namespace Microsoft.PowerShell.EditorServices
// Clients could specify paths with escaped space, [ and ] characters which .NET APIs
// will not handle. These paths will get appropriately escaped just before being passed
// into the PowerShell engine.
filePath = PowerShellContext.UnescapePath(filePath);
// into the SqlTools engine.
filePath = SqlToolsContext.UnescapePath(filePath);
// Get the absolute file path
filePath = Path.GetFullPath(filePath);
@@ -253,10 +253,10 @@ namespace Microsoft.PowerShell.EditorServices
internal static bool IsPathInMemory(string filePath)
{
// When viewing PowerShell files in the Git diff viewer, VS Code
// When viewing SqlTools files in the Git diff viewer, VS Code
// sends the contents of the file at HEAD with a URI that starts
// with 'inmemory'. Untitled files which have been marked of
// type PowerShell have a path starting with 'untitled'.
// type SqlTools have a path starting with 'untitled'.
return
filePath.StartsWith("inmemory") ||
filePath.StartsWith("untitled");