Skip to content

Commit e2c8738

Browse files
authored
Move settings from custom UI to built-in options panel. (#96)
1 parent ffd20bb commit e2c8738

23 files changed

+1224
-808
lines changed

PowerShellTools.2022/PowerShellTools.15.0.imagemanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ImageManifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/VisualStudio/ImageManifestSchema/2014">
33
<Symbols>
44
<!--;v1.2.3.4;32cd18849a3a99f8-->
5-
<String Name="Resources" Value="/PowerShellTools.2022.2024.7.0;component/Resources" />
5+
<String Name="Resources" Value="/PowerShellTools.2022.2024.7.1;component/Resources" />
66
<Guid Name="ProjectGuid" Value="{072A9D46-0C24-4CFA-990A-25D7E12271F5}" />
77
<ID Name="ProjectIcon" Value="1" />
88
<ID Name="ScriptIcon" Value="2" />

PowerShellTools.2022/PowerShellTools.vsct

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,6 @@
231231
<ButtonText>PowerShell Modules</ButtonText>
232232
</Strings>
233233
</Button>
234-
235-
<Button guid="guidPoshToolsCmdSet" id="SettingsCommandId" priority="0x7f03" type="Button">
236-
<Parent guid="guidPoshToolsCmdSet" id="SubMenuGroup"/>
237-
<Icon guid="guidSettingsImage" id="1"/>
238-
<Strings>
239-
<ButtonText>Settings</ButtonText>
240-
</Strings>
241-
</Button>
242234
</Buttons>
243235

244236
<Bitmaps>

PowerShellTools.2022/packages.lock.json

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,6 +1819,27 @@
18191819
"PowerShellStandard.Library": "[5.1.0, )"
18201820
}
18211821
},
1822+
"powershelltools.templates.data": {
1823+
"type": "Project"
1824+
},
1825+
"powershelltools.templates.formproject": {
1826+
"type": "Project"
1827+
},
1828+
"powershelltools.templates.module": {
1829+
"type": "Project"
1830+
},
1831+
"powershelltools.templates.moduleproject": {
1832+
"type": "Project"
1833+
},
1834+
"powershelltools.templates.script": {
1835+
"type": "Project"
1836+
},
1837+
"powershelltools.templates.scriptproject": {
1838+
"type": "Project"
1839+
},
1840+
"powershelltools.templates.test": {
1841+
"type": "Project"
1842+
},
18221843
"powershelltools.testadapter": {
18231844
"type": "Project",
18241845
"dependencies": {
@@ -1857,6 +1878,227 @@
18571878
"System.Drawing.Common": "[6.0.0, )",
18581879
"System.Text.Json": "[4.6.0, )"
18591880
}
1881+
},
1882+
"powershelltoolspro.templates.formitem": {
1883+
"type": "Project"
1884+
},
1885+
"powershelltoolspro.templates.serviceitem": {
1886+
"type": "Project"
1887+
}
1888+
},
1889+
".NETFramework,Version=v4.7.2/win": {
1890+
"Microsoft.Win32.Registry": {
1891+
"type": "Direct",
1892+
"requested": "[5.0.0, )",
1893+
"resolved": "5.0.0",
1894+
"contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==",
1895+
"dependencies": {
1896+
"System.Security.AccessControl": "5.0.0",
1897+
"System.Security.Principal.Windows": "5.0.0"
1898+
}
1899+
},
1900+
"Microsoft.Win32.Primitives": {
1901+
"type": "Transitive",
1902+
"resolved": "4.3.0",
1903+
"contentHash": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==",
1904+
"dependencies": {
1905+
"runtime.win.Microsoft.Win32.Primitives": "4.3.0"
1906+
}
1907+
},
1908+
"runtime.win.Microsoft.Win32.Primitives": {
1909+
"type": "Transitive",
1910+
"resolved": "4.3.0",
1911+
"contentHash": "NU51SEt/ZaD2MF48sJ17BIqx7rjeNNLXUevfMOjqQIetdndXwYjZfZsT6jD+rSWp/FYxjesdK4xUSl4OTEI0jw=="
1912+
},
1913+
"System.IO.Compression": {
1914+
"type": "Transitive",
1915+
"resolved": "4.3.0",
1916+
"contentHash": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg=="
1917+
},
1918+
"System.IO.Pipes.AccessControl": {
1919+
"type": "Transitive",
1920+
"resolved": "4.5.0",
1921+
"contentHash": "uqKLJb0Cukb8vG6JVKbJXOAmMWUWOue4ZTjMn7qrfGLZHww3iV8xV1amipI238kmmoFQx6I8GP2bjDM/ss5pQQ==",
1922+
"dependencies": {
1923+
"System.Security.AccessControl": "4.5.0",
1924+
"System.Security.Principal.Windows": "4.5.0"
1925+
}
1926+
},
1927+
"System.Runtime.InteropServices.RuntimeInformation": {
1928+
"type": "Transitive",
1929+
"resolved": "4.3.0",
1930+
"contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw=="
1931+
},
1932+
"System.Security.AccessControl": {
1933+
"type": "Transitive",
1934+
"resolved": "6.0.0",
1935+
"contentHash": "AUADIc0LIEQe7MzC+I0cl0rAT8RrTAKFHl53yHjEUzNVIaUlhFY11vc2ebiVJzVBuOzun6F7FBA+8KAbGTTedQ==",
1936+
"dependencies": {
1937+
"System.Security.Principal.Windows": "5.0.0"
1938+
}
1939+
},
1940+
"System.Security.Principal.Windows": {
1941+
"type": "Transitive",
1942+
"resolved": "5.0.0",
1943+
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
1944+
}
1945+
},
1946+
".NETFramework,Version=v4.7.2/win-arm64": {
1947+
"Microsoft.Win32.Registry": {
1948+
"type": "Direct",
1949+
"requested": "[5.0.0, )",
1950+
"resolved": "5.0.0",
1951+
"contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==",
1952+
"dependencies": {
1953+
"System.Security.AccessControl": "5.0.0",
1954+
"System.Security.Principal.Windows": "5.0.0"
1955+
}
1956+
},
1957+
"System.IO.Compression": {
1958+
"type": "Transitive",
1959+
"resolved": "4.3.0",
1960+
"contentHash": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg=="
1961+
},
1962+
"System.IO.Pipes.AccessControl": {
1963+
"type": "Transitive",
1964+
"resolved": "4.5.0",
1965+
"contentHash": "uqKLJb0Cukb8vG6JVKbJXOAmMWUWOue4ZTjMn7qrfGLZHww3iV8xV1amipI238kmmoFQx6I8GP2bjDM/ss5pQQ==",
1966+
"dependencies": {
1967+
"System.Security.AccessControl": "4.5.0",
1968+
"System.Security.Principal.Windows": "4.5.0"
1969+
}
1970+
},
1971+
"System.Runtime.InteropServices.RuntimeInformation": {
1972+
"type": "Transitive",
1973+
"resolved": "4.3.0",
1974+
"contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw=="
1975+
},
1976+
"System.Security.AccessControl": {
1977+
"type": "Transitive",
1978+
"resolved": "6.0.0",
1979+
"contentHash": "AUADIc0LIEQe7MzC+I0cl0rAT8RrTAKFHl53yHjEUzNVIaUlhFY11vc2ebiVJzVBuOzun6F7FBA+8KAbGTTedQ==",
1980+
"dependencies": {
1981+
"System.Security.Principal.Windows": "5.0.0"
1982+
}
1983+
},
1984+
"System.Security.Principal.Windows": {
1985+
"type": "Transitive",
1986+
"resolved": "5.0.0",
1987+
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
1988+
}
1989+
},
1990+
".NETFramework,Version=v4.7.2/win-x64": {
1991+
"Microsoft.Win32.Registry": {
1992+
"type": "Direct",
1993+
"requested": "[5.0.0, )",
1994+
"resolved": "5.0.0",
1995+
"contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==",
1996+
"dependencies": {
1997+
"System.Security.AccessControl": "5.0.0",
1998+
"System.Security.Principal.Windows": "5.0.0"
1999+
}
2000+
},
2001+
"Microsoft.Win32.Primitives": {
2002+
"type": "Transitive",
2003+
"resolved": "4.3.0",
2004+
"contentHash": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==",
2005+
"dependencies": {
2006+
"runtime.win.Microsoft.Win32.Primitives": "4.3.0"
2007+
}
2008+
},
2009+
"runtime.win.Microsoft.Win32.Primitives": {
2010+
"type": "Transitive",
2011+
"resolved": "4.3.0",
2012+
"contentHash": "NU51SEt/ZaD2MF48sJ17BIqx7rjeNNLXUevfMOjqQIetdndXwYjZfZsT6jD+rSWp/FYxjesdK4xUSl4OTEI0jw=="
2013+
},
2014+
"System.IO.Compression": {
2015+
"type": "Transitive",
2016+
"resolved": "4.3.0",
2017+
"contentHash": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg=="
2018+
},
2019+
"System.IO.Pipes.AccessControl": {
2020+
"type": "Transitive",
2021+
"resolved": "4.5.0",
2022+
"contentHash": "uqKLJb0Cukb8vG6JVKbJXOAmMWUWOue4ZTjMn7qrfGLZHww3iV8xV1amipI238kmmoFQx6I8GP2bjDM/ss5pQQ==",
2023+
"dependencies": {
2024+
"System.Security.AccessControl": "4.5.0",
2025+
"System.Security.Principal.Windows": "4.5.0"
2026+
}
2027+
},
2028+
"System.Runtime.InteropServices.RuntimeInformation": {
2029+
"type": "Transitive",
2030+
"resolved": "4.3.0",
2031+
"contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw=="
2032+
},
2033+
"System.Security.AccessControl": {
2034+
"type": "Transitive",
2035+
"resolved": "6.0.0",
2036+
"contentHash": "AUADIc0LIEQe7MzC+I0cl0rAT8RrTAKFHl53yHjEUzNVIaUlhFY11vc2ebiVJzVBuOzun6F7FBA+8KAbGTTedQ==",
2037+
"dependencies": {
2038+
"System.Security.Principal.Windows": "5.0.0"
2039+
}
2040+
},
2041+
"System.Security.Principal.Windows": {
2042+
"type": "Transitive",
2043+
"resolved": "5.0.0",
2044+
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
2045+
}
2046+
},
2047+
".NETFramework,Version=v4.7.2/win-x86": {
2048+
"Microsoft.Win32.Registry": {
2049+
"type": "Direct",
2050+
"requested": "[5.0.0, )",
2051+
"resolved": "5.0.0",
2052+
"contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==",
2053+
"dependencies": {
2054+
"System.Security.AccessControl": "5.0.0",
2055+
"System.Security.Principal.Windows": "5.0.0"
2056+
}
2057+
},
2058+
"Microsoft.Win32.Primitives": {
2059+
"type": "Transitive",
2060+
"resolved": "4.3.0",
2061+
"contentHash": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==",
2062+
"dependencies": {
2063+
"runtime.win.Microsoft.Win32.Primitives": "4.3.0"
2064+
}
2065+
},
2066+
"runtime.win.Microsoft.Win32.Primitives": {
2067+
"type": "Transitive",
2068+
"resolved": "4.3.0",
2069+
"contentHash": "NU51SEt/ZaD2MF48sJ17BIqx7rjeNNLXUevfMOjqQIetdndXwYjZfZsT6jD+rSWp/FYxjesdK4xUSl4OTEI0jw=="
2070+
},
2071+
"System.IO.Compression": {
2072+
"type": "Transitive",
2073+
"resolved": "4.3.0",
2074+
"contentHash": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg=="
2075+
},
2076+
"System.IO.Pipes.AccessControl": {
2077+
"type": "Transitive",
2078+
"resolved": "4.5.0",
2079+
"contentHash": "uqKLJb0Cukb8vG6JVKbJXOAmMWUWOue4ZTjMn7qrfGLZHww3iV8xV1amipI238kmmoFQx6I8GP2bjDM/ss5pQQ==",
2080+
"dependencies": {
2081+
"System.Security.AccessControl": "4.5.0",
2082+
"System.Security.Principal.Windows": "4.5.0"
2083+
}
2084+
},
2085+
"System.Runtime.InteropServices.RuntimeInformation": {
2086+
"type": "Transitive",
2087+
"resolved": "4.3.0",
2088+
"contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw=="
2089+
},
2090+
"System.Security.AccessControl": {
2091+
"type": "Transitive",
2092+
"resolved": "6.0.0",
2093+
"contentHash": "AUADIc0LIEQe7MzC+I0cl0rAT8RrTAKFHl53yHjEUzNVIaUlhFY11vc2ebiVJzVBuOzun6F7FBA+8KAbGTTedQ==",
2094+
"dependencies": {
2095+
"System.Security.Principal.Windows": "5.0.0"
2096+
}
2097+
},
2098+
"System.Security.Principal.Windows": {
2099+
"type": "Transitive",
2100+
"resolved": "5.0.0",
2101+
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
18602102
}
18612103
}
18622104
}

PowerShellTools.Shared/Options/AnalysisOptions.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,36 @@ internal class AnalysisOptions : BaseOptionModel<AnalysisOptions>
1010
public event EventHandler<EventArgs<bool>> ScriptAnalyzerChanged;
1111
public event EventHandler<EventArgs<bool>> SolutionWideAnalysisChanged;
1212
public event EventHandler<EventArgs<bool>> AnalyzeOnSaveChanged;
13+
public event EventHandler<EventArgs<string>> ConfigurationFileChanged;
1314

1415
public AnalysisOptions()
1516
{
1617
this.SolutionWideAnalysis = this.ScriptAnalyzer;
1718
}
1819

19-
[DisplayName(@"Script Analyzer")]
20-
[Description("When true, enables script analyzer support.")]
20+
[DisplayName(@"Enable Script Analyzer")]
21+
[Description("When true, enables PSScriptAnalyzer support.")]
2122
public bool ScriptAnalyzer { get; set; }
2223

2324
[DisplayName(@"Solution Wide Analysis")]
2425
[Description("When true, enables script analyzer support for the entire solution.")]
2526
public bool SolutionWideAnalysis { get; set; }
2627

2728
[DisplayName(@"Analyze on Save")]
28-
[Description("When true, analyzes a file when it is saved.")]
29+
[Description("When true, analyzes a file when it is saved. When false, the script will be analyzed as you type.")]
2930
public bool AnalyzeOnSave { get; set; }
3031

32+
[DisplayName(@"Configuration File")]
33+
[Description("The path to a PSScriptAnalyzer configuration file.")]
34+
public string ConfigurationFile { get; set; }
35+
3136
public override void Load()
3237
{
3338
var previousScriptAnalyzer = ScriptAnalyzer;
3439
var previousSolutionWideAnalysis = SolutionWideAnalysis;
3540
var previousAnalyzeOnSave = AnalyzeOnSave;
41+
var previousConfigurationFile = ConfigurationFile;
42+
3643

3744
base.Load();
3845

@@ -50,6 +57,11 @@ public override void Load()
5057
{
5158
OnSolutionWideAnalysisChanged();
5259
}
60+
61+
if (previousConfigurationFile != ConfigurationFile)
62+
{
63+
OnConfigurationFileChanged();
64+
}
5365
}
5466

5567
public override async Task LoadAsync()
@@ -90,5 +102,10 @@ public void OnSolutionWideAnalysisChanged()
90102
{
91103
SolutionWideAnalysisChanged?.Invoke(this, new EventArgs<bool>(SolutionWideAnalysis));
92104
}
105+
106+
public void OnConfigurationFileChanged()
107+
{
108+
ConfigurationFileChanged?.Invoke(this, new EventArgs<string>(ConfigurationFile));
109+
}
93110
}
94111
}

PowerShellTools.Shared/Options/BaseOptionModel.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ public virtual async Task SaveAsync()
155155
/// </summary>
156156
protected virtual string SerializeValue(object value)
157157
{
158+
if (value == null)
159+
{
160+
return null;
161+
}
162+
158163
using (var stream = new MemoryStream())
159164
{
160165
var formatter = new BinaryFormatter();
@@ -180,10 +185,10 @@ protected virtual object DeserializeValue(string value, Type type)
180185

181186
private static async Task<ShellSettingsManager> GetSettingsManagerAsync()
182187
{
183-
#pragma warning disable VSTHRD010
188+
#pragma warning disable VSTHRD010
184189
// False-positive in Threading Analyzers. Bug tracked here https://github.com/Microsoft/vs-threading/issues/230
185190
var svc = await AsyncServiceProvider.GlobalProvider.GetServiceAsync(typeof(SVsSettingsManager)) as IVsSettingsManager;
186-
#pragma warning restore VSTHRD010
191+
#pragma warning restore VSTHRD010
187192

188193
Assumes.Present(svc);
189194

PowerShellTools.Shared/Options/DialogPageProvider.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ internal class DialogPageProvider
55
public class General : BaseOptionPage<GeneralOptions> {
66
public General() : base(x => new GeneralOptionsControl(x.Self)) { }
77
}
8+
9+
public class Analysis : BaseOptionPage<AnalysisOptions> { }
10+
811
public class Diagnostics : BaseOptionPage<DiagnosticOptions> { }
12+
13+
914
}
1015
}

PowerShellTools.Shared/Options/GeneralOptions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public GeneralOptions()
1414
this.ShouldLoadProfiles = true;
1515
this.TabComplete = true;
1616
this.Sta = false;
17-
this.DontShowLicenseInfoOnStartup = false;
1817

1918
var powershellLocator = new PowerShellLocator();
2019
this.PowerShellVersion = powershellLocator.DefaultVersion;
@@ -73,7 +72,5 @@ public void OnPowerShellVersionChanged()
7372

7473
[DisplayName(@"Apartment State")]
7574
public bool Sta { get; set; }
76-
[DisplayName(@"Don't Show License Info On Startup")]
77-
public bool DontShowLicenseInfoOnStartup { get; set; }
7875
}
7976
}

0 commit comments

Comments
 (0)