mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-29 09:35:38 -05:00
Enable Quick Info hover tooltips (#65)
Pushing to include in tomorrow's partner release build. Please send me any feedback and I'll address in the next Intellisense PR.
This commit is contained in:
@@ -19,13 +19,13 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
||||
/// 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";
|
||||
public const string DefaultHostName = "SqlTools Service 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";
|
||||
public const string DefaultHostProfileId = "Microsoft.SqlToolsServiceHost";
|
||||
|
||||
/// <summary>
|
||||
/// The default host version for SqlTools Editor Services. If
|
||||
@@ -78,9 +78,9 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
||||
/// </param>
|
||||
/// <param name="version">The host application's version.</param>
|
||||
public HostDetails(
|
||||
string name,
|
||||
string profileId,
|
||||
Version version)
|
||||
string name = null,
|
||||
string profileId = null,
|
||||
Version version = null)
|
||||
{
|
||||
this.Name = name ?? DefaultHostName;
|
||||
this.ProfileId = profileId ?? DefaultHostProfileId;
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
||||
this.EnableSuggestions = true;
|
||||
this.LowerCaseSuggestions = false;
|
||||
this.EnableDiagnostics = true;
|
||||
this.EnableQuickInfo = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -36,6 +37,11 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
||||
/// </summary>
|
||||
public bool? EnableDiagnostics { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a flag determining if quick info is enabled
|
||||
/// </summary>
|
||||
public bool? EnableQuickInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Update the Intellisense settings
|
||||
/// </summary>
|
||||
@@ -47,6 +53,7 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
||||
this.EnableSuggestions = settings.EnableSuggestions;
|
||||
this.LowerCaseSuggestions = settings.LowerCaseSuggestions;
|
||||
this.EnableDiagnostics = settings.EnableDiagnostics;
|
||||
this.EnableQuickInfo = settings.EnableQuickInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
//
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,14 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public SqlToolsContext(HostDetails hostDetails, ProfilePaths profilePaths)
|
||||
/// <summary>
|
||||
/// Initalizes the SQL Tools context instance
|
||||
/// </summary>
|
||||
/// <param name="hostDetails"></param>
|
||||
public SqlToolsContext(HostDetails hostDetails)
|
||||
{
|
||||
|
||||
this.SqlToolsVersion = hostDetails.Version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,18 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
||||
&& this.SqlTools.IntelliSense.EnableSuggestions.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a flag determining if quick info is enabled
|
||||
/// </summary>
|
||||
public bool IsQuickInfoEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.SqlTools.EnableIntellisense
|
||||
&& this.SqlTools.IntelliSense.EnableQuickInfo.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user