wmjordan/Codist

Some syntax highlight styles got broken or failed to apply after VS 17.7.1

wmjordan opened this issue ยท 22 comments

As stated in the following issues: #295, #297, #299, which were not yet solved and merged to this one.

Every update after VS 17.7.1 prevented one or two syntax highlights from working properly.
Some classifications were not sorted in proper priority.
Some classifications could not be styled.
Very weird!

fitdev commented

Strangely, I have just got similar issue on an old VS 2022 17.7 Preview 3 (have not had the need to update it yet). It was working fine, until I restarted VS (perhaps I launched another instance of it once), and then all of a sudden highlights are not being properly applied - even in XML, not just in C#. Some of the formats are applied, but most are wrong. The preview in the Customize Syntax Highlight also does not show the correct style (even though individual format elements like color are set correctly).

Screenshot 2023-10-17 172627

Thought I would share this too.

Restarting VS again (when no other instances were running) fixed the issue.

I just upgraded to VS 17.8 preview 6.
It seemed that the VS team had realized their broken syntax highlighting system and fixed it.
Now the Codist Highlight is working as expected on my machine again.

fitdev commented

Running VS 17.9 Preview 1, again syntax highlights are broken. This time restarting VS / reinstalling Codist (tried different versions) did not fix the issues.

  • User comment tags are completely broken - in both C# and XML. It seems that only base (comment) style is being applied, while the various user tag styles are not applied at all. This is the biggest one for me.
  • Operator overloads are also not applied correctly - again it seems that only base (operator) style is applied, but if the operator is a custom one, it should be colored differently, but it's not.

Now I use latest released Codist version.

Attached are my styles.
Codist.styles.zip

Hope you can look into this when you have time, as it seriously hinders cripples feature.

fitdev commented

Here are some illustrations:

Screenshot_20231115_121839

Screenshot_20231115_121903

Screenshot_20231115_121951

Note: Cyan background over FIX is correct - it uses VS's highlight current word feature, so not part of the style.

I just upgraded to 17.9 preview 1 and experienced the same issue. Comment taggers were broken.
Unfortunately, the experimental instance of my VS also got broken after the upgrade, thus I had a hard time debugging the extension.

fitdev commented

Thank you for confirming that this is not just something on my end. Hopefully a workaround can be made soon. I really miss those user comment highlights.

It could take some time since I could not debug the VS with the broken experimental instance. It happened once in a previous VS preview version which had also ruined the experimental instance. Hopefully it could be fixed in 17.9 preview 2.

fitdev commented

Seems 17.9 preview 1 is buggy. Pity I upgraded to it so soon, but I needed DotNet 8 RTM, so I had little choice. Perhaps you will get the experimental instance fixed so you can try debugging it there. Thank you for all your hard work!

Seems 17.9 preview 1 is buggy. Pity I upgraded to it so soon, but I needed DotNet 8 RTM, so I had little choice. Perhaps you will get the experimental instance fixed so you can try debugging it there. Thank you for all your hard work!

@fitdev
I spent half an hour tracking the failure of comment tagger. Since the experiment instance was broken, it was very time consuming.
Codist previously used an ITagAggregator<IClassificationTag> to gather and tag classified comments. In the current preview version of VS, the tag aggregator provided by VS no longer returned anything in C#, which broke the C# comment tagger.
Since things were working well before the last VS preview, I will not spend any more time trying to fix it and will wait for their next preview versions.

I see. Thank you for looking into this. Hopefully they will fix in in their next preview.

PS. I thought that Codist was manually parsing all regular comments and then using RegEx or something like this to see if a comment contains the tag and therefore should be styled.

PS. I thought that Codist was manually parsing all regular comments and then using RegEx or something like this to see if a comment contains the tag and therefore should be styled.

Yes, it is working somewhat like that, but without Regular Expression.
Before parsing, we have got to find out where are those comments, that is what the aforementioned ITagAggregator<IClassificationTag> supposed to do.

Just to let you know, for the moment I am suing Highlighter Extension to get a similar result with comment tags. It is not nearly as good as Codist, but at least makes it possibly to more readily identify the tags in the comments. Unfortunately I could not find a source code for it. But perhaps you may find it useful.

Highlighter is open-sourced. And the magic happens there. It examines every visible line in the editor window and compares against predefined/customized rules. Actually I had once planned to do something like that in a code file which has not yet been put into use, before the COVID pandemic, 4 years ago. Somehow I think it of low priority and put it down.

I see. I think it may be a useful feature, since it gives one more control and flexibility over what and how to highlight. As a bonus it allows highlights to work even when VS upgrade screws things up like it did with 17.9.P1. So, if it is relatively simple to finish integrating the draft version you already have into Codist, I think it will be a great addition to the already excellent Codist's highlighting capabilities!

@fitdev Please test this new version which restores the comment tagger.
Codist.zip

This version is not as performant as previous versions. But anyway, it should work.

Thanks for the fix! So nice to see old highlights back! I will let you know if I encounter any issues. Hopefully the performance penalty is not too bad.

I noticed in the new version, sometimes highlight would be lost - for no apparent reason - like after typing ion the document - either in the highlighted part or nearby. To fix it, you need to reopen the document, then highlight is restored.

Also, sometimes when I just type the start of my tag which is supposed to be highlighted, it does not get highlighted, until after I close and reopen the document.

When the comment tag highlighting gets disabled, it strangely affects all tags within a document not just one - even on very different lines.

sometimes highlight would be lost - for no apparent reason - like after typing ion the document - either in the highlighted part or nearby. To fix it, you need to reopen the document, then highlight is restored.

I have not yet encountered this.

Happens pretty regularly actually. It does not matter where you type - within the comment, or elsewhere in the document, sometimes the highlighting (of the comment tags) just disappears everywhere in the document at once. The solution is to close and reopen the document. I have not noticed any pattern to this. BTW, I did disable the other highlighter extension of course.

Could you post some screenshots demonstrating what's happening?

Doubt that it will be helpful, but here is an example:

After I returned to VS after about an hour of inactivity and started typing //TOD... on a new line below the lines in the screenshot, comment tag highlighting got removed everywhere in the document:

Screenshot_20231218_154633

Then, once I closed and reopened the document, everything is back to normal, but for how long?

Screenshot_20231218_154754

I am using VS 17.9 Preview 2 (latest)