From b5d270148bdead83d821b0b415176875108c050b Mon Sep 17 00:00:00 2001 From: Christer van der Meeren Date: Tue, 24 Oct 2017 10:07:09 +0200 Subject: [PATCH 1/9] start working on color option --- .../src/FSharp.Editor/CodeLens/LineLens.fs | 2 +- .../FSharp.Editor/Options/EditorOptions.fs | 3 + .../CodeLensOptionControl.xaml | 2 + .../FSharp.UIResources/Strings.Designer.cs | 73 +++++++++++-------- .../src/FSharp.UIResources/Strings.resx | 3 + 5 files changed, 50 insertions(+), 33 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs index c007ef13b25..3f101ce5317 100644 --- a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs +++ b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs @@ -353,7 +353,7 @@ type internal FSharpCodeLensService textBox.Inlines.Add (Documents.Run Settings.CodeLens.Prefix) for text in taggedText do let run = Documents.Run text.Text - DependencyObjectExtensions.SetTextProperties (run, layoutTagToFormatting text.Tag) + if Settings.CodeLens.UseColors then DependencyObjectExtensions.SetTextProperties (run, layoutTagToFormatting text.Tag) let inl = match text with | :? Layout.NavigableTaggedText as nav when navigation.IsTargetValid nav.Range -> diff --git a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs index 37dbf74e26a..8b9d766ac73 100644 --- a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs +++ b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs @@ -45,6 +45,7 @@ type LanguageServicePerformanceOptions = type CodeLensOptions = { Enabled : bool ReplaceWithLineLens: bool + UseColors: bool Prefix : string } [)>] @@ -73,6 +74,7 @@ type internal Settings [](store: SettingsStore) = store.RegisterDefault { Enabled = true + UseColors = false ReplaceWithLineLens = true Prefix = "// " } @@ -125,5 +127,6 @@ module internal OptionsUI = let view = CodeLensOptionControl() bindCheckBox view.replaceWithLineLens "ReplaceWithLineLens" bindCheckBox view.enableCodeLens "Enabled" + bindCheckBox view.useColors "UseColors" bindTextBox view.prefix "Prefix" upcast view \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/CodeLensOptionControl.xaml b/vsintegration/src/FSharp.UIResources/CodeLensOptionControl.xaml index c5dc3e59030..a8ebdd9b13c 100644 --- a/vsintegration/src/FSharp.UIResources/CodeLensOptionControl.xaml +++ b/vsintegration/src/FSharp.UIResources/CodeLensOptionControl.xaml @@ -21,6 +21,8 @@ + diff --git a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs index c2a54914ba3..e17a4df9a4b 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs +++ b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,12 +13,12 @@ namespace Microsoft.VisualStudio.FSharp.UIResources { /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -33,7 +33,7 @@ internal Strings() { } /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ internal Strings() { } /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ internal Strings() { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Always place open statements at the top level ähnelt. + /// Looks up a localized string similar to Always place open statements at the top level. /// public static string Always_place_opens_at_top_level { get { @@ -70,7 +70,7 @@ public static string Always_place_opens_at_top_level { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Code Fixes ähnelt. + /// Looks up a localized string similar to Code Fixes. /// public static string Code_Fixes { get { @@ -79,7 +79,7 @@ public static string Code_Fixes { } /// - /// Sucht eine lokalisierte Zeichenfolge, die CodeLens ähnelt. + /// Looks up a localized string similar to CodeLens. /// public static string CodeLens { get { @@ -88,7 +88,7 @@ public static string CodeLens { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Annotation prefix ähnelt. + /// Looks up a localized string similar to Annotation prefix. /// public static string CodeLens_Prefix { get { @@ -97,7 +97,7 @@ public static string CodeLens_Prefix { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Show annotations to the right instead of above the line ähnelt. + /// Looks up a localized string similar to Show annotations to the right instead of above the line. /// public static string CodeLens_Replace_LineLens { get { @@ -106,7 +106,7 @@ public static string CodeLens_Replace_LineLens { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Show type signature annotations in the editor ähnelt. + /// Looks up a localized string similar to Show type signature annotations in the editor. /// public static string CodeLens_Switch { get { @@ -115,7 +115,16 @@ public static string CodeLens_Switch { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Completion Lists ähnelt. + /// Looks up a localized string similar to Use colors in annotations. + /// + public static string CodeLens_UseColors { + get { + return ResourceManager.GetString("CodeLens_UseColors", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Completion Lists. /// public static string Completion_Lists { get { @@ -124,7 +133,7 @@ public static string Completion_Lists { } /// - /// Sucht eine lokalisierte Zeichenfolge, die D_ash underline ähnelt. + /// Looks up a localized string similar to D_ash underline. /// public static string Dash_underline { get { @@ -133,7 +142,7 @@ public static string Dash_underline { } /// - /// Sucht eine lokalisierte Zeichenfolge, die D_ot underline ähnelt. + /// Looks up a localized string similar to D_ot underline. /// public static string Dot_underline { get { @@ -142,7 +151,7 @@ public static string Dot_underline { } /// - /// Sucht eine lokalisierte Zeichenfolge, die _Enable in-memory cross project references ähnelt. + /// Looks up a localized string similar to _Enable in-memory cross project references. /// public static string Enable_in_memory_cross_project_references { get { @@ -151,7 +160,7 @@ public static string Enable_in_memory_cross_project_references { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Performance ähnelt. + /// Looks up a localized string similar to Performance. /// public static string Language_Service_Performance { get { @@ -160,7 +169,7 @@ public static string Language_Service_Performance { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Navigation links ähnelt. + /// Looks up a localized string similar to Navigation links. /// public static string Navigation_links { get { @@ -169,7 +178,7 @@ public static string Navigation_links { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Project check cache size ähnelt. + /// Looks up a localized string similar to Project check cache size. /// public static string Project_check_cache_size { get { @@ -178,7 +187,7 @@ public static string Project_check_cache_size { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Show s_ymbols in unopened namespaces ähnelt. + /// Looks up a localized string similar to Show s_ymbols in unopened namespaces. /// public static string Show_all_symbols { get { @@ -187,7 +196,7 @@ public static string Show_all_symbols { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Show completion list after a character is _deleted ähnelt. + /// Looks up a localized string similar to Show completion list after a character is _deleted. /// public static string Show_completion_list_after_a_character_is_deleted { get { @@ -196,7 +205,7 @@ public static string Show_completion_list_after_a_character_is_deleted { } /// - /// Sucht eine lokalisierte Zeichenfolge, die _Show completion list after a character is typed ähnelt. + /// Looks up a localized string similar to _Show completion list after a character is typed. /// public static string Show_completion_list_after_a_character_is_typed { get { @@ -205,7 +214,7 @@ public static string Show_completion_list_after_a_character_is_typed { } /// - /// Sucht eine lokalisierte Zeichenfolge, die S_how navigation links as ähnelt. + /// Looks up a localized string similar to S_how navigation links as. /// public static string Show_navigation_links_as { get { @@ -214,7 +223,7 @@ public static string Show_navigation_links_as { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Simplify names (remove unnecessary qualifiers) ähnelt. + /// Looks up a localized string similar to Simplify names (remove unnecessary qualifiers). /// public static string Simplify_name_code_fix { get { @@ -223,7 +232,7 @@ public static string Simplify_name_code_fix { } /// - /// Sucht eine lokalisierte Zeichenfolge, die _Solid underline ähnelt. + /// Looks up a localized string similar to _Solid underline. /// public static string Solid_underline { get { @@ -232,7 +241,7 @@ public static string Solid_underline { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Remove unused open statements ähnelt. + /// Looks up a localized string similar to Remove unused open statements. /// public static string Unused_opens_code_fix { get { diff --git a/vsintegration/src/FSharp.UIResources/Strings.resx b/vsintegration/src/FSharp.UIResources/Strings.resx index 7afc02197a6..b4f0c4ca8b4 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.resx +++ b/vsintegration/src/FSharp.UIResources/Strings.resx @@ -177,4 +177,7 @@ Annotation prefix + + Use colors in annotations + \ No newline at end of file From de4e6bb10e4fa4fd56557850caef8e722e4729b0 Mon Sep 17 00:00:00 2001 From: Christer van der Meeren Date: Tue, 24 Oct 2017 11:46:25 +0200 Subject: [PATCH 2/9] =?UTF-8?q?use=20darker=20gray=20=C3=A0=20la=20normal?= =?UTF-8?q?=20CodeLens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/FSharp.Editor/CodeLens/LineLens.fs | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs index 3f101ce5317..e62f8207163 100644 --- a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs +++ b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs @@ -350,10 +350,29 @@ type internal FSharpCodeLensService let! taggedText, navigation = lens.TaggedText let textBox = new TextBlock(Width = 500., Background = Brushes.Transparent, Opacity = 0.0, TextTrimming = TextTrimming.None) DependencyObjectExtensions.SetDefaultTextProperties(textBox, formatMap.Value) - textBox.Inlines.Add (Documents.Run Settings.CodeLens.Prefix) + + let prefix = Documents.Run Settings.CodeLens.Prefix + prefix.Foreground <- SolidColorBrush(Color.FromRgb(153uy, 153uy, 153uy)) + textBox.Inlines.Add (prefix) + for text in taggedText do + + let properties = layoutTagToFormatting text.Tag + let properties = + if Settings.CodeLens.UseColors + then + match properties.ForegroundBrush with + | :? SolidColorBrush as b -> + let c = b.Color + // Change to correct gray color + if c.R = c.G && c.R = c.B then properties.SetForeground(Color.FromRgb(153uy, 153uy, 153uy)) else properties + | _ -> properties + else + properties.SetForeground(Color.FromRgb(153uy, 153uy, 153uy)) + let run = Documents.Run text.Text - if Settings.CodeLens.UseColors then DependencyObjectExtensions.SetTextProperties (run, layoutTagToFormatting text.Tag) + DependencyObjectExtensions.SetTextProperties (run, properties) + let inl = match text with | :? Layout.NavigableTaggedText as nav when navigation.IsTargetValid nav.Range -> @@ -362,10 +381,11 @@ type internal FSharpCodeLensService navigation.NavigateTo nav.Range) h :> Documents.Inline | _ -> run :> _ + DependencyObjectExtensions.SetTextProperties (inl, properties) textBox.Inlines.Add inl lens.Computed <- true lens.UiElement <- textBox - } + } let executeCodeLenseAsync () = asyncMaybe { From f738a97179f4eed3f5df0abecc3e8e4ed177e148 Mon Sep 17 00:00:00 2001 From: Christer van der Meeren Date: Wed, 25 Oct 2017 18:56:43 +0200 Subject: [PATCH 3/9] Undo unintended whitespace change --- vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs index e62f8207163..c2e8d2f879e 100644 --- a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs +++ b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs @@ -385,7 +385,7 @@ type internal FSharpCodeLensService textBox.Inlines.Add inl lens.Computed <- true lens.UiElement <- textBox - } + } let executeCodeLenseAsync () = asyncMaybe { From a16c435b1509481e64e357b223bd27427b0dab64 Mon Sep 17 00:00:00 2001 From: Christer van der Meeren Date: Wed, 25 Oct 2017 18:56:43 +0200 Subject: [PATCH 4/9] Should be part of previous commit --- vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs index e62f8207163..6af6bbf552b 100644 --- a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs +++ b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs @@ -385,7 +385,7 @@ type internal FSharpCodeLensService textBox.Inlines.Add inl lens.Computed <- true lens.UiElement <- textBox - } + } let executeCodeLenseAsync () = asyncMaybe { From 958da82aa70022e83a8ef706ba2e00b63bd71f22 Mon Sep 17 00:00:00 2001 From: Christer van der Meeren Date: Tue, 24 Oct 2017 10:07:09 +0200 Subject: [PATCH 5/9] start working on color option --- .../src/FSharp.Editor/CodeLens/LineLens.fs | 2 +- .../FSharp.Editor/Options/EditorOptions.fs | 3 + .../CodeLensOptionControl.xaml | 2 + .../FSharp.UIResources/Strings.Designer.cs | 73 +++++++++++-------- .../src/FSharp.UIResources/Strings.resx | 3 + 5 files changed, 50 insertions(+), 33 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs index c007ef13b25..3f101ce5317 100644 --- a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs +++ b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs @@ -353,7 +353,7 @@ type internal FSharpCodeLensService textBox.Inlines.Add (Documents.Run Settings.CodeLens.Prefix) for text in taggedText do let run = Documents.Run text.Text - DependencyObjectExtensions.SetTextProperties (run, layoutTagToFormatting text.Tag) + if Settings.CodeLens.UseColors then DependencyObjectExtensions.SetTextProperties (run, layoutTagToFormatting text.Tag) let inl = match text with | :? Layout.NavigableTaggedText as nav when navigation.IsTargetValid nav.Range -> diff --git a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs index 37dbf74e26a..8b9d766ac73 100644 --- a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs +++ b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs @@ -45,6 +45,7 @@ type LanguageServicePerformanceOptions = type CodeLensOptions = { Enabled : bool ReplaceWithLineLens: bool + UseColors: bool Prefix : string } [)>] @@ -73,6 +74,7 @@ type internal Settings [](store: SettingsStore) = store.RegisterDefault { Enabled = true + UseColors = false ReplaceWithLineLens = true Prefix = "// " } @@ -125,5 +127,6 @@ module internal OptionsUI = let view = CodeLensOptionControl() bindCheckBox view.replaceWithLineLens "ReplaceWithLineLens" bindCheckBox view.enableCodeLens "Enabled" + bindCheckBox view.useColors "UseColors" bindTextBox view.prefix "Prefix" upcast view \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/CodeLensOptionControl.xaml b/vsintegration/src/FSharp.UIResources/CodeLensOptionControl.xaml index c5dc3e59030..a8ebdd9b13c 100644 --- a/vsintegration/src/FSharp.UIResources/CodeLensOptionControl.xaml +++ b/vsintegration/src/FSharp.UIResources/CodeLensOptionControl.xaml @@ -21,6 +21,8 @@ + diff --git a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs index c2a54914ba3..e17a4df9a4b 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs +++ b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,12 +13,12 @@ namespace Microsoft.VisualStudio.FSharp.UIResources { /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -33,7 +33,7 @@ internal Strings() { } /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ internal Strings() { } /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ internal Strings() { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Always place open statements at the top level ähnelt. + /// Looks up a localized string similar to Always place open statements at the top level. /// public static string Always_place_opens_at_top_level { get { @@ -70,7 +70,7 @@ public static string Always_place_opens_at_top_level { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Code Fixes ähnelt. + /// Looks up a localized string similar to Code Fixes. /// public static string Code_Fixes { get { @@ -79,7 +79,7 @@ public static string Code_Fixes { } /// - /// Sucht eine lokalisierte Zeichenfolge, die CodeLens ähnelt. + /// Looks up a localized string similar to CodeLens. /// public static string CodeLens { get { @@ -88,7 +88,7 @@ public static string CodeLens { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Annotation prefix ähnelt. + /// Looks up a localized string similar to Annotation prefix. /// public static string CodeLens_Prefix { get { @@ -97,7 +97,7 @@ public static string CodeLens_Prefix { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Show annotations to the right instead of above the line ähnelt. + /// Looks up a localized string similar to Show annotations to the right instead of above the line. /// public static string CodeLens_Replace_LineLens { get { @@ -106,7 +106,7 @@ public static string CodeLens_Replace_LineLens { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Show type signature annotations in the editor ähnelt. + /// Looks up a localized string similar to Show type signature annotations in the editor. /// public static string CodeLens_Switch { get { @@ -115,7 +115,16 @@ public static string CodeLens_Switch { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Completion Lists ähnelt. + /// Looks up a localized string similar to Use colors in annotations. + /// + public static string CodeLens_UseColors { + get { + return ResourceManager.GetString("CodeLens_UseColors", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Completion Lists. /// public static string Completion_Lists { get { @@ -124,7 +133,7 @@ public static string Completion_Lists { } /// - /// Sucht eine lokalisierte Zeichenfolge, die D_ash underline ähnelt. + /// Looks up a localized string similar to D_ash underline. /// public static string Dash_underline { get { @@ -133,7 +142,7 @@ public static string Dash_underline { } /// - /// Sucht eine lokalisierte Zeichenfolge, die D_ot underline ähnelt. + /// Looks up a localized string similar to D_ot underline. /// public static string Dot_underline { get { @@ -142,7 +151,7 @@ public static string Dot_underline { } /// - /// Sucht eine lokalisierte Zeichenfolge, die _Enable in-memory cross project references ähnelt. + /// Looks up a localized string similar to _Enable in-memory cross project references. /// public static string Enable_in_memory_cross_project_references { get { @@ -151,7 +160,7 @@ public static string Enable_in_memory_cross_project_references { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Performance ähnelt. + /// Looks up a localized string similar to Performance. /// public static string Language_Service_Performance { get { @@ -160,7 +169,7 @@ public static string Language_Service_Performance { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Navigation links ähnelt. + /// Looks up a localized string similar to Navigation links. /// public static string Navigation_links { get { @@ -169,7 +178,7 @@ public static string Navigation_links { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Project check cache size ähnelt. + /// Looks up a localized string similar to Project check cache size. /// public static string Project_check_cache_size { get { @@ -178,7 +187,7 @@ public static string Project_check_cache_size { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Show s_ymbols in unopened namespaces ähnelt. + /// Looks up a localized string similar to Show s_ymbols in unopened namespaces. /// public static string Show_all_symbols { get { @@ -187,7 +196,7 @@ public static string Show_all_symbols { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Show completion list after a character is _deleted ähnelt. + /// Looks up a localized string similar to Show completion list after a character is _deleted. /// public static string Show_completion_list_after_a_character_is_deleted { get { @@ -196,7 +205,7 @@ public static string Show_completion_list_after_a_character_is_deleted { } /// - /// Sucht eine lokalisierte Zeichenfolge, die _Show completion list after a character is typed ähnelt. + /// Looks up a localized string similar to _Show completion list after a character is typed. /// public static string Show_completion_list_after_a_character_is_typed { get { @@ -205,7 +214,7 @@ public static string Show_completion_list_after_a_character_is_typed { } /// - /// Sucht eine lokalisierte Zeichenfolge, die S_how navigation links as ähnelt. + /// Looks up a localized string similar to S_how navigation links as. /// public static string Show_navigation_links_as { get { @@ -214,7 +223,7 @@ public static string Show_navigation_links_as { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Simplify names (remove unnecessary qualifiers) ähnelt. + /// Looks up a localized string similar to Simplify names (remove unnecessary qualifiers). /// public static string Simplify_name_code_fix { get { @@ -223,7 +232,7 @@ public static string Simplify_name_code_fix { } /// - /// Sucht eine lokalisierte Zeichenfolge, die _Solid underline ähnelt. + /// Looks up a localized string similar to _Solid underline. /// public static string Solid_underline { get { @@ -232,7 +241,7 @@ public static string Solid_underline { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Remove unused open statements ähnelt. + /// Looks up a localized string similar to Remove unused open statements. /// public static string Unused_opens_code_fix { get { diff --git a/vsintegration/src/FSharp.UIResources/Strings.resx b/vsintegration/src/FSharp.UIResources/Strings.resx index 7afc02197a6..b4f0c4ca8b4 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.resx +++ b/vsintegration/src/FSharp.UIResources/Strings.resx @@ -177,4 +177,7 @@ Annotation prefix + + Use colors in annotations + \ No newline at end of file From 69669340dfd4e77b216b6eb1a84b0292cda04e82 Mon Sep 17 00:00:00 2001 From: Christer van der Meeren Date: Tue, 24 Oct 2017 11:46:25 +0200 Subject: [PATCH 6/9] =?UTF-8?q?use=20darker=20gray=20=C3=A0=20la=20normal?= =?UTF-8?q?=20CodeLens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/FSharp.Editor/CodeLens/LineLens.fs | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs index 3f101ce5317..e62f8207163 100644 --- a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs +++ b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs @@ -350,10 +350,29 @@ type internal FSharpCodeLensService let! taggedText, navigation = lens.TaggedText let textBox = new TextBlock(Width = 500., Background = Brushes.Transparent, Opacity = 0.0, TextTrimming = TextTrimming.None) DependencyObjectExtensions.SetDefaultTextProperties(textBox, formatMap.Value) - textBox.Inlines.Add (Documents.Run Settings.CodeLens.Prefix) + + let prefix = Documents.Run Settings.CodeLens.Prefix + prefix.Foreground <- SolidColorBrush(Color.FromRgb(153uy, 153uy, 153uy)) + textBox.Inlines.Add (prefix) + for text in taggedText do + + let properties = layoutTagToFormatting text.Tag + let properties = + if Settings.CodeLens.UseColors + then + match properties.ForegroundBrush with + | :? SolidColorBrush as b -> + let c = b.Color + // Change to correct gray color + if c.R = c.G && c.R = c.B then properties.SetForeground(Color.FromRgb(153uy, 153uy, 153uy)) else properties + | _ -> properties + else + properties.SetForeground(Color.FromRgb(153uy, 153uy, 153uy)) + let run = Documents.Run text.Text - if Settings.CodeLens.UseColors then DependencyObjectExtensions.SetTextProperties (run, layoutTagToFormatting text.Tag) + DependencyObjectExtensions.SetTextProperties (run, properties) + let inl = match text with | :? Layout.NavigableTaggedText as nav when navigation.IsTargetValid nav.Range -> @@ -362,10 +381,11 @@ type internal FSharpCodeLensService navigation.NavigateTo nav.Range) h :> Documents.Inline | _ -> run :> _ + DependencyObjectExtensions.SetTextProperties (inl, properties) textBox.Inlines.Add inl lens.Computed <- true lens.UiElement <- textBox - } + } let executeCodeLenseAsync () = asyncMaybe { From 15c351afa013241b0e0c31145362234dfa4883fd Mon Sep 17 00:00:00 2001 From: Christer van der Meeren Date: Wed, 25 Oct 2017 18:56:43 +0200 Subject: [PATCH 7/9] Undo unintended whitespace change --- vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs index e62f8207163..c2e8d2f879e 100644 --- a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs +++ b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs @@ -385,7 +385,7 @@ type internal FSharpCodeLensService textBox.Inlines.Add inl lens.Computed <- true lens.UiElement <- textBox - } + } let executeCodeLenseAsync () = asyncMaybe { From 9f63f2d3db79d1cf066bf3d03a3e9b75b4a02db2 Mon Sep 17 00:00:00 2001 From: Christer van der Meeren Date: Wed, 25 Oct 2017 18:56:43 +0200 Subject: [PATCH 8/9] Should be part of previous commit --- vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs index c2e8d2f879e..6af6bbf552b 100644 --- a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs +++ b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs @@ -385,7 +385,7 @@ type internal FSharpCodeLensService textBox.Inlines.Add inl lens.Computed <- true lens.UiElement <- textBox - } + } let executeCodeLenseAsync () = asyncMaybe { From 4e4ff6a445c7122ea7781beef91094d4826e42ba Mon Sep 17 00:00:00 2001 From: Christer van der Meeren Date: Wed, 25 Oct 2017 19:21:52 +0200 Subject: [PATCH 9/9] fix value names --- .../src/FSharp.Editor/CodeLens/LineLens.fs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs index 6af6bbf552b..f0d5dc11e0f 100644 --- a/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs +++ b/vsintegration/src/FSharp.Editor/CodeLens/LineLens.fs @@ -357,21 +357,24 @@ type internal FSharpCodeLensService for text in taggedText do - let properties = layoutTagToFormatting text.Tag - let properties = + let coloredProperties = layoutTagToFormatting text.Tag + let actualProperties = if Settings.CodeLens.UseColors then - match properties.ForegroundBrush with + // If color is gray (R=G=B), change to correct gray color. + // Otherwise, use the provided color. + match coloredProperties.ForegroundBrush with | :? SolidColorBrush as b -> let c = b.Color - // Change to correct gray color - if c.R = c.G && c.R = c.B then properties.SetForeground(Color.FromRgb(153uy, 153uy, 153uy)) else properties - | _ -> properties + if c.R = c.G && c.R = c.B + then coloredProperties.SetForeground(Color.FromRgb(153uy, 153uy, 153uy)) + else coloredProperties + | _ -> coloredProperties else - properties.SetForeground(Color.FromRgb(153uy, 153uy, 153uy)) + coloredProperties.SetForeground(Color.FromRgb(153uy, 153uy, 153uy)) let run = Documents.Run text.Text - DependencyObjectExtensions.SetTextProperties (run, properties) + DependencyObjectExtensions.SetTextProperties (run, actualProperties) let inl = match text with @@ -381,7 +384,7 @@ type internal FSharpCodeLensService navigation.NavigateTo nav.Range) h :> Documents.Inline | _ -> run :> _ - DependencyObjectExtensions.SetTextProperties (inl, properties) + DependencyObjectExtensions.SetTextProperties (inl, actualProperties) textBox.Inlines.Add inl lens.Computed <- true lens.UiElement <- textBox