Skip to content

Bugfix/atr 966 dev fix coloring part 2#670

Open
SENya1990 wants to merge 57 commits into
devfrom
bugfix/ATR-966-dev-fix-coloring-part-2
Open

Bugfix/atr 966 dev fix coloring part 2#670
SENya1990 wants to merge 57 commits into
devfrom
bugfix/ATR-966-dev-fix-coloring-part-2

Conversation

@SENya1990
Copy link
Copy Markdown
Collaborator

@SENya1990 SENya1990 commented May 13, 2026

Changes Overview

Big rework of the syntax coloring.

Removed legacy regex coloring and related code required to switch between different taggers

  • Removed regex based coloring tagger
  • Removed VS options to enable regex based coloring
  • Removed special delegating tagger that forwards tagging to one of the specialized taggers based on options
  • Simplified the design and logic of the remaining taggers, joined base colorizing tagger with Roslyn-based coloring tagger, eliminated the tagging delegating logic

Implemented Claude and Copilot suggestions

  • Added IsLastTaggingSuccessfull flag to the logic to not skip required re-tagging
  • Added catching of unhandled general exceptions in the TryAwait extension method that may be thrown during the tagging
  • Added additional handling of faulted tagging tasks in the after-tagging callback
  • Many fixes for race conditions and edge cases of the algorithms made from Claude and Copilot review

Main Fix - rework of the Roslyn workspace caching and calculation of HasReferenceToAcumaticaPlatform flag.

Under manual debug another issue with coloring was detected. It was different from the issues suggested by AI. The issue was caused by the incorrectly cached Roslyn workspace and HasReferenceToAcumaticaPlatform flag. They were cached not in the tagger but in the tagger provider and calculated just once on the creation of a tagger. The incorrect assumption was that the Roslyn Workspace instance associated with the document does not change through its lifetime. It is not true.

The debugging session discovered that on big solutions like Pure when VS opens a document there are several attempts to create a tagger for the document. During the solution loading the document has several stages:
-There is no workspace associated with the document's ITextBuffer. The found workspace is null.
-There is a special "preview" derived "misc files" workspace without projects and metadata. It is added to the document first. Previously, Acuminator incorrectly cached this workspace and assumed that there is no reference to the Acumatica Framework in the solution. That caused one of the coloring bugs (ATR-525) when there was no Acuminator coloring of the first opened document for big solutions

  • Finally, after loading the solution, a complete workspace is attached to the document's text buffer. For regular documents it is 'VisualStudioWorkspace', for decompiled code it is "metadata as source" workspace.

The big rework changes how coloring tagger handles the changes of document's workspace:

  • Moved calculation of workspace and HasReferenceToAcumaticaPlatform flag from the tagger provider to the tagger. The base tagger provider type was removed since there was nothing more to cache.
  • The Roslyn-based coloring tagger subscribes on workspace changes to re-calculate the HasReferenceToAcumaticaPlatform flag and raise re-tagging on some of these changes.
  • A special RoslynWorkspaceProvider component was created. It obtains a workspace registration object associated with the document's text buffer and subscribes on its WorkspaceChanged event. The component caches the workspace and fires its own WorkspaceChanged event that passes old and new workspaces. This component also filters our the useless preview workspace, The tagger subscribes on component's WorkspaceChanged event and raise its own tags changed event to update tags based on the info in the new workspace.
  • Calculation of HasReferenceToAcumaticaPlatform was optimized
  • Check whether the parsing of the document and re-tagging is needed was fixed.
  • Minor changes. Made some calls to raise tags synchronous.

SENya1990 added 30 commits May 8, 2026 17:09
…r value tasks, added catching of all exceptions, not just operation cancelled exceptions
… to avoid skipping re-tagging on faulted tagging tasks
…om tagger providers because it happens too early when workspace is not initialized yet. The check should be moved to taggers instead. Added check of UI thread to all tagger providers.
…rs + a helper property for Roslyn workspace.

In the outlining tagger implemented this flag through the colorizing tagger
…rizer tagger and do it not on the tagger initialization but at the start of the tagging process.

Added additional fast check for the possibility to create PXGraph in the project, the check works only if the Roslyn compilation is available.

Added subscription to Workspace events to recalculate cached HasReferenceToAcumaticaPlatform flag when needed
…e base tagger + changed outlining tagger code to call sync version
…umber of HasReferenceToAcumaticaPlatform calculatons
…the tagger provider. Tagger should cache it instead.
…S while it initialize the main roslyn workspace
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 2 comments.

Comment thread src/Acuminator/Acuminator.Vsix/Coloriser/PXRoslynColorizerTagger.cs Outdated
Comment thread src/Acuminator/Acuminator.Vsix/Coloriser/Roslyn/RoslynWorkspaceProvider.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 3 comments.

Comment thread src/Acuminator/Acuminator.Vsix/Coloriser/PXRoslynColorizerTagger.cs
Comment thread src/Acuminator/Acuminator.Vsix/Coloriser/PXRoslynColorizerTagger.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 2 comments.

Comment thread src/Acuminator/Acuminator.Vsix/Coloriser/PXRoslynColorizerTagger.cs
Comment thread src/Acuminator/Acuminator.Vsix/Coloriser/PXRoslynColorizerTagger.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 32 out of 33 changed files in this pull request and generated 3 comments.

Comment thread src/Acuminator/Acuminator.Vsix/Coloriser/PXRoslynColorizerTagger.cs
Comment thread src/Acuminator/Acuminator.Vsix/Coloriser/PXRoslynColorizerTagger.cs Outdated
Comment thread src/Acuminator/Acuminator.Vsix/Coloriser/PXRoslynColorizerTagger.cs
@SENya1990 SENya1990 requested a review from dropsonic May 14, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants