What is the IContextAction that provides the Create Class Quick Fix?

I want to chain together the Create Class Quick Fix with some additional actions but I cannot determine what concrete type is used for the IContextAction interface. If anyone can provide the type(and assembly) to look at I would appriciate it.

Attached is the quick fix menu that I want to extend. I just need to know which class provides the IsAvailable(IUserDataHolder cache) implementation so that I can delegate to it for my IContextAction.

Thanks in advance.
Eric



Attachment(s):
CreateClass.JPG
6 comments

Hello,

The cllass you are looking for is CreateClassFromNewFix. It implements
IQuickFix interface and requires NotResolvedError class to construct.
If you want to implement custom QuickFix for NotResolvedError use the
following code:


class CustomQF : IQuickFix
{
public CustomQF(NotResolvedError daemonError) {}
/.../
}


Alexander Zverev
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”

"Eric Hexter" <eric_hexter@dell.com> wrote in message
news:19561915.68781223404641738.JavaMail.jive@app4.labs.intellij.net...
>I want to chain together the Create Class Quick Fix with some additional
>actions but I cannot determine what concrete type is used for the
>IContextAction interface. If anyone can provide the type(and assembly) to
>look at I would appriciate it.
>

Attached is the quick fix menu that I want to extend. I just need to know
which class provides the IsAvailable(IUserDataHolder cache) implementation
so that I can delegate to it for my IContextAction.

>

Thanks in advance.
Eric


0

Great, thanks so much! I think I have more than enough to make this happen.

Eric

0

I found the IQuickFix and the NotResolvedError types.

I could not find the CreateClassFromNewFix in any of the assemblies. I see that the CreateClassFromNewFix is marked internal. Oh.... that is too bad.

0

Wow. So, the only reason a QuickFix implementation is queried is because of its constructor arguments? The documentation says that a QuickFix constructor should take an IHighlighting. It would be useful to have some documentation on what quickfix contexts can be extended, and what parameters are necessary.

0

Hi Jonathan. Thanks for the comment. Yes, a QuickFix is wired up to the alt-enter menu based on the type of the highlighting applied to the code under the cursor. ReSharper looks for a constructor that takes in the type (which implements IHighlighting), and uses that in the menu. There are no limitations to the highlightings you can write a QuickFix for - ReSharper provides approximately 1500 highlightings, plugins can provide more, and QuickFixes can use any of them.

Thanks
Matt

0

Ah, I see. My original implementation just took IHighlighting as a constructor argument, and I was surprised to only be receiving CSharpSyntaxErrors. Thanks.

0

Please sign in to leave a comment.