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