How to get: HihglighterContext

10 views
Skip to first unread message

Mark Warpool

unread,
Aug 22, 2016, 11:39:53 AM8/22/16
to resharper-plugins
I'm working on updating the Enhanced Tooltip packge (https://github.com/MrJul/ReSharper.EnhancedTooltip) for 2016.2 and I've fixed most of the errors from the upgrade to 2016.2, but there's one thing I wanted to check on before I attempt to publish it.  There's a block of code that used an IDocumentMarkup reference to get to the Context property; that property seems to have been removed from the interface but is still available on the DocumentMarkupBase, so I rewrote the following line:

 ShellLocks shellLocks = documentMarkup.Context.Locks;

as

 IShellLocks shellLocks = ((DocumentMarkupBase)documentMarkup).Context.Locks;

This seems to be safe as all the implementations of IDocumentMarkup that I could find inherit from DocumentMarkupBase, but I was hoping if someone could confirm that it's safe or suggest a better way to get the HihglighterContext reference.

Matt Ellis

unread,
Aug 22, 2016, 12:40:29 PM8/22/16
to resharper-plugins
Hi Mark. Answered in the PR, but you can either cast to IDocumentMarkupImpl or use Shell.Instance.GetComponent<IShellLocks>.

Regards
Matt
Reply all
Reply to author
Forward
0 new messages