dotnet / dotnet/fsharp

The theme change in Visual Studio does not change the default color value in "Fonts and Colors"

Open
#10,555 3 comments 0 reactions 0 assignees View on GitHub
AI-thinks-windows-only Area-VS-Editor Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

Hi. There is probably a very small bug in F# integration with Visual Studio. Usually you have a two sets of default colors for both light and dark themes. However, in the integration code here the VS fonts and colors cache is updated incorrectly:
https://github.com/dotnet/fsharp/blob/main/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs#L121
According to the documentation for IVsFontAndColorCacheManager interface you need to call to the ClearCache/ClearAllCaches at the end of update:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.interop.ivsfontandcolorcachemanager?view=visualstudiosdk-2019

Otherwise you may see that the default color didn't change.

**Repro steps**
1. Open VS settings, find "Fonts and Colors" section, look at the default value of some of F# colors and remember it.
2. Change the theme, the default color in "Fonts and Colors" should change as well
3. Without restart of Visual Studio open "Fonts and Colors" section in the settings. The default color still stays the same.

**Expected behavior**
The default color should change to the color which corresponds to the theme

**Actual behavior**
The default color still stays the same.

**Known workarounds**
Restart of VS solves this issue because it updates the caches.

**Related information**
The fix should be simple - just add fontAndColorCacheManager.RefreshCache/ClearCache

You may find useful my answer on stack overflow:
https://stackoverflow.com/a/48993958/2893207

* Operating system Windows 10
* .NET Framework 4.8
* I used Visual Studio Professional 2019 Version 16.7.7

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.