mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-13 17:23:02 -05:00
* Move unused forked code to external directory * Fix SLN build errors * Add back resource provider core since it's referenced by main resource provider project * Update PackageProjects step of pipeline
146 lines
4.0 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|
|
}
|