Files
sqltoolsservice/src/Microsoft.SqlTools.CoreServices/SqlContext/SqlToolsSettings.cs
Kevin Cunnane 71195869e1 Add v2 of the Hosting Service and build nuget packages for it (#675)
* Port v2 of Hosting service to SqlToolsService
- Renamed project to .v2 so that existing hosted service isn't impacted
- Copied over the CoreServices project which contains ConnectionServiceCore and other reusable services for anything interacting with MSSQL
- Ported unit test project across and verified tests run.

* Nuget package support for reusable DLLs

* Use 1.1 version per Karl's suggestion

* Use correct license URL and project URL

* Use new SMO packages
2018-08-07 12:59:57 -07:00

146 lines
4.0 KiB
C#

//
// 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.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
namespace Microsoft.SqlTools.CoreServices.SqlContext
{
/// <summary>
/// Class for serialization and deserialization of the settings the SQL Tools Service needs.
/// </summary>
public class SqlToolsSettings
{
private ISqlToolsSettingsValues sqlTools = null;
private SqlToolsSettingsValues mssqlTools = null;
private SqlToolsSettingsValues allSqlTools = null;
public ISqlToolsSettingsValues SqlTools
{
get
{
if (this.sqlTools == null)
{
this.sqlTools = new CompoundToolsSettingsValues(MssqlTools, AllSqlTools);
}
return this.sqlTools;
}
set
{
this.sqlTools = value;
}
}
/// <summary>
/// Gets or sets the underlying settings value object
/// </summary>
[JsonProperty("mssql")]
public SqlToolsSettingsValues MssqlTools
{
get
{
if (this.mssqlTools == null)
{
this.mssqlTools = new SqlToolsSettingsValues(false);
}
return this.mssqlTools;
}
set
{
this.mssqlTools = value;
}
}
/// <summary>
/// Gets or sets the underlying settings value object
/// </summary>
[JsonProperty("sql")]
public SqlToolsSettingsValues AllSqlTools
{
get
{
if (this.allSqlTools == null)
{
this.allSqlTools = new SqlToolsSettingsValues(false);
}
return this.allSqlTools;
}
set
{
this.sqlTools = value;
}
}
/// <summary>
/// Query excution settings forwarding property
/// </summary>
// public QueryExecutionSettings QueryExecutionSettings
// {
// get { return this.SqlTools.QueryExecutionSettings; }
// }
/// <summary>
/// Updates the extension settings
/// </summary>
/// <param name="settings"></param>
public void Update(SqlToolsSettings settings)
{
if (settings != null)
{
this.SqlTools.IntelliSense.Update(settings.SqlTools.IntelliSense);
}
}
/// <summary>
/// Gets a flag determining if diagnostics are enabled
/// </summary>
public bool IsDiagnosticsEnabled
{
get
{
return this.SqlTools.IntelliSense.EnableIntellisense
&& this.SqlTools.IntelliSense.EnableErrorChecking.Value;
}
}
/// <summary>
/// Gets a flag determining if suggestions are enabled
/// </summary>
public bool IsSuggestionsEnabled
{
get
{
return this.SqlTools.IntelliSense.EnableIntellisense
&& this.SqlTools.IntelliSense.EnableSuggestions.Value;
}
}
/// <summary>
/// Gets a flag determining if quick info is enabled
/// </summary>
public bool IsQuickInfoEnabled
{
get
{
return this.SqlTools.IntelliSense.EnableIntellisense
&& this.SqlTools.IntelliSense.EnableQuickInfo.Value;
}
}
/// <summary>
/// Gets a flag determining if IntelliSense is enabled
/// </summary>
public bool IsIntelliSenseEnabled
{
get
{
return this.SqlTools.IntelliSense.EnableIntellisense;
}
}
}
}