From cdf334cb856f533052afec28469295de75c86e59 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 1 May 2026 14:40:48 +0000
Subject: [PATCH 01/11] Add GotoDefinitionResultsWindow for multiple
goto-definition results
Agent-Logs-Url: https://github.com/X-Sharp/XSharpPublic/sessions/970d2592-55a2-44c5-bd37-c3fc9baa77f4
Co-authored-by: RobertvanderHulst <14240939+RobertvanderHulst@users.noreply.github.com>
---
.../Commands/GotoDefinition.cs | 9 +-
.../Commands/GotoDefinitionResultsWindow.xaml | 36 ++++++++
.../GotoDefinitionResultsWindow.xaml.cs | 86 +++++++++++++++++++
.../LanguageService/LanguageService.csproj | 8 ++
.../LanguageService2022.csproj | 8 ++
5 files changed, 146 insertions(+), 1 deletion(-)
create mode 100644 src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml
create mode 100644 src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml.cs
diff --git a/src/VisualStudio/LanguageService/Commands/GotoDefinition.cs b/src/VisualStudio/LanguageService/Commands/GotoDefinition.cs
index f9601af87a..db873fc711 100644
--- a/src/VisualStudio/LanguageService/Commands/GotoDefinition.cs
+++ b/src/VisualStudio/LanguageService/Commands/GotoDefinition.cs
@@ -54,11 +54,18 @@ internal static void GotoDefn(ITextView TextView)
var result = TextView.GetSymbolUnderCursor(out var state,out _, out _);
//
ThreadHelper.ThrowIfNotOnUIThread();
- if (result.Count > 0)
+ if (result.Count == 1)
{
Goto(result[0], TextView, state);
return;
}
+ if (result.Count > 1)
+ {
+ var window = new GotoDefinitionResultsWindow(result, TextView, state);
+ window.Owner = System.Windows.Application.Current?.MainWindow;
+ window.Show();
+ return;
+ }
}
catch (Exception ex)
{
diff --git a/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml b/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml
new file mode 100644
index 0000000000..5d17e4cadf
--- /dev/null
+++ b/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml.cs b/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml.cs
new file mode 100644
index 0000000000..38cb6a39e8
--- /dev/null
+++ b/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml.cs
@@ -0,0 +1,86 @@
+// Copyright (c) XSharp B.V. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0.
+// See License.txt in the project root for license information.
+//
+using Microsoft.VisualStudio.Text.Editor;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Input;
+using XSharpModel;
+
+namespace XSharp.LanguageService
+{
+ ///
+ /// Floating tool window shown when Goto Definition finds multiple locations.
+ /// Double-clicking an item (or pressing Enter) navigates to that location and closes the window.
+ ///
+ internal partial class GotoDefinitionResultsWindow : Window
+ {
+ private readonly ITextView _textView;
+ private readonly CompletionState _state;
+
+ internal GotoDefinitionResultsWindow(IList results, ITextView textView, CompletionState state)
+ {
+ InitializeComponent();
+ _textView = textView;
+ _state = state;
+
+ var items = new List();
+ foreach (var symbol in results)
+ {
+ items.Add(new GotoDefinitionResultItem(symbol));
+ }
+ _listView.ItemsSource = items;
+ if (items.Count > 0)
+ _listView.SelectedIndex = 0;
+ }
+
+ private void NavigateToSelected()
+ {
+ if (_listView.SelectedItem is GotoDefinitionResultItem item)
+ {
+ Close();
+ XSharpGotoDefinition.Goto(item.Symbol, _textView, _state);
+ }
+ }
+
+ private void OnItemDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ if (_listView.SelectedItem != null)
+ NavigateToSelected();
+ }
+
+ private void OnKeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter)
+ {
+ NavigateToSelected();
+ e.Handled = true;
+ }
+ else if (e.Key == Key.Escape)
+ {
+ Close();
+ e.Handled = true;
+ }
+ }
+ }
+
+ ///
+ /// View-model item for a single Goto Definition result.
+ ///
+ internal sealed class GotoDefinitionResultItem
+ {
+ internal IXSymbol Symbol { get; }
+ internal string DisplayName { get; }
+ internal string Location { get; }
+
+ internal GotoDefinitionResultItem(IXSymbol symbol)
+ {
+ Symbol = symbol;
+ DisplayName = symbol.Description;
+ if (string.IsNullOrEmpty(DisplayName))
+ DisplayName = symbol.FullName;
+ Location = symbol.Location;
+ }
+ }
+}
diff --git a/src/VisualStudio/LanguageService/LanguageService.csproj b/src/VisualStudio/LanguageService/LanguageService.csproj
index b79a58ae01..11f1eacde1 100644
--- a/src/VisualStudio/LanguageService/LanguageService.csproj
+++ b/src/VisualStudio/LanguageService/LanguageService.csproj
@@ -61,6 +61,10 @@
+
+ GotoDefinitionResultsWindow.xaml
+ Code
+
@@ -339,6 +343,10 @@
+
+ MSBuild:Compile
+ Designer
+
MSBuild:Compile
Designer
diff --git a/src/VisualStudio/LanguageService/LanguageService2022.csproj b/src/VisualStudio/LanguageService/LanguageService2022.csproj
index 1e1c1767e3..6c5f8b3094 100644
--- a/src/VisualStudio/LanguageService/LanguageService2022.csproj
+++ b/src/VisualStudio/LanguageService/LanguageService2022.csproj
@@ -63,6 +63,10 @@
+
+ GotoDefinitionResultsWindow.xaml
+ Code
+
@@ -355,6 +359,10 @@
MSBuild:Compile
Designer
+
+ MSBuild:Compile
+ Designer
+
MSBuild:Compile
Designer
From 8a47749559182872e677b58082a4abe06453d4ad Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 1 May 2026 14:42:06 +0000
Subject: [PATCH 02/11] Fix review: use VS IVsUIShell for window owner and
handle keys at window level
Agent-Logs-Url: https://github.com/X-Sharp/XSharpPublic/sessions/970d2592-55a2-44c5-bd37-c3fc9baa77f4
Co-authored-by: RobertvanderHulst <14240939+RobertvanderHulst@users.noreply.github.com>
---
.../Commands/GotoDefinitionResultsWindow.xaml | 3 +-
.../GotoDefinitionResultsWindow.xaml.cs | 34 ++++++++++++++++++-
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml b/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml
index 5d17e4cadf..79fbe4340c 100644
--- a/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml
+++ b/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml
@@ -16,8 +16,7 @@
+ MouseDoubleClick="OnItemDoubleClick">
results, ITextView textView
_listView.ItemsSource = items;
if (items.Count > 0)
_listView.SelectedIndex = 0;
+
+ // Set the VS main window as the owner so the popup stays on top of the IDE
+ SetVsOwner();
+ }
+
+ private void SetVsOwner()
+ {
+ try
+ {
+ ThreadHelper.JoinableTaskFactory.Run(async () =>
+ {
+ await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
+ var vsUIShell = ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;
+ if (vsUIShell != null)
+ {
+ vsUIShell.GetDialogOwnerHwnd(out IntPtr ownerHwnd);
+ if (ownerHwnd != IntPtr.Zero)
+ {
+ new WindowInteropHelper(this).Owner = ownerHwnd;
+ }
+ }
+ });
+ }
+ catch (Exception)
+ {
+ // Fallback: no owner; window will still work
+ }
}
private void NavigateToSelected()
@@ -50,7 +81,7 @@ private void OnItemDoubleClick(object sender, MouseButtonEventArgs e)
NavigateToSelected();
}
- private void OnKeyDown(object sender, KeyEventArgs e)
+ protected override void OnPreviewKeyDown(KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
@@ -62,6 +93,7 @@ private void OnKeyDown(object sender, KeyEventArgs e)
Close();
e.Handled = true;
}
+ base.OnPreviewKeyDown(e);
}
}
From 657be04ce24fe5dc5018c41dea98d91050907f40 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 1 May 2026 14:50:38 +0000
Subject: [PATCH 03/11] Use CVT VS.Services.GetUIShellAsync and
toolkit:Themes.UseVsTheme on results window
Agent-Logs-Url: https://github.com/X-Sharp/XSharpPublic/sessions/b57213ac-3397-4e6e-a075-bc0c6c065d5b
Co-authored-by: RobertvanderHulst <14240939+RobertvanderHulst@users.noreply.github.com>
---
.../Commands/GotoDefinitionResultsWindow.xaml | 2 ++
.../Commands/GotoDefinitionResultsWindow.xaml.cs | 5 ++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml b/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml
index 79fbe4340c..0cb5eba492 100644
--- a/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml
+++ b/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml
@@ -1,6 +1,8 @@
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
- var vsUIShell = ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;
+ var vsUIShell = await VS.Services.GetUIShellAsync();
if (vsUIShell != null)
{
vsUIShell.GetDialogOwnerHwnd(out IntPtr ownerHwnd);
From a7203b0f5db2c2cfdb3dfe1034827e59fbb3a56e Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 1 May 2026 14:51:35 +0000
Subject: [PATCH 04/11] Remove redundant window.Owner assignment; SetVsOwner
handles HWND ownership
Agent-Logs-Url: https://github.com/X-Sharp/XSharpPublic/sessions/b57213ac-3397-4e6e-a075-bc0c6c065d5b
Co-authored-by: RobertvanderHulst <14240939+RobertvanderHulst@users.noreply.github.com>
---
src/VisualStudio/LanguageService/Commands/GotoDefinition.cs | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/VisualStudio/LanguageService/Commands/GotoDefinition.cs b/src/VisualStudio/LanguageService/Commands/GotoDefinition.cs
index db873fc711..94e7431b2b 100644
--- a/src/VisualStudio/LanguageService/Commands/GotoDefinition.cs
+++ b/src/VisualStudio/LanguageService/Commands/GotoDefinition.cs
@@ -62,7 +62,6 @@ internal static void GotoDefn(ITextView TextView)
if (result.Count > 1)
{
var window = new GotoDefinitionResultsWindow(result, TextView, state);
- window.Owner = System.Windows.Application.Current?.MainWindow;
window.Show();
return;
}
From 8d4b675ad652b7e6a5100160f5c773b8350590f5 Mon Sep 17 00:00:00 2001
From: Robert van der Hulst
Date: Sat, 2 May 2026 11:58:22 +0200
Subject: [PATCH 05/11] Moved windows to common folder. Make sure multiple
results are returned. Added methods to XProject that return multiple
functions.
---
.../Commands/GotoDefinition.cs | 10 +++++++-
.../DocumentOutlineControl.cs | 0
.../DocumentOutlineControl.xaml | 0
.../GotoDefinitionResultsWindow.xaml | 4 +++
.../GotoDefinitionResultsWindow.xaml.cs | 5 +++-
.../LanguageService2022.csproj | 10 ++++----
.../LanguageService/Lookup/XSharpLookup.cs | 25 ++++++++++++++-----
.../ProjectSystem/XProject.prg | 17 ++++++++-----
8 files changed, 52 insertions(+), 19 deletions(-)
rename src/VisualStudio/LanguageService/{DocumentOutline => Controls}/DocumentOutlineControl.cs (100%)
rename src/VisualStudio/LanguageService/{DocumentOutline => Controls}/DocumentOutlineControl.xaml (100%)
rename src/VisualStudio/LanguageService/{Commands => Controls}/GotoDefinitionResultsWindow.xaml (92%)
rename src/VisualStudio/LanguageService/{Commands => Controls}/GotoDefinitionResultsWindow.xaml.cs (95%)
diff --git a/src/VisualStudio/LanguageService/Commands/GotoDefinition.cs b/src/VisualStudio/LanguageService/Commands/GotoDefinition.cs
index 94e7431b2b..fbdec2e884 100644
--- a/src/VisualStudio/LanguageService/Commands/GotoDefinition.cs
+++ b/src/VisualStudio/LanguageService/Commands/GotoDefinition.cs
@@ -154,7 +154,15 @@ private static XSourceEntity FindElementInFile(XFile file, XPETypeSymbol petype,
{
if (entity.Name == element.Name)
{
- return entity;
+ if (entity is IXMemberSymbol m1 && element is IXMemberSymbol m2)
+ {
+ if (m1.Prototype == m2.Prototype)
+ return entity;
+ }
+ else if (entity.FullName == element.FullName)
+ {
+ return entity;
+ }
}
}
}
diff --git a/src/VisualStudio/LanguageService/DocumentOutline/DocumentOutlineControl.cs b/src/VisualStudio/LanguageService/Controls/DocumentOutlineControl.cs
similarity index 100%
rename from src/VisualStudio/LanguageService/DocumentOutline/DocumentOutlineControl.cs
rename to src/VisualStudio/LanguageService/Controls/DocumentOutlineControl.cs
diff --git a/src/VisualStudio/LanguageService/DocumentOutline/DocumentOutlineControl.xaml b/src/VisualStudio/LanguageService/Controls/DocumentOutlineControl.xaml
similarity index 100%
rename from src/VisualStudio/LanguageService/DocumentOutline/DocumentOutlineControl.xaml
rename to src/VisualStudio/LanguageService/Controls/DocumentOutlineControl.xaml
diff --git a/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml b/src/VisualStudio/LanguageService/Controls/GotoDefinitionResultsWindow.xaml
similarity index 92%
rename from src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml
rename to src/VisualStudio/LanguageService/Controls/GotoDefinitionResultsWindow.xaml
index 0cb5eba492..36b253f5d2 100644
--- a/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml
+++ b/src/VisualStudio/LanguageService/Controls/GotoDefinitionResultsWindow.xaml
@@ -11,6 +11,10 @@
ResizeMode="CanResize"
WindowStartupLocation="Manual">
+
+
+
+
diff --git a/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml.cs b/src/VisualStudio/LanguageService/Controls/GotoDefinitionResultsWindow.xaml.cs
similarity index 95%
rename from src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml.cs
rename to src/VisualStudio/LanguageService/Controls/GotoDefinitionResultsWindow.xaml.cs
index 465effc770..3ab01f6156 100644
--- a/src/VisualStudio/LanguageService/Commands/GotoDefinitionResultsWindow.xaml.cs
+++ b/src/VisualStudio/LanguageService/Controls/GotoDefinitionResultsWindow.xaml.cs
@@ -3,6 +3,8 @@
// See License.txt in the project root for license information.
//
using Community.VisualStudio.Toolkit;
+
+using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Text.Editor;
using System;
using System.Collections.Generic;
@@ -17,7 +19,7 @@ namespace XSharp.LanguageService
/// Floating tool window shown when Goto Definition finds multiple locations.
/// Double-clicking an item (or pressing Enter) navigates to that location and closes the window.
///
- internal partial class GotoDefinitionResultsWindow : Window
+ partial class GotoDefinitionResultsWindow : Window
{
private readonly ITextView _textView;
private readonly CompletionState _state;
@@ -113,5 +115,6 @@ internal GotoDefinitionResultItem(IXSymbol symbol)
DisplayName = symbol.FullName;
Location = symbol.Location;
}
+ public override string ToString() => DisplayName + " (" + Location + ")";
}
}
diff --git a/src/VisualStudio/LanguageService/LanguageService2022.csproj b/src/VisualStudio/LanguageService/LanguageService2022.csproj
index 6c5f8b3094..318c015270 100644
--- a/src/VisualStudio/LanguageService/LanguageService2022.csproj
+++ b/src/VisualStudio/LanguageService/LanguageService2022.csproj
@@ -63,7 +63,7 @@
-
+
GotoDefinitionResultsWindow.xaml
Code
@@ -225,7 +225,7 @@
-
+
DocumentOutlineControl.xaml
Code
@@ -355,15 +355,15 @@
- DocumentOutline\VsThemeDictionary.xaml
+ Controls\VsThemeDictionary.xaml
MSBuild:Compile
Designer
-
+
MSBuild:Compile
Designer
-
+
MSBuild:Compile
Designer
diff --git a/src/VisualStudio/LanguageService/Lookup/XSharpLookup.cs b/src/VisualStudio/LanguageService/Lookup/XSharpLookup.cs
index 8ab4a49cb3..9dabb5e578 100644
--- a/src/VisualStudio/LanguageService/Lookup/XSharpLookup.cs
+++ b/src/VisualStudio/LanguageService/Lookup/XSharpLookup.cs
@@ -14,6 +14,7 @@
using XSharpModel;
using XSharp.Settings;
using XSharp.Support;
+using System.Windows.Controls;
namespace XSharp.LanguageService
{
internal static class XSharpLookup
@@ -1140,10 +1141,22 @@ enum PPUDCType : byte
if (result.Count == 0 && symbols.Count > 0)
{
result.Add(symbols.Pop());
- if (result[0] is IXMemberSymbol xmember && xmember.ParentType != null && xmember.ParentType.IsGeneric && symbols.Count > 0)
+ if (result[0] is IXMemberSymbol xmember)
{
- result.Clear();
- result.Add(AdjustGenericMember(xmember, symbols.Peek()));
+ if (xmember.ParentType != null && xmember.ParentType.IsGeneric && symbols.Count > 0)
+ {
+ result.Clear();
+ result.Add(AdjustGenericMember(xmember, symbols.Peek()));
+ }
+ else
+ {
+ var overloads = xmember.GetOverloads();
+ if (overloads.Length > 1)
+ {
+ result.Clear();
+ result.AddRange(overloads);
+ }
+ }
}
}
if (result.Count > 0 && result[0] is IXTypeSymbol xtype && state == CompletionState.Constructors)
@@ -2004,10 +2017,10 @@ private static IList SearchFunction(XSharpSearchLocation locatio
return result;
}
WriteOutputMessage($" SearchFunction {location.File.SourcePath}, '{name}' ");
- IXMemberSymbol xMethod = location.File.Project.FindFunction(name);
- if (xMethod != null)
+ var xMethods = location.File.Project.FindFunctions(name);
+ if (xMethods != null)
{
- result.Add(xMethod);
+ result.AddRange(xMethods);
}
else
{
diff --git a/src/VisualStudio/XSharpCodeModelXs/ProjectSystem/XProject.prg b/src/VisualStudio/XSharpCodeModelXs/ProjectSystem/XProject.prg
index ace26e04f2..c6d2536c84 100644
--- a/src/VisualStudio/XSharpCodeModelXs/ProjectSystem/XProject.prg
+++ b/src/VisualStudio/XSharpCodeModelXs/ProjectSystem/XProject.prg
@@ -12,7 +12,7 @@ USING LanguageService.CodeAnalysis.XSharp
USING System.Collections.Concurrent
USING System.Reflection
USING XSharp.Settings
-
+USING System.Linq
#pragma options ("az", ON)
NAMESPACE XSharpModel
@@ -803,8 +803,10 @@ CLASS XProject
SELF:LogTypeMessage(i"FindFunctionsLike {name}, found {result.Count} occurences")
RETURN result
-
METHOD FindFunction(name AS STRING, lRecursive := TRUE AS LOGIC) AS IXMemberSymbol
+ var members := SELF:FindFunctions(name, lRecursive)
+ return members:FirstOrDefault()
+ METHOD FindFunctions(name AS STRING, lRecursive := TRUE AS LOGIC) AS IList
// we look in the project references and assembly references
// pass the list of ProjectIds and AssemblyIds to the database engine
SELF:LogTypeMessage(ie"FindFunction {name} ")
@@ -814,9 +816,9 @@ CLASS XProject
projectIds := SELF:DependentProjectList
ENDIF
VAR result := XDatabase.FindFunction(name, projectIds)
- VAR xmember := SELF:GetGlobalMember(result)
- SELF:LogTypeMessage(ie"FindFunction {name}, result {iif (xmember != NULL, xmember.FullName, \"not found\")} ")
- RETURN xmember
+ VAR xmembers := SELF:GetGlobalMembers(result)
+ SELF:LogTypeMessage(ie"FindFunction {name}, result {result:Count} ")
+ RETURN xmembers
METHOD FindGlobalOrDefine(name AS STRING, lRecursive := TRUE AS LOGIC) AS IXMemberSymbol
// we look in the project references and assembly references
@@ -832,6 +834,9 @@ CLASS XProject
RETURN xmember
PRIVATE METHOD GetGlobalMember(result AS IList) AS IXMemberSymbol
+ var members := SELF:GetGlobalMembers(result)
+ return iif(members?:Count() > 0, members[0], NULL)
+ PRIVATE METHOD GetGlobalMembers(result AS IList) AS List
IF result:Count > 0
// Get the source code and parse it into a member
// we know that it will be of the globals class
@@ -872,7 +877,7 @@ CLASS XProject
ENDIF
NEXT
parentType:SetMembers(entities)
- RETURN first
+ RETURN entities:ToList()
ENDIF
RETURN NULL
From a8307e8bf360d851d4ad2007e45e863b5925fb9e Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sat, 2 May 2026 10:20:52 +0000
Subject: [PATCH 06/11] Replace ImageList glyphs with KnownMonikers in
DocumentOutlineControl; use CrispImage for tree icons
Agent-Logs-Url: https://github.com/X-Sharp/XSharpPublic/sessions/66420f9b-d1a6-4c04-8928-fc5f4ebe4705
Co-authored-by: RobertvanderHulst <14240939+RobertvanderHulst@users.noreply.github.com>
---
.../Controls/DocumentOutlineControl.cs | 236 +++++++++++-------
1 file changed, 148 insertions(+), 88 deletions(-)
diff --git a/src/VisualStudio/LanguageService/Controls/DocumentOutlineControl.cs b/src/VisualStudio/LanguageService/Controls/DocumentOutlineControl.cs
index 581429b738..2f3985d1da 100644
--- a/src/VisualStudio/LanguageService/Controls/DocumentOutlineControl.cs
+++ b/src/VisualStudio/LanguageService/Controls/DocumentOutlineControl.cs
@@ -3,17 +3,13 @@
// See License.txt in the project root for license information.
//
using Community.VisualStudio.Toolkit;
-
+using Microsoft.VisualStudio.Imaging;
+using Microsoft.VisualStudio.Imaging.Interop;
using Microsoft.VisualStudio.Shell;
-
using System;
using System.Collections.Generic;
-using System.Data.Common;
-using System.IO;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
using Microsoft.VisualStudio.TextManager.Interop;
using XSharpModel;
@@ -33,33 +29,6 @@ sealed partial class DocumentOutlineControl : UserControl
private bool _navigating; // reentrancy guard
private bool _sortByName; // false = sort by document order (default)
- // -----------------------------------------------------------------------
- // Image source cache: maps glyph index -> ImageSource
- // -----------------------------------------------------------------------
- private static readonly Dictionary _glyphCache = new Dictionary();
- private static System.Windows.Forms.ImageList _imageList;
-
- static DocumentOutlineControl()
- {
- _imageList = new System.Windows.Forms.ImageList
- {
- ImageSize = new System.Drawing.Size(16, 16),
- TransparentColor = System.Drawing.Color.FromArgb(255, 0, 255)
- };
- try
- {
- Stream stream = typeof(Microsoft.VisualStudio.Package.LanguageService)
- .Assembly
- .GetManifestResourceStream("Resources.completionset.bmp");
- if (stream != null)
- _imageList.Images.AddStrip(new System.Drawing.Bitmap(stream));
- }
- catch (Exception)
- {
- // If images cannot be loaded the tree will still work without icons.
- }
- }
-
// -----------------------------------------------------------------------
// Construction
// -----------------------------------------------------------------------
@@ -155,7 +124,7 @@ private OutlineTreeNode CreateNode(XSourceEntity entity)
string label = entity.ComboPrototype;
if (string.IsNullOrEmpty(label))
label = entity.Name;
- return new OutlineTreeNode(entity, label, GetGlyphImage(entity.Glyph));
+ return new OutlineTreeNode(entity, label, GetMoniker(entity.Kind, entity.Visibility));
}
private void AddMemberNodes(OutlineTreeNode parentNode, XSourceTypeSymbol type)
@@ -210,45 +179,149 @@ private static void FindBestNode(OutlineTreeNode node, int line, ref OutlineTree
}
// -----------------------------------------------------------------------
- // Glyph -> ImageSource conversion
+ // Kind + Visibility -> ImageMoniker mapping
// -----------------------------------------------------------------------
- private static ImageSource GetGlyphImage(int glyphIndex)
- {
- if (_imageList == null || glyphIndex < 0 || glyphIndex >= _imageList.Images.Count)
- return null;
-
- if (_glyphCache.TryGetValue(glyphIndex, out var cached))
- return cached;
- var bmp = _imageList.Images[glyphIndex] as System.Drawing.Bitmap;
- if (bmp == null)
- return null;
-
- ImageSource source;
- try
+ ///
+ /// Returns the from that best
+ /// represents the given entity and .
+ ///
+ private static ImageMoniker GetMoniker(Kind kind, Modifiers visibility)
+ {
+ switch (kind)
{
- var handle = bmp.GetHbitmap();
- try
- {
- source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
- handle,
- IntPtr.Zero,
- Int32Rect.Empty,
- BitmapSizeOptions.FromEmptyOptions());
- source.Freeze();
- }
- finally
- {
- NativeMethods.DeleteObject(handle);
- }
+ case Kind.Class:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.ClassPublic, KnownMonikers.ClassProtected,
+ KnownMonikers.ClassPrivate, KnownMonikers.ClassInternal);
+
+ case Kind.Structure:
+ case Kind.VOStruct:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.ValueTypePublic, KnownMonikers.ValueTypeProtected,
+ KnownMonikers.ValueTypePrivate, KnownMonikers.ValueTypeInternal);
+
+ case Kind.Interface:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.InterfacePublic, KnownMonikers.InterfaceProtected,
+ KnownMonikers.InterfacePrivate, KnownMonikers.InterfaceInternal);
+
+ case Kind.Delegate:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.DelegatePublic, KnownMonikers.DelegateProtected,
+ KnownMonikers.DelegatePrivate, KnownMonikers.DelegateInternal);
+
+ case Kind.Enum:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.EnumerationPublic, KnownMonikers.EnumerationProtected,
+ KnownMonikers.EnumerationPrivate, KnownMonikers.EnumerationInternal);
+
+ case Kind.EnumMember:
+ return KnownMonikers.EnumerationItemPublic;
+
+ case Kind.Constructor:
+ case Kind.Destructor:
+ case Kind.Method:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.MethodPublic, KnownMonikers.MethodProtected,
+ KnownMonikers.MethodPrivate, KnownMonikers.MethodInternal);
+
+ case Kind.Function:
+ case Kind.Procedure:
+ case Kind.LocalFunc:
+ case Kind.LocalProc:
+ // Global/module-level routines have no class visibility
+ return KnownMonikers.MethodPublic;
+
+ case Kind.Access:
+ case Kind.Assign:
+ case Kind.Property:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.PropertyPublic, KnownMonikers.PropertyProtected,
+ KnownMonikers.PropertyPrivate, KnownMonikers.PropertyInternal);
+
+ case Kind.Event:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.EventPublic, KnownMonikers.EventProtected,
+ KnownMonikers.EventPrivate, KnownMonikers.EventInternal);
+
+ case Kind.Field:
+ case Kind.VOGlobal:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.FieldPublic, KnownMonikers.FieldProtected,
+ KnownMonikers.FieldPrivate, KnownMonikers.FieldInternal);
+
+ case Kind.Operator:
+ return KnownMonikers.Operator;
+
+ case Kind.Namespace:
+ return KnownMonikers.Namespace;
+
+ case Kind.Union:
+ return KnownMonikers.Union;
+
+ case Kind.VODefine:
+ case Kind.Define:
+ case Kind.Undefine:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.ConstantPublic, KnownMonikers.ConstantProtected,
+ KnownMonikers.ConstantPrivate, KnownMonikers.ConstantInternal);
+
+ case Kind.Command:
+ case Kind.XCommand:
+ case Kind.YCommand:
+ case Kind.Translate:
+ case Kind.XTranslate:
+ case Kind.YTranslate:
+ return KnownMonikers.MacroPublic;
+
+ case Kind.Include:
+ return KnownMonikers.Library;
+
+ case Kind.Keyword:
+ return KnownMonikers.IntellisenseKeyword;
+
+ case Kind.Attribute:
+ return KnownMonikers.Attribute;
+
+ case Kind.TypeParameter:
+ return KnownMonikers.Type;
+
+ case Kind.Local:
+ case Kind.Parameter:
+ case Kind.MemVar:
+ case Kind.DbField:
+ case Kind.Undeclared:
+ return KnownMonikers.LocalVariable;
+
+ default:
+ return KnownMonikers.Item;
}
- catch (Exception)
+ }
+
+ ///
+ /// Picks one of four visibility-specific monikers based on .
+ /// maps to the
+ /// because that is the closest visual equivalent available in the catalog.
+ /// Any other value (including and )
+ /// returns .
+ ///
+ private static ImageMoniker VisibilityMoniker(Modifiers visibility,
+ ImageMoniker publicMoniker, ImageMoniker protectedMoniker,
+ ImageMoniker privateMoniker, ImageMoniker internalMoniker)
+ {
+ switch (visibility)
{
- return null;
+ case Modifiers.Protected:
+ case Modifiers.ProtectedInternal:
+ return protectedMoniker;
+ case Modifiers.Private:
+ return privateMoniker;
+ case Modifiers.Internal:
+ return internalMoniker;
+ default:
+ return publicMoniker;
}
-
- _glyphCache[glyphIndex] = source;
- return source;
}
// -----------------------------------------------------------------------
@@ -376,22 +449,19 @@ internal sealed class OutlineTreeNode : TreeViewItem
{
public XSourceEntity Entity { get; }
- public OutlineTreeNode(XSourceEntity entity, string label, ImageSource icon)
+ public OutlineTreeNode(XSourceEntity entity, string label, ImageMoniker moniker)
{
Entity = entity;
var panel = new StackPanel { Orientation = Orientation.Horizontal };
- if (icon != null)
+ panel.Children.Add(new CrispImage
{
- panel.Children.Add(new System.Windows.Controls.Image
- {
- Source = icon,
- Width = 16,
- Height = 16,
- Margin = new Thickness(0, 0, 4, 0),
- VerticalAlignment = VerticalAlignment.Center
- });
- }
+ Moniker = moniker,
+ Width = 16,
+ Height = 16,
+ Margin = new Thickness(0, 0, 4, 0),
+ VerticalAlignment = VerticalAlignment.Center
+ });
panel.Children.Add(new TextBlock
{
Text = label,
@@ -401,15 +471,5 @@ public OutlineTreeNode(XSourceEntity entity, string label, ImageSource icon)
Header = panel;
}
}
-
- // ---------------------------------------------------------------------------
- // P/Invoke helper for bitmap conversion
- // ---------------------------------------------------------------------------
- internal static class NativeMethods
- {
- [System.Runtime.InteropServices.DllImport("gdi32.dll")]
- [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)]
- internal static extern bool DeleteObject(IntPtr hObject);
- }
}
From 31d1d6f9ac8f45dd00a9955bee9f4776adad28a8 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sat, 2 May 2026 10:37:05 +0000
Subject: [PATCH 07/11] Extract GetImageMoniker extension method; use it in
DocumentOutlineControl and AnalysisClasses
Agent-Logs-Url: https://github.com/X-Sharp/XSharpPublic/sessions/e07732be-3319-43f9-a8b3-753229c8a572
Co-authored-by: RobertvanderHulst <14240939+RobertvanderHulst@users.noreply.github.com>
---
.../Controls/DocumentOutlineControl.cs | 149 +---------------
.../Controls/KindExtensions.cs | 160 ++++++++++++++++++
.../LanguageService/LanguageService.csproj | 1 +
.../LanguageService2022.csproj | 1 +
.../LanguageService/Lookup/AnalysisClasses.cs | 31 +---
5 files changed, 164 insertions(+), 178 deletions(-)
create mode 100644 src/VisualStudio/LanguageService/Controls/KindExtensions.cs
diff --git a/src/VisualStudio/LanguageService/Controls/DocumentOutlineControl.cs b/src/VisualStudio/LanguageService/Controls/DocumentOutlineControl.cs
index 2f3985d1da..54713d84b0 100644
--- a/src/VisualStudio/LanguageService/Controls/DocumentOutlineControl.cs
+++ b/src/VisualStudio/LanguageService/Controls/DocumentOutlineControl.cs
@@ -3,7 +3,6 @@
// See License.txt in the project root for license information.
//
using Community.VisualStudio.Toolkit;
-using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.Imaging.Interop;
using Microsoft.VisualStudio.Shell;
using System;
@@ -124,7 +123,7 @@ private OutlineTreeNode CreateNode(XSourceEntity entity)
string label = entity.ComboPrototype;
if (string.IsNullOrEmpty(label))
label = entity.Name;
- return new OutlineTreeNode(entity, label, GetMoniker(entity.Kind, entity.Visibility));
+ return new OutlineTreeNode(entity, label, entity.Kind.GetImageMoniker(entity.Visibility));
}
private void AddMemberNodes(OutlineTreeNode parentNode, XSourceTypeSymbol type)
@@ -178,152 +177,6 @@ private static void FindBestNode(OutlineTreeNode node, int line, ref OutlineTree
FindBestNode(child, line, ref best, ref bestLength);
}
- // -----------------------------------------------------------------------
- // Kind + Visibility -> ImageMoniker mapping
- // -----------------------------------------------------------------------
-
- ///
- /// Returns the from that best
- /// represents the given entity and .
- ///
- private static ImageMoniker GetMoniker(Kind kind, Modifiers visibility)
- {
- switch (kind)
- {
- case Kind.Class:
- return VisibilityMoniker(visibility,
- KnownMonikers.ClassPublic, KnownMonikers.ClassProtected,
- KnownMonikers.ClassPrivate, KnownMonikers.ClassInternal);
-
- case Kind.Structure:
- case Kind.VOStruct:
- return VisibilityMoniker(visibility,
- KnownMonikers.ValueTypePublic, KnownMonikers.ValueTypeProtected,
- KnownMonikers.ValueTypePrivate, KnownMonikers.ValueTypeInternal);
-
- case Kind.Interface:
- return VisibilityMoniker(visibility,
- KnownMonikers.InterfacePublic, KnownMonikers.InterfaceProtected,
- KnownMonikers.InterfacePrivate, KnownMonikers.InterfaceInternal);
-
- case Kind.Delegate:
- return VisibilityMoniker(visibility,
- KnownMonikers.DelegatePublic, KnownMonikers.DelegateProtected,
- KnownMonikers.DelegatePrivate, KnownMonikers.DelegateInternal);
-
- case Kind.Enum:
- return VisibilityMoniker(visibility,
- KnownMonikers.EnumerationPublic, KnownMonikers.EnumerationProtected,
- KnownMonikers.EnumerationPrivate, KnownMonikers.EnumerationInternal);
-
- case Kind.EnumMember:
- return KnownMonikers.EnumerationItemPublic;
-
- case Kind.Constructor:
- case Kind.Destructor:
- case Kind.Method:
- return VisibilityMoniker(visibility,
- KnownMonikers.MethodPublic, KnownMonikers.MethodProtected,
- KnownMonikers.MethodPrivate, KnownMonikers.MethodInternal);
-
- case Kind.Function:
- case Kind.Procedure:
- case Kind.LocalFunc:
- case Kind.LocalProc:
- // Global/module-level routines have no class visibility
- return KnownMonikers.MethodPublic;
-
- case Kind.Access:
- case Kind.Assign:
- case Kind.Property:
- return VisibilityMoniker(visibility,
- KnownMonikers.PropertyPublic, KnownMonikers.PropertyProtected,
- KnownMonikers.PropertyPrivate, KnownMonikers.PropertyInternal);
-
- case Kind.Event:
- return VisibilityMoniker(visibility,
- KnownMonikers.EventPublic, KnownMonikers.EventProtected,
- KnownMonikers.EventPrivate, KnownMonikers.EventInternal);
-
- case Kind.Field:
- case Kind.VOGlobal:
- return VisibilityMoniker(visibility,
- KnownMonikers.FieldPublic, KnownMonikers.FieldProtected,
- KnownMonikers.FieldPrivate, KnownMonikers.FieldInternal);
-
- case Kind.Operator:
- return KnownMonikers.Operator;
-
- case Kind.Namespace:
- return KnownMonikers.Namespace;
-
- case Kind.Union:
- return KnownMonikers.Union;
-
- case Kind.VODefine:
- case Kind.Define:
- case Kind.Undefine:
- return VisibilityMoniker(visibility,
- KnownMonikers.ConstantPublic, KnownMonikers.ConstantProtected,
- KnownMonikers.ConstantPrivate, KnownMonikers.ConstantInternal);
-
- case Kind.Command:
- case Kind.XCommand:
- case Kind.YCommand:
- case Kind.Translate:
- case Kind.XTranslate:
- case Kind.YTranslate:
- return KnownMonikers.MacroPublic;
-
- case Kind.Include:
- return KnownMonikers.Library;
-
- case Kind.Keyword:
- return KnownMonikers.IntellisenseKeyword;
-
- case Kind.Attribute:
- return KnownMonikers.Attribute;
-
- case Kind.TypeParameter:
- return KnownMonikers.Type;
-
- case Kind.Local:
- case Kind.Parameter:
- case Kind.MemVar:
- case Kind.DbField:
- case Kind.Undeclared:
- return KnownMonikers.LocalVariable;
-
- default:
- return KnownMonikers.Item;
- }
- }
-
- ///
- /// Picks one of four visibility-specific monikers based on .
- /// maps to the
- /// because that is the closest visual equivalent available in the catalog.
- /// Any other value (including and )
- /// returns .
- ///
- private static ImageMoniker VisibilityMoniker(Modifiers visibility,
- ImageMoniker publicMoniker, ImageMoniker protectedMoniker,
- ImageMoniker privateMoniker, ImageMoniker internalMoniker)
- {
- switch (visibility)
- {
- case Modifiers.Protected:
- case Modifiers.ProtectedInternal:
- return protectedMoniker;
- case Modifiers.Private:
- return privateMoniker;
- case Modifiers.Internal:
- return internalMoniker;
- default:
- return publicMoniker;
- }
- }
-
// -----------------------------------------------------------------------
// Event handlers
// -----------------------------------------------------------------------
diff --git a/src/VisualStudio/LanguageService/Controls/KindExtensions.cs b/src/VisualStudio/LanguageService/Controls/KindExtensions.cs
new file mode 100644
index 0000000000..5c9ec6375d
--- /dev/null
+++ b/src/VisualStudio/LanguageService/Controls/KindExtensions.cs
@@ -0,0 +1,160 @@
+// Copyright (c) XSharp B.V. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0.
+// See License.txt in the project root for license information.
+//
+using Microsoft.VisualStudio.Imaging;
+using Microsoft.VisualStudio.Imaging.Interop;
+using XSharpModel;
+
+namespace XSharp.LanguageService
+{
+ ///
+ /// Extension methods on that map an entity kind and visibility
+ /// to the appropriate from the VS catalog.
+ ///
+ internal static class KindExtensions
+ {
+ ///
+ /// Returns the from that best
+ /// represents the given and .
+ ///
+ internal static ImageMoniker GetImageMoniker(this Kind kind, Modifiers visibility)
+ {
+ switch (kind)
+ {
+ case Kind.Class:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.ClassPublic, KnownMonikers.ClassProtected,
+ KnownMonikers.ClassPrivate, KnownMonikers.ClassInternal);
+
+ case Kind.Structure:
+ case Kind.VOStruct:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.ValueTypePublic, KnownMonikers.ValueTypeProtected,
+ KnownMonikers.ValueTypePrivate, KnownMonikers.ValueTypeInternal);
+
+ case Kind.Interface:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.InterfacePublic, KnownMonikers.InterfaceProtected,
+ KnownMonikers.InterfacePrivate, KnownMonikers.InterfaceInternal);
+
+ case Kind.Delegate:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.DelegatePublic, KnownMonikers.DelegateProtected,
+ KnownMonikers.DelegatePrivate, KnownMonikers.DelegateInternal);
+
+ case Kind.Enum:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.EnumerationPublic, KnownMonikers.EnumerationProtected,
+ KnownMonikers.EnumerationPrivate, KnownMonikers.EnumerationInternal);
+
+ case Kind.EnumMember:
+ return KnownMonikers.EnumerationItemPublic;
+
+ case Kind.Constructor:
+ case Kind.Destructor:
+ case Kind.Method:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.MethodPublic, KnownMonikers.MethodProtected,
+ KnownMonikers.MethodPrivate, KnownMonikers.MethodInternal);
+
+ case Kind.Function:
+ case Kind.Procedure:
+ case Kind.LocalFunc:
+ case Kind.LocalProc:
+ // Global/module-level routines have no class visibility
+ return KnownMonikers.MethodPublic;
+
+ case Kind.Access:
+ case Kind.Assign:
+ case Kind.Property:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.PropertyPublic, KnownMonikers.PropertyProtected,
+ KnownMonikers.PropertyPrivate, KnownMonikers.PropertyInternal);
+
+ case Kind.Event:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.EventPublic, KnownMonikers.EventProtected,
+ KnownMonikers.EventPrivate, KnownMonikers.EventInternal);
+
+ case Kind.Field:
+ case Kind.VOGlobal:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.FieldPublic, KnownMonikers.FieldProtected,
+ KnownMonikers.FieldPrivate, KnownMonikers.FieldInternal);
+
+ case Kind.Operator:
+ return KnownMonikers.Operator;
+
+ case Kind.Namespace:
+ case Kind.Using:
+ return KnownMonikers.Namespace;
+
+ case Kind.Union:
+ return KnownMonikers.Union;
+
+ case Kind.VODefine:
+ case Kind.Define:
+ case Kind.Undefine:
+ return VisibilityMoniker(visibility,
+ KnownMonikers.ConstantPublic, KnownMonikers.ConstantProtected,
+ KnownMonikers.ConstantPrivate, KnownMonikers.ConstantInternal);
+
+ case Kind.Command:
+ case Kind.XCommand:
+ case Kind.YCommand:
+ case Kind.Translate:
+ case Kind.XTranslate:
+ case Kind.YTranslate:
+ return KnownMonikers.MacroPublic;
+
+ case Kind.Include:
+ return KnownMonikers.Library;
+
+ case Kind.Keyword:
+ return KnownMonikers.IntellisenseKeyword;
+
+ case Kind.Attribute:
+ return KnownMonikers.Attribute;
+
+ case Kind.TypeParameter:
+ return KnownMonikers.Type;
+
+ case Kind.Local:
+ case Kind.Parameter:
+ case Kind.MemVar:
+ case Kind.DbField:
+ case Kind.Undeclared:
+ return KnownMonikers.LocalVariable;
+
+ default:
+ return KnownMonikers.Item;
+ }
+ }
+
+ ///
+ /// Picks one of four visibility-specific monikers based on .
+ /// maps to the
+ /// because that is the closest visual equivalent available in the catalog.
+ /// Any other value (including and )
+ /// returns .
+ ///
+ private static ImageMoniker VisibilityMoniker(Modifiers visibility,
+ ImageMoniker publicMoniker, ImageMoniker protectedMoniker,
+ ImageMoniker privateMoniker, ImageMoniker internalMoniker)
+ {
+ switch (visibility)
+ {
+ case Modifiers.Protected:
+ case Modifiers.ProtectedInternal:
+ return protectedMoniker;
+ case Modifiers.Private:
+ return privateMoniker;
+ case Modifiers.Internal:
+ return internalMoniker;
+ default:
+ return publicMoniker;
+ }
+ }
+ }
+}
diff --git a/src/VisualStudio/LanguageService/LanguageService.csproj b/src/VisualStudio/LanguageService/LanguageService.csproj
index 11f1eacde1..57795561d4 100644
--- a/src/VisualStudio/LanguageService/LanguageService.csproj
+++ b/src/VisualStudio/LanguageService/LanguageService.csproj
@@ -224,6 +224,7 @@
+
DocumentOutlineControl.xaml
Code
diff --git a/src/VisualStudio/LanguageService/LanguageService2022.csproj b/src/VisualStudio/LanguageService/LanguageService2022.csproj
index 318c015270..764f73710e 100644
--- a/src/VisualStudio/LanguageService/LanguageService2022.csproj
+++ b/src/VisualStudio/LanguageService/LanguageService2022.csproj
@@ -225,6 +225,7 @@
+
DocumentOutlineControl.xaml
Code
diff --git a/src/VisualStudio/LanguageService/Lookup/AnalysisClasses.cs b/src/VisualStudio/LanguageService/Lookup/AnalysisClasses.cs
index 821e774fc4..d72125e0e4 100644
--- a/src/VisualStudio/LanguageService/Lookup/AnalysisClasses.cs
+++ b/src/VisualStudio/LanguageService/Lookup/AnalysisClasses.cs
@@ -4,7 +4,6 @@
// See License.txt in the project root for license information.
//
-using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.Imaging.Interop;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text.Adornments;
@@ -26,35 +25,7 @@ internal XAnalysis(IXSymbol sym)
symbol = sym;
Name = sym.FullName;
}
- internal ImageMoniker Image
- {
- get
- {
- switch (symbol.Kind)
- {
- case Kind.Class:
- return KnownMonikers.Class;
- case Kind.Structure:
- return KnownMonikers.Structure;
- case Kind.Interface:
- return KnownMonikers.Interface;
- case Kind.Delegate:
- return KnownMonikers.Delegate;
- case Kind.Enum:
- return KnownMonikers.Enumeration;
- case Kind.VOStruct:
- return KnownMonikers.ValueType;
- case Kind.Union:
- return KnownMonikers.Union;
- case Kind.Using:
- case Kind.Namespace:
- return KnownMonikers.Namespace;
- case Kind.Keyword:
- return KnownMonikers.IntellisenseKeyword;
- }
- return KnownMonikers.None;
- }
- }
+ internal ImageMoniker Image => symbol.Kind.GetImageMoniker(symbol.Visibility);
public string Prototype => Name;
public virtual ClassifiedTextRun[] WPFDescription
From 6ae0401c14e4a18f33f0ef0b3ed5ce22559cd902 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sat, 2 May 2026 13:12:53 +0000
Subject: [PATCH 08/11] Migrate DropDownClient and CompletionHelpers to use
GetImageMoniker extension method
Agent-Logs-Url: https://github.com/X-Sharp/XSharpPublic/sessions/5a7c76a7-f084-4a3c-ab78-99f4cac72825
Co-authored-by: RobertvanderHulst <14240939+RobertvanderHulst@users.noreply.github.com>
---
.../Completion/CompletionHelpers.cs | 33 ++++-----
.../Completion/XSharpCompletionSource.cs | 2 +-
.../XSharpCompletionSourceProvider.cs | 4 -
.../Controls/KindExtensions.cs | 33 +++++++++
.../LanguageService/Generic/DropDownClient.cs | 73 +++++++------------
5 files changed, 77 insertions(+), 68 deletions(-)
diff --git a/src/VisualStudio/LanguageService/Completion/CompletionHelpers.cs b/src/VisualStudio/LanguageService/Completion/CompletionHelpers.cs
index 550867eb02..6812dabc26 100644
--- a/src/VisualStudio/LanguageService/Completion/CompletionHelpers.cs
+++ b/src/VisualStudio/LanguageService/Completion/CompletionHelpers.cs
@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using XSharpModel;
@@ -19,14 +20,12 @@ namespace XSharp.LanguageService
{
internal class CompletionHelpers
{
- internal IGlyphService _glyphService = null;
private XDialect _dialect;
private XFile _file;
private bool _settingIgnoreCase;
- internal CompletionHelpers(XDialect dialect, IGlyphService glyphService, XFile file, bool ignoreCase)
+ internal CompletionHelpers(XDialect dialect, XFile file, bool ignoreCase)
{
_dialect = dialect;
- _glyphService = glyphService;
_file = file;
_settingIgnoreCase = ignoreCase;
}
@@ -94,7 +93,7 @@ internal void AddPETypeNamesLike(XCompletionList compList, XSharpSearchLocation
continue;
var typeAnalysis = new XTypeAnalysis(type);
- ImageSource icon = _glyphService.GetGlyph(type.getGlyphGroup(), type.getGlyphItem());
+ ImageSource icon = type.Kind.GetImageMoniker(type.Visibility).GetImageSource();
if (!compList.Add(new XSCompletion(displayName, displayName, typeAnalysis.Prototype, icon, null, Kind.Class, "")))
break;
}
@@ -120,7 +119,7 @@ internal void AddSourceTypeNamesLike(XCompletionList compList, XSharpSearchLocat
continue;
var typeAnalysis = new XTypeAnalysis(type);
- ImageSource icon = _glyphService.GetGlyph(type.getGlyphGroup(), type.getGlyphItem());
+ ImageSource icon = type.Kind.GetImageMoniker(type.Visibility).GetImageSource();
if (!compList.Add(new XSCompletion(displayName, displayName, typeAnalysis.Prototype, icon, null, Kind.Class, "")))
break;
}
@@ -182,7 +181,7 @@ internal void AddXSharpKeywordsLike(XCompletionList compList, string startWith)
{
foreach (var kw in XSharpSyntax.GetKeywords().Where(ti => nameStartsWith(ti.Name, startWith)))
{
- ImageSource icon = _glyphService.GetGlyph(kw.getGlyphGroup(), kw.getGlyphItem());
+ ImageSource icon = kw.Kind.GetImageMoniker(kw.Visibility).GetImageSource();
var item = new XSCompletion(kw.Name, kw.Name, kw.Prototype, icon, null, Kind.Keyword, "");
compList.Add(item);
}
@@ -192,7 +191,7 @@ internal void AddSnippets(XCompletionList compList, string startWith)
var snippets = SnippetHelpers.FindSnippets(startWith);
foreach (var snippet in snippets)
{
- ImageSource icon = _glyphService.GetGlyph(StandardGlyphGroup.GlyphCSharpExpansion, StandardGlyphItem.GlyphItemPublic);
+ ImageSource icon = KnownMonikers.Snippet.GetImageSource();
var item = new XSCompletion(snippet.title, "", snippet.description, icon, null, Kind.Snippet, snippet.shortcut);
item.Properties.AddProperty(typeof(VsExpansion), snippet);
compList.Add(item,false, true);
@@ -210,7 +209,7 @@ internal void AddXSharpTypeNamesLike(XCompletionList compList, XSharpSearchLocat
continue;
// Then remove it
- ImageSource icon = _glyphService.GetGlyph(typeInfo.getGlyphGroup(), typeInfo.getGlyphItem());
+ ImageSource icon = typeInfo.Kind.GetImageMoniker(typeInfo.Visibility).GetImageSource();
if (!compList.Add(new XSCompletion(typeInfo.Name, typeInfo.Name, typeInfo.FullName, icon, null, typeInfo.Kind, "")))
break;
}
@@ -237,7 +236,7 @@ internal void AddXSharpKeywordTypeNamesLike(XCompletionList compList, string sta
// Then remove it
if (dotPos > 0)
realTypeName = realTypeName.Substring(0, dotPos);
- ImageSource icon = _glyphService.GetGlyph(typeInfo.getGlyphGroup(), typeInfo.getGlyphItem());
+ ImageSource icon = typeInfo.Kind.GetImageMoniker(typeInfo.Visibility).GetImageSource();
if (!compList.Add(new XSCompletion(realTypeName, realTypeName, typeInfo.Prototype, icon, null, Kind.Class, "")))
break;
}
@@ -334,8 +333,8 @@ internal void AddNamespacesLike(XCompletionList compList, XSharpSearchLocation l
int dotPos = startWith.LastIndexOf('.');
if (dotPos != -1)
startLen = dotPos + 1;
- ImageSource icon = _glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupNamespace, StandardGlyphItem.GlyphItemPublic);
- ImageSource iconClass = _glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupClass, StandardGlyphItem.GlyphItemPublic);
+ ImageSource icon = KnownMonikers.Namespace.GetImageSource();
+ ImageSource iconClass = KnownMonikers.ClassPublic.GetImageSource();
foreach (string nameSpace in namespaces.Where(ns => nameStartsWith(ns, startWith)))
{
string displayName = nameSpace;
@@ -408,7 +407,7 @@ internal void AddGenericLocalsLike(XCompletionList compList, XSharpSearchLocatio
// First, look after Parameters
foreach (var paramVar in location.Member.Parameters.Where(p => nameStartsWith(p.Name, startWith)))
{
- ImageSource icon = _glyphService.GetGlyph(paramVar.getGlyphGroup(), paramVar.getGlyphItem());
+ ImageSource icon = paramVar.Kind.GetImageMoniker(paramVar.Visibility).GetImageSource();
if (!compList.Add(new XSCompletion(paramVar.Name, paramVar.Name, paramVar.Prototype, icon, null, Kind.Parameter, "")))
break;
}
@@ -416,7 +415,7 @@ internal void AddGenericLocalsLike(XCompletionList compList, XSharpSearchLocatio
// line numbers in the range are 1 based. currentLine = 0 based !
foreach (var localVar in location.Member.GetLocals(location).Where(l => nameStartsWith(l.Name, startWith) && l.Range.StartLine <= location.LineNumber))
{
- ImageSource icon = _glyphService.GetGlyph(localVar.getGlyphGroup(), localVar.getGlyphItem());
+ ImageSource icon = localVar.Kind.GetImageMoniker(localVar.Visibility).GetImageSource();
if (!compList.Add(new XSCompletion(localVar.Name, localVar.Name, localVar.Prototype, icon, null, Kind.Local, "")))
break;
@@ -440,7 +439,7 @@ internal void AddGenericSelfMembersLike(XCompletionList compList, XSharpSearchLo
return;
foreach (var member in type.GetMembers(startWith))
{
- ImageSource icon = _glyphService.GetGlyph(member.getGlyphGroup(), member.getGlyphItem());
+ ImageSource icon = member.Kind.GetImageMoniker(member.Visibility).GetImageSource();
if (!compList.Add(new XSCompletion(member.Name, member.Name, member.Prototype, icon, null, Kind.Field, "")))
break;
}
@@ -465,7 +464,7 @@ internal void AddGenericInheritedMembersLike(XCompletionList compList, XSharpSea
return;
foreach (var member in baseType.GetMembers(startWith))
{
- ImageSource icon = _glyphService.GetGlyph(member.getGlyphGroup(), member.getGlyphItem());
+ ImageSource icon = member.Kind.GetImageMoniker(member.Visibility).GetImageSource();
if (!compList.Add(new XSCompletion(member.Name, member.Name, member.Prototype, icon, null, Kind.Field, "")))
break;
}
@@ -578,7 +577,7 @@ internal void FillEnumMembers(XSharpSearchLocation location, XCompletionList com
continue;
if (elt is XPESymbol peSym && peSym.IsSpecialName)
continue;
- ImageSource icon = _glyphService.GetGlyph(elt.getGlyphGroup(), elt.getGlyphItem());
+ ImageSource icon = elt.Kind.GetImageMoniker(elt.Visibility).GetImageSource();
if (!compList.Add(new XSCompletion(elt.Name, elt.Name, elt.Prototype, icon, null, elt.Kind, elt.Value)))
break;
}
@@ -638,7 +637,7 @@ internal void FillMembers(XSharpSearchLocation location, XCompletionList compLis
if (!add)
continue;
//
- ImageSource icon = _glyphService.GetGlyph(elt.getGlyphGroup(), elt.getGlyphItem());
+ ImageSource icon = elt.Kind.GetImageMoniker(elt.Visibility).GetImageSource();
string toAdd = AddOpenParen(elt.Kind);
if (!compList.Add(new XSCompletion(elt.Name, elt.Name + toAdd, elt.Prototype, icon, null, elt.Kind, elt.Value)))
break;
diff --git a/src/VisualStudio/LanguageService/Completion/XSharpCompletionSource.cs b/src/VisualStudio/LanguageService/Completion/XSharpCompletionSource.cs
index 45567b7310..cc903309a4 100644
--- a/src/VisualStudio/LanguageService/Completion/XSharpCompletionSource.cs
+++ b/src/VisualStudio/LanguageService/Completion/XSharpCompletionSource.cs
@@ -42,7 +42,7 @@ public XSharpCompletionSource(XSharpCompletionSourceProvider provider, ITextBuff
_file = file;
var prj = _file.Project.ProjectNode;
_dialect = _file.Project.Dialect;
- helpers = new CompletionHelpers(_dialect, provider.GlyphService, file, !prj.ParseOptions.CaseSensitive);
+ helpers = new CompletionHelpers(_dialect, file, !prj.ParseOptions.CaseSensitive);
this._tagAggregator = aggregator.CreateTagAggregator(_buffer);
}
diff --git a/src/VisualStudio/LanguageService/Completion/XSharpCompletionSourceProvider.cs b/src/VisualStudio/LanguageService/Completion/XSharpCompletionSourceProvider.cs
index 5e297fe8b9..5d7ecdeee8 100644
--- a/src/VisualStudio/LanguageService/Completion/XSharpCompletionSourceProvider.cs
+++ b/src/VisualStudio/LanguageService/Completion/XSharpCompletionSourceProvider.cs
@@ -12,7 +12,6 @@
using Microsoft.VisualStudio.Utilities;
using XSharpModel;
using Microsoft.VisualStudio.Shell;
-using System.Windows.Media;
using LanguageService.SyntaxTree;
using LanguageService.CodeAnalysis.XSharp.SyntaxParser;
using Microsoft.VisualStudio;
@@ -29,9 +28,6 @@ class XSharpCompletionSourceProvider : ICompletionSourceProvider
[Import]
internal SVsServiceProvider ServiceProvider = null;
- [Import]
- internal IGlyphService GlyphService = null;
-
[Import]
IBufferTagAggregatorFactoryService aggregator = null;
diff --git a/src/VisualStudio/LanguageService/Controls/KindExtensions.cs b/src/VisualStudio/LanguageService/Controls/KindExtensions.cs
index 5c9ec6375d..ec714ccd71 100644
--- a/src/VisualStudio/LanguageService/Controls/KindExtensions.cs
+++ b/src/VisualStudio/LanguageService/Controls/KindExtensions.cs
@@ -4,6 +4,11 @@
//
using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.Imaging.Interop;
+using Microsoft.VisualStudio.Shell;
+using Microsoft.VisualStudio.Shell.Interop;
+using System.Runtime.InteropServices;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
using XSharpModel;
namespace XSharp.LanguageService
@@ -156,5 +161,33 @@ private static ImageMoniker VisibilityMoniker(Modifiers visibility,
return publicMoniker;
}
}
+
+ ///
+ /// Converts an to a WPF at 16×16 logical pixels
+ /// using the VS image service. Returns null when the image service is unavailable.
+ ///
+ internal static ImageSource GetImageSource(this ImageMoniker moniker)
+ {
+ var imageService = Package.GetGlobalService(typeof(SVsImageService)) as IVsImageService2;
+ if (imageService == null)
+ return null;
+
+ var attributes = new ImageAttributes
+ {
+ StructSize = Marshal.SizeOf(typeof(ImageAttributes)),
+ ImageType = (uint)_UIImageType.IT_Bitmap,
+ Format = (uint)_UIDataFormat.DF_WPF,
+ LogicalWidth = 16,
+ LogicalHeight = 16,
+ Flags = (uint)_ImageAttributesFlags.IAF_RequiredFlags,
+ };
+
+ IVsUIObject uiObject = imageService.GetImage(moniker, attributes);
+ if (uiObject == null)
+ return null;
+
+ uiObject.get_Data(out object data);
+ return data as BitmapSource;
+ }
}
}
diff --git a/src/VisualStudio/LanguageService/Generic/DropDownClient.cs b/src/VisualStudio/LanguageService/Generic/DropDownClient.cs
index bdd856e6fc..5eba739fa8 100644
--- a/src/VisualStudio/LanguageService/Generic/DropDownClient.cs
+++ b/src/VisualStudio/LanguageService/Generic/DropDownClient.cs
@@ -1,18 +1,18 @@
using Microsoft.VisualStudio;
+using Microsoft.VisualStudio.Imaging;
+using Microsoft.VisualStudio.Imaging.Interop;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.TextManager.Interop;
using System;
using System.Collections.Generic;
using System.Diagnostics;
-using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using XSharpModel;
using File = System.IO.File;
-using MVP = Microsoft.VisualStudio.Package;
using Task = System.Threading.Tasks.Task;
using XSharp.Settings;
using XSharp.Support;
@@ -46,13 +46,12 @@ internal bool Changed
}
- public class XSharpDropDownClient : IVsDropdownBarClient
+ public class XSharpDropDownClient : IVsDropdownBarClient, IVsDropdownBarClient4
{
const int PROJECTINDEX = 0;
const int TYPEINDEX = 1;
const int MEMBERINDEX = 2;
- static readonly ImageList _imageList = new ImageList();
private IVsDropdownBar _dropDownBar;
readonly Dictionary _textViews;
ITextView _activeView = null;
@@ -74,7 +73,6 @@ public class XSharpDropDownClient : IVsDropdownBarClient
private DropdownSettings _settings;
private List _relatedFiles;
private DateTime _lastFileChanged = DateTime.MinValue;
- private static readonly int projectIcon = -1;
private XDocument _document;
XProject ActiveProject
{
@@ -88,20 +86,6 @@ XProject ActiveProject
}
}
- static XSharpDropDownClient()
- {
- // Load images from Microsoft and Our project system (linked resource file)
- Stream stream = typeof(MVP.LanguageService).Assembly.GetManifestResourceStream("Resources.completionset.bmp");
- _imageList.ImageSize = new Size(16, 16);
- _imageList.TransparentColor = Color.FromArgb(255, 0, 255);
- _imageList.Images.AddStrip(new Bitmap(stream));
- // the project Icon is the first in the ImageList from the project package
- projectIcon = _imageList.Images.Count;
- stream = typeof(XSharpDropDownClient).Assembly.GetManifestResourceStream("XSharp.LanguageService.Resources.XSharpProjectImageList.bmp");
- _imageList.Images.AddStrip(new Bitmap(stream));
- }
-
-
public XSharpDropDownClient(IVsDropdownBarManager manager, XFile file)
{
_manager = manager;
@@ -525,7 +509,7 @@ private void loadTypeCombos(int nLine)
{
name = "?";
}
- elt = new XDropDownMember(name, sp, eltType.Glyph, ft, eltType);
+ elt = new XDropDownMember(name, sp, eltType.Kind.GetImageMoniker(eltType.Visibility), ft, eltType);
nSelect = _types.Count;
_types.Add(elt);
if (eltType.Range.StartLine <= nLine && eltType.Range.EndLine >= nLine)
@@ -602,21 +586,21 @@ private void loadMemberCombos(int selectedType)
{
if (currentType.Kind != Kind.Delegate)
{
- elt = new XDropDownMember("(" + currentType.Name + ")", spM, currentType.Glyph, ft, currentType);
+ elt = new XDropDownMember("(" + currentType.Name + ")", spM, currentType.Kind.GetImageMoniker(currentType.Visibility), ft, currentType);
_members.Add(elt);
_addToDict(currentType);
}
}
else
{
- elt = new XDropDownMember(currentType.Name, spM, currentType.Glyph, ft, currentType);
+ elt = new XDropDownMember(currentType.Name, spM, currentType.Kind.GetImageMoniker(currentType.Visibility), ft, currentType);
_members.Add(elt);
_addToDict(currentType);
}
}
else if (!_settings.IncludeFields)
{
- elt = new XDropDownMember(globalType.Name, spM, globalType.Glyph, ft, globalType);
+ elt = new XDropDownMember(globalType.Name, spM, globalType.Kind.GetImageMoniker(globalType.Visibility), ft, globalType);
_members.Add(elt);
_addToDict(globalType);
}
@@ -677,7 +661,7 @@ private void loadMemberCombos(int selectedType)
ft = DROPDOWNFONTATTR.FONTATTR_GRAY;
prototype += " (" + System.IO.Path.GetFileName(member.File.SourcePath) + ")";
}
- elt = new XDropDownMember(prototype, spM, member.Glyph, ft, member);
+ elt = new XDropDownMember(prototype, spM, member.Kind.GetImageMoniker(member.Visibility), ft, member);
var nSelect = _members.Count;
_members.Add(elt);
_addToDict(member);
@@ -774,7 +758,7 @@ public async System.Threading.Tasks.Task RefreshDropDownAsync(bool needsUI)
public int GetComboAttributes(int combo, out uint entries, out uint entryType, out IntPtr imageList)
{
entries = 0;
- imageList = _imageList.Handle;
+ imageList = IntPtr.Zero; // no HIMAGELIST needed; IVsDropdownBarClient4.GetEntryImage returns monikers
entryType = (uint)(DROPDOWNENTRYTYPE.ENTRY_ATTR | DROPDOWNENTRYTYPE.ENTRY_IMAGE | DROPDOWNENTRYTYPE.ENTRY_TEXT);
switch (combo)
{
@@ -827,30 +811,27 @@ public int GetEntryAttributes(int combo, int index, out uint attr)
public int GetEntryImage(int combo, int index, out int imageIndex)
{
+ // IVsDropdownBarClient4.GetEntryImage is called instead when VS supports it
+ imageIndex = -1;
+ return VSConstants.E_NOTIMPL;
+ }
- imageIndex = 0;
- if (index < 0)
- {
- return VSConstants.E_FAIL;
- }
+ ImageMoniker IVsDropdownBarClient4.GetEntryImage(int combo, int index)
+ {
switch (combo)
{
- case TYPEINDEX: // types
- if (index < _types.Count)
- imageIndex = _types[index].Glyph;
- break;
- case MEMBERINDEX: // members
- if (index < _members.Count)
- imageIndex = _members[index].Glyph;
+ case TYPEINDEX:
+ if (index >= 0 && index < _types.Count)
+ return _types[index].Moniker;
break;
- case PROJECTINDEX: // projects
- imageIndex = projectIcon;
+ case MEMBERINDEX:
+ if (index >= 0 && index < _members.Count)
+ return _members[index].Moniker;
break;
- default:
- throw new ArgumentOutOfRangeException();
-
+ case PROJECTINDEX:
+ return KnownMonikers.Application;
}
- return 0;
+ return default;
}
public int GetEntryText(int combo, int index, out string text)
@@ -984,14 +965,14 @@ internal class XDropDownMember
{
public TextSpan Span { get; set; }
public string Label { get; set; }
- public int Glyph { get; set; }
+ public ImageMoniker Moniker { get; set; }
public DROPDOWNFONTATTR FontAttr { get; set; }
public XSourceEntity Entity { get; set; }
- internal XDropDownMember(string label, TextSpan span, int glyph, DROPDOWNFONTATTR fontAttribute, XSourceEntity element)
+ internal XDropDownMember(string label, TextSpan span, ImageMoniker moniker, DROPDOWNFONTATTR fontAttribute, XSourceEntity element)
{
Label = label;
Span = span;
- Glyph = glyph;
+ Moniker = moniker;
FontAttr = fontAttribute;
Entity = element;
}
From 8007389a269083a6e3bac0136406ec4b03286c99 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sat, 2 May 2026 13:22:54 +0000
Subject: [PATCH 09/11] Remove unused XSharpProjectImageList.bmp embedded
resource from LanguageService projects
Agent-Logs-Url: https://github.com/X-Sharp/XSharpPublic/sessions/aa358ee7-ebe3-4870-adc8-6a5b06f2c9d4
Co-authored-by: RobertvanderHulst <14240939+RobertvanderHulst@users.noreply.github.com>
---
src/VisualStudio/LanguageService/LanguageService.csproj | 3 ---
src/VisualStudio/LanguageService/LanguageService2022.csproj | 3 ---
2 files changed, 6 deletions(-)
diff --git a/src/VisualStudio/LanguageService/LanguageService.csproj b/src/VisualStudio/LanguageService/LanguageService.csproj
index 57795561d4..e59900deb4 100644
--- a/src/VisualStudio/LanguageService/LanguageService.csproj
+++ b/src/VisualStudio/LanguageService/LanguageService.csproj
@@ -325,9 +325,6 @@
-
- Resources\XSharpProjectImageList.bmp
-
diff --git a/src/VisualStudio/LanguageService/LanguageService2022.csproj b/src/VisualStudio/LanguageService/LanguageService2022.csproj
index 764f73710e..994f468ff2 100644
--- a/src/VisualStudio/LanguageService/LanguageService2022.csproj
+++ b/src/VisualStudio/LanguageService/LanguageService2022.csproj
@@ -342,9 +342,6 @@
-
- Resources\XSharpProjectImageList.bmp
-
From fce5c2708421870d1cff0032806bbffba953ccbc Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sat, 2 May 2026 14:04:29 +0000
Subject: [PATCH 10/11] Convert Windows.Forms UI to WPF in LanguageService
project
- Replace CtorParamsDlg (WinForms Form) with WPF Window + XAML
- Replace XSharpSpecialOptions (WinForms Form) with WPF Window + XAML
- Replace all 6 options controls (WinForms UserControls) with WPF UserControls + XAML
- Rewrite XSUserControl as WPF UserControl base with reflection-based data binding
- Rewrite XSDialogPage as UIElementDialogPage (instead of DialogPage)
- Update ConstructorAction.cs to use WPF ShowDialog() bool result
- Remove all Designer.cs and .resx files for converted controls
- Update LanguageService.csproj and LanguageService2022.csproj accordingly
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: RobertvanderHulst <14240939+RobertvanderHulst@users.noreply.github.com>
---
.../LanguageService/LanguageService.csproj | 104 ++---
.../LanguageService2022.csproj | 104 ++---
.../LightBulb/ConstructorAction.cs | 2 +-
.../LightBulb/CtorParamsDlg.Designer.cs | 172 --------
.../LightBulb/CtorParamsDlg.cs | 177 ++++----
.../LightBulb/CtorParamsDlg.xaml | 71 ++++
.../CompletionOptionsControl.Designer.cs | 370 -----------------
.../OptionsPages/CompletionOptionsControl.cs | 56 ++-
.../CompletionOptionsControl.xaml | 116 ++++++
.../FormattingOptionsControl.Designer.cs | 236 -----------
.../OptionsPages/FormattingOptionsControl.cs | 90 ++---
.../FormattingOptionsControl.xaml | 51 +++
.../GeneratorOptionsControl.Designer.cs | 215 ----------
.../OptionsPages/GeneratorOptionsControl.cs | 67 +--
.../OptionsPages/GeneratorOptionsControl.xaml | 40 ++
.../IndentingOptionsControl.Designer.cs | 106 -----
.../OptionsPages/IndentingOptionsControl.cs | 227 +++++------
.../OptionsPages/IndentingOptionsControl.xaml | 43 ++
.../IntellisenseOptionsControl.Designer.cs | 246 -----------
.../IntellisenseOptionsControl.cs | 72 ++--
.../IntellisenseOptionsControl.xaml | 77 ++++
.../OtherOptionsControl.Designer.cs | 260 ------------
.../OptionsPages/OtherOptionsControl.cs | 33 +-
.../OptionsPages/OtherOptionsControl.xaml | 93 +++++
.../OptionsPages/XSDialogPage.cs | 55 ++-
.../OptionsPages/XSUserControl.cs | 99 ++---
.../XSharpSpecialOptions.Designer.cs | 381 ------------------
.../OptionsPages/XSharpSpecialOptions.cs | 102 ++---
.../OptionsPages/XSharpSpecialOptions.xaml | 61 +++
29 files changed, 1045 insertions(+), 2681 deletions(-)
delete mode 100644 src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.Designer.cs
create mode 100644 src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.xaml
delete mode 100644 src/VisualStudio/LanguageService/OptionsPages/CompletionOptionsControl.Designer.cs
create mode 100644 src/VisualStudio/LanguageService/OptionsPages/CompletionOptionsControl.xaml
delete mode 100644 src/VisualStudio/LanguageService/OptionsPages/FormattingOptionsControl.Designer.cs
create mode 100644 src/VisualStudio/LanguageService/OptionsPages/FormattingOptionsControl.xaml
delete mode 100644 src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.Designer.cs
create mode 100644 src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.xaml
delete mode 100644 src/VisualStudio/LanguageService/OptionsPages/IndentingOptionsControl.Designer.cs
create mode 100644 src/VisualStudio/LanguageService/OptionsPages/IndentingOptionsControl.xaml
delete mode 100644 src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.Designer.cs
create mode 100644 src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.xaml
delete mode 100644 src/VisualStudio/LanguageService/OptionsPages/OtherOptionsControl.Designer.cs
create mode 100644 src/VisualStudio/LanguageService/OptionsPages/OtherOptionsControl.xaml
delete mode 100644 src/VisualStudio/LanguageService/OptionsPages/XSharpSpecialOptions.Designer.cs
create mode 100644 src/VisualStudio/LanguageService/OptionsPages/XSharpSpecialOptions.xaml
diff --git a/src/VisualStudio/LanguageService/LanguageService.csproj b/src/VisualStudio/LanguageService/LanguageService.csproj
index e59900deb4..410dc2e170 100644
--- a/src/VisualStudio/LanguageService/LanguageService.csproj
+++ b/src/VisualStudio/LanguageService/LanguageService.csproj
@@ -107,10 +107,7 @@
- Form
-
-
- CtorParamsDlg.cs
+ CtorParamsDlg.xaml
@@ -135,34 +132,22 @@
- UserControl
-
-
- CompletionOptionsControl.cs
+ CompletionOptionsControl.xaml
Component
- UserControl
-
-
- IndentingOptionsControl.cs
+ IndentingOptionsControl.xaml
- UserControl
-
-
- FormattingOptionsControl.cs
+ FormattingOptionsControl.xaml
Component
- UserControl
-
-
- GeneratorOptionsControl.cs
+ GeneratorOptionsControl.xaml
@@ -172,16 +157,10 @@
- UserControl
-
-
- OtherOptionsControl.cs
+ OtherOptionsControl.xaml
- UserControl
-
-
- IntellisenseOptionsControl.cs
+ IntellisenseOptionsControl.xaml
Component
@@ -195,18 +174,11 @@
Component
-
- Component
-
+
- Form
-
-
- XSharpSpecialOptions.cs
-
-
- UserControl
+ XSharpSpecialOptions.xaml
+
@@ -282,30 +254,6 @@
-
- CtorParamsDlg.cs
-
-
- CompletionOptionsControl.cs
-
-
- IndentingOptionsControl.cs
-
-
- FormattingOptionsControl.cs
-
-
- GeneratorOptionsControl.cs
-
-
- OtherOptionsControl.cs
-
-
- IntellisenseOptionsControl.cs
-
-
- XSharpSpecialOptions.cs
-
Designer
@@ -349,6 +297,38 @@
MSBuild:Compile
Designer
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
diff --git a/src/VisualStudio/LanguageService/LanguageService2022.csproj b/src/VisualStudio/LanguageService/LanguageService2022.csproj
index 994f468ff2..f04ae1ebb0 100644
--- a/src/VisualStudio/LanguageService/LanguageService2022.csproj
+++ b/src/VisualStudio/LanguageService/LanguageService2022.csproj
@@ -109,10 +109,7 @@
- Form
-
-
- CtorParamsDlg.cs
+ CtorParamsDlg.xaml
@@ -136,34 +133,22 @@
- UserControl
-
-
- CompletionOptionsControl.cs
+ CompletionOptionsControl.xaml
Component
- UserControl
-
-
- IndentingOptionsControl.cs
+ IndentingOptionsControl.xaml
- UserControl
-
-
- FormattingOptionsControl.cs
+ FormattingOptionsControl.xaml
Component
- UserControl
-
-
- GeneratorOptionsControl.cs
+ GeneratorOptionsControl.xaml
@@ -173,16 +158,10 @@
- UserControl
-
-
- OtherOptionsControl.cs
+ OtherOptionsControl.xaml
- UserControl
-
-
- IntellisenseOptionsControl.cs
+ IntellisenseOptionsControl.xaml
Component
@@ -196,18 +175,11 @@
Component
-
- Component
-
+
- Form
-
-
- XSharpSpecialOptions.cs
-
-
- UserControl
+ XSharpSpecialOptions.xaml
+
@@ -299,30 +271,6 @@
-
- CtorParamsDlg.cs
-
-
- CompletionOptionsControl.cs
-
-
- IndentingOptionsControl.cs
-
-
- FormattingOptionsControl.cs
-
-
- GeneratorOptionsControl.cs
-
-
- OtherOptionsControl.cs
-
-
- IntellisenseOptionsControl.cs
-
-
- XSharpSpecialOptions.cs
-
Designer
@@ -365,6 +313,38 @@
MSBuild:Compile
Designer
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
diff --git a/src/VisualStudio/LanguageService/LightBulb/ConstructorAction.cs b/src/VisualStudio/LanguageService/LightBulb/ConstructorAction.cs
index 73b32e9f12..bed88da6ec 100644
--- a/src/VisualStudio/LanguageService/LightBulb/ConstructorAction.cs
+++ b/src/VisualStudio/LanguageService/LightBulb/ConstructorAction.cs
@@ -169,7 +169,7 @@ private List CreateCtor(string prefix, int indentSize)
{
CtorParamsDlg dlg = new CtorParamsDlg();
dlg.FillMembers(_fieldsNProps);
- if ( dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK )
+ if ( dlg.ShowDialog() == true )
{
insertText.Append(prefix);
insertText.Append("PUBLIC ");
diff --git a/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.Designer.cs b/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.Designer.cs
deleted file mode 100644
index 4b4b831edf..0000000000
--- a/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.Designer.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-
-namespace XSharp.LanguageService.Editors.LightBulb
-{
- partial class CtorParamsDlg
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.btnCancel = new System.Windows.Forms.Button();
- this.btnOk = new System.Windows.Forms.Button();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.btnDeselect = new System.Windows.Forms.Button();
- this.btnSelect = new System.Windows.Forms.Button();
- this.btnDown = new System.Windows.Forms.Button();
- this.btnUp = new System.Windows.Forms.Button();
- this.listMembers = new System.Windows.Forms.ListView();
- this.colMembers = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.groupBox1.SuspendLayout();
- this.SuspendLayout();
- //
- // btnCancel
- //
- this.btnCancel.Location = new System.Drawing.Point(452, 373);
- this.btnCancel.Name = "btnCancel";
- this.btnCancel.Size = new System.Drawing.Size(75, 30);
- this.btnCancel.TabIndex = 0;
- this.btnCancel.Text = "Cancel";
- this.btnCancel.UseVisualStyleBackColor = true;
- this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
- //
- // btnOk
- //
- this.btnOk.Location = new System.Drawing.Point(371, 373);
- this.btnOk.Name = "btnOk";
- this.btnOk.Size = new System.Drawing.Size(75, 30);
- this.btnOk.TabIndex = 1;
- this.btnOk.Text = "OK";
- this.btnOk.UseVisualStyleBackColor = true;
- this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.btnDeselect);
- this.groupBox1.Controls.Add(this.btnSelect);
- this.groupBox1.Controls.Add(this.btnDown);
- this.groupBox1.Controls.Add(this.btnUp);
- this.groupBox1.Controls.Add(this.listMembers);
- this.groupBox1.Location = new System.Drawing.Point(12, 36);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(515, 314);
- this.groupBox1.TabIndex = 2;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "Pick members to be used as constructor parameters";
- //
- // btnDeselect
- //
- this.btnDeselect.Location = new System.Drawing.Point(404, 161);
- this.btnDeselect.Name = "btnDeselect";
- this.btnDeselect.Size = new System.Drawing.Size(105, 30);
- this.btnDeselect.TabIndex = 6;
- this.btnDeselect.Text = "Deselect All";
- this.btnDeselect.UseVisualStyleBackColor = true;
- this.btnDeselect.Click += new System.EventHandler(this.btnDeselect_Click);
- //
- // btnSelect
- //
- this.btnSelect.Location = new System.Drawing.Point(404, 125);
- this.btnSelect.Name = "btnSelect";
- this.btnSelect.Size = new System.Drawing.Size(105, 30);
- this.btnSelect.TabIndex = 5;
- this.btnSelect.Text = "Select All";
- this.btnSelect.UseVisualStyleBackColor = true;
- this.btnSelect.Click += new System.EventHandler(this.btnSelect_Click);
- //
- // btnDown
- //
- this.btnDown.Location = new System.Drawing.Point(404, 67);
- this.btnDown.Name = "btnDown";
- this.btnDown.Size = new System.Drawing.Size(105, 30);
- this.btnDown.TabIndex = 4;
- this.btnDown.Text = "Down";
- this.btnDown.UseVisualStyleBackColor = true;
- this.btnDown.Click += new System.EventHandler(this.btnDown_Click);
- //
- // btnUp
- //
- this.btnUp.Location = new System.Drawing.Point(404, 31);
- this.btnUp.Name = "btnUp";
- this.btnUp.Size = new System.Drawing.Size(105, 30);
- this.btnUp.TabIndex = 3;
- this.btnUp.Text = "Up";
- this.btnUp.UseVisualStyleBackColor = true;
- this.btnUp.Click += new System.EventHandler(this.btnUp_Click);
- //
- // listMembers
- //
- this.listMembers.Activation = System.Windows.Forms.ItemActivation.OneClick;
- this.listMembers.CheckBoxes = true;
- this.listMembers.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.colMembers});
- this.listMembers.FullRowSelect = true;
- this.listMembers.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
- this.listMembers.HideSelection = false;
- this.listMembers.HotTracking = true;
- this.listMembers.HoverSelection = true;
- this.listMembers.Location = new System.Drawing.Point(19, 31);
- this.listMembers.Name = "listMembers";
- this.listMembers.Size = new System.Drawing.Size(368, 265);
- this.listMembers.TabIndex = 0;
- this.listMembers.UseCompatibleStateImageBehavior = false;
- this.listMembers.View = System.Windows.Forms.View.Details;
- //
- // colMembers
- //
- this.colMembers.Text = "Members";
- this.colMembers.Width = 329;
- //
- // CtorParamsDlg
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(539, 415);
- this.Controls.Add(this.groupBox1);
- this.Controls.Add(this.btnOk);
- this.Controls.Add(this.btnCancel);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "CtorParamsDlg";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Pick members";
- this.groupBox1.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.Button btnCancel;
- private System.Windows.Forms.Button btnOk;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.ListView listMembers;
- private System.Windows.Forms.Button btnDeselect;
- private System.Windows.Forms.Button btnSelect;
- private System.Windows.Forms.Button btnDown;
- private System.Windows.Forms.Button btnUp;
- private System.Windows.Forms.ColumnHeader colMembers;
- }
-}
diff --git a/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.cs b/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.cs
index e4daf6a07e..da897765dc 100644
--- a/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.cs
+++ b/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.cs
@@ -1,156 +1,129 @@
-using System;
+// Copyright (c) XSharp B.V. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0.
+// See License.txt in the project root for license information.
+using Microsoft.VisualStudio.Imaging.Interop;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
+using System.Runtime.CompilerServices;
+using System.Windows;
using XSharpModel;
-using MVP = Microsoft.VisualStudio.Package;
namespace XSharp.LanguageService.Editors.LightBulb
{
- public partial class CtorParamsDlg : Form
+ public partial class CtorParamsDlg : Window
{
- ImageList _imageList = new ImageList();
- List selectedFieldsNProps = new List();
-
- public List FieldsNProps { get { return selectedFieldsNProps; } }
+ private readonly ObservableCollection _items = new ObservableCollection();
public CtorParamsDlg()
{
InitializeComponent();
- this.InitImageList();
- //
- this.listMembers.ListViewItemSorter = new MemberTagValueComparer();
+ _listView.ItemsSource = _items;
}
- private void InitImageList()
+ public List FieldsNProps
{
- Stream stream = typeof(MVP.LanguageService).Assembly.GetManifestResourceStream("Resources.completionset.bmp");
- _imageList.ImageSize = new Size(16, 16);
- _imageList.TransparentColor = Color.FromArgb(255, 0, 255);
- _imageList.Images.AddStrip(new Bitmap(stream));
- //
- this.listMembers.SmallImageList = _imageList;
+ get
+ {
+ var result = new List();
+ foreach (var item in _items)
+ {
+ if (item.IsChecked)
+ result.Add(item.Member);
+ }
+ return result;
+ }
}
- public void FillMembers(List fieldsNProps)
+ public void FillMembers(List fieldsNProps)
{
+ _items.Clear();
int i = 0;
foreach (var mbr in fieldsNProps)
{
- ListViewItem lvi = new ListViewItem(mbr.Name);
- lvi.Checked = true;
- lvi.Tag = ( i++, mbr );
- if (mbr is XSymbol xmbr)
+ _items.Add(new MemberItem
{
- lvi.ImageIndex = xmbr.Glyph;
- }
- this.listMembers.Items.Add(lvi);
+ Name = mbr.Name,
+ Member = mbr,
+ IsChecked = true,
+ Order = i++,
+ Moniker = mbr.Kind.GetImageMoniker(mbr.Visibility)
+ });
}
}
- private void btnSelect_Click(object sender, EventArgs e)
+ private void OnUp(object sender, RoutedEventArgs e)
{
- foreach (ListViewItem lvi in listMembers.Items)
+ int idx = _listView.SelectedIndex;
+ if (idx > 0)
{
- lvi.Checked = true;
+ _items.Move(idx, idx - 1);
+ _listView.SelectedIndex = idx - 1;
}
}
- private void btnDeselect_Click(object sender, EventArgs e)
+ private void OnDown(object sender, RoutedEventArgs e)
{
- foreach (ListViewItem lvi in listMembers.Items)
+ int idx = _listView.SelectedIndex;
+ if (idx >= 0 && idx < _items.Count - 1)
{
- lvi.Checked = false;
+ _items.Move(idx, idx + 1);
+ _listView.SelectedIndex = idx + 1;
}
}
- private void btnUp_Click(object sender, EventArgs e)
+ private void OnSelectAll(object sender, RoutedEventArgs e)
{
- if (listMembers.SelectedItems.Count > 0)
- {
- ListViewItem lvi = listMembers.SelectedItems[0];
- (int, IXMemberSymbol) t1 = ((int, IXMemberSymbol))lvi.Tag;
- int tagValue = t1.Item1;
- if ( tagValue > 0)
- {
- ListViewItem otherLvi = listMembers.Items[tagValue-1];
- (int, IXMemberSymbol) t2 = ((int, IXMemberSymbol))otherLvi.Tag;
- t1.Item1 = t2.Item1;
- t2.Item1 = tagValue;
- //
- lvi.Tag = t1;
- otherLvi.Tag = t2;
- //
- listMembers.Sort();
- }
- }
+ foreach (var item in _items)
+ item.IsChecked = true;
}
- private void btnDown_Click(object sender, EventArgs e)
+ private void OnDeselectAll(object sender, RoutedEventArgs e)
{
- if (listMembers.SelectedItems.Count > 0)
+ foreach (var item in _items)
+ item.IsChecked = false;
+ }
+
+ private void OnOk(object sender, RoutedEventArgs e)
+ {
+ bool any = false;
+ foreach (var item in _items)
{
- ListViewItem lvi = listMembers.SelectedItems[0];
- (int, IXMemberSymbol) t1 = ((int, IXMemberSymbol))lvi.Tag;
- int tagValue = t1.Item1;
- if (tagValue < listMembers.Items.Count-1)
- {
- ListViewItem otherLvi = listMembers.Items[tagValue + 1];
- (int, IXMemberSymbol) t2 = ((int, IXMemberSymbol))otherLvi.Tag;
- t1.Item1 = t2.Item1;
- t2.Item1 = tagValue;
- //
- lvi.Tag = t1;
- otherLvi.Tag = t2;
- //
- listMembers.Sort();
- }
+ if (item.IsChecked) { any = true; break; }
}
+ DialogResult = any;
}
- private void btnCancel_Click(object sender, EventArgs e)
+ private void OnCancel(object sender, RoutedEventArgs e)
{
- this.DialogResult = DialogResult.Cancel;
+ DialogResult = false;
}
+ }
+
+ internal sealed class MemberItem : INotifyPropertyChanged
+ {
+ private bool _isChecked;
- private void btnOk_Click(object sender, EventArgs e)
+ public bool IsChecked
{
- foreach( ListViewItem lvi in listMembers.Items )
+ get => _isChecked;
+ set
{
- if ( lvi.Checked )
+ if (_isChecked != value)
{
- (int, IXMemberSymbol) t1 = ((int, IXMemberSymbol))lvi.Tag;
- this.selectedFieldsNProps.Add(t1.Item2);
+ _isChecked = value;
+ OnPropertyChanged();
}
}
- if ( this.selectedFieldsNProps.Count > 0 )
- {
- this.DialogResult = DialogResult.OK;
- }
- else
- {
- this.DialogResult = DialogResult.Cancel;
- }
}
- }
- class MemberTagValueComparer : System.Collections.IComparer
- {
- public int Compare(object o1, object o2)
- {
- ListViewItem i1 = (ListViewItem)o1;
- ListViewItem i2 = (ListViewItem)o2;
- //
- (int, IXMemberSymbol) t1 = ((int, IXMemberSymbol))i1.Tag;
- (int, IXMemberSymbol) t2 = ((int, IXMemberSymbol))i2.Tag;
- //
- return t1.Item1.CompareTo(t2.Item1);
- }
+ public string Name { get; set; }
+ public int Order { get; set; }
+ public IXMemberSymbol Member { get; set; }
+ public ImageMoniker Moniker { get; set; }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ private void OnPropertyChanged([CallerMemberName] string name = null)
+ => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
}
diff --git a/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.xaml b/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.xaml
new file mode 100644
index 0000000000..7e4e2c3ba8
--- /dev/null
+++ b/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.xaml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/VisualStudio/LanguageService/OptionsPages/CompletionOptionsControl.Designer.cs b/src/VisualStudio/LanguageService/OptionsPages/CompletionOptionsControl.Designer.cs
deleted file mode 100644
index 397799437c..0000000000
--- a/src/VisualStudio/LanguageService/OptionsPages/CompletionOptionsControl.Designer.cs
+++ /dev/null
@@ -1,370 +0,0 @@
-namespace XSharp.LanguageService.OptionsPages
-{
- partial class CompletionOptionsControl
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.label1 = new System.Windows.Forms.Label();
- this.chkLocals = new System.Windows.Forms.CheckBox();
- this.chkFields = new System.Windows.Forms.CheckBox();
- this.chkInherited = new System.Windows.Forms.CheckBox();
- this.chkGlobalsProject = new System.Windows.Forms.CheckBox();
- this.chkFunctions = new System.Windows.Forms.CheckBox();
- this.chkFunctionsSource = new System.Windows.Forms.CheckBox();
- this.chkFunctionsExternal = new System.Windows.Forms.CheckBox();
- this.chkGlobalsSource = new System.Windows.Forms.CheckBox();
- this.chkGlobalsExtern = new System.Windows.Forms.CheckBox();
- this.chkKeywords = new System.Windows.Forms.CheckBox();
- this.chkSnippets = new System.Windows.Forms.CheckBox();
- this.rtfDescription = new System.Windows.Forms.RichTextBox();
- this.btnAll = new System.Windows.Forms.Button();
- this.btnNothing = new System.Windows.Forms.Button();
- this.lblChars = new System.Windows.Forms.Label();
- this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.tbChars = new System.Windows.Forms.NumericUpDown();
- this.chkNamespaces = new System.Windows.Forms.CheckBox();
- this.chkTypes = new System.Windows.Forms.CheckBox();
- this.tbMaxEntries = new System.Windows.Forms.NumericUpDown();
- this.lblMaxEntries = new System.Windows.Forms.Label();
- ((System.ComponentModel.ISupportInitialize)(this.tbChars)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.tbMaxEntries)).BeginInit();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(20, 12);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(0, 13);
- this.label1.TabIndex = 1;
- //
- // chkLocals
- //
- this.chkLocals.AutoSize = true;
- this.chkLocals.Location = new System.Drawing.Point(19, 166);
- this.chkLocals.Name = "chkLocals";
- this.chkLocals.Size = new System.Drawing.Size(122, 17);
- this.chkLocals.TabIndex = 4;
- this.chkLocals.Text = "&Locals && Parameters";
- this.toolTip1.SetToolTip(this.chkLocals, "Include Locals and Parameters in the completion list");
- this.chkLocals.UseVisualStyleBackColor = true;
- //
- // chkFields
- //
- this.chkFields.AutoSize = true;
- this.chkFields.Location = new System.Drawing.Point(19, 187);
- this.chkFields.Name = "chkFields";
- this.chkFields.Size = new System.Drawing.Size(176, 17);
- this.chkFields.TabIndex = 5;
- this.chkFields.Text = "&Fields and methods current type";
- this.toolTip1.SetToolTip(this.chkFields, "Include fields and methods of the current type in the completionlist");
- this.chkFields.UseVisualStyleBackColor = true;
- //
- // chkInherited
- //
- this.chkInherited.AutoSize = true;
- this.chkInherited.Location = new System.Drawing.Point(19, 208);
- this.chkInherited.Name = "chkInherited";
- this.chkInherited.Size = new System.Drawing.Size(161, 17);
- this.chkInherited.TabIndex = 6;
- this.chkInherited.Text = "&Inherited Fields and methods";
- this.toolTip1.SetToolTip(this.chkInherited, "Include fields and methods of parent type(s) in the completionlist");
- this.chkInherited.UseVisualStyleBackColor = true;
- //
- // chkGlobalsProject
- //
- this.chkGlobalsProject.AutoSize = true;
- this.chkGlobalsProject.Location = new System.Drawing.Point(195, 142);
- this.chkGlobalsProject.Name = "chkGlobalsProject";
- this.chkGlobalsProject.Size = new System.Drawing.Size(191, 17);
- this.chkGlobalsProject.TabIndex = 11;
- this.chkGlobalsProject.Text = "&Globals && Defines in current project";
- this.toolTip1.SetToolTip(this.chkGlobalsProject, "Include Globals and Defines from the current project in the completion list");
- this.chkGlobalsProject.UseVisualStyleBackColor = true;
- //
- // chkFunctions
- //
- this.chkFunctions.AutoSize = true;
- this.chkFunctions.Location = new System.Drawing.Point(195, 208);
- this.chkFunctions.Name = "chkFunctions";
- this.chkFunctions.Size = new System.Drawing.Size(154, 17);
- this.chkFunctions.TabIndex = 14;
- this.chkFunctions.Text = "&Functions in current project";
- this.toolTip1.SetToolTip(this.chkFunctions, "Include Functions from the current project in the completion list");
- this.chkFunctions.UseVisualStyleBackColor = true;
- //
- // chkFunctionsSource
- //
- this.chkFunctionsSource.AutoSize = true;
- this.chkFunctionsSource.Location = new System.Drawing.Point(195, 229);
- this.chkFunctionsSource.Name = "chkFunctionsSource";
- this.chkFunctionsSource.Size = new System.Drawing.Size(118, 17);
- this.chkFunctionsSource.TabIndex = 15;
- this.chkFunctionsSource.Text = "Functions in &source";
- this.toolTip1.SetToolTip(this.chkFunctionsSource, "Include Functions from referenced X# projects in the completion list");
- this.chkFunctionsSource.UseVisualStyleBackColor = true;
- //
- // chkFunctionsExternal
- //
- this.chkFunctionsExternal.AutoSize = true;
- this.chkFunctionsExternal.Location = new System.Drawing.Point(195, 250);
- this.chkFunctionsExternal.Name = "chkFunctionsExternal";
- this.chkFunctionsExternal.Size = new System.Drawing.Size(137, 17);
- this.chkFunctionsExternal.TabIndex = 16;
- this.chkFunctionsExternal.Text = "Functions in assemblies";
- this.toolTip1.SetToolTip(this.chkFunctionsExternal, "Include Functions from referenced X# assemblies in the completion list. \r\nThis in" +
- "cludes Functions in the X# Runtime.");
- this.chkFunctionsExternal.UseVisualStyleBackColor = true;
- //
- // chkGlobalsSource
- //
- this.chkGlobalsSource.AutoSize = true;
- this.chkGlobalsSource.Location = new System.Drawing.Point(195, 166);
- this.chkGlobalsSource.Name = "chkGlobalsSource";
- this.chkGlobalsSource.Size = new System.Drawing.Size(155, 17);
- this.chkGlobalsSource.TabIndex = 12;
- this.chkGlobalsSource.Text = "G&lobals && Defines in source";
- this.toolTip1.SetToolTip(this.chkGlobalsSource, "Include Globals and Defines from referenced X# projects in the completion list");
- this.chkGlobalsSource.UseVisualStyleBackColor = true;
- //
- // chkGlobalsExtern
- //
- this.chkGlobalsExtern.AutoSize = true;
- this.chkGlobalsExtern.Location = new System.Drawing.Point(195, 187);
- this.chkGlobalsExtern.Name = "chkGlobalsExtern";
- this.chkGlobalsExtern.Size = new System.Drawing.Size(174, 17);
- this.chkGlobalsExtern.TabIndex = 13;
- this.chkGlobalsExtern.Text = "Gl&obals && Defines in assemblies";
- this.toolTip1.SetToolTip(this.chkGlobalsExtern, "Include Globals and Defines from referenced X# assemblies in the completion list." +
- "\r\nThis includes Globals and Defines in the X# Runtime.");
- this.chkGlobalsExtern.UseVisualStyleBackColor = true;
- //
- // chkKeywords
- //
- this.chkKeywords.AutoSize = true;
- this.chkKeywords.Location = new System.Drawing.Point(19, 250);
- this.chkKeywords.Name = "chkKeywords";
- this.chkKeywords.Size = new System.Drawing.Size(72, 17);
- this.chkKeywords.TabIndex = 9;
- this.chkKeywords.Text = "&Keywords";
- this.toolTip1.SetToolTip(this.chkKeywords, "Include keywords in the completionlist");
- this.chkKeywords.UseVisualStyleBackColor = true;
- //
- // chkSnippets
- //
- this.chkSnippets.AutoSize = true;
- this.chkSnippets.Location = new System.Drawing.Point(108, 249);
- this.chkSnippets.Name = "chkSnippets";
- this.chkSnippets.Size = new System.Drawing.Size(67, 17);
- this.chkSnippets.TabIndex = 10;
- this.chkSnippets.Text = "&Snippets";
- this.toolTip1.SetToolTip(this.chkSnippets, "Include snipprts in the completionlist");
- this.chkSnippets.UseVisualStyleBackColor = true;
- //
- // rtfDescription
- //
- this.rtfDescription.BackColor = System.Drawing.SystemColors.Control;
- this.rtfDescription.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.rtfDescription.BulletIndent = 5;
- this.rtfDescription.Location = new System.Drawing.Point(10, -3);
- this.rtfDescription.Name = "rtfDescription";
- this.rtfDescription.ReadOnly = true;
- this.rtfDescription.Size = new System.Drawing.Size(382, 139);
- this.rtfDescription.TabIndex = 0;
- this.rtfDescription.TabStop = false;
- this.rtfDescription.Text = "";
- //
- // btnAll
- //
- this.btnAll.Location = new System.Drawing.Point(350, 214);
- this.btnAll.Name = "btnAll";
- this.btnAll.Size = new System.Drawing.Size(44, 23);
- this.btnAll.TabIndex = 17;
- this.btnAll.Text = "&All";
- this.btnAll.UseVisualStyleBackColor = true;
- this.btnAll.Click += new System.EventHandler(this.btnAll_Click);
- //
- // btnNothing
- //
- this.btnNothing.Location = new System.Drawing.Point(350, 242);
- this.btnNothing.Name = "btnNothing";
- this.btnNothing.Size = new System.Drawing.Size(44, 23);
- this.btnNothing.TabIndex = 18;
- this.btnNothing.Text = "&None";
- this.btnNothing.UseVisualStyleBackColor = true;
- this.btnNothing.Click += new System.EventHandler(this.btnNothing_Click);
- //
- // lblChars
- //
- this.lblChars.AutoSize = true;
- this.lblChars.Location = new System.Drawing.Point(208, 270);
- this.lblChars.Name = "lblChars";
- this.lblChars.Size = new System.Drawing.Size(78, 13);
- this.lblChars.TabIndex = 2;
- this.lblChars.Text = "Chars required:";
- this.toolTip1.SetToolTip(this.lblChars, "Number of characters required to start Generic CompletionList");
- this.lblChars.Visible = false;
- //
- // tbChars
- //
- this.tbChars.Location = new System.Drawing.Point(292, 268);
- this.tbChars.Minimum = new decimal(new int[] {
- 3,
- 0,
- 0,
- 0});
- this.tbChars.Name = "tbChars";
- this.tbChars.Size = new System.Drawing.Size(79, 20);
- this.tbChars.TabIndex = 3;
- this.toolTip1.SetToolTip(this.tbChars, "Number of characters required to start Generic CompletionList. This must be a num" +
- "ber > 1");
- this.tbChars.Value = new decimal(new int[] {
- 3,
- 0,
- 0,
- 0});
- this.tbChars.Visible = false;
- //
- // chkNamespaces
- //
- this.chkNamespaces.AutoSize = true;
- this.chkNamespaces.Location = new System.Drawing.Point(19, 229);
- this.chkNamespaces.Name = "chkNamespaces";
- this.chkNamespaces.Size = new System.Drawing.Size(88, 17);
- this.chkNamespaces.TabIndex = 7;
- this.chkNamespaces.Text = "&Namespaces";
- this.toolTip1.SetToolTip(this.chkNamespaces, "Include namespaces from the current project and all referenced projects and assem" +
- "blies");
- this.chkNamespaces.UseVisualStyleBackColor = true;
- //
- // chkTypes
- //
- this.chkTypes.AutoSize = true;
- this.chkTypes.Location = new System.Drawing.Point(108, 229);
- this.chkTypes.Name = "chkTypes";
- this.chkTypes.Size = new System.Drawing.Size(55, 17);
- this.chkTypes.TabIndex = 8;
- this.chkTypes.Text = "&Types";
- this.toolTip1.SetToolTip(this.chkTypes, "Include types from the current assembly and all referenced projects and assemblie" +
- "s");
- this.chkTypes.UseVisualStyleBackColor = true;
- //
- // tbMaxEntries
- //
- this.tbMaxEntries.Location = new System.Drawing.Point(104, 141);
- this.tbMaxEntries.Maximum = new decimal(new int[] {
- 1000,
- 0,
- 0,
- 0});
- this.tbMaxEntries.Minimum = new decimal(new int[] {
- 25,
- 0,
- 0,
- 0});
- this.tbMaxEntries.Name = "tbMaxEntries";
- this.tbMaxEntries.Size = new System.Drawing.Size(79, 20);
- this.tbMaxEntries.TabIndex = 20;
- this.toolTip1.SetToolTip(this.tbMaxEntries, "Maximum # of entries in completion list");
- this.tbMaxEntries.Value = new decimal(new int[] {
- 25,
- 0,
- 0,
- 0});
- //
- // lblMaxEntries
- //
- this.lblMaxEntries.AutoSize = true;
- this.lblMaxEntries.Location = new System.Drawing.Point(20, 143);
- this.lblMaxEntries.Name = "lblMaxEntries";
- this.lblMaxEntries.Size = new System.Drawing.Size(65, 13);
- this.lblMaxEntries.TabIndex = 19;
- this.lblMaxEntries.Text = "Max Entries:";
- this.toolTip1.SetToolTip(this.lblMaxEntries, "Maximum # of entries in completion list");
- //
- // CompletionOptionsControl
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.AutoScroll = true;
- this.Controls.Add(this.tbMaxEntries);
- this.Controls.Add(this.lblMaxEntries);
- this.Controls.Add(this.chkTypes);
- this.Controls.Add(this.chkNamespaces);
- this.Controls.Add(this.tbChars);
- this.Controls.Add(this.lblChars);
- this.Controls.Add(this.btnNothing);
- this.Controls.Add(this.btnAll);
- this.Controls.Add(this.rtfDescription);
- this.Controls.Add(this.chkSnippets);
- this.Controls.Add(this.chkKeywords);
- this.Controls.Add(this.chkGlobalsExtern);
- this.Controls.Add(this.chkGlobalsSource);
- this.Controls.Add(this.chkFunctionsExternal);
- this.Controls.Add(this.chkFunctionsSource);
- this.Controls.Add(this.chkFunctions);
- this.Controls.Add(this.chkGlobalsProject);
- this.Controls.Add(this.chkInherited);
- this.Controls.Add(this.chkFields);
- this.Controls.Add(this.chkLocals);
- this.Controls.Add(this.label1);
- this.Name = "CompletionOptionsControl";
- this.Size = new System.Drawing.Size(403, 305);
- ((System.ComponentModel.ISupportInitialize)(this.tbChars)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.tbMaxEntries)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.CheckBox chkLocals;
- private System.Windows.Forms.CheckBox chkFields;
- private System.Windows.Forms.CheckBox chkInherited;
- private System.Windows.Forms.CheckBox chkGlobalsProject;
- private System.Windows.Forms.CheckBox chkFunctions;
- private System.Windows.Forms.CheckBox chkFunctionsSource;
- private System.Windows.Forms.CheckBox chkFunctionsExternal;
- private System.Windows.Forms.CheckBox chkGlobalsSource;
- private System.Windows.Forms.CheckBox chkGlobalsExtern;
- private System.Windows.Forms.CheckBox chkKeywords;
- private System.Windows.Forms.CheckBox chkSnippets;
- private System.Windows.Forms.RichTextBox rtfDescription;
- private System.Windows.Forms.Button btnAll;
- private System.Windows.Forms.Button btnNothing;
- private System.Windows.Forms.Label lblChars;
- private System.Windows.Forms.ToolTip toolTip1;
- private System.Windows.Forms.NumericUpDown tbChars;
- private System.Windows.Forms.CheckBox chkNamespaces;
- private System.Windows.Forms.CheckBox chkTypes;
- private System.Windows.Forms.NumericUpDown tbMaxEntries;
- private System.Windows.Forms.Label lblMaxEntries;
- }
-}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/CompletionOptionsControl.cs b/src/VisualStudio/LanguageService/OptionsPages/CompletionOptionsControl.cs
index 3aebe31d2e..bdb9db2285 100644
--- a/src/VisualStudio/LanguageService/OptionsPages/CompletionOptionsControl.cs
+++ b/src/VisualStudio/LanguageService/OptionsPages/CompletionOptionsControl.cs
@@ -1,4 +1,9 @@
-using System;
+// Copyright (c) XSharp B.V. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0.
+// See License.txt in the project root for license information.
+using System;
+using System.Windows;
+
namespace XSharp.LanguageService.OptionsPages
{
public partial class CompletionOptionsControl : XSUserControl
@@ -6,44 +11,29 @@ public partial class CompletionOptionsControl : XSUserControl
public CompletionOptionsControl()
{
InitializeComponent();
- chkSnippets.Visible = false;
- chkFields.Tag = nameof(CompletionOptions.CompleteSelf);
- chkLocals.Tag = nameof(CompletionOptions.CompleteLocals);
- chkInherited.Tag = nameof(CompletionOptions.CompleteParent);
- chkNamespaces.Tag = nameof(CompletionOptions.CompleteNamespaces);
- chkTypes.Tag = nameof(CompletionOptions.CompleteTypes);
- chkKeywords.Tag = nameof(CompletionOptions.CompleteKeywords);
- tbMaxEntries.Tag = nameof(CompletionOptions.MaxCompletionEntries);
- chkSnippets.Tag = nameof(CompletionOptions.CompleteSnippets);
- chkGlobalsProject.Tag = nameof(CompletionOptions.CompleteGlobals);
- chkGlobalsSource.Tag = nameof(CompletionOptions.CompleteGlobalsP);
- chkGlobalsExtern.Tag = nameof(CompletionOptions.CompleteGlobalsA);
- chkFunctions.Tag = nameof(CompletionOptions.CompleteFunctions);
- chkFunctionsSource.Tag = nameof(CompletionOptions.CompleteFunctionsP);
- chkFunctionsExternal.Tag = nameof(CompletionOptions.CompleteFunctionsA);
- tbChars.Tag = nameof(CompletionOptions.CompleteNumChars);
- this.rtfDescription.Text = String.Join(Environment.NewLine,
- new string[] {
- "Code Completion is triggered by special characters such as '.' and ':'",
- "The editor can also perform code completion at other locations such as:",
- "•\tafter certain keywords, such as AS, INHERIT, IMPLEMENTS, USING ",
- "•\tat the start of an expression, such as at the start of a line or after an",
- "\topening '(', '{' or '[' or after :=",
- "The filling of these second \"generic\" completion lists will be NOT be automatically ",
- "started, but you have to press the \"Complete Word\" key, which is usually assigned ",
- "to the Ctrl-Space key.",
- "",
- "On this page you can control where the editor will look for completion." });
- this.tbChars.Enabled = this.lblChars.Enabled = false;
- this.chkSnippets.Enabled = false;
+ rtfDescription.Text = string.Join(Environment.NewLine,
+ new[]
+ {
+ "Code Completion is triggered by special characters such as '.' and ':'",
+ "The editor can also perform code completion at other locations such as:",
+ "\u2022 after certain keywords, such as AS, INHERIT, IMPLEMENTS, USING",
+ "\u2022 at the start of an expression, such as at the start of a line or after an",
+ " opening '(', '{' or '[' or after :=",
+ "",
+ "The filling of these second \"generic\" completion lists will NOT be automatically",
+ "started, but you have to press the \"Complete Word\" key, which is usually assigned",
+ "to the Ctrl-Space key.",
+ "",
+ "On this page you can control where the editor will look for completion."
+ });
}
- private void btnAll_Click(object sender, EventArgs e)
+ private void OnAll(object sender, RoutedEventArgs e)
{
checkbuttons(true);
}
- private void btnNothing_Click(object sender, EventArgs e)
+ private void OnNone(object sender, RoutedEventArgs e)
{
checkbuttons(false);
}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/CompletionOptionsControl.xaml b/src/VisualStudio/LanguageService/OptionsPages/CompletionOptionsControl.xaml
new file mode 100644
index 0000000000..608bf73d41
--- /dev/null
+++ b/src/VisualStudio/LanguageService/OptionsPages/CompletionOptionsControl.xaml
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/VisualStudio/LanguageService/OptionsPages/FormattingOptionsControl.Designer.cs b/src/VisualStudio/LanguageService/OptionsPages/FormattingOptionsControl.Designer.cs
deleted file mode 100644
index 9761268e9e..0000000000
--- a/src/VisualStudio/LanguageService/OptionsPages/FormattingOptionsControl.Designer.cs
+++ /dev/null
@@ -1,236 +0,0 @@
-namespace XSharp.LanguageService.OptionsPages
-{
- partial class FormattingOptionsControl
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Windows.Forms.Label label1;
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormattingOptionsControl));
- this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.chkTrimTrailngWhiteSpace = new System.Windows.Forms.CheckBox();
- this.chkInsertFinalNewLine = new System.Windows.Forms.CheckBox();
- this.chkSynchronizeUDCKeywords = new System.Windows.Forms.CheckBox();
- this.chkIdentifierCase = new System.Windows.Forms.CheckBox();
- this.panel1 = new System.Windows.Forms.Panel();
- this.grpCase = new System.Windows.Forms.GroupBox();
- this.tbExample = new System.Windows.Forms.TextBox();
- this.grpKeywordCase = new System.Windows.Forms.GroupBox();
- this.rbTitle = new System.Windows.Forms.RadioButton();
- this.rbNone = new System.Windows.Forms.RadioButton();
- this.rbUpper = new System.Windows.Forms.RadioButton();
- this.rbLower = new System.Windows.Forms.RadioButton();
- label1 = new System.Windows.Forms.Label();
- this.panel1.SuspendLayout();
- this.grpCase.SuspendLayout();
- this.grpKeywordCase.SuspendLayout();
- this.SuspendLayout();
- //
- // label1
- //
- label1.Location = new System.Drawing.Point(0, 0);
- label1.Name = "label1";
- label1.Size = new System.Drawing.Size(100, 23);
- label1.TabIndex = 0;
- //
- // chkTrimTrailngWhiteSpace
- //
- this.chkTrimTrailngWhiteSpace.AutoSize = true;
- this.chkTrimTrailngWhiteSpace.Location = new System.Drawing.Point(13, 105);
- this.chkTrimTrailngWhiteSpace.Name = "chkTrimTrailngWhiteSpace";
- this.chkTrimTrailngWhiteSpace.Size = new System.Drawing.Size(143, 17);
- this.chkTrimTrailngWhiteSpace.TabIndex = 4;
- this.chkTrimTrailngWhiteSpace.Text = "Trim Trailing Whitespace";
- this.toolTip1.SetToolTip(this.chkTrimTrailngWhiteSpace, "When you select this then all the lines will be \"trimmed\" when you save the file." +
- "");
- this.chkTrimTrailngWhiteSpace.UseVisualStyleBackColor = true;
- //
- // chkInsertFinalNewLine
- //
- this.chkInsertFinalNewLine.AutoSize = true;
- this.chkInsertFinalNewLine.Location = new System.Drawing.Point(13, 128);
- this.chkInsertFinalNewLine.Name = "chkInsertFinalNewLine";
- this.chkInsertFinalNewLine.Size = new System.Drawing.Size(122, 17);
- this.chkInsertFinalNewLine.TabIndex = 5;
- this.chkInsertFinalNewLine.Text = "Insert Final NewLine";
- this.toolTip1.SetToolTip(this.chkInsertFinalNewLine, "When you select this then the editor will add a CRLF after the last line of code " +
- "when needed.");
- this.chkInsertFinalNewLine.UseVisualStyleBackColor = true;
- //
- // chkSynchronizeUDCKeywords
- //
- this.chkSynchronizeUDCKeywords.AutoSize = true;
- this.chkSynchronizeUDCKeywords.Location = new System.Drawing.Point(13, 59);
- this.chkSynchronizeUDCKeywords.Name = "chkSynchronizeUDCKeywords";
- this.chkSynchronizeUDCKeywords.Size = new System.Drawing.Size(191, 17);
- this.chkSynchronizeUDCKeywords.TabIndex = 2;
- this.chkSynchronizeUDCKeywords.Text = "Sychronize case of &UDC Keywords";
- this.toolTip1.SetToolTip(this.chkSynchronizeUDCKeywords, "When you enable this option then User Defined keywords inside UDCs will follow th" +
- "e capitalization rules for the built-in keywords");
- this.chkSynchronizeUDCKeywords.UseVisualStyleBackColor = true;
- //
- // chkIdentifierCase
- //
- this.chkIdentifierCase.AutoSize = true;
- this.chkIdentifierCase.Location = new System.Drawing.Point(13, 82);
- this.chkIdentifierCase.Name = "chkIdentifierCase";
- this.chkIdentifierCase.Size = new System.Drawing.Size(171, 17);
- this.chkIdentifierCase.TabIndex = 3;
- this.chkIdentifierCase.Text = "&Identifier Case Synchronization";
- this.toolTip1.SetToolTip(this.chkIdentifierCase, resources.GetString("chkIdentifierCase.ToolTip"));
- this.chkIdentifierCase.UseVisualStyleBackColor = true;
- //
- // panel1
- //
- this.panel1.Controls.Add(this.grpCase);
- this.panel1.Location = new System.Drawing.Point(0, 0);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(381, 186);
- this.panel1.TabIndex = 0;
- //
- // grpCase
- //
- this.grpCase.Controls.Add(this.tbExample);
- this.grpCase.Controls.Add(this.chkSynchronizeUDCKeywords);
- this.grpCase.Controls.Add(this.chkInsertFinalNewLine);
- this.grpCase.Controls.Add(this.chkTrimTrailngWhiteSpace);
- this.grpCase.Controls.Add(this.grpKeywordCase);
- this.grpCase.Controls.Add(this.chkIdentifierCase);
- this.grpCase.Location = new System.Drawing.Point(3, 14);
- this.grpCase.Name = "grpCase";
- this.grpCase.Size = new System.Drawing.Size(373, 158);
- this.grpCase.TabIndex = 0;
- this.grpCase.TabStop = false;
- this.grpCase.Text = "Document Formatting";
- //
- // tbExample
- //
- this.tbExample.BackColor = System.Drawing.Color.White;
- this.tbExample.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.tbExample.ForeColor = System.Drawing.Color.Red;
- this.tbExample.Location = new System.Drawing.Point(264, 27);
- this.tbExample.Name = "tbExample";
- this.tbExample.ReadOnly = true;
- this.tbExample.Size = new System.Drawing.Size(103, 22);
- this.tbExample.TabIndex = 1;
- this.tbExample.TabStop = false;
- this.tbExample.Text = "FUNCTION";
- //
- // grpKeywordCase
- //
- this.grpKeywordCase.Controls.Add(this.rbTitle);
- this.grpKeywordCase.Controls.Add(this.rbNone);
- this.grpKeywordCase.Controls.Add(this.rbUpper);
- this.grpKeywordCase.Controls.Add(this.rbLower);
- this.grpKeywordCase.Location = new System.Drawing.Point(7, 16);
- this.grpKeywordCase.Name = "grpKeywordCase";
- this.grpKeywordCase.Size = new System.Drawing.Size(237, 36);
- this.grpKeywordCase.TabIndex = 0;
- this.grpKeywordCase.TabStop = false;
- this.grpKeywordCase.Text = "&Keyword Case Synchronization";
- //
- // rbTitle
- //
- this.rbTitle.AutoSize = true;
- this.rbTitle.Location = new System.Drawing.Point(183, 15);
- this.rbTitle.Name = "rbTitle";
- this.rbTitle.Size = new System.Drawing.Size(45, 17);
- this.rbTitle.TabIndex = 3;
- this.rbTitle.TabStop = true;
- this.rbTitle.Text = "&Title";
- this.rbTitle.UseVisualStyleBackColor = true;
- this.rbTitle.CheckedChanged += new System.EventHandler(this.caseChanged);
- //
- // rbNone
- //
- this.rbNone.AutoSize = true;
- this.rbNone.Location = new System.Drawing.Point(6, 15);
- this.rbNone.Name = "rbNone";
- this.rbNone.Size = new System.Drawing.Size(51, 17);
- this.rbNone.TabIndex = 0;
- this.rbNone.TabStop = true;
- this.rbNone.Text = "&None";
- this.rbNone.UseVisualStyleBackColor = true;
- this.rbNone.CheckedChanged += new System.EventHandler(this.caseChanged);
- //
- // rbUpper
- //
- this.rbUpper.AutoSize = true;
- this.rbUpper.Location = new System.Drawing.Point(59, 15);
- this.rbUpper.Name = "rbUpper";
- this.rbUpper.Size = new System.Drawing.Size(62, 17);
- this.rbUpper.TabIndex = 1;
- this.rbUpper.TabStop = true;
- this.rbUpper.Text = "&UPPER";
- this.rbUpper.UseVisualStyleBackColor = true;
- this.rbUpper.CheckedChanged += new System.EventHandler(this.caseChanged);
- //
- // rbLower
- //
- this.rbLower.AutoSize = true;
- this.rbLower.Location = new System.Drawing.Point(127, 15);
- this.rbLower.Name = "rbLower";
- this.rbLower.Size = new System.Drawing.Size(50, 17);
- this.rbLower.TabIndex = 2;
- this.rbLower.TabStop = true;
- this.rbLower.Text = "&lower";
- this.rbLower.UseVisualStyleBackColor = true;
- this.rbLower.CheckedChanged += new System.EventHandler(this.caseChanged);
- //
- // FormattingOptionsControl
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.AutoScroll = true;
- this.Controls.Add(this.panel1);
- this.Name = "FormattingOptionsControl";
- this.Size = new System.Drawing.Size(389, 204);
- this.panel1.ResumeLayout(false);
- this.grpCase.ResumeLayout(false);
- this.grpCase.PerformLayout();
- this.grpKeywordCase.ResumeLayout(false);
- this.grpKeywordCase.PerformLayout();
- this.ResumeLayout(false);
-
- }
-
- #endregion
- private System.Windows.Forms.ToolTip toolTip1;
- private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.GroupBox grpCase;
- private System.Windows.Forms.GroupBox grpKeywordCase;
- private System.Windows.Forms.RadioButton rbTitle;
- private System.Windows.Forms.RadioButton rbNone;
- private System.Windows.Forms.RadioButton rbUpper;
- private System.Windows.Forms.RadioButton rbLower;
- private System.Windows.Forms.CheckBox chkIdentifierCase;
- private System.Windows.Forms.CheckBox chkInsertFinalNewLine;
- private System.Windows.Forms.CheckBox chkTrimTrailngWhiteSpace;
- private System.Windows.Forms.CheckBox chkSynchronizeUDCKeywords;
- private System.Windows.Forms.TextBox tbExample;
- }
-}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/FormattingOptionsControl.cs b/src/VisualStudio/LanguageService/OptionsPages/FormattingOptionsControl.cs
index 1a0c40aa5d..9717c3d21b 100644
--- a/src/VisualStudio/LanguageService/OptionsPages/FormattingOptionsControl.cs
+++ b/src/VisualStudio/LanguageService/OptionsPages/FormattingOptionsControl.cs
@@ -1,95 +1,53 @@
-using System;
-using System.Windows.Forms;
+// Copyright (c) XSharp B.V. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0.
+// See License.txt in the project root for license information.
+using System.Windows;
using XSharpModel;
using XSharp.Settings;
+
namespace XSharp.LanguageService.OptionsPages
{
public partial class FormattingOptionsControl : XSUserControl
{
-
public FormattingOptionsControl()
{
InitializeComponent();
- grpCase.Enabled = true;
- rbUpper.Tag = nameof(KeywordCase.Upper);
- rbLower.Tag = nameof(KeywordCase.Lower);
- rbTitle.Tag = nameof(KeywordCase.Title);
- rbNone.Tag = nameof(KeywordCase.None);
-
- chkSynchronizeUDCKeywords.Tag = nameof(FormattingOptions.UdcCase);
- chkIdentifierCase.Tag = nameof(FormattingOptions.IdentifierCase);
- chkInsertFinalNewLine.Tag = nameof(FormattingOptions.InsertFinalNewLine);
- chkTrimTrailngWhiteSpace.Tag = nameof(FormattingOptions.TrimTrailingWhiteSpace);
-
}
-
internal override void ReadValues(object options)
{
base.ReadValues(options);
switch (((FormattingOptions)options).KeywordCase)
{
- case KeywordCase.Upper:
- rbUpper.Checked = true;
- break;
- case KeywordCase.Lower:
- rbLower.Checked = true;
- break;
- case KeywordCase.Title:
- rbTitle.Checked = true;
- break;
- default:
- rbNone.Checked = true;
- break;
+ case KeywordCase.Upper: rbUpper.IsChecked = true; break;
+ case KeywordCase.Lower: rbLower.IsChecked = true; break;
+ case KeywordCase.Title: rbTitle.IsChecked = true; break;
+ default: rbNone.IsChecked = true; break;
}
- showExample();
+ ShowExample();
}
+
internal override void SaveValues(object options)
{
base.SaveValues(options);
- var controls = new RadioButton[] { rbLower, rbUpper, rbNone, rbTitle };
- foreach (var rb in controls)
- {
- var tag = rb.Tag;
- if (tag is string strTag && rb.Checked)
- {
- switch (strTag)
- {
- case nameof(KeywordCase.None):
- case nameof(KeywordCase.Upper):
- case nameof(KeywordCase.Lower):
- case nameof(KeywordCase.Title):
- ((FormattingOptions) options).KeywordCase = (KeywordCase)Enum.Parse(typeof(KeywordCase), strTag);
- break;
- }
- }
- }
+ var opts = (FormattingOptions)options;
+ if (rbUpper.IsChecked == true) opts.KeywordCase = KeywordCase.Upper;
+ else if (rbLower.IsChecked == true) opts.KeywordCase = KeywordCase.Lower;
+ else if (rbTitle.IsChecked == true) opts.KeywordCase = KeywordCase.Title;
+ else opts.KeywordCase = KeywordCase.None;
}
-
- private void caseChanged(object sender, EventArgs e)
+ private void OnCaseChanged(object sender, RoutedEventArgs e)
{
- showExample();
+ ShowExample();
}
- void showExample()
- {
- if (rbUpper.Checked)
- {
- tbExample.Text = "FUNCTION";
- }
- else if (rbLower.Checked)
- {
- tbExample.Text = "function";
- }
- else if (rbNone.Checked)
- {
- tbExample.Text = "FuNcTiOn";
- }
- else if (rbTitle.Checked)
- {
- tbExample.Text = "Function";
- }
+ private void ShowExample()
+ {
+ if (rbUpper.IsChecked == true) tbExample.Text = "FUNCTION";
+ else if (rbLower.IsChecked == true) tbExample.Text = "function";
+ else if (rbNone.IsChecked == true) tbExample.Text = "FuNcTiOn";
+ else if (rbTitle.IsChecked == true) tbExample.Text = "Function";
}
}
}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/FormattingOptionsControl.xaml b/src/VisualStudio/LanguageService/OptionsPages/FormattingOptionsControl.xaml
new file mode 100644
index 0000000000..5c5b0503a4
--- /dev/null
+++ b/src/VisualStudio/LanguageService/OptionsPages/FormattingOptionsControl.xaml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.Designer.cs b/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.Designer.cs
deleted file mode 100644
index df25b5918c..0000000000
--- a/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.Designer.cs
+++ /dev/null
@@ -1,215 +0,0 @@
-namespace XSharp.LanguageService.OptionsPages
-{
- partial class GeneratorOptionsControl
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.lblPublic = new System.Windows.Forms.Label();
- this.rbPublic = new System.Windows.Forms.RadioButton();
- this.rbExport = new System.Windows.Forms.RadioButton();
- this.rbNone = new System.Windows.Forms.RadioButton();
- this.label1 = new System.Windows.Forms.Label();
- this.rbPrivate = new System.Windows.Forms.RadioButton();
- this.rbHidden = new System.Windows.Forms.RadioButton();
- this.chkShowXMLComments = new System.Windows.Forms.CheckBox();
- this.grpCodeGenerator = new System.Windows.Forms.GroupBox();
- this.grpPrivate = new System.Windows.Forms.GroupBox();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.panel1 = new System.Windows.Forms.Panel();
- this.grpCodeGenerator.SuspendLayout();
- this.grpPrivate.SuspendLayout();
- this.groupBox1.SuspendLayout();
- this.panel1.SuspendLayout();
- this.SuspendLayout();
- //
- // lblPublic
- //
- this.lblPublic.AutoSize = true;
- this.lblPublic.Location = new System.Drawing.Point(15, 50);
- this.lblPublic.Name = "lblPublic";
- this.lblPublic.Size = new System.Drawing.Size(143, 13);
- this.lblPublic.TabIndex = 1;
- this.lblPublic.Text = "Modifier for Public properties:";
- this.toolTip1.SetToolTip(this.lblPublic, "Specify the modifier the code generators should use for public properties");
- //
- // rbPublic
- //
- this.rbPublic.AutoSize = true;
- this.rbPublic.Location = new System.Drawing.Point(17, 8);
- this.rbPublic.Name = "rbPublic";
- this.rbPublic.Size = new System.Drawing.Size(54, 17);
- this.rbPublic.TabIndex = 0;
- this.rbPublic.TabStop = true;
- this.rbPublic.Text = "&Public";
- this.toolTip1.SetToolTip(this.rbPublic, "Use PUBLIC as modifier");
- this.rbPublic.UseVisualStyleBackColor = true;
- //
- // rbExport
- //
- this.rbExport.AutoSize = true;
- this.rbExport.Location = new System.Drawing.Point(78, 8);
- this.rbExport.Name = "rbExport";
- this.rbExport.Size = new System.Drawing.Size(55, 17);
- this.rbExport.TabIndex = 1;
- this.rbExport.Text = "E&xport";
- this.toolTip1.SetToolTip(this.rbExport, "Use EXPORT as modifier");
- this.rbExport.UseVisualStyleBackColor = true;
- //
- // rbNone
- //
- this.rbNone.AutoSize = true;
- this.rbNone.Location = new System.Drawing.Point(140, 9);
- this.rbNone.Name = "rbNone";
- this.rbNone.Size = new System.Drawing.Size(51, 17);
- this.rbNone.TabIndex = 2;
- this.rbNone.Text = "&None";
- this.toolTip1.SetToolTip(this.rbNone, "Use modifier for public properties and methods");
- this.rbNone.UseVisualStyleBackColor = true;
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(15, 77);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(147, 13);
- this.label1.TabIndex = 3;
- this.label1.Text = "Modifier for Private properties:";
- this.toolTip1.SetToolTip(this.label1, "Specify the modifier the code generator should use for private properties");
- //
- // rbPrivate
- //
- this.rbPrivate.AutoSize = true;
- this.rbPrivate.Location = new System.Drawing.Point(17, 10);
- this.rbPrivate.Name = "rbPrivate";
- this.rbPrivate.Size = new System.Drawing.Size(58, 17);
- this.rbPrivate.TabIndex = 0;
- this.rbPrivate.TabStop = true;
- this.rbPrivate.Text = "P&rivate";
- this.toolTip1.SetToolTip(this.rbPrivate, "Use PRIVATE as modifier");
- this.rbPrivate.UseVisualStyleBackColor = true;
- //
- // rbHidden
- //
- this.rbHidden.AutoSize = true;
- this.rbHidden.Location = new System.Drawing.Point(78, 10);
- this.rbHidden.Name = "rbHidden";
- this.rbHidden.Size = new System.Drawing.Size(59, 17);
- this.rbHidden.TabIndex = 1;
- this.rbHidden.Text = "&Hidden";
- this.toolTip1.SetToolTip(this.rbHidden, "Use HIDDEN as modifier");
- this.rbHidden.UseVisualStyleBackColor = true;
- //
- // chkShowXMLComments
- //
- this.chkShowXMLComments.AutoSize = true;
- this.chkShowXMLComments.Location = new System.Drawing.Point(20, 18);
- this.chkShowXMLComments.Name = "chkShowXMLComments";
- this.chkShowXMLComments.Size = new System.Drawing.Size(341, 17);
- this.chkShowXMLComments.TabIndex = 0;
- this.chkShowXMLComments.Text = "Show XML comments in generated source code for Goto Definition";
- this.chkShowXMLComments.UseVisualStyleBackColor = true;
- //
- // grpCodeGenerator
- //
- this.grpCodeGenerator.Controls.Add(this.grpPrivate);
- this.grpCodeGenerator.Controls.Add(this.groupBox1);
- this.grpCodeGenerator.Controls.Add(this.label1);
- this.grpCodeGenerator.Controls.Add(this.lblPublic);
- this.grpCodeGenerator.Controls.Add(this.chkShowXMLComments);
- this.grpCodeGenerator.Location = new System.Drawing.Point(3, 3);
- this.grpCodeGenerator.Name = "grpCodeGenerator";
- this.grpCodeGenerator.Size = new System.Drawing.Size(385, 119);
- this.grpCodeGenerator.TabIndex = 0;
- this.grpCodeGenerator.TabStop = false;
- this.grpCodeGenerator.Text = "Code Generator";
- //
- // grpPrivate
- //
- this.grpPrivate.Controls.Add(this.rbPrivate);
- this.grpPrivate.Controls.Add(this.rbHidden);
- this.grpPrivate.Location = new System.Drawing.Point(165, 69);
- this.grpPrivate.Name = "grpPrivate";
- this.grpPrivate.Size = new System.Drawing.Size(207, 33);
- this.grpPrivate.TabIndex = 4;
- this.grpPrivate.TabStop = false;
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.rbPublic);
- this.groupBox1.Controls.Add(this.rbExport);
- this.groupBox1.Controls.Add(this.rbNone);
- this.groupBox1.Location = new System.Drawing.Point(165, 40);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(203, 29);
- this.groupBox1.TabIndex = 2;
- this.groupBox1.TabStop = false;
- //
- // panel1
- //
- this.panel1.Controls.Add(this.grpCodeGenerator);
- this.panel1.Location = new System.Drawing.Point(0, 0);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(391, 158);
- this.panel1.TabIndex = 1;
- //
- // GeneratorOptionsControl
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.AutoScroll = true;
- this.Controls.Add(this.panel1);
- this.Name = "GeneratorOptionsControl";
- this.Size = new System.Drawing.Size(395, 173);
- this.grpCodeGenerator.ResumeLayout(false);
- this.grpCodeGenerator.PerformLayout();
- this.grpPrivate.ResumeLayout(false);
- this.grpPrivate.PerformLayout();
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.panel1.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
-
- #endregion
- private System.Windows.Forms.ToolTip toolTip1;
- private System.Windows.Forms.GroupBox grpCodeGenerator;
- private System.Windows.Forms.CheckBox chkShowXMLComments;
- private System.Windows.Forms.RadioButton rbNone;
- private System.Windows.Forms.RadioButton rbExport;
- private System.Windows.Forms.RadioButton rbPublic;
- private System.Windows.Forms.Label lblPublic;
- private System.Windows.Forms.GroupBox grpPrivate;
- private System.Windows.Forms.RadioButton rbPrivate;
- private System.Windows.Forms.RadioButton rbHidden;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Panel panel1;
- }
-}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.cs b/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.cs
index 4f03dc3156..e162dd841d 100644
--- a/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.cs
+++ b/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.cs
@@ -1,7 +1,9 @@
-using System;
-using System.Windows.Forms;
+// Copyright (c) XSharp B.V. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0.
+// See License.txt in the project root for license information.
using XSharpModel;
using XSharp.Settings;
+
namespace XSharp.LanguageService.OptionsPages
{
public partial class GeneratorOptionsControl : XSUserControl
@@ -9,65 +11,34 @@ public partial class GeneratorOptionsControl : XSUserControl
public GeneratorOptionsControl()
{
InitializeComponent();
- chkShowXMLComments.Tag = nameof(GeneratorOptions.ShowXmlComments);
- rbExport.Tag = nameof(PublicStyle.Export);
- rbPublic.Tag = nameof(PublicStyle.Public);
- rbNone.Tag = nameof(PublicStyle.None);
- rbPrivate.Tag = nameof(PrivateStyle.Private);
- rbHidden.Tag = nameof(PrivateStyle.Hidden);
}
internal override void ReadValues(object options)
{
- GeneratorOptionsPage OurOptionsPage = (GeneratorOptionsPage)optionPage;
base.ReadValues(options);
-
- switch (OurOptionsPage.Options.PublicStyle)
+ var page = (GeneratorOptionsPage)optionPage;
+ switch ((PublicStyle)page.Options.PublicStyle)
{
- case 1:
- rbExport.Checked = true;
- break;
- case 2:
- rbNone.Checked = true;
- break;
- default:
- rbPublic.Checked = true;
- break;
+ case PublicStyle.Export: rbExport.IsChecked = true; break;
+ case PublicStyle.None: rbNone.IsChecked = true; break;
+ default: rbPublic.IsChecked = true; break;
}
- switch (OurOptionsPage.Options.PrivateStyle)
+ switch ((PrivateStyle)page.Options.PrivateStyle)
{
- case 1:
- rbHidden.Checked = true;
- break;
- default:
- rbPrivate.Checked = true;
- break;
+ case PrivateStyle.Hidden: rbHidden.IsChecked = true; break;
+ default: rbPrivate.IsChecked = true; break;
}
}
+
internal override void SaveValues(object options)
{
base.SaveValues(options);
- var controls = new RadioButton[] { rbExport, rbNone, rbPublic, rbPrivate, rbHidden };
- foreach (var rb in controls)
- {
- var tag = rb.Tag;
- if (tag is string strTag && rb.Checked)
- {
- switch (strTag)
- {
- case nameof(PublicStyle.Export):
- case nameof(PublicStyle.Public):
- case nameof(PublicStyle.None):
- ((GeneratorOptions) options).PublicStyle = (int)(PublicStyle)Enum.Parse(typeof(PublicStyle), strTag);
- break;
- case nameof(PrivateStyle.Private):
- case nameof(PrivateStyle.Hidden):
- ((GeneratorOptions)options).PrivateStyle = (int)(PrivateStyle)Enum.Parse(typeof(PrivateStyle), strTag);
- break;
- }
- }
- }
-
+ var opts = (GeneratorOptions)options;
+ if (rbExport.IsChecked == true) opts.PublicStyle = (int)PublicStyle.Export;
+ else if (rbNone.IsChecked == true) opts.PublicStyle = (int)PublicStyle.None;
+ else opts.PublicStyle = (int)PublicStyle.Public;
+ if (rbHidden.IsChecked == true) opts.PrivateStyle = (int)PrivateStyle.Hidden;
+ else opts.PrivateStyle = (int)PrivateStyle.Private;
}
}
}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.xaml b/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.xaml
new file mode 100644
index 0000000000..c5efb64da0
--- /dev/null
+++ b/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.xaml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/VisualStudio/LanguageService/OptionsPages/IndentingOptionsControl.Designer.cs b/src/VisualStudio/LanguageService/OptionsPages/IndentingOptionsControl.Designer.cs
deleted file mode 100644
index a6b69f47bc..0000000000
--- a/src/VisualStudio/LanguageService/OptionsPages/IndentingOptionsControl.Designer.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-namespace XSharp.LanguageService.OptionsPages
-{
- partial class IndentingOptionsControl
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Windows.Forms.Label label1;
- this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.panel1 = new System.Windows.Forms.Panel();
- this.treeIndentStyle = new System.Windows.Forms.TreeView();
- this.codeSample = new System.Windows.Forms.RichTextBox();
- label1 = new System.Windows.Forms.Label();
- this.panel1.SuspendLayout();
- this.SuspendLayout();
- //
- // label1
- //
- label1.Location = new System.Drawing.Point(0, 0);
- label1.Name = "label1";
- label1.Size = new System.Drawing.Size(100, 23);
- label1.TabIndex = 0;
- //
- // panel1
- //
- this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.panel1.Controls.Add(this.treeIndentStyle);
- this.panel1.Controls.Add(this.codeSample);
- this.panel1.Location = new System.Drawing.Point(0, 0);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(425, 311);
- this.panel1.TabIndex = 0;
- //
- // treeIndentStyle
- //
- this.treeIndentStyle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.treeIndentStyle.FullRowSelect = true;
- this.treeIndentStyle.HideSelection = false;
- this.treeIndentStyle.Location = new System.Drawing.Point(12, 14);
- this.treeIndentStyle.Name = "treeIndentStyle";
- this.treeIndentStyle.ShowLines = false;
- this.treeIndentStyle.ShowRootLines = false;
- this.treeIndentStyle.Size = new System.Drawing.Size(401, 129);
- this.treeIndentStyle.TabIndex = 3;
- //
- // codeSample
- //
- this.codeSample.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.codeSample.BackColor = System.Drawing.SystemColors.Window;
- this.codeSample.Location = new System.Drawing.Point(12, 148);
- this.codeSample.Margin = new System.Windows.Forms.Padding(2);
- this.codeSample.Name = "codeSample";
- this.codeSample.ReadOnly = true;
- this.codeSample.Size = new System.Drawing.Size(401, 152);
- this.codeSample.TabIndex = 1;
- this.codeSample.Text = "";
- //
- // IndentingOptionsControl
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.AutoScroll = true;
- this.Controls.Add(this.panel1);
- this.Name = "IndentingOptionsControl";
- this.Size = new System.Drawing.Size(440, 327);
- this.panel1.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
-
- #endregion
- private System.Windows.Forms.ToolTip toolTip1;
- private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.TreeView treeIndentStyle;
- private System.Windows.Forms.RichTextBox codeSample;
- }
-}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/IndentingOptionsControl.cs b/src/VisualStudio/LanguageService/OptionsPages/IndentingOptionsControl.cs
index 22de695191..1653894c33 100644
--- a/src/VisualStudio/LanguageService/OptionsPages/IndentingOptionsControl.cs
+++ b/src/VisualStudio/LanguageService/OptionsPages/IndentingOptionsControl.cs
@@ -1,163 +1,154 @@
-using System;
-using System.Windows.Forms;
-using XSharpModel;
+// Copyright (c) XSharp B.V. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0.
+// See License.txt in the project root for license information.
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.IO;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+
namespace XSharp.LanguageService.OptionsPages
{
public partial class IndentingOptionsControl : XSUserControl
{
- private IndentingOptions Options => (IndentingOptions) optionPage.AutomationObject;
+ private readonly ObservableCollection _items = new ObservableCollection();
+
+ private static readonly string RtfPrefix =
+ @"{\rtf1\deftab400{\colortbl ;\red0\green77\blue187;}";
+
public IndentingOptionsControl()
{
InitializeComponent();
- //
- treeIndentStyle.CheckBoxes = true;
- var tvi = new TreeNode("Indent entities inside namespace");
- tvi.Tag = new string[] { "IndentNamespace",
- @"\cf1 BEGIN NAMESPACE \cf0 MyNs\par\cf1{tab} CLASS \cf0 MyClass \par \par {tab} \cf1 END CLASS \cf0\par\cf1 END NAMESPACE\par}" };
- this.treeIndentStyle.Nodes.Add(tvi);
- //
- tvi = new TreeNode("Indent multiline members inside types");
- tvi.Tag = new string[] { "IndentEntityContent",
- @"\cf1 CLASS \cf0 foo\par\par\cf1{tab} METHOD \cf0 m1() \cf1 AS VOID\cf0\par\par\cf1{tab} CONSTRUCTOR \cf0 m1()\cf0\par}"};
- this.treeIndentStyle.Nodes.Add(tvi);
+ _items.Add(new IndentItem("IndentNamespace",
+ "Indent entities inside namespace",
+ @"\cf1 BEGIN NAMESPACE \cf0 MyNs\par\cf1{tab} CLASS \cf0 MyClass \par \par {tab} \cf1 END CLASS \cf0\par\cf1 END NAMESPACE\par}"));
+ _items.Add(new IndentItem("IndentEntityContent",
+ "Indent multiline members inside types",
+ @"\cf1 CLASS \cf0 foo\par\par\cf1{tab} METHOD \cf0 m1() \cf1 AS VOID\cf0\par\par\cf1{tab} CONSTRUCTOR \cf0 m1()\cf0\par}"));
+ _items.Add(new IndentItem("IndentFieldContent",
+ "Indent single line members inside types",
+ @"\cf1 CLASS \cf0 foo\par\cf1{tab} PUBLIC \cf0 x \cf1 AS INT\cf0\par\par\cf1{tab} PROPERTY \cf0 y \cf1 AS STRING AUTO \cf0\par}"));
+ _items.Add(new IndentItem("IndentBlockContent",
+ "Indent statements inside entities",
+ @"\cf1 FUNCTION \cf0 foo\par\cf1{tab} LOCAL \cf0 x \cf1 AS INT\cf0\par\cf1{tab} LOCAL \cf0 y \cf1 AS INT\cf0\par}"));
+ _items.Add(new IndentItem("IndentCaseLabel",
+ "Indent case label",
+ @"\cf1 DO CASE \par\cf1{tab} CASE \cf0 x == 1\par\par\cf1{tab} CASE \cf0 x == 2\par}"));
+ _items.Add(new IndentItem("IndentCaseContent",
+ "Indent statements inside case block",
+ @"\cf1 DO CASE \par\cf1\tab CASE \cf0 x == 1\par\cf1\tab{tab} nop\par\cf1\tab{tab} nop\cf0\par}"));
+ _items.Add(new IndentItem("IndentMultiLines",
+ "Indent continuing lines",
+ @"\cf1 FUNCTION \cf0 foo( \cf0 x \cf1 AS INT ; \par{tab}\cf0 y \cf1 AS INT \cf0 ;\par{tab} \cf0 z \cf1 AS INT \cf0) \par}"));
+ _items.Add(new IndentItem("IndentPreprocessorLines",
+ "Indent preprocessor lines",
+ @"\cf1 CLASS \cf0 foo\par{tab}\cf0#region FIELDS \par\cf1\tab PUBLIC \cf0 x \cf1 AS INT\cf0\par{tab} \cf0#endregion\par\cf1\tab METHOD \cf0 m1() \cf1 AS VOID\cf0\par}"));
- tvi = new TreeNode("Indent single line members inside types");
- tvi.Tag = new string[] { "IndentFieldContent",
- @"\cf1 CLASS \cf0 foo\par\cf1{tab} PUBLIC \cf0 x \cf1 AS INT\cf0\par\par\cf1{tab} PROPERTY \cf0 y \cf1 AS STRING AUTO \cf0\par}"};
- this.treeIndentStyle.Nodes.Add(tvi);
- //
- tvi = new TreeNode("Indent statements inside entities");
- tvi.Tag = new string[] { "IndentBlockContent",
- @"\cf1 FUNCTION \cf0 foo\par\cf1{tab} LOCAL \cf0 x \cf1 AS INT\cf0\par\cf1{tab} LOCAL \cf0 y \cf1 AS INT\cf0\par}" };
- this.treeIndentStyle.Nodes.Add(tvi);
- //
- tvi = new TreeNode("Indent case label");
- tvi.Tag = new string[] { "IndentCaseLabel",
- @"\cf1 DO CASE \par\cf1{tab} CASE \cf0 x == 1\par\par\cf1{tab} CASE \cf0 x == 2\par}"};
- this.treeIndentStyle.Nodes.Add(tvi);
- //
- tvi = new TreeNode("Indent statements inside case block");
- tvi.Tag = new string[] { "IndentCaseContent",
- @"\cf1 DO CASE \par\cf1\tab CASE \cf0 x == 1\par\cf1\tab{tab} nop\par\cf1\tab{tab} nop\cf0\par}"};
- this.treeIndentStyle.Nodes.Add(tvi);
- //
- tvi = new TreeNode("Indent continuing Lines");
- tvi.Tag = new string[] { "IndentMultiLines",
- @"\cf1 FUNCTION \cf0 foo( \cf0 x \cf1 AS INT ; \par{tab}\cf0 y \cf1 AS INT \cf0 ;\par{tab} \cf0 z \cf1 AS INT \cf0) \par}" };
- this.treeIndentStyle.Nodes.Add(tvi);
- //
+ foreach (var item in _items)
+ item.PropertyChanged += (s, e) =>
+ {
+ if (e.PropertyName == nameof(IndentItem.IsChecked))
+ ShowCodeSample(_listView.SelectedItem as IndentItem);
+ };
- tvi = new TreeNode("Indent preprocessor lines");
- tvi.Tag = new string[] { "IndentPreprocessorLines",
- @"\cf1 CLASS \cf0 foo\par{tab}\cf0#region FIELDS \par\cf1\tab PUBLIC \cf0 x \cf1 AS INT\cf0\par{tab} \cf0#endregion\par\cf1\tab METHOD \cf0 m1() \cf1 AS VOID\cf0\par}"};
- this.treeIndentStyle.Nodes.Add(tvi);
- this.treeIndentStyle.AfterCheck += TreeShowNode;
- this.treeIndentStyle.AfterSelect += TreeShowNode;
- this.treeIndentStyle.SelectedNode = treeIndentStyle.Nodes[0];
+ _listView.ItemsSource = _items;
+ if (_items.Count > 0)
+ _listView.SelectedIndex = 0;
}
- private void TreeShowNode(object sender, TreeViewEventArgs e)
+ private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
- ShowCodeSample(e.Node);
+ ShowCodeSample(_listView.SelectedItem as IndentItem);
}
- internal override void ReadValues(object options)
+ private void ShowCodeSample(IndentItem item)
{
- base.ReadValues(options);
- foreach (TreeNode tvi in this.treeIndentStyle.Nodes)
- {
- ReadItem(tvi);
- }
+ if (item == null) return;
+ var rtf = item.RtfCode;
+ if (item.IsChecked)
+ rtf = rtf.Replace("{tab}", @"\tab");
+ else
+ rtf = rtf.Replace("{tab}", "");
+ if (rtf.EndsWith("}"))
+ rtf = RtfPrefix + rtf;
+ SetRtf(rtf);
}
- private void ReadItem(TreeNode tvi)
+ private void SetRtf(string rtf)
{
- var tag = tvi.Tag;
- if (tag is string[] tags)
+ try
{
- // The Tag is a String[] with 3 elements :
- // 0 : Property Name
- // 1 : Text if Checked
- // 2 : Text if unChecked
- if (tags.Length > 0)
+ var bytes = Encoding.ASCII.GetBytes(rtf);
+ using (var ms = new MemoryStream(bytes))
{
- var strTag = tags[0];
- var prop = typeof(IndentingOptions).GetProperty(strTag);
- if (prop != null)
- {
- var val = prop.GetValue(Options);
- if (val is bool bValue)
- {
- tvi.Checked = bValue;
- }
- }
+ var range = new TextRange(codeSample.Document.ContentStart, codeSample.Document.ContentEnd);
+ range.Load(ms, DataFormats.Rtf);
}
}
+ catch
+ {
+ // ignore RTF parsing errors
+ }
}
- internal override void SaveValues(object options)
+ internal override void ReadValues(object options)
{
- base.SaveValues(options);
- foreach (TreeNode tvi in this.treeIndentStyle.Nodes)
+ base.ReadValues(options);
+ var opts = (IndentingOptions)options;
+ foreach (var item in _items)
{
- SaveItem(tvi);
+ var prop = typeof(IndentingOptions).GetProperty(item.PropertyName);
+ if (prop?.GetValue(opts) is bool b)
+ item.IsChecked = b;
}
+ ShowCodeSample(_listView.SelectedItem as IndentItem);
}
- private void SaveItem(TreeNode tvi)
+ internal override void SaveValues(object options)
{
- var tag = tvi.Tag;
- if (tag is string[] tags)
+ base.SaveValues(options);
+ var opts = (IndentingOptions)options;
+ foreach (var item in _items)
{
- // The Tag is a String[] with 3 elements :
- // 0 : Property Name
- // 1 : Text if Checked
- // 2 : Text if unChecked
- if (tags.Length > 0)
- {
- var strTag = tags[0];
- var prop = typeof(IndentingOptions).GetProperty(strTag);
- if (prop != null && prop.SetMethod != null)
- {
- prop.SetValue(Options, tvi.Checked);
- }
- }
+ var prop = typeof(IndentingOptions).GetProperty(item.PropertyName);
+ prop?.SetValue(opts, item.IsChecked);
}
}
+ }
- private void ShowCodeSample( TreeNode node)
+ internal sealed class IndentItem : INotifyPropertyChanged
+ {
+ private bool _isChecked;
+
+ public string PropertyName { get; }
+ public string Label { get; }
+ public string RtfCode { get; }
+
+ public bool IsChecked
{
- var tag = node.Tag;
- var isChecked = node.Checked;
- if (tag is string[] tags)
+ get => _isChecked;
+ set
{
- // The Tag is a String[] with 3 elements :
- // 0 : Property Name
- // 1 : Text "{tab}" for possible tabs
- if (tags.Length > 1)
+ if (_isChecked != value)
{
- var strTag = tags[1];
- if (isChecked)
- strTag = strTag.Replace("{tab}", @"\tab");
- else
- strTag = strTag.Replace("{tab}", "");
- //
- if (strTag.EndsWith("}"))
- codeSample.Rtf = RTFPrefix + strTag;
- else
- codeSample.Text = strTag;
+ _isChecked = value;
+ OnPropertyChanged();
}
}
}
- private string RTFPrefix
+ public IndentItem(string propertyName, string label, string rtfCode)
{
- // Put it as a Getter, so we may later try to retrieve the X# Color definition for Keywords
- // instead of a constant
- get
- {
- return @"{\rtf1\deftab400{\colortbl ;\red0\green77\blue187;}";
- }
+ PropertyName = propertyName;
+ Label = label;
+ RtfCode = rtfCode;
}
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ private void OnPropertyChanged([CallerMemberName] string name = null)
+ => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/IndentingOptionsControl.xaml b/src/VisualStudio/LanguageService/OptionsPages/IndentingOptionsControl.xaml
new file mode 100644
index 0000000000..b1c7083b45
--- /dev/null
+++ b/src/VisualStudio/LanguageService/OptionsPages/IndentingOptionsControl.xaml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.Designer.cs b/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.Designer.cs
deleted file mode 100644
index 00cc98f686..0000000000
--- a/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.Designer.cs
+++ /dev/null
@@ -1,246 +0,0 @@
-namespace XSharp.LanguageService.OptionsPages
-{
- partial class IntellisenseOptionsControl
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Windows.Forms.Label label1;
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(IntellisenseOptionsControl));
- this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.chkShowMembersOfCurrentType = new System.Windows.Forms.CheckBox();
- this.chkSortNavBar = new System.Windows.Forms.CheckBox();
- this.chkIncludeFields = new System.Windows.Forms.CheckBox();
- this.chkKeywordsInAll = new System.Windows.Forms.CheckBox();
- this.chkCompletionListtabs = new System.Windows.Forms.CheckBox();
- this.chkExcludeMembersFromOtherfiles = new System.Windows.Forms.CheckBox();
- this.chkUseMicrosoftSQLite = new System.Windows.Forms.CheckBox();
- this.panel1 = new System.Windows.Forms.Panel();
- this.btnShowMeTheMagic = new System.Windows.Forms.Button();
- this.grpNavigationBars = new System.Windows.Forms.GroupBox();
- this.grpCompletionListTabs = new System.Windows.Forms.GroupBox();
- this.btnReset = new System.Windows.Forms.Button();
- this.commitChars = new System.Windows.Forms.TextBox();
- label1 = new System.Windows.Forms.Label();
- this.panel1.SuspendLayout();
- this.grpNavigationBars.SuspendLayout();
- this.grpCompletionListTabs.SuspendLayout();
- this.SuspendLayout();
- //
- // label1
- //
- label1.AutoSize = true;
- label1.Location = new System.Drawing.Point(10, 63);
- label1.Name = "label1";
- label1.Size = new System.Drawing.Size(270, 13);
- label1.TabIndex = 2;
- label1.Text = "Commit completion list by typing the following characters";
- //
- // chkShowMembersOfCurrentType
- //
- this.chkShowMembersOfCurrentType.AutoSize = true;
- this.chkShowMembersOfCurrentType.Location = new System.Drawing.Point(13, 57);
- this.chkShowMembersOfCurrentType.Name = "chkShowMembersOfCurrentType";
- this.chkShowMembersOfCurrentType.Size = new System.Drawing.Size(335, 17);
- this.chkShowMembersOfCurrentType.TabIndex = 2;
- this.chkShowMembersOfCurrentType.Text = "Members combobox shows members of current selected type only";
- this.toolTip1.SetToolTip(this.chkShowMembersOfCurrentType, "If you select this then the combox on the right hand side will only show members " +
- "of the current selected type. Also the member names will no longer be prefixed w" +
- "ith the typenames.");
- this.chkShowMembersOfCurrentType.UseVisualStyleBackColor = true;
- //
- // chkSortNavBar
- //
- this.chkSortNavBar.AutoSize = true;
- this.chkSortNavBar.Location = new System.Drawing.Point(13, 38);
- this.chkSortNavBar.Name = "chkSortNavBar";
- this.chkSortNavBar.Size = new System.Drawing.Size(116, 17);
- this.chkSortNavBar.TabIndex = 1;
- this.chkSortNavBar.Text = "Sort Items by name";
- this.toolTip1.SetToolTip(this.chkSortNavBar, "If you enable this then the items in the comboboxes on the navigation bar will be" +
- " sorted by name. Otherwise they will appear in the order in which they appear in" +
- " the source code.");
- this.chkSortNavBar.UseVisualStyleBackColor = true;
- //
- // chkIncludeFields
- //
- this.chkIncludeFields.AutoSize = true;
- this.chkIncludeFields.Location = new System.Drawing.Point(13, 17);
- this.chkIncludeFields.Name = "chkIncludeFields";
- this.chkIncludeFields.Size = new System.Drawing.Size(228, 17);
- this.chkIncludeFields.TabIndex = 0;
- this.chkIncludeFields.Text = "Include fields (instance variables) && defines";
- this.toolTip1.SetToolTip(this.chkIncludeFields, "When you enable this then the combo box on the right hand side of the navigation " +
- "bar will also include fields and defines");
- this.chkIncludeFields.UseVisualStyleBackColor = true;
- //
- // chkKeywordsInAll
- //
- this.chkKeywordsInAll.AutoSize = true;
- this.chkKeywordsInAll.Location = new System.Drawing.Point(13, 39);
- this.chkKeywordsInAll.Name = "chkKeywordsInAll";
- this.chkKeywordsInAll.Size = new System.Drawing.Size(168, 17);
- this.chkKeywordsInAll.TabIndex = 1;
- this.chkKeywordsInAll.Text = "Add &Keywords to the mainTab";
- this.toolTip1.SetToolTip(this.chkKeywordsInAll, "If you organize the Completion lists in tabs, this controls if keywords are added" +
- " to the main tab");
- this.chkKeywordsInAll.UseVisualStyleBackColor = true;
- //
- // chkCompletionListtabs
- //
- this.chkCompletionListtabs.AutoSize = true;
- this.chkCompletionListtabs.Location = new System.Drawing.Point(13, 18);
- this.chkCompletionListtabs.Name = "chkCompletionListtabs";
- this.chkCompletionListtabs.Size = new System.Drawing.Size(334, 17);
- this.chkCompletionListtabs.TabIndex = 0;
- this.chkCompletionListtabs.Text = "Organize in &tabs with different item types (properties, methods etc)";
- this.toolTip1.SetToolTip(this.chkCompletionListtabs, "This organizes your completionlists in tabs, to make it easier to find a method o" +
- "r property in long completionlists");
- this.chkCompletionListtabs.UseVisualStyleBackColor = true;
- //
- // chkExcludeMembersFromOtherfiles
- //
- this.chkExcludeMembersFromOtherfiles.AutoSize = true;
- this.chkExcludeMembersFromOtherfiles.Location = new System.Drawing.Point(13, 76);
- this.chkExcludeMembersFromOtherfiles.Name = "chkExcludeMembersFromOtherfiles";
- this.chkExcludeMembersFromOtherfiles.Size = new System.Drawing.Size(270, 17);
- this.chkExcludeMembersFromOtherfiles.TabIndex = 3;
- this.chkExcludeMembersFromOtherfiles.Text = "Exclude members from other files (for partial classes)";
- this.toolTip1.SetToolTip(this.chkExcludeMembersFromOtherfiles, "If you select this then the combox on the right hand side will only show members " +
- "of the current selected type and only from the current file.");
- this.chkExcludeMembersFromOtherfiles.UseVisualStyleBackColor = true;
- //
- // chkUseMicrosoftSQLite
- //
- this.chkUseMicrosoftSQLite.AutoSize = true;
- this.chkUseMicrosoftSQLite.Location = new System.Drawing.Point(13, 99);
- this.chkUseMicrosoftSQLite.Name = "chkUseMicrosoftSQLite";
- this.chkUseMicrosoftSQLite.Size = new System.Drawing.Size(339, 17);
- this.chkUseMicrosoftSQLite.TabIndex = 4;
- this.chkUseMicrosoftSQLite.Text = "Use the Microsoft.Data.SQLite engine for the intellisense database";
- this.toolTip1.SetToolTip(this.chkUseMicrosoftSQLite, resources.GetString("chkUseMicrosoftSQLite.ToolTip"));
- this.chkUseMicrosoftSQLite.UseVisualStyleBackColor = true;
- //
- // panel1
- //
- this.panel1.Controls.Add(this.btnShowMeTheMagic);
- this.panel1.Controls.Add(this.grpNavigationBars);
- this.panel1.Controls.Add(this.grpCompletionListTabs);
- this.panel1.Location = new System.Drawing.Point(0, 0);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(381, 282);
- this.panel1.TabIndex = 0;
- //
- // btnShowMeTheMagic
- //
- this.btnShowMeTheMagic.Location = new System.Drawing.Point(262, 249);
- this.btnShowMeTheMagic.Name = "btnShowMeTheMagic";
- this.btnShowMeTheMagic.Size = new System.Drawing.Size(114, 23);
- this.btnShowMeTheMagic.TabIndex = 2;
- this.btnShowMeTheMagic.Text = "Open Sesame";
- this.btnShowMeTheMagic.UseVisualStyleBackColor = true;
- this.btnShowMeTheMagic.Click += new System.EventHandler(this.btnShowMeTheMagic_Click);
- //
- // grpNavigationBars
- //
- this.grpNavigationBars.Controls.Add(this.chkUseMicrosoftSQLite);
- this.grpNavigationBars.Controls.Add(this.chkExcludeMembersFromOtherfiles);
- this.grpNavigationBars.Controls.Add(this.chkShowMembersOfCurrentType);
- this.grpNavigationBars.Controls.Add(this.chkSortNavBar);
- this.grpNavigationBars.Controls.Add(this.chkIncludeFields);
- this.grpNavigationBars.Location = new System.Drawing.Point(5, 121);
- this.grpNavigationBars.Name = "grpNavigationBars";
- this.grpNavigationBars.Size = new System.Drawing.Size(373, 122);
- this.grpNavigationBars.TabIndex = 1;
- this.grpNavigationBars.TabStop = false;
- this.grpNavigationBars.Text = "Navigation Bars";
- //
- // grpCompletionListTabs
- //
- this.grpCompletionListTabs.Controls.Add(this.btnReset);
- this.grpCompletionListTabs.Controls.Add(this.commitChars);
- this.grpCompletionListTabs.Controls.Add(label1);
- this.grpCompletionListTabs.Controls.Add(this.chkKeywordsInAll);
- this.grpCompletionListTabs.Controls.Add(this.chkCompletionListtabs);
- this.grpCompletionListTabs.Location = new System.Drawing.Point(3, 3);
- this.grpCompletionListTabs.Name = "grpCompletionListTabs";
- this.grpCompletionListTabs.Size = new System.Drawing.Size(373, 112);
- this.grpCompletionListTabs.TabIndex = 0;
- this.grpCompletionListTabs.TabStop = false;
- this.grpCompletionListTabs.Text = "Completion Lists";
- //
- // btnReset
- //
- this.btnReset.Location = new System.Drawing.Point(310, 80);
- this.btnReset.Name = "btnReset";
- this.btnReset.Size = new System.Drawing.Size(57, 23);
- this.btnReset.TabIndex = 4;
- this.btnReset.Text = "&Reset";
- this.btnReset.UseVisualStyleBackColor = true;
- this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
- //
- // commitChars
- //
- this.commitChars.Location = new System.Drawing.Point(14, 79);
- this.commitChars.Name = "commitChars";
- this.commitChars.Size = new System.Drawing.Size(286, 20);
- this.commitChars.TabIndex = 3;
- //
- // IntellisenseOptionsControl
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.AutoScroll = true;
- this.Controls.Add(this.panel1);
- this.Name = "IntellisenseOptionsControl";
- this.Size = new System.Drawing.Size(388, 293);
- this.panel1.ResumeLayout(false);
- this.grpNavigationBars.ResumeLayout(false);
- this.grpNavigationBars.PerformLayout();
- this.grpCompletionListTabs.ResumeLayout(false);
- this.grpCompletionListTabs.PerformLayout();
- this.ResumeLayout(false);
-
- }
-
- #endregion
- private System.Windows.Forms.ToolTip toolTip1;
- private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.Button btnShowMeTheMagic;
- private System.Windows.Forms.GroupBox grpNavigationBars;
- private System.Windows.Forms.CheckBox chkShowMembersOfCurrentType;
- private System.Windows.Forms.CheckBox chkSortNavBar;
- private System.Windows.Forms.CheckBox chkIncludeFields;
- private System.Windows.Forms.GroupBox grpCompletionListTabs;
- internal System.Windows.Forms.TextBox commitChars;
- private System.Windows.Forms.CheckBox chkKeywordsInAll;
- private System.Windows.Forms.CheckBox chkCompletionListtabs;
- private System.Windows.Forms.CheckBox chkExcludeMembersFromOtherfiles;
- private System.Windows.Forms.Button btnReset;
- private System.Windows.Forms.CheckBox chkUseMicrosoftSQLite;
- }
-}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.cs b/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.cs
index efaed39ba9..d9791817cd 100644
--- a/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.cs
+++ b/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.cs
@@ -1,75 +1,69 @@
-using Community.VisualStudio.Toolkit;
+// Copyright (c) XSharp B.V. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0.
+// See License.txt in the project root for license information.
+using Community.VisualStudio.Toolkit;
using System;
+using System.Windows;
using XSharp.Settings;
using XSharpModel;
+
namespace XSharp.LanguageService.OptionsPages
{
public partial class IntellisenseOptionsControl : XSUserControl
{
- string defaultCommitChars = "{}[]().,:;+-*/%&|^!~<>?@#\'\"\\";
- bool Isx86 = false;
+ private const string DefaultCommitChars = "{}[]().,:;+-*/%&|^!~<>?@#'\"\\";
+ private bool _isx86;
+
public IntellisenseOptionsControl()
{
InitializeComponent();
- this.commitChars.Text = defaultCommitChars;
- chkCompletionListtabs.Tag = nameof(IntellisenseOptions.CompletionListTabs);
- chkKeywordsInAll.Tag = nameof(IntellisenseOptions.KeywordsInAll);
- chkIncludeFields.Tag = nameof(IntellisenseOptions.IncludeFieldsInNavigationBars);
- chkSortNavBar.Tag = nameof(IntellisenseOptions.SortNavigationBars);
- chkShowMembersOfCurrentType.Tag = nameof(IntellisenseOptions.ShowMembersOfCurrentTypeOnly);
- commitChars.Tag = nameof(IntellisenseOptions.CommitChars);
- chkExcludeMembersFromOtherfiles.Tag = nameof(IntellisenseOptions.ExcludeMembersFromOtherFiles);
- chkUseMicrosoftSQLite.Tag = nameof(IntellisenseOptions.UseMicrosoftSQLite);
- if (String.IsNullOrEmpty(Environment.GetEnvironmentVariable(Constants.EnvironmentXSharpDev)))
- {
- this.btnShowMeTheMagic.Visible = false;
- }
- Isx86 = IntPtr.Size == 4;
- if (Isx86)
+ commitChars.Text = DefaultCommitChars;
+
+ if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable(Constants.EnvironmentXSharpDev)))
+ btnShowMeTheMagic.Visibility = Visibility.Collapsed;
+
+ _isx86 = IntPtr.Size == 4;
+ if (_isx86)
{
- chkUseMicrosoftSQLite.Checked = false;
- chkUseMicrosoftSQLite.Visible = false;
+ chkUseMicrosoftSQLite.IsChecked = false;
+ chkUseMicrosoftSQLite.Visibility = Visibility.Collapsed;
}
else if (XSettings.IsArm)
{
- chkUseMicrosoftSQLite.Checked = true;
- chkUseMicrosoftSQLite.Visible = false;
+ chkUseMicrosoftSQLite.IsChecked = true;
+ chkUseMicrosoftSQLite.Visibility = Visibility.Collapsed;
}
-
}
+
internal override void ReadValues(object options)
{
base.ReadValues(options);
- if (Isx86)
- {
- chkUseMicrosoftSQLite.Checked = false;
- }
+ if (_isx86)
+ chkUseMicrosoftSQLite.IsChecked = false;
else if (XSettings.IsArm)
- {
- chkUseMicrosoftSQLite.Checked = true;
- }
+ chkUseMicrosoftSQLite.IsChecked = true;
}
+
internal override void SaveValues(object options)
{
base.SaveValues(options);
- if (!Isx86 && chkUseMicrosoftSQLite.Checked != XSettings.UseMicrosoftSQLite && !XSettings.IsArm)
+ if (!_isx86 && chkUseMicrosoftSQLite.IsChecked != XSettings.UseMicrosoftSQLite && !XSettings.IsArm)
{
VS.MessageBox.ShowWarning("You have changed the setting for the SQLite provider. This change will only take effect after you restart Visual Studio");
XDatabase.DeleteOnClose = true;
- XSettings.UseMicrosoftSQLite = chkUseMicrosoftSQLite.Checked;
- }
-
+ XSettings.UseMicrosoftSQLite = chkUseMicrosoftSQLite.IsChecked == true;
+ }
}
- private void btnShowMeTheMagic_Click(object sender, EventArgs e)
+ private void OnShowMeTheMagic(object sender, RoutedEventArgs e)
{
- XSharpSpecialOptions form = new XSharpSpecialOptions((IntellisenseOptionsPage)optionPage);
+ var form = new XSharpSpecialOptions((IntellisenseOptionsPage)optionPage);
form.ShowDialog();
}
-
- private void btnReset_Click(object sender, EventArgs e)
+
+ private void OnReset(object sender, RoutedEventArgs e)
{
- this.commitChars.Text = defaultCommitChars;
+ commitChars.Text = DefaultCommitChars;
}
}
}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.xaml b/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.xaml
new file mode 100644
index 0000000000..5ddd2b3231
--- /dev/null
+++ b/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.xaml
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/VisualStudio/LanguageService/OptionsPages/OtherOptionsControl.Designer.cs b/src/VisualStudio/LanguageService/OptionsPages/OtherOptionsControl.Designer.cs
deleted file mode 100644
index bc9dcc77ae..0000000000
--- a/src/VisualStudio/LanguageService/OptionsPages/OtherOptionsControl.Designer.cs
+++ /dev/null
@@ -1,260 +0,0 @@
-namespace XSharp.LanguageService.OptionsPages
-{
- partial class OtherOptionsControl
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.chkSingleLineDividers = new System.Windows.Forms.CheckBox();
- this.chkShowDividers = new System.Windows.Forms.CheckBox();
- this.chkHighlightWord = new System.Windows.Forms.CheckBox();
- this.chkBraceMatching = new System.Windows.Forms.CheckBox();
- this.chkKeywordMatching = new System.Windows.Forms.CheckBox();
- this.chkLightBulbs = new System.Windows.Forms.CheckBox();
- this.chkQuickInfo = new System.Windows.Forms.CheckBox();
- this.chkParameters = new System.Windows.Forms.CheckBox();
- this.chkCompletion = new System.Windows.Forms.CheckBox();
- this.chkRegions = new System.Windows.Forms.CheckBox();
- this.chkAutoPairs = new System.Windows.Forms.CheckBox();
- this.chkAutoOpen = new System.Windows.Forms.CheckBox();
- this.grpOther = new System.Windows.Forms.GroupBox();
- this.label3 = new System.Windows.Forms.Label();
- this.panel1 = new System.Windows.Forms.Panel();
- this.grpOther.SuspendLayout();
- this.panel1.SuspendLayout();
- this.SuspendLayout();
- //
- // chkSingleLineDividers
- //
- this.chkSingleLineDividers.AutoSize = true;
- this.chkSingleLineDividers.Location = new System.Drawing.Point(20, 44);
- this.chkSingleLineDividers.Name = "chkSingleLineDividers";
- this.chkSingleLineDividers.Size = new System.Drawing.Size(147, 17);
- this.chkSingleLineDividers.TabIndex = 1;
- this.chkSingleLineDividers.Text = "&Single line Entity Dividers ";
- this.toolTip1.SetToolTip(this.chkSingleLineDividers, "This applies to GLOBALs, DEFINEs, DELEGATES, CLASS Variables, MEMBERs of structur" +
- "es etc");
- this.chkSingleLineDividers.UseVisualStyleBackColor = true;
- //
- // chkShowDividers
- //
- this.chkShowDividers.AutoSize = true;
- this.chkShowDividers.Location = new System.Drawing.Point(20, 20);
- this.chkShowDividers.Name = "chkShowDividers";
- this.chkShowDividers.Size = new System.Drawing.Size(123, 17);
- this.chkShowDividers.TabIndex = 0;
- this.chkShowDividers.Text = "Show Entity &Dividers";
- this.toolTip1.SetToolTip(this.chkShowDividers, "The entity dividers will have the color that is defined in the Color setting as " +
- "\"Outlining Margin Vertical Rule");
- this.chkShowDividers.UseVisualStyleBackColor = true;
- this.chkShowDividers.CheckedChanged += new System.EventHandler(this.chkShowDividers_CheckedChanged);
- //
- // chkHighlightWord
- //
- this.chkHighlightWord.AutoSize = true;
- this.chkHighlightWord.Location = new System.Drawing.Point(20, 67);
- this.chkHighlightWord.Name = "chkHighlightWord";
- this.chkHighlightWord.Size = new System.Drawing.Size(114, 17);
- this.chkHighlightWord.TabIndex = 2;
- this.chkHighlightWord.Text = "&Highlight identifiers";
- this.toolTip1.SetToolTip(this.chkHighlightWord, "Highlight matchign identifiers in the editor");
- this.chkHighlightWord.UseVisualStyleBackColor = true;
- //
- // chkBraceMatching
- //
- this.chkBraceMatching.AutoSize = true;
- this.chkBraceMatching.Location = new System.Drawing.Point(20, 90);
- this.chkBraceMatching.Name = "chkBraceMatching";
- this.chkBraceMatching.Size = new System.Drawing.Size(101, 17);
- this.chkBraceMatching.TabIndex = 3;
- this.chkBraceMatching.Text = "&Brace Matching";
- this.toolTip1.SetToolTip(this.chkBraceMatching, "Match braces");
- this.chkBraceMatching.UseVisualStyleBackColor = true;
- //
- // chkKeywordMatching
- //
- this.chkKeywordMatching.AutoSize = true;
- this.chkKeywordMatching.Location = new System.Drawing.Point(213, 19);
- this.chkKeywordMatching.Name = "chkKeywordMatching";
- this.chkKeywordMatching.Size = new System.Drawing.Size(137, 17);
- this.chkKeywordMatching.TabIndex = 6;
- this.chkKeywordMatching.Text = "Highlight &Keyword Pairs";
- this.toolTip1.SetToolTip(this.chkKeywordMatching, "Highlight keyword pairs, such as FOR and NEXT, IF and ENDIF etc.");
- this.chkKeywordMatching.UseVisualStyleBackColor = true;
- //
- // chkLightBulbs
- //
- this.chkLightBulbs.AutoSize = true;
- this.chkLightBulbs.Location = new System.Drawing.Point(213, 42);
- this.chkLightBulbs.Name = "chkLightBulbs";
- this.chkLightBulbs.Size = new System.Drawing.Size(78, 17);
- this.chkLightBulbs.TabIndex = 7;
- this.chkLightBulbs.Text = "&Light Bulbs";
- this.toolTip1.SetToolTip(this.chkLightBulbs, "Enable Light bulbs for suggestions for code manipulation");
- this.chkLightBulbs.UseVisualStyleBackColor = true;
- //
- // chkQuickInfo
- //
- this.chkQuickInfo.AutoSize = true;
- this.chkQuickInfo.Location = new System.Drawing.Point(213, 65);
- this.chkQuickInfo.Name = "chkQuickInfo";
- this.chkQuickInfo.Size = new System.Drawing.Size(98, 17);
- this.chkQuickInfo.TabIndex = 8;
- this.chkQuickInfo.Text = "&Quick Info Tips";
- this.toolTip1.SetToolTip(this.chkQuickInfo, "Enable Quick Info tips with hints about identifiers");
- this.chkQuickInfo.UseVisualStyleBackColor = true;
- //
- // chkParameters
- //
- this.chkParameters.AutoSize = true;
- this.chkParameters.Location = new System.Drawing.Point(213, 89);
- this.chkParameters.Name = "chkParameters";
- this.chkParameters.Size = new System.Drawing.Size(97, 17);
- this.chkParameters.TabIndex = 9;
- this.chkParameters.Text = "&Parameter Tips";
- this.toolTip1.SetToolTip(this.chkParameters, "Enable Parameter Tips");
- this.chkParameters.UseVisualStyleBackColor = true;
- //
- // chkCompletion
- //
- this.chkCompletion.AutoSize = true;
- this.chkCompletion.Location = new System.Drawing.Point(213, 112);
- this.chkCompletion.Name = "chkCompletion";
- this.chkCompletion.Size = new System.Drawing.Size(106, 17);
- this.chkCompletion.TabIndex = 10;
- this.chkCompletion.Text = "&Code Completion";
- this.toolTip1.SetToolTip(this.chkCompletion, "Enable Code completion for \'.\' and \':\' characters");
- this.chkCompletion.UseVisualStyleBackColor = true;
- //
- // chkRegions
- //
- this.chkRegions.AutoSize = true;
- this.chkRegions.Location = new System.Drawing.Point(213, 135);
- this.chkRegions.Name = "chkRegions";
- this.chkRegions.Size = new System.Drawing.Size(65, 17);
- this.chkRegions.TabIndex = 11;
- this.chkRegions.Text = "&Regions";
- this.toolTip1.SetToolTip(this.chkRegions, "Enable Regions in the Editor");
- this.chkRegions.UseVisualStyleBackColor = true;
- //
- // chkAutoPairs
- //
- this.chkAutoPairs.AutoSize = true;
- this.chkAutoPairs.Location = new System.Drawing.Point(20, 138);
- this.chkAutoPairs.Name = "chkAutoPairs";
- this.chkAutoPairs.Size = new System.Drawing.Size(109, 17);
- this.chkAutoPairs.TabIndex = 5;
- this.chkAutoPairs.Text = "Br&ace Completion";
- this.toolTip1.SetToolTip(this.chkAutoPairs, "Type closing brace or closing quote after typing opening character \\\'(\\\', \\\'{\\\', " +
- "\\\'[\\\' and quotes\"");
- this.chkAutoPairs.UseVisualStyleBackColor = true;
- //
- // chkAutoOpen
- //
- this.chkAutoOpen.AutoSize = true;
- this.chkAutoOpen.Location = new System.Drawing.Point(20, 115);
- this.chkAutoOpen.Name = "chkAutoOpen";
- this.chkAutoOpen.Size = new System.Drawing.Size(187, 17);
- this.chkAutoOpen.TabIndex = 4;
- this.chkAutoOpen.Text = "&Add \'(\' to methods in completionlist";
- this.toolTip1.SetToolTip(this.chkAutoOpen, "Automatically type \'(\' when selecting a method from a completion list");
- this.chkAutoOpen.UseVisualStyleBackColor = true;
- //
- // grpOther
- //
- this.grpOther.Controls.Add(this.chkAutoOpen);
- this.grpOther.Controls.Add(this.chkRegions);
- this.grpOther.Controls.Add(this.chkAutoPairs);
- this.grpOther.Controls.Add(this.label3);
- this.grpOther.Controls.Add(this.chkCompletion);
- this.grpOther.Controls.Add(this.chkParameters);
- this.grpOther.Controls.Add(this.chkQuickInfo);
- this.grpOther.Controls.Add(this.chkLightBulbs);
- this.grpOther.Controls.Add(this.chkKeywordMatching);
- this.grpOther.Controls.Add(this.chkBraceMatching);
- this.grpOther.Controls.Add(this.chkHighlightWord);
- this.grpOther.Controls.Add(this.chkSingleLineDividers);
- this.grpOther.Controls.Add(this.chkShowDividers);
- this.grpOther.Location = new System.Drawing.Point(6, 3);
- this.grpOther.Name = "grpOther";
- this.grpOther.Size = new System.Drawing.Size(363, 194);
- this.grpOther.TabIndex = 0;
- this.grpOther.TabStop = false;
- this.grpOther.Text = "Source Code Editor";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(17, 166);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(309, 13);
- this.label3.TabIndex = 12;
- this.label3.Text = "Most options require closing and reopening the editor window(s).";
- //
- // panel1
- //
- this.panel1.Controls.Add(this.grpOther);
- this.panel1.Location = new System.Drawing.Point(3, 3);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(380, 208);
- this.panel1.TabIndex = 1;
- //
- // OtherOptionsControl
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.AutoScroll = true;
- this.Controls.Add(this.panel1);
- this.Name = "OtherOptionsControl";
- this.Size = new System.Drawing.Size(406, 223);
- this.grpOther.ResumeLayout(false);
- this.grpOther.PerformLayout();
- this.panel1.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
-
- #endregion
- private System.Windows.Forms.ToolTip toolTip1;
- private System.Windows.Forms.GroupBox grpOther;
- private System.Windows.Forms.CheckBox chkSingleLineDividers;
- private System.Windows.Forms.CheckBox chkShowDividers;
- private System.Windows.Forms.CheckBox chkHighlightWord;
- private System.Windows.Forms.CheckBox chkBraceMatching;
- private System.Windows.Forms.CheckBox chkKeywordMatching;
- private System.Windows.Forms.CheckBox chkLightBulbs;
- private System.Windows.Forms.CheckBox chkQuickInfo;
- private System.Windows.Forms.CheckBox chkParameters;
- private System.Windows.Forms.CheckBox chkCompletion;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.CheckBox chkRegions;
- private System.Windows.Forms.CheckBox chkAutoPairs;
- private System.Windows.Forms.CheckBox chkAutoOpen;
- private System.Windows.Forms.Panel panel1;
- }
-}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/OtherOptionsControl.cs b/src/VisualStudio/LanguageService/OptionsPages/OtherOptionsControl.cs
index 8f0d7ead74..d46bb0bd30 100644
--- a/src/VisualStudio/LanguageService/OptionsPages/OtherOptionsControl.cs
+++ b/src/VisualStudio/LanguageService/OptionsPages/OtherOptionsControl.cs
@@ -1,6 +1,8 @@
-using System;
-using System.Windows.Forms;
-using XSharpModel;
+// Copyright (c) XSharp B.V. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0.
+// See License.txt in the project root for license information.
+using System.Windows;
+
namespace XSharp.LanguageService.OptionsPages
{
public partial class OtherOptionsControl : XSUserControl
@@ -8,32 +10,21 @@ public partial class OtherOptionsControl : XSUserControl
public OtherOptionsControl()
{
InitializeComponent();
- chkShowDividers.Tag = nameof(OtherOptions.ShowDividers);
- chkSingleLineDividers.Tag = nameof(OtherOptions.ShowSingleLineDividers);
- chkHighlightWord.Tag = nameof(OtherOptions.EnableHighlightWord);
- chkBraceMatching.Tag = nameof(OtherOptions.EnableBraceMatching);
- chkKeywordMatching.Tag = nameof(OtherOptions.EnableKeywordmatching);
-
- chkLightBulbs.Tag = nameof(OtherOptions.EnableLightBulbs);
- chkQuickInfo.Tag = nameof(OtherOptions.EnableQuickInfo);
- chkParameters.Tag = nameof(OtherOptions.EnableParameterInfo);
- chkCompletion.Tag = nameof(OtherOptions.EnableCodeCompletion);
- chkRegions.Tag = nameof(OtherOptions.EnableRegions);
- chkAutoPairs.Tag = nameof(OtherOptions.AutoPairs);
- chkAutoOpen.Tag = nameof(OtherOptions.AutoOpen);
}
+
internal override void ReadValues(object options)
{
base.ReadValues(options);
- chkSingleLineDividers.Enabled = chkShowDividers.Checked;
+ chkSingleLineDividers.IsEnabled = chkShowDividers.IsChecked == true;
}
- private void chkShowDividers_CheckedChanged(object sender, EventArgs e)
+ private void OnShowDividersChanged(object sender, RoutedEventArgs e)
{
- chkSingleLineDividers.Enabled = chkShowDividers.Checked;
- if (!chkSingleLineDividers.Enabled)
+ if (chkSingleLineDividers != null)
{
- chkSingleLineDividers.Checked = false;
+ chkSingleLineDividers.IsEnabled = chkShowDividers.IsChecked == true;
+ if (!chkSingleLineDividers.IsEnabled)
+ chkSingleLineDividers.IsChecked = false;
}
}
}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/OtherOptionsControl.xaml b/src/VisualStudio/LanguageService/OptionsPages/OtherOptionsControl.xaml
new file mode 100644
index 0000000000..62d729f8b1
--- /dev/null
+++ b/src/VisualStudio/LanguageService/OptionsPages/OtherOptionsControl.xaml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/VisualStudio/LanguageService/OptionsPages/XSDialogPage.cs b/src/VisualStudio/LanguageService/OptionsPages/XSDialogPage.cs
index c2f7f7ca33..e8fe48cb9c 100644
--- a/src/VisualStudio/LanguageService/OptionsPages/XSDialogPage.cs
+++ b/src/VisualStudio/LanguageService/OptionsPages/XSDialogPage.cs
@@ -1,20 +1,23 @@
-using XSharpModel;
+// Copyright (c) XSharp B.V. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0.
+// See License.txt in the project root for license information.
+using XSharpModel;
using Microsoft.VisualStudio.Shell;
-using System.ComponentModel;
using System.Runtime.InteropServices;
-using System.Windows.Forms;
+using System.Windows;
using XSharp.Settings;
-#pragma warning disable VSTHRD012
+#pragma warning disable VSTHRD012
namespace XSharp.LanguageService.OptionsPages
{
[ComVisible(true)]
- public class XSDialogPage : DialogPage where T: XSUserControl, new() where U : OptionsBase, new()
+ public class XSDialogPage : UIElementDialogPage where T : XSUserControl, new() where U : OptionsBase, new()
{
#region Properties
public override object AutomationObject => Options;
public U Options { get; private set; } = null;
#endregion
- internal XSDialogPage() : base(ThreadHelper.JoinableTaskContext)
+
+ internal XSDialogPage()
{
Options = new U();
}
@@ -22,39 +25,30 @@ internal XSDialogPage() : base(ThreadHelper.JoinableTaskContext)
public override void LoadSettingsFromStorage()
{
base.LoadSettingsFromStorage();
- if (control != null)
- {
- control.ReadValues(Options);
- }
+ if (_control != null)
+ _control.ReadValues(Options);
}
+
public override void SaveSettingsToStorage()
{
- CreateControl();
- if (control != null)
- {
- control.SaveValues(Options);
- }
+ EnsureControl();
+ if (_control != null)
+ _control.SaveValues(Options);
base.SaveSettingsToStorage();
Options.WriteToSettings();
}
- private void CreateControl()
+ private void EnsureControl()
{
- if (control == null)
+ if (_control == null)
{
- control = new T
- {
- optionPage = this
- };
- control.ReadValues(Options);
+ _control = new T { optionPage = this };
+ _control.ReadValues(Options);
}
}
- XSUserControl control = null;
- ///
- /// Set the properties of the page from the Options object
- ///
- ///
+ private T _control;
+
internal void SetOptions(U options)
{
if (Options == null)
@@ -70,12 +64,13 @@ internal void SetOptions(U options)
}
}
}
- protected override IWin32Window Window
+
+ protected override UIElement Child
{
get
{
- CreateControl();
- return control;
+ EnsureControl();
+ return _control;
}
}
}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/XSUserControl.cs b/src/VisualStudio/LanguageService/OptionsPages/XSUserControl.cs
index 2d169f7cca..bd531f90d5 100644
--- a/src/VisualStudio/LanguageService/OptionsPages/XSUserControl.cs
+++ b/src/VisualStudio/LanguageService/OptionsPages/XSUserControl.cs
@@ -1,112 +1,85 @@
-using Microsoft.VisualStudio.Shell;
-using System;
-using System.Windows.Forms;
+// Copyright (c) XSharp B.V. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0.
+// See License.txt in the project root for license information.
+using Microsoft.VisualStudio.Shell;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
namespace XSharp.LanguageService.OptionsPages
{
- public class XSUserControl : UserControl
+ public class XSUserControl : UserControl
{
internal DialogPage optionPage;
- private void ReadControl(Control c, object options)
+ private void ReadControl(DependencyObject element, object options)
{
- var tag = c.Tag;
- if (tag is string strTag)
+ if (element is FrameworkElement fe && fe.Tag is string strTag)
{
-
var prop = options.GetType().GetProperty(strTag);
if (prop != null)
{
var val = prop.GetValue(options);
- if (c is CheckBox cb && val is bool bValue)
- {
- cb.Checked = bValue;
- }
- if (c is NumericUpDown number && val is int iValue)
- {
- number.Value = iValue >= number.Minimum && iValue < number.Maximum ? iValue : number.Minimum ;
- }
- if (c is TextBox tb)
- {
- tb.Text = val.ToString();
- }
-
+ if (fe is CheckBox cb && val is bool bValue)
+ cb.IsChecked = bValue;
+ else if (fe is TextBox tb)
+ tb.Text = val?.ToString() ?? string.Empty;
}
}
- foreach (Control control in c.Controls)
- {
- ReadControl(control, options);
- }
-
+ foreach (var child in LogicalTreeHelper.GetChildren(element).OfType())
+ ReadControl(child, options);
}
+
internal virtual void ReadValues(object options)
{
- foreach (Control control in this.Controls)
- {
- ReadControl(control, options);
- }
+ ReadControl(this, options);
}
internal virtual void SaveValues(object options)
{
- foreach (Control control in this.Controls)
- {
- SaveControl(control, options);
- }
+ SaveControl(this, options);
}
- private void SaveControl(Control c, Object options)
+
+ private void SaveControl(DependencyObject element, object options)
{
- var tag = c.Tag;
- if (tag is string strTag)
+ if (element is FrameworkElement fe && fe.Tag is string strTag)
{
var prop = options.GetType().GetProperty(strTag);
if (prop != null && prop.SetMethod != null)
{
- if (c is CheckBox cb)
- {
- prop.SetValue(options, cb.Checked);
- }
- if (c is NumericUpDown number)
- {
- prop.SetValue(options, (int)number.Value);
- }
- if (c is TextBox tb)
+ if (fe is CheckBox cb)
+ prop.SetValue(options, cb.IsChecked == true);
+ else if (fe is TextBox tb)
{
var old = prop.GetValue(options);
switch (old)
{
case int _:
- if (int.TryParse(tb.Text, out var iNew))
+ if (int.TryParse(tb.Text, out int iNew))
prop.SetValue(options, iNew);
-
break;
case string _:
prop.SetValue(options, tb.Text);
break;
}
}
-
}
}
- foreach (Control control in c.Controls)
- {
- SaveControl(control, options);
- }
+ foreach (var child in LogicalTreeHelper.GetChildren(element).OfType())
+ SaveControl(child, options);
}
-
protected void checkbuttons(bool check)
{
- foreach (var control in this.Controls)
- {
- if (control is CheckBox cb)
- {
- cb.Checked = check;
- }
- }
-
+ CheckAllCheckBoxes(this, check);
}
-
+ private void CheckAllCheckBoxes(DependencyObject element, bool check)
+ {
+ if (element is CheckBox cb)
+ cb.IsChecked = check;
+ foreach (var child in LogicalTreeHelper.GetChildren(element).OfType())
+ CheckAllCheckBoxes(child, check);
+ }
}
}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/XSharpSpecialOptions.Designer.cs b/src/VisualStudio/LanguageService/OptionsPages/XSharpSpecialOptions.Designer.cs
deleted file mode 100644
index a47c9c4ca1..0000000000
--- a/src/VisualStudio/LanguageService/OptionsPages/XSharpSpecialOptions.Designer.cs
+++ /dev/null
@@ -1,381 +0,0 @@
-namespace XSharp.LanguageService.OptionsPages
-{
- partial class XSharpSpecialOptions
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.chkDisableXSharpProjectReferences = new System.Windows.Forms.CheckBox();
- this.label3 = new System.Windows.Forms.Label();
- this.chkDisableForeignProjectReferences = new System.Windows.Forms.CheckBox();
- this.label1 = new System.Windows.Forms.Label();
- this.chkDisableAssemblyReferences = new System.Windows.Forms.CheckBox();
- this.chkDisableClassViewObjectView = new System.Windows.Forms.CheckBox();
- this.chkDisableEditorDropdowns = new System.Windows.Forms.CheckBox();
- this.chkDisableEntityParsing = new System.Windows.Forms.CheckBox();
- this.chkDisableSyntaxColorization = new System.Windows.Forms.CheckBox();
- this.chkEnableParserLog = new System.Windows.Forms.CheckBox();
- this.chkEnableDatabaseLog = new System.Windows.Forms.CheckBox();
- this.btnOk = new System.Windows.Forms.Button();
- this.btnCancel = new System.Windows.Forms.Button();
- this.chkEnableBraceMatchLog = new System.Windows.Forms.CheckBox();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.chkEnableTypeLookupLog = new System.Windows.Forms.CheckBox();
- this.chkEnableReferenceLog = new System.Windows.Forms.CheckBox();
- this.chkEnableOutputPane = new System.Windows.Forms.CheckBox();
- this.chkEnableQuickInfoLog = new System.Windows.Forms.CheckBox();
- this.chkEnableParameterTipsLog = new System.Windows.Forms.CheckBox();
- this.chkEnableCodeCompletionLog = new System.Windows.Forms.CheckBox();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.chkLogToDebug = new System.Windows.Forms.CheckBox();
- this.chkLogToFile = new System.Windows.Forms.CheckBox();
- this.groupBox1.SuspendLayout();
- this.groupBox3.SuspendLayout();
- this.groupBox4.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.chkDisableXSharpProjectReferences);
- this.groupBox1.Controls.Add(this.label3);
- this.groupBox1.Controls.Add(this.chkDisableForeignProjectReferences);
- this.groupBox1.Controls.Add(this.label1);
- this.groupBox1.Controls.Add(this.chkDisableAssemblyReferences);
- this.groupBox1.Controls.Add(this.chkDisableClassViewObjectView);
- this.groupBox1.Controls.Add(this.chkDisableEditorDropdowns);
- this.groupBox1.Controls.Add(this.chkDisableEntityParsing);
- this.groupBox1.Controls.Add(this.chkDisableSyntaxColorization);
- this.groupBox1.Location = new System.Drawing.Point(12, 12);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(373, 245);
- this.groupBox1.TabIndex = 4;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "Enable/ Disable various intellisense options";
- //
- // chkDisableXSharpProjectReferences
- //
- this.chkDisableXSharpProjectReferences.AutoSize = true;
- this.chkDisableXSharpProjectReferences.Location = new System.Drawing.Point(18, 211);
- this.chkDisableXSharpProjectReferences.Name = "chkDisableXSharpProjectReferences";
- this.chkDisableXSharpProjectReferences.Size = new System.Drawing.Size(243, 17);
- this.chkDisableXSharpProjectReferences.TabIndex = 3;
- this.chkDisableXSharpProjectReferences.Text = "Disable Lookup in XSharp Project References";
- this.chkDisableXSharpProjectReferences.UseVisualStyleBackColor = true;
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(15, 146);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(304, 13);
- this.label3.TabIndex = 14;
- this.label3.Text = "Most others require closing and reopening the editor window(s).";
- //
- // chkDisableForeignProjectReferences
- //
- this.chkDisableForeignProjectReferences.AutoSize = true;
- this.chkDisableForeignProjectReferences.Location = new System.Drawing.Point(18, 188);
- this.chkDisableForeignProjectReferences.Name = "chkDisableForeignProjectReferences";
- this.chkDisableForeignProjectReferences.Size = new System.Drawing.Size(232, 17);
- this.chkDisableForeignProjectReferences.TabIndex = 2;
- this.chkDisableForeignProjectReferences.Text = "Disable Loading \'Foreign\' project references";
- this.chkDisableForeignProjectReferences.UseVisualStyleBackColor = true;
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(15, 130);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(341, 13);
- this.label1.TabIndex = 12;
- this.label1.Text = "Some options (such as ClassView and Objectview) require a VS restart ";
- //
- // chkDisableAssemblyReferences
- //
- this.chkDisableAssemblyReferences.AutoSize = true;
- this.chkDisableAssemblyReferences.Location = new System.Drawing.Point(18, 165);
- this.chkDisableAssemblyReferences.Name = "chkDisableAssemblyReferences";
- this.chkDisableAssemblyReferences.Size = new System.Drawing.Size(202, 17);
- this.chkDisableAssemblyReferences.TabIndex = 1;
- this.chkDisableAssemblyReferences.Text = "Disable Loading Assembly Reference";
- this.chkDisableAssemblyReferences.UseVisualStyleBackColor = true;
- //
- // chkDisableClassViewObjectView
- //
- this.chkDisableClassViewObjectView.AutoSize = true;
- this.chkDisableClassViewObjectView.Enabled = false;
- this.chkDisableClassViewObjectView.Location = new System.Drawing.Point(18, 87);
- this.chkDisableClassViewObjectView.Name = "chkDisableClassViewObjectView";
- this.chkDisableClassViewObjectView.Size = new System.Drawing.Size(169, 17);
- this.chkDisableClassViewObjectView.TabIndex = 10;
- this.chkDisableClassViewObjectView.Text = "Disable Class and Objectview";
- this.chkDisableClassViewObjectView.UseVisualStyleBackColor = true;
- //
- // chkDisableEditorDropdowns
- //
- this.chkDisableEditorDropdowns.AutoSize = true;
- this.chkDisableEditorDropdowns.Location = new System.Drawing.Point(18, 64);
- this.chkDisableEditorDropdowns.Name = "chkDisableEditorDropdowns";
- this.chkDisableEditorDropdowns.Size = new System.Drawing.Size(148, 17);
- this.chkDisableEditorDropdowns.TabIndex = 9;
- this.chkDisableEditorDropdowns.Text = "Disable Editor Dropdowns";
- this.chkDisableEditorDropdowns.UseVisualStyleBackColor = true;
- //
- // chkDisableEntityParsing
- //
- this.chkDisableEntityParsing.AutoSize = true;
- this.chkDisableEntityParsing.Location = new System.Drawing.Point(18, 42);
- this.chkDisableEntityParsing.Name = "chkDisableEntityParsing";
- this.chkDisableEntityParsing.Size = new System.Drawing.Size(128, 17);
- this.chkDisableEntityParsing.TabIndex = 6;
- this.chkDisableEntityParsing.Text = "Disable Entity Parsing";
- this.chkDisableEntityParsing.UseVisualStyleBackColor = true;
- //
- // chkDisableSyntaxColorization
- //
- this.chkDisableSyntaxColorization.AutoSize = true;
- this.chkDisableSyntaxColorization.Location = new System.Drawing.Point(18, 19);
- this.chkDisableSyntaxColorization.Name = "chkDisableSyntaxColorization";
- this.chkDisableSyntaxColorization.Size = new System.Drawing.Size(153, 17);
- this.chkDisableSyntaxColorization.TabIndex = 5;
- this.chkDisableSyntaxColorization.Text = "Disable Syntax Colorization";
- this.chkDisableSyntaxColorization.UseVisualStyleBackColor = true;
- //
- // chkEnableParserLog
- //
- this.chkEnableParserLog.AutoSize = true;
- this.chkEnableParserLog.Location = new System.Drawing.Point(10, 60);
- this.chkEnableParserLog.Name = "chkEnableParserLog";
- this.chkEnableParserLog.Size = new System.Drawing.Size(136, 17);
- this.chkEnableParserLog.TabIndex = 6;
- this.chkEnableParserLog.Text = "Log background parser";
- this.chkEnableParserLog.UseVisualStyleBackColor = true;
- //
- // chkEnableDatabaseLog
- //
- this.chkEnableDatabaseLog.AutoSize = true;
- this.chkEnableDatabaseLog.Location = new System.Drawing.Point(10, 37);
- this.chkEnableDatabaseLog.Name = "chkEnableDatabaseLog";
- this.chkEnableDatabaseLog.Size = new System.Drawing.Size(143, 17);
- this.chkEnableDatabaseLog.TabIndex = 5;
- this.chkEnableDatabaseLog.Text = "Log database operations";
- this.chkEnableDatabaseLog.UseVisualStyleBackColor = true;
- //
- // btnOk
- //
- this.btnOk.Location = new System.Drawing.Point(434, 375);
- this.btnOk.Name = "btnOk";
- this.btnOk.Size = new System.Drawing.Size(75, 23);
- this.btnOk.TabIndex = 6;
- this.btnOk.Text = "&Ok";
- this.btnOk.UseVisualStyleBackColor = true;
- this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
- //
- // btnCancel
- //
- this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.Location = new System.Drawing.Point(536, 375);
- this.btnCancel.Name = "btnCancel";
- this.btnCancel.Size = new System.Drawing.Size(75, 23);
- this.btnCancel.TabIndex = 7;
- this.btnCancel.Text = "&Cancel";
- this.btnCancel.UseVisualStyleBackColor = true;
- //
- // chkEnableBraceMatchLog
- //
- this.chkEnableBraceMatchLog.AutoSize = true;
- this.chkEnableBraceMatchLog.Location = new System.Drawing.Point(10, 83);
- this.chkEnableBraceMatchLog.Name = "chkEnableBraceMatchLog";
- this.chkEnableBraceMatchLog.Size = new System.Drawing.Size(120, 17);
- this.chkEnableBraceMatchLog.TabIndex = 7;
- this.chkEnableBraceMatchLog.Text = "Log brace matching";
- this.chkEnableBraceMatchLog.UseVisualStyleBackColor = true;
- //
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.chkEnableTypeLookupLog);
- this.groupBox3.Controls.Add(this.chkEnableReferenceLog);
- this.groupBox3.Controls.Add(this.chkEnableOutputPane);
- this.groupBox3.Controls.Add(this.chkEnableQuickInfoLog);
- this.groupBox3.Controls.Add(this.chkEnableParameterTipsLog);
- this.groupBox3.Controls.Add(this.chkEnableCodeCompletionLog);
- this.groupBox3.Controls.Add(this.chkEnableBraceMatchLog);
- this.groupBox3.Controls.Add(this.chkEnableDatabaseLog);
- this.groupBox3.Controls.Add(this.chkEnableParserLog);
- this.groupBox3.Location = new System.Drawing.Point(405, 25);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(222, 232);
- this.groupBox3.TabIndex = 8;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "Output pane Logging options";
- //
- // chkEnableTypeLookupLog
- //
- this.chkEnableTypeLookupLog.AutoSize = true;
- this.chkEnableTypeLookupLog.Location = new System.Drawing.Point(10, 198);
- this.chkEnableTypeLookupLog.Name = "chkEnableTypeLookupLog";
- this.chkEnableTypeLookupLog.Size = new System.Drawing.Size(110, 17);
- this.chkEnableTypeLookupLog.TabIndex = 13;
- this.chkEnableTypeLookupLog.Text = "Log Type Lookup";
- this.chkEnableTypeLookupLog.UseVisualStyleBackColor = true;
- //
- // chkEnableReferenceLog
- //
- this.chkEnableReferenceLog.AutoSize = true;
- this.chkEnableReferenceLog.Location = new System.Drawing.Point(10, 175);
- this.chkEnableReferenceLog.Name = "chkEnableReferenceLog";
- this.chkEnableReferenceLog.Size = new System.Drawing.Size(154, 17);
- this.chkEnableReferenceLog.TabIndex = 12;
- this.chkEnableReferenceLog.Text = "Log Handling of references";
- this.chkEnableReferenceLog.UseVisualStyleBackColor = true;
- //
- // chkEnableOutputPane
- //
- this.chkEnableOutputPane.AutoSize = true;
- this.chkEnableOutputPane.Location = new System.Drawing.Point(10, 17);
- this.chkEnableOutputPane.Name = "chkEnableOutputPane";
- this.chkEnableOutputPane.Size = new System.Drawing.Size(196, 17);
- this.chkEnableOutputPane.TabIndex = 11;
- this.chkEnableOutputPane.Text = "ENable output pane in Visual Studio";
- this.chkEnableOutputPane.UseVisualStyleBackColor = true;
- //
- // chkEnableQuickInfoLog
- //
- this.chkEnableQuickInfoLog.AutoSize = true;
- this.chkEnableQuickInfoLog.Location = new System.Drawing.Point(10, 152);
- this.chkEnableQuickInfoLog.Name = "chkEnableQuickInfoLog";
- this.chkEnableQuickInfoLog.Size = new System.Drawing.Size(173, 17);
- this.chkEnableQuickInfoLog.TabIndex = 10;
- this.chkEnableQuickInfoLog.Text = "Log QuickInfo (tooltip) handling";
- this.chkEnableQuickInfoLog.UseVisualStyleBackColor = true;
- //
- // chkEnableParameterTipsLog
- //
- this.chkEnableParameterTipsLog.AutoSize = true;
- this.chkEnableParameterTipsLog.Location = new System.Drawing.Point(10, 129);
- this.chkEnableParameterTipsLog.Name = "chkEnableParameterTipsLog";
- this.chkEnableParameterTipsLog.Size = new System.Drawing.Size(137, 17);
- this.chkEnableParameterTipsLog.TabIndex = 9;
- this.chkEnableParameterTipsLog.Text = "Log parameter handling";
- this.chkEnableParameterTipsLog.UseVisualStyleBackColor = true;
- //
- // chkEnableCodeCompletionLog
- //
- this.chkEnableCodeCompletionLog.AutoSize = true;
- this.chkEnableCodeCompletionLog.Location = new System.Drawing.Point(10, 106);
- this.chkEnableCodeCompletionLog.Name = "chkEnableCodeCompletionLog";
- this.chkEnableCodeCompletionLog.Size = new System.Drawing.Size(125, 17);
- this.chkEnableCodeCompletionLog.TabIndex = 8;
- this.chkEnableCodeCompletionLog.Text = "Log code completion";
- this.chkEnableCodeCompletionLog.UseVisualStyleBackColor = true;
- //
- // groupBox4
- //
- this.groupBox4.Controls.Add(this.chkLogToDebug);
- this.groupBox4.Controls.Add(this.chkLogToFile);
- this.groupBox4.Location = new System.Drawing.Point(12, 263);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(615, 72);
- this.groupBox4.TabIndex = 9;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "Other logging (enables all options above)";
- //
- // chkLogToDebug
- //
- this.chkLogToDebug.AutoSize = true;
- this.chkLogToDebug.Location = new System.Drawing.Point(10, 42);
- this.chkLogToDebug.Name = "chkLogToDebug";
- this.chkLogToDebug.Size = new System.Drawing.Size(128, 17);
- this.chkLogToDebug.TabIndex = 15;
- this.chkLogToDebug.Text = "Log to &debug window";
- this.chkLogToDebug.UseVisualStyleBackColor = true;
- //
- // chkLogToFile
- //
- this.chkLogToFile.AutoSize = true;
- this.chkLogToFile.Location = new System.Drawing.Point(10, 19);
- this.chkLogToFile.Name = "chkLogToFile";
- this.chkLogToFile.Size = new System.Drawing.Size(72, 17);
- this.chkLogToFile.TabIndex = 14;
- this.chkLogToFile.Text = "Log to &file";
- this.chkLogToFile.UseVisualStyleBackColor = true;
- //
- // XSharpSpecialOptions
- //
- this.AcceptButton = this.btnOk;
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.CancelButton = this.btnCancel;
- this.ClientSize = new System.Drawing.Size(639, 410);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.btnCancel);
- this.Controls.Add(this.btnOk);
- this.Controls.Add(this.groupBox1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.Name = "XSharpSpecialOptions";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "XSharpSpecialOptions";
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- this.groupBox4.ResumeLayout(false);
- this.groupBox4.PerformLayout();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label1;
- internal System.Windows.Forms.CheckBox chkDisableClassViewObjectView;
- internal System.Windows.Forms.CheckBox chkDisableEditorDropdowns;
- internal System.Windows.Forms.CheckBox chkDisableEntityParsing;
- internal System.Windows.Forms.CheckBox chkDisableSyntaxColorization;
- internal System.Windows.Forms.CheckBox chkDisableXSharpProjectReferences;
- internal System.Windows.Forms.CheckBox chkDisableForeignProjectReferences;
- internal System.Windows.Forms.CheckBox chkDisableAssemblyReferences;
- private System.Windows.Forms.Button btnOk;
- private System.Windows.Forms.Button btnCancel;
- internal System.Windows.Forms.CheckBox chkEnableDatabaseLog;
- internal System.Windows.Forms.CheckBox chkEnableParserLog;
- internal System.Windows.Forms.CheckBox chkEnableBraceMatchLog;
- private System.Windows.Forms.GroupBox groupBox3;
- internal System.Windows.Forms.CheckBox chkEnableParameterTipsLog;
- internal System.Windows.Forms.CheckBox chkEnableCodeCompletionLog;
- internal System.Windows.Forms.CheckBox chkEnableQuickInfoLog;
- internal System.Windows.Forms.CheckBox chkEnableOutputPane;
- internal System.Windows.Forms.CheckBox chkEnableTypeLookupLog;
- internal System.Windows.Forms.CheckBox chkEnableReferenceLog;
- private System.Windows.Forms.GroupBox groupBox4;
- internal System.Windows.Forms.CheckBox chkLogToDebug;
- internal System.Windows.Forms.CheckBox chkLogToFile;
- }
-}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/XSharpSpecialOptions.cs b/src/VisualStudio/LanguageService/OptionsPages/XSharpSpecialOptions.cs
index 85c05d979b..c222d75810 100644
--- a/src/VisualStudio/LanguageService/OptionsPages/XSharpSpecialOptions.cs
+++ b/src/VisualStudio/LanguageService/OptionsPages/XSharpSpecialOptions.cs
@@ -1,68 +1,70 @@
-using System;
-using System.Windows.Forms;
+// Copyright (c) XSharp B.V. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0.
+// See License.txt in the project root for license information.
+using System.Windows;
namespace XSharp.LanguageService.OptionsPages
{
- public partial class XSharpSpecialOptions : Form
+ public partial class XSharpSpecialOptions : Window
{
- private IntellisenseOptionsPage _page;
+ private readonly IntellisenseOptionsPage _page;
+
public XSharpSpecialOptions(IntellisenseOptionsPage page)
{
InitializeComponent();
_page = page;
- loadSettings();
+ LoadSettings();
}
- private void btnOk_Click(object sender, EventArgs e)
+ private void LoadSettings()
{
- this.DialogResult = DialogResult.OK;
- SaveSettings();
- this.Close();
+ chkDisableEditorDropdowns.IsChecked = _page.Options.DisableEditorDropdowns;
+ chkDisableClassViewObjectView.IsChecked = _page.Options.DisableClassViewObjectView;
+ chkDisableEntityParsing.IsChecked = _page.Options.DisableEntityParsing;
+ chkDisableSyntaxColorization.IsChecked = _page.Options.DisableSyntaxColorization;
+ chkDisableAssemblyReferences.IsChecked = _page.Options.DisableAssemblyReferences;
+ chkDisableForeignProjectReferences.IsChecked = _page.Options.DisableForeignProjectReferences;
+ chkDisableXSharpProjectReferences.IsChecked = _page.Options.DisableXSharpProjectReferences;
+ chkEnableOutputPane.IsChecked = _page.Options.EnableOutputPane;
+ chkEnableDatabaseLog.IsChecked = _page.Options.EnableDatabaseLog;
+ chkEnableParserLog.IsChecked = _page.Options.EnableParserLog;
+ chkEnableParameterTipsLog.IsChecked = _page.Options.EnableParameterLog;
+ chkEnableBraceMatchLog.IsChecked = _page.Options.EnableBraceMatchLog;
+ chkEnableCodeCompletionLog.IsChecked = _page.Options.EnableCodeCompletionLog;
+ chkEnableQuickInfoLog.IsChecked = _page.Options.EnableQuickInfoLog;
+ chkEnableTypeLookupLog.IsChecked = _page.Options.EnableTypelookupLog;
+ chkEnableReferenceLog.IsChecked = _page.Options.EnableReferenceInfoLog;
+ chkLogToDebug.IsChecked = LogOptions.Instance.LogToDebug;
+ chkLogToFile.IsChecked = LogOptions.Instance.LogToFile;
}
- internal void loadSettings()
- {
- this.chkDisableEditorDropdowns.Checked = _page.Options.DisableEditorDropdowns;
- this.chkDisableClassViewObjectView.Checked = _page.Options.DisableClassViewObjectView;
- this.chkDisableEntityParsing.Checked = _page.Options.DisableEntityParsing;
- this.chkDisableSyntaxColorization.Checked = _page.Options.DisableSyntaxColorization;
- this.chkDisableAssemblyReferences.Checked = _page.Options.DisableAssemblyReferences;
- this.chkDisableForeignProjectReferences.Checked = _page.Options.DisableForeignProjectReferences;
- this.chkDisableXSharpProjectReferences.Checked = _page.Options.DisableXSharpProjectReferences;
- this.chkEnableOutputPane.Checked = _page.Options.EnableOutputPane;
- this.chkEnableDatabaseLog.Checked = _page.Options.EnableDatabaseLog;
- this.chkEnableParserLog.Checked = _page.Options.EnableParserLog;
- this.chkEnableParameterTipsLog.Checked = _page.Options.EnableParameterLog;
- this.chkEnableBraceMatchLog.Checked = _page.Options.EnableBraceMatchLog;
- this.chkEnableCodeCompletionLog.Checked = _page.Options.EnableCodeCompletionLog;
- this.chkEnableQuickInfoLog.Checked = _page.Options.EnableQuickInfoLog;
- this.chkEnableTypeLookupLog.Checked = _page.Options.EnableTypelookupLog;
- this.chkEnableReferenceLog.Checked = _page.Options.EnableReferenceInfoLog;
- this.chkLogToDebug.Checked = LogOptions.Instance.LogToDebug;
- this.chkLogToFile.Checked = LogOptions.Instance.LogToFile;
- }
- internal void SaveSettings()
+
+ private void SaveSettings()
{
- _page.Options.DisableEditorDropdowns = this.chkDisableEditorDropdowns.Checked;
- _page.Options.DisableClassViewObjectView = this.chkDisableClassViewObjectView.Checked;
- _page.Options.DisableEntityParsing = this.chkDisableEntityParsing.Checked;
- _page.Options.DisableSyntaxColorization = this.chkDisableSyntaxColorization.Checked;
- _page.Options.DisableAssemblyReferences = this.chkDisableAssemblyReferences.Checked;
- _page.Options.DisableForeignProjectReferences = this.chkDisableForeignProjectReferences.Checked;
- _page.Options.DisableXSharpProjectReferences = this.chkDisableXSharpProjectReferences.Checked;
- _page.Options.EnableOutputPane = this.chkEnableOutputPane.Checked;
- _page.Options.EnableDatabaseLog = this.chkEnableDatabaseLog.Checked;
- _page.Options.EnableParserLog = this.chkEnableParserLog.Checked;
- _page.Options.EnableParameterLog = this.chkEnableParameterTipsLog.Checked;
- _page.Options.EnableBraceMatchLog = this.chkEnableBraceMatchLog.Checked;
- _page.Options.EnableCodeCompletionLog = this.chkEnableCodeCompletionLog.Checked;
- _page.Options.EnableQuickInfoLog = this.chkEnableQuickInfoLog.Checked;
- _page.Options.EnableTypelookupLog = this.chkEnableTypeLookupLog.Checked;
- _page.Options.EnableReferenceInfoLog = this.chkEnableReferenceLog.Checked;
- LogOptions.Instance.LogToFile = this.chkLogToFile.Checked;
- LogOptions.Instance.LogToDebug = this.chkLogToDebug.Checked;
+ _page.Options.DisableEditorDropdowns = chkDisableEditorDropdowns.IsChecked == true;
+ _page.Options.DisableClassViewObjectView = chkDisableClassViewObjectView.IsChecked == true;
+ _page.Options.DisableEntityParsing = chkDisableEntityParsing.IsChecked == true;
+ _page.Options.DisableSyntaxColorization = chkDisableSyntaxColorization.IsChecked == true;
+ _page.Options.DisableAssemblyReferences = chkDisableAssemblyReferences.IsChecked == true;
+ _page.Options.DisableForeignProjectReferences = chkDisableForeignProjectReferences.IsChecked == true;
+ _page.Options.DisableXSharpProjectReferences = chkDisableXSharpProjectReferences.IsChecked == true;
+ _page.Options.EnableOutputPane = chkEnableOutputPane.IsChecked == true;
+ _page.Options.EnableDatabaseLog = chkEnableDatabaseLog.IsChecked == true;
+ _page.Options.EnableParserLog = chkEnableParserLog.IsChecked == true;
+ _page.Options.EnableParameterLog = chkEnableParameterTipsLog.IsChecked == true;
+ _page.Options.EnableBraceMatchLog = chkEnableBraceMatchLog.IsChecked == true;
+ _page.Options.EnableCodeCompletionLog = chkEnableCodeCompletionLog.IsChecked == true;
+ _page.Options.EnableQuickInfoLog = chkEnableQuickInfoLog.IsChecked == true;
+ _page.Options.EnableTypelookupLog = chkEnableTypeLookupLog.IsChecked == true;
+ _page.Options.EnableReferenceInfoLog = chkEnableReferenceLog.IsChecked == true;
+ LogOptions.Instance.LogToFile = chkLogToFile.IsChecked == true;
+ LogOptions.Instance.LogToDebug = chkLogToDebug.IsChecked == true;
LogOptions.Instance.WriteToSettings();
-
}
+ private void OnOk(object sender, RoutedEventArgs e)
+ {
+ SaveSettings();
+ DialogResult = true;
+ }
}
}
diff --git a/src/VisualStudio/LanguageService/OptionsPages/XSharpSpecialOptions.xaml b/src/VisualStudio/LanguageService/OptionsPages/XSharpSpecialOptions.xaml
new file mode 100644
index 0000000000..9fc27f0670
--- /dev/null
+++ b/src/VisualStudio/LanguageService/OptionsPages/XSharpSpecialOptions.xaml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From a7cad914135ae3fa1913a2a2b3c8516e67c0e108 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sat, 2 May 2026 14:10:50 +0000
Subject: [PATCH 11/11] feat: convert WinForms dialogs and options pages to WPF
Agent-Logs-Url: https://github.com/X-Sharp/XSharpPublic/sessions/0bde006f-4188-47d1-bf82-636e97a44b8b
Co-authored-by: RobertvanderHulst <14240939+RobertvanderHulst@users.noreply.github.com>
---
src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.cs | 1 +
.../LanguageService/OptionsPages/GeneratorOptionsControl.cs | 6 +++---
.../OptionsPages/IntellisenseOptionsControl.xaml | 6 ------
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.cs b/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.cs
index da897765dc..9e1cbc2239 100644
--- a/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.cs
+++ b/src/VisualStudio/LanguageService/LightBulb/CtorParamsDlg.cs
@@ -7,6 +7,7 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
+using XSharp.LanguageService;
using XSharpModel;
namespace XSharp.LanguageService.Editors.LightBulb
diff --git a/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.cs b/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.cs
index e162dd841d..4911d6f03d 100644
--- a/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.cs
+++ b/src/VisualStudio/LanguageService/OptionsPages/GeneratorOptionsControl.cs
@@ -16,14 +16,14 @@ public GeneratorOptionsControl()
internal override void ReadValues(object options)
{
base.ReadValues(options);
- var page = (GeneratorOptionsPage)optionPage;
- switch ((PublicStyle)page.Options.PublicStyle)
+ var opts = (GeneratorOptions)options;
+ switch ((PublicStyle)opts.PublicStyle)
{
case PublicStyle.Export: rbExport.IsChecked = true; break;
case PublicStyle.None: rbNone.IsChecked = true; break;
default: rbPublic.IsChecked = true; break;
}
- switch ((PrivateStyle)page.Options.PrivateStyle)
+ switch ((PrivateStyle)opts.PrivateStyle)
{
case PrivateStyle.Hidden: rbHidden.IsChecked = true; break;
default: rbPrivate.IsChecked = true; break;
diff --git a/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.xaml b/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.xaml
index 5ddd2b3231..9a045edbd1 100644
--- a/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.xaml
+++ b/src/VisualStudio/LanguageService/OptionsPages/IntellisenseOptionsControl.xaml
@@ -60,12 +60,6 @@
-
-