-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quirks and inconveniences when configuring syntax highlight styles #282
Comments
It is impossible to select the one style. The display of a symbol can be a composition of several syntax styles, thus Syntax Styles lists all styles that correspond to the selected / clicked place in the code editor. If you want the old-school configuration way like the Fonts and Colors, click the "All languages" in the Syntax Categories box, where all configurable symbols are listed. |
So I click on something rendered in RED and you show me the three styles that may apply: One each RED, GREEN and BLUE. And it is not possible to determine which one I'm trying to change? Clearly for the RED object I clicked, it is the ONLY possible style I could be changing. I could (possibly) understand if more than one color in the applicable list matched what I clicked, but still, Codist must've made a final choice as to what style it was using to render the clicked item ... or does it render all of the potentially applicable styles? If the latter, does that mean colors can change as I'm moving through the file? If the selected color is consistent (and therefore predictable) then, once again, it seems that it should be possible to select the correct item in the style list. Sorry to sound so argumentative. It just baffles me that, if the correct syntax style is always selected for rendering, I cannot comprehend why that suddenly becomes impossible later. I'm guessing some lousy code from Microsoft, as I so often encounter in my own work. |
Thank you for taking so much time with valuable feedback. 2: 3: 4: It would be much better to start with the colors already configured into Visual Studio. 5: 6: 7: 8: |
Unfortunately, Codist is not the final one. Nevertheless, in your case, and most common cases in C++, it is quite possible to find out the "most possible" syntax classification and have it selected in the Syntax Style by default. I will give it a try. |
There's a new beta version which addressed some of problems (1, 2 and 4) you posted above. Please download it from #283 and give it a try. BTW, due to the limitation of VS API, Codist has no idea about the actually rendered style of a code symbol on the screen. |
As for request 8, I remembered why the custom colors were not used. Quite a few years ago. I once tried to use those custom colors during the customization, however, I found the experience was not so good. Thus I removed the already written code. The implementation of the ColorDialog is quite absurd. Hence I added two items, "Copy color" and "Paste color", to the drop-down menu when you click on the color button. You can use those two menu commands to reuse colors. |
@fitdev |
It is working well for me for the most part, apart from a few issues with things like |
Thanks! I will give the test version a try, but since part of it is to choose better colors the first time syntax coloring is enabled after installing Codist, I must ask about possible saved settings: I plan to
Will that process get me a "clean" install of Codist, as if I had never had it installed before? If not, what do I need to remove/clean up between steps 3 and 4 to ensure the test is "clean"? For number 5 [At least one color does not work correctly at VS start up]... This one is consistent for me. If there is anything I can check and/or test for you, please let me know. I would much prefer to have the same behavior you are reporting, but I do not. The color assigned to custom data types (cppType) is always the identifier color. If I open the Codist color settings and select the white color that is already selected for the cppType, then the color of those symbols changes to white, as I would've expected when I load Visual Studio. There may be other colors that have this issue, but with 394 different colors to set in my Fonts & Colors | Text Editor dialog, there's no way I can check them all! Also, a comment on the custom colors in the not-so-great ChooseColor dialog: I agree it is a clunky interface, but after using it for literally decades, I personally, have gotten used to how it works. Yes, it is annoying that it resets the selected color when an "empty" customer color slot is selected, but it is really selecting the color currently in the slot, which is what the user wants after a custom color has been assigned. I've simply learned to look at and remember the three RGB values I want and type them back in after selecting an "empty" custom slot. Some programs even save the custom colors to reload after program restarts, but that's not nearly as important as being able to save and reuse a color during a single work session. As it stands, I need to write down the RGB for specific colors I wish to use in multiple settings so that I may type them in every time I open the ChooseColor dialog -- I was hoping I could do that only once. Finally, does formal language really need to be listed in the syntax color lists? If so, wouldn't it simply be the default color when no specific classification fits? (If that is even possible) I can understand that it is the base type (I hope that's a good term) for ALL of the classification types, but I would be surprised if it is actually a type that can actually exist. I'm probably wrong, just following what I consider logic (which, apparently, often is not.) |
Nice to hear from you, @nurbles.
Now the Codist is reset. |
If the problem is consistent, that'll be relatively easier for us to fix it. |
I usually use the aforementioned "Copy Color" and "Paste Color" to reuse colors. If I were to rewrite our own the ColorDialog, I will consider listing standard colors and existing colors in current highlight configuration in two arrays of buttons. Another array of "color variance" buttons may be there to help users to quickly formulate their color themes too. However, the Color Spectrum on the ColorDialog is kind of difficult. |
The ColorDialog with color variances mentioned in #282 (comment) is released in beta 8926. |
Here's the config.json that you requested.
As long as there's a mechanism for selecting a precise color (like RGB) and making adjustments to an existing color (like HSL), I think we can make it work. If you're interested in an custom color selection dialog that may have gone overboard, you might want to check out the ColorPicker extension I'm fond of his method for providing gradients to select colors, but he also allows direct entry in more formats than I realized existed! |
It is really questionable. The thing is the base type of many classification types. However, it is not necessary the base of all syntax classification types. For instance, |
I will check it out later.
Yes, numeric value boxes or sliders will be there.
I have seen similar implementations alike the ColorPicker. |
Sorry I forgot to mention this... You did such a good job automatically selecting the appropriate syntax style that it took me a while to remember that was a new function! So far, everything I've found to check it with has worked perfectly! THANKS! To me, this makes a very good feature into a great feature! |
Another observation on the test version... Because Codist can save and restore its own colors, I hoped I would finally be able to save my colors, switch to a dark theme and restore my colors after the theme completely messes them up. And it worked. Somewhat, at least. I needed to leave my desk to a while, so I powered off my displays. When I returned home and powered them on, as usual Windows had moved and resized Visual Studio because I run it on a 4K TV rather than a purpose-built computer monitor (the TV was almost 10 times cheaper than an equivalent size/resolution monitor!) Unexpectedly, this had a side effect of all the fonts and colors returning to the theme's defaults! I was able to open Codist's color settings and reload my saved colors, but having the colors changed due to a monitor change like that was VERY unexpected. It appears that something in the monitor loss/detect triggered Codist to reload the current colors from Fonts&Colors, as if it had just been started and was first creating the color config. I would only expect that to happen once, perhaps with a button to trigger that function on demand if I changed the theme and wanted Codist to start with the new theme. So, while you did a great job copying the pre-existing colors, it seems to me that the copy function may be called at some additional and unexpected times. |
[Apologies for these long posts. I try to ensure I'm clearly describing what I see and to provide whatever useful information I can (sometimes as suggestions {smile})]
It is possible (but probably unlikely) that the loss of a monitor might trigger the save events. That would require physical disconnection of a purpose-built computer monitor, since they have some special EDID circuitry that apparently even works when the monitor is powered off so that Windows "knows" the monitor is still attached. My issue is definitely a Windows issue at its root, since Windows thinks my TV monitor is, well, gone forever I guess as opposed to temporarily powered off, which seems to be how Windows deals with computer monitors. This causes Windows to move all icons and applications from the TV monitor (which is the central of 3 screens) to the other two screens, with Visual Studio ending as spanning both of the other two screens. How Visual Studio deals with this event is beyond me. Before installing Codist, I didn't notice any changes other than Window size and position because my TV screen is 3840x2160 while the other two screens are only 1080x1920 and 1280x1024, so VS is always taller than the other two screens and often wider than both put together. If you would like me to run any tests, including instrumented versions of Codist, just let me know.
I think you misunderstood a possible issue for a suggestion. I was not asking for the copy function to run more often -- I was suggesting that it is running too often already. I suspected this because the colors revert to the VS selected colors at unexpected times. Two examples I can remember right now are when I loaded the theme and after the screen issues described above. I believe there was at least one other time I accidentally triggered the colors to return to the theme's colors, but I failed to record it on paper, in a file or (sadly) in my own aging memory (I started writing code 45 years ago.) If I see the colors revert to the theme again, I will actually write it down so that I may report it to you.
Sorry, after cleaning the old config out and installing the test version I got some unexpected color changes at first. For example, control keywords changed from #00FF00 to the kinda dull blue in your image. However, after going through the colors and adjusting the ones that weren't what I expected and setting a couple that were new to me (like a special color for labels, thanks!) I have not seen and incorrect colors at the initial VS load time. I was curious about the requirement to use the VS Fonts&Colors to change the default foreground & background colors for the Text Editor. I wondered if changing the background for formal language might actually turn out to be the default colors. It does seem to be the default colors for the syntax elements, but it is not the default color for the entire Window, i.e. anywhere that produces the "No syntax highlight is applied to active position in code window," message in Codist's color dialog. Are the default colors (called "Plain text") unavailable to Codist or have you chosen not to present them? Just curious, since I can still use the VS setting to control them. Finally, while I was searching the Codist syntax styles for "Plain Text" (or something that might be plain text), I was using the All languages category. This spawned these suggestions:
|
I just loaded VS2022 and noticed two things:
|
It is always good to have kind and rational discussions. No matter long or short. 😄
You have not met with these kind of situation before since you have not used Codist to override the syntax styles. I only have a laptop computer so it is impossible for me to unplug the monitor to reproduce this.
The For instance, the following code, if uncommented, will change the editor background into light green when a new code window is open. Codist/Codist/SyntaxHighlight/HighlighterFactory.cs Lines 31 to 40 in 1529a84
There's already quite a few extensions which can change editor background in the marketplace. And changing the text color of the code editor via Fonts and Colors options page is easy. Therefore I have not code such a configuration window to do similar things.
Those things are usually LogPoint and SnapPoint styles. Their background colors are implemented via text adornments and can not be configure via the syntax color configuration system--maybe the
The "All language" list is ordered by syntax priority of the syntax highlight system. Prior entries have lower priority and latter ones have higher priority, typically. Currently there's a filter box on top of the list which can help you find out the entries you want.
From the "All language" section in the configuration window, we can see that "CppDataType" should have a higher priority than "identifier". However, the implementation in VS can somehow break the priority rule. Thus you will see odds in the final result (style of identifier overrides style of CppType, previously). There's no documentation to explain why these odds can happen. It took me quite a few years to get any inches to get around the odds in the system. And obviously, they are not yet surmounted.
No, it doesn't. The visible white space is in another place, not in the syntax highlight system. |
A short conclusion about odds remained:
And some requests maybe implemented in the future but not guaranteed:
|
OK, here's what I had hoped would be happening:
But what I think I see happening, and your comments seem to support this, is that at least one of the events that Codist responds to is used to trigger number 1 (above) and, unfortunately, this event occurs more often than expected (at least, "expected by me"). Also, there is nothing in Codist that records that number 1 has already been performed, so that it is not performed again, possibly destroying the user's updates to fonts & colors within the Codist color settings dialog. That automatic loss of settings is the issue that frustrates me -- once I have enabled Codist's syntax coloring and number 1 has been performed to provide a familiar starting point, step number 1 should never be performed again unless specifically requested by the customer, either by pressing a new button to trigger the function, or by removing the config file while VS is not running so that the next startup is "initial" again.
It is called "Plain Text" in the Fonts&Colors, Text Editor color list. Changing the background of plain text changes the entire edit window background color, including all empty space. It also changes the background of everything using "Default" as the background color, so it is clearly where the overall default is for all "unclassified" areas, as well as the defaults for any "classified" symbols that are configured to use the default. That said, some classifications clearly have their own, unique defaults and I have no idea where those would be set (I suspect they are hard-coded somewhere.) "Visible white space" is the same as this. It is one of the hundreds of colors in the Fonts&Colors list and, while not actually a syntax element neither does cppInactiveCodeClassification seem to be a syntax element, since, technically, it is not currently part of the code at all, yet that color is supported (albiet differently than the way VS uses the original color, but dimmed, while Codist makes all inactive code a single color).
OK, I can accept that. (smile) It might save users a little time if there was some space in the color settings dialog that mentioned the fact that some "non-syntax" colors must still be controlled using the original Fonts&Colors (or whatever extension the customer already has to do that, I suppose.) Personally, I think I spent almost an hour experimenting with different colors in Codist before finally giving up and assuming that some colors were "uncontrolled" by Codist. OHOT, if you could add a second panel (tab?) to Codist's color dialog where at least the most common of the non-syntax colors could be set (and therefore saved & restored!) that would be fantastic! But a small note (as mentioned above) somewhere would be helpful until you feel like tackling this new functionality (if ever.) The thoughts about the "All language" list were mostly just ideas. I had seen and used the filter feature, but sometimes I have no idea what the correct term is that I'm searching for until I actually see it. I have similar issues with all search engines: sometimes I cannot find what I'm searching for until I already have the answer. My mind finds it easier to scan a sorted list than a "chaotic" list. I don't know why, but that's apparently how I process information best. (smile) The "sorted by color" idea also seems to be a natural because it would allow me to see if I have the same (or a very similar) color for a syntax style that is present in my current file, but may appear with styles that I've already defined. I agree that a visual search by color is made unnecessary by the ability to click on the item in question, so that was dumb (sorry, I think I was channeling Microsoft's dialog when I wrote that.) re: Short Conclusion 1: I cannot determine whether Codist stops applying colors or the event that triggers Codist to copy the existing VS colors fires. I suspect the latter, since I doubt there is any way that Codist would just "stop" applying syntax colors. My thoughts on copying existing VS fonts & colors were detailed above. re: Short Conclusion 2: I think this refers to an element sometimes rendering with a different color from its "family" of styles (e.g. a cppDataType rendering with the identifier color). If so, I am no longer seeing this happen reliably. Sometimes I see it when I switch between VS2019 and VS2022 (or back). Sometimes it is the cppDataType, but other times it has been the cppControlKeyword or cppKeyword. If I ever manage to get a reliable repro of this, I will let you know. Until then, I'll leave it alone unless you come up with an instrumented build you'd like me to use until it triggers. FWIW, Codist is, so far, the closest I've found to an extension that allows me to save my Text Editor Fonts&Colors before applying a Theme and restoring them after. Themes have a nasty habit of changing FONTS to things I cannot see (I'm mildly vision impaired) and Codist helps me recover from that, so thanks! I'm mostly complaining due to frustration that I'm still finding some font and color settings that are not saved -- especially the default font, foreground and background, since I have almost all syntax elements set to use the default font and background. I've submitted a feature request to "fix" the theme system and a bug report for the two different colors for the same variable name, in case you want to vote for them. (smile) |
I found a way to trigger an unexpected Codist syntax color theme change: I was running VS2019 and everything looked fine. I opened VS2022 (while VS2019 was still open) to check something, which included loading and displayed source code, and then closed VS2022. When I returned to VS2019, the colors had changed to the dark mode theme defaults. I used Codist to re-import my saved font/color settings and all was well. But this is a repeatable issue that should not cause the fonts/colors in either IDE to change. |
Perhaps you are roaming VS settings. Codist won't reset syntax styles unless you press the Reset button or apply new Codist syntax themes in the customization window. When VS theme changes, it is the weakest moment that Codist can get lost. (see this issue, years ago I begun to fight against it: #14 ) |
Hi, There's a new beta version. A filter which displays only customized styles is now placed in top right corner of the customization window. This beta version has spent me 3 days' holiday! 2 days on the WPF color picker. |
@nurbles |
Sorry for my delay in testing ... I had some minor surgery last Wednesday and have been AFK until now. I really, really like the new ChooseColor dialog that you found and the way it works! I was really impressed that I could see the colors change as I dragged the selector around the color spectrum box! I also like the filter to show only customized styles! As always, I have a couple thoughts:
These are just ideas, in case you're interested in them. It just occurred to me that (if you haven't already) you might want to make a note that this could be a useful way for the colorblind to get syntax highlighting, since you support different fonts for every syntax. I think this is a great accessibility feature!
I might need to make a second donation! (smile) Holidays are important, please enjoy them! I'm never important enough for you to lose any quality time! Then again, I once "lost" a four day holiday weekend writing my own web server from scratch, just to learn how to do it, so I can also understand getting hooked on helping your creating achieve its fullest potential! Thanks for your dedication! |
Oh, I am sorry to hear that.
Yes. This is really the problem.
Yes. It is possible. That is what I once thought about. However, when focusing on what we are doing, we usually use this customization window to create or fix the syntax styles, what we see is on the screen. We usually do not need to care whether a style is customized or not, but whether the style looks good to us. The appearance of the styles tell us which ones need to be fixed :) The useful moment of the "customized" mark may be the time we want to export the syntax theme and share it with others. We need to make sure which ones will be exported (only customized styles are exported) and which ones are inherited from VS theme.
I have not yet realize this. Your feedback is really valuable. I would love to share it with my team.
Thank you for this suggestion!! |
Hmmm... is there any chance that there could be an option to export ALL colors, customized or not? I realize that once imported, all colors would them be customized, but that's OK for my purpose. I'm hoping to use Codist's export/import colors (and fonts) to avoid having strange, unexpected colors appear in my code if I change themes. I had the same problem with Microsoft's export/import .vssettings because they only export fonts & colors that were changed from default, resulting in some truly strange and unexpected combinations after a theme change and import of the text editor colors (I manually removed everything else from the saved settings file.) So, while I understand why this isn't the default, it would be nice to have the option to export all current colors in order to ensure that an import results in the exact same color scheme instead of a mixture of two. |
In most cases it is possible to do so without great difficulty, at my first thought. But unfortunately I found that sometimes some items were absent from the "All languages" list and I could not figure out the reason--perhaps those missing styles were generated dynamically as transient ones which would not appear in that list. |
I am working on the color theming problem. Today I found that SOME colors could go wrong if the VS theme changed with the Syntax Highlight Customization window opened. Those "went-wrong" colors could be the ones listed on the "Select code" category on the customization window. If we closed the customization window before changing the VS theme, all things would go well. |
Is it possible to set styles for |
No API for this. |
I will keep an eye on it. Maybe I can dig out the API in the future. |
How are you doing? |
once I saw a extension doing something over it. i will try to find it and reference it here. |
@wmjordan Well... I had been using v7.6.0.9098, which was working as I hoped and expected. After seeing your prompt, I looked back through the thread and found a link to v7.6.0.9239 (from the Beta 7.7 #288 page), so I downloaded it and gave it a try. I'm not exactly sure what's going on, but it doesn't look like the syntax coloring isn't working.
So, all in all, I think I'm going to try to revert to 7.6.0.9098 for now. But, I'm currently working on building up some embedded linux systems and not spending much (if any) time in Visual Studio 2019 or 2022 (though I will be in VS Code) for a while. However, if there's anything you'd like me to test out for you, please let me know. |
@nurbles Oh, that is really bad. I only tested C# projects and thought it was fine until I read your post.
EDIT: The new beta fixed the WYSIWYG code preview. However, it could not probably save/load the styles. Please revert to 7.6 at this moment. I will address it later when I have the chance to think and test it thoroughly. |
The new beta 9263 should be correct now. |
It seems that the very first color I tried to set does not exist in the Codist color set! I didn't feel like exploring to find out how many other colors I rely on are not supported, but I'm going to expect there will be more if I search.
Since this is an important color for me (and Codist doesn't start with my current colors, requiring me to manually find them all over again), this potentially great feature is not usable for me at this time.
The text was updated successfully, but these errors were encountered: