// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using Newtonsoft.Json; namespace Microsoft.SqlTools.ServiceLayer.SqlContext { /// /// Class for serialization and deserialization of the settings the SQL Tools Service needs. /// public class SqlToolsSettings { private SqlToolsSettingsValues sqlTools = null; /// /// Gets or sets the underlying settings value object /// [JsonProperty("mssql")] public SqlToolsSettingsValues SqlTools { get { if (this.sqlTools == null) { this.sqlTools = new SqlToolsSettingsValues(); } return this.sqlTools; } 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.EnableIntellisense = settings.SqlTools.IntelliSense.EnableIntellisense; this.SqlTools.IntelliSense.Update(settings.SqlTools.IntelliSense); } } /// /// Gets a flag determining if diagnostics are enabled /// public bool IsDiagnositicsEnabled { 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; } } } /// /// Class that is used to serialize and deserialize SQL Tools settings /// public class SqlToolsSettingsValues { /// /// Initializes the Sql Tools settings values /// public SqlToolsSettingsValues() { this.IntelliSense = new IntelliSenseSettings(); this.QueryExecutionSettings = new QueryExecutionSettings(); } /// /// Gets or sets the detailed IntelliSense settings /// public IntelliSenseSettings IntelliSense { get; set; } /// /// Gets or sets the query execution settings /// public QueryExecutionSettings QueryExecutionSettings { get; set; } } }