Skip to content

AdornmentManager Abstraction#54035

Merged
akhera99 merged 4 commits intodotnet:mainfrom
akhera99:adornment_manager_rework
Jul 8, 2021
Merged

AdornmentManager Abstraction#54035
akhera99 merged 4 commits intodotnet:mainfrom
akhera99:adornment_manager_rework

Conversation

@akhera99
Copy link
Member

Hola!

I separated out the work that was done to make the adornment manager abstract in its own PR. This was done so it could be reused for the inline diagnostics feature.
The line separator feature needed some updates per this change.

@akhera99 akhera99 requested a review from a team as a code owner June 11, 2021 17:43
@akhera99 akhera99 requested a review from a team June 11, 2021 17:43
@ghost ghost added the Area-IDE label Jun 11, 2021
private readonly IAsynchronousOperationListener _asyncListener;
protected readonly IThreadingContext _threadingContext;
protected readonly IViewTagAggregatorFactoryService _tagAggregatorFactoryService;
protected readonly IAsynchronousOperationListener _asyncListener;
Copy link
Contributor

Choose a reason for hiding this comment

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

protected members should not use _ names. Use PascalCasing in this case.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

if (!textView.TextBuffer.GetFeatureOnOffOption(EditorComponentOnOffOptions.Adornment))
{
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this is code you likely want to run in any subclass. so instead of this pattern, have a non virtual TextViewCreated that does this logic. Then have it call into a new protected abstract method that all subclasses have to implement that then doesn't need to duplciate this logic.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

internal abstract class AdornmentManager<T> where T : GraphicsTag
{
private readonly object _invalidatedSpansLock = new object();
protected readonly object _invalidatedSpansLock = new object();
Copy link
Contributor

Choose a reason for hiding this comment

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

very wary about exposing a lock.

Copy link
Member Author

Choose a reason for hiding this comment

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

was not used by the subclasses, made it private readonly


/// <summary>Notification system about operations we do</summary>
private readonly IAsynchronousOperationListener _asyncListener;
protected IAsynchronousOperationListener AsyncListener { get; }
Copy link
Contributor

Choose a reason for hiding this comment

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

are all of these needed by the subclasses?

Copy link
Member Author

Choose a reason for hiding this comment

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

I made the items that are not used by the subclass private readonly again.

: base(threadingContext, textView, tagAggregatorFactoryService, asyncListener, adornmentLayerName)
{
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this doesn't appear to be using any of the protected members of the base class. indeed, this type doesn't seem to have any useful logic/state in it at all. i'm not sure why it needs to exist.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added the method that differentiates it from inline errors.

@akhera99 akhera99 requested a review from CyrusNajmabadi June 14, 2021 17:18
@akhera99 akhera99 closed this Jun 14, 2021
@akhera99 akhera99 reopened this Jun 14, 2021
@akhera99 akhera99 merged commit e59dbb8 into dotnet:main Jul 8, 2021
@ghost ghost added this to the Next milestone Jul 8, 2021
@allisonchou allisonchou modified the milestones: Next, 17.0.P3 Jul 27, 2021
@akhera99 akhera99 deleted the adornment_manager_rework branch June 18, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants