Fixing project names to fix VS bugs

For whatever reason, Visual Studio throws a fit if a referenced project has a name
and the folder name (which is used to reference the project) is different than that name.
To solve this issue, I've renamed all the projects and folders to match their project
names as stated in the project.json.
This commit is contained in:
Benjamin Russell
2016-07-29 16:55:44 -07:00
parent bb0cd461b6
commit e83d2704b9
83 changed files with 5 additions and 5 deletions

View File

@@ -0,0 +1,92 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
namespace Microsoft.SqlTools.ServiceLayer.SqlContext
{
/// <summary>
/// Contains details about the current host application (most
/// likely the editor which is using the host process).
/// </summary>
public class HostDetails
{
#region Constants
/// <summary>
/// The default host name for SqlTools Editor Services. Used
/// if no host name is specified by the host application.
/// </summary>
public const string DefaultHostName = "SqlTools Editor Services Host";
/// <summary>
/// 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.SqlToolsEditorServices";
/// <summary>
/// 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>
public static readonly Version DefaultHostVersion = new Version("0.0.0");
/// <summary>
/// The default host details in a HostDetails object.
/// </summary>
public static readonly HostDetails Default = new HostDetails(null, null, null);
#endregion
#region Properties
/// <summary>
/// Gets the name of the host.
/// </summary>
public string Name { get; private set; }
/// <summary>
/// Gets the profile ID of the host, used to determine the
/// host-specific profile path.
/// </summary>
public string ProfileId { get; private set; }
/// <summary>
/// Gets the version of the host.
/// </summary>
public Version Version { get; private set; }
#endregion
#region Constructors
/// <summary>
/// Creates an instance of the HostDetails class.
/// </summary>
/// <param name="name">
/// The display name for the host, typically in the form of
/// "[Application Name] Host".
/// </param>
/// <param name="profileId">
/// 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.
/// </param>
/// <param name="version">The host application's version.</param>
public HostDetails(
string name,
string profileId,
Version version)
{
this.Name = name ?? DefaultHostName;
this.ProfileId = profileId ?? DefaultHostProfileId;
this.Version = version ?? DefaultHostVersion;
}
#endregion
}
}

View File

@@ -0,0 +1,108 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Microsoft.SqlTools.ServiceLayer.SqlContext
{
/// <summary>
/// Provides profile path resolution behavior relative to the name
/// of a particular SqlTools host.
/// </summary>
public class ProfilePaths
{
#region Constants
/// <summary>
/// The file name for the "all hosts" profile. Also used as the
/// suffix for the host-specific profile filenames.
/// </summary>
public const string AllHostsProfileName = "profile.ps1";
#endregion
#region Properties
/// <summary>
/// Gets the profile path for all users, all hosts.
/// </summary>
public string AllUsersAllHosts { get; private set; }
/// <summary>
/// Gets the profile path for all users, current host.
/// </summary>
public string AllUsersCurrentHost { get; private set; }
/// <summary>
/// Gets the profile path for the current user, all hosts.
/// </summary>
public string CurrentUserAllHosts { get; private set; }
/// <summary>
/// Gets the profile path for the current user and host.
/// </summary>
public string CurrentUserCurrentHost { get; private set; }
#endregion
#region Public Methods
/// <summary>
/// Creates a new instance of the ProfilePaths class.
/// </summary>
/// <param name="hostProfileId">
/// The identifier of the host used in the host-specific X_profile.ps1 filename.
/// </param>
/// <param name="baseAllUsersPath">The base path to use for constructing AllUsers profile paths.</param>
/// <param name="baseCurrentUserPath">The base path to use for constructing CurrentUser profile paths.</param>
public ProfilePaths(
string hostProfileId,
string baseAllUsersPath,
string baseCurrentUserPath)
{
this.Initialize(hostProfileId, baseAllUsersPath, baseCurrentUserPath);
}
private void Initialize(
string hostProfileId,
string baseAllUsersPath,
string baseCurrentUserPath)
{
string currentHostProfileName =
string.Format(
"{0}_{1}",
hostProfileId,
AllHostsProfileName);
this.AllUsersCurrentHost = Path.Combine(baseAllUsersPath, currentHostProfileName);
this.CurrentUserCurrentHost = Path.Combine(baseCurrentUserPath, currentHostProfileName);
this.AllUsersAllHosts = Path.Combine(baseAllUsersPath, AllHostsProfileName);
this.CurrentUserAllHosts = Path.Combine(baseCurrentUserPath, AllHostsProfileName);
}
/// <summary>
/// Gets the list of profile paths that exist on the filesystem.
/// </summary>
/// <returns>An IEnumerable of profile path strings to be loaded.</returns>
public IEnumerable<string> GetLoadableProfilePaths()
{
var profilePaths =
new string[]
{
this.AllUsersAllHosts,
this.AllUsersCurrentHost,
this.CurrentUserAllHosts,
this.CurrentUserCurrentHost
};
return profilePaths.Where(p => File.Exists(p));
}
#endregion
}
}

View File

@@ -0,0 +1,28 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
namespace Microsoft.SqlTools.ServiceLayer.SqlContext
{
/// <summary>
/// Context for SQL Tools
/// </summary>
public class SqlToolsContext
{
/// <summary>
/// Gets the PowerShell version of the current runspace.
/// </summary>
public Version SqlToolsVersion
{
get; private set;
}
public SqlToolsContext(HostDetails hostDetails, ProfilePaths profilePaths)
{
}
}
}

View File

@@ -0,0 +1,86 @@
using System.IO;
using Microsoft.SqlTools.EditorServices.Utility;
namespace Microsoft.SqlTools.ServiceLayer.SqlContext
{
/// <summary>
/// Class for serialization and deserialization of the settings the SQL Tools Service needs.
/// </summary>
public class SqlToolsSettings
{
// TODO: Is this needed? I can't make sense of this comment.
// NOTE: This property is capitalized as 'SqlTools' because the
// mode name sent from the client is written as 'SqlTools' and
// JSON.net is using camelCasing.
//public ServiceHostSettings SqlTools { get; set; }
public SqlToolsSettings()
{
this.ScriptAnalysis = new ScriptAnalysisSettings();
}
public bool EnableProfileLoading { get; set; }
public ScriptAnalysisSettings ScriptAnalysis { get; set; }
public void Update(SqlToolsSettings settings, string workspaceRootPath)
{
if (settings != null)
{
this.EnableProfileLoading = settings.EnableProfileLoading;
this.ScriptAnalysis.Update(settings.ScriptAnalysis, workspaceRootPath);
}
}
}
/// <summary>
/// Sub class for serialization and deserialization of script analysis settings
/// </summary>
public class ScriptAnalysisSettings
{
public bool? Enable { get; set; }
public string SettingsPath { get; set; }
public ScriptAnalysisSettings()
{
this.Enable = true;
}
public void Update(ScriptAnalysisSettings settings, string workspaceRootPath)
{
if (settings != null)
{
this.Enable = settings.Enable;
string settingsPath = settings.SettingsPath;
if (string.IsNullOrWhiteSpace(settingsPath))
{
settingsPath = null;
}
else if (!Path.IsPathRooted(settingsPath))
{
if (string.IsNullOrEmpty(workspaceRootPath))
{
// The workspace root path could be an empty string
// when the user has opened a SqlTools script file
// without opening an entire folder (workspace) first.
// In this case we should just log an error and let
// the specified settings path go through even though
// it will fail to load.
Logger.Write(
LogLevel.Error,
"Could not resolve Script Analyzer settings path due to null or empty workspaceRootPath.");
}
else
{
settingsPath = Path.GetFullPath(Path.Combine(workspaceRootPath, settingsPath));
}
}
this.SettingsPath = settingsPath;
}
}
}
}