Compartilhar via


IVsRefactorNotify Interface

Notifies code generators about the occurrence of refactoring operations.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)

Syntax

'Declaration
<InterfaceTypeAttribute()> _
<GuidAttribute("130497E3-5CDB-4F29-9804-A2AF805016D7")> _
Public Interface IVsRefactorNotify
[InterfaceTypeAttribute()]
[GuidAttribute("130497E3-5CDB-4F29-9804-A2AF805016D7")]
public interface IVsRefactorNotify
[InterfaceTypeAttribute()]
[GuidAttribute(L"130497E3-5CDB-4F29-9804-A2AF805016D7")]
public interface class IVsRefactorNotify
[<InterfaceTypeAttribute()>]
[<GuidAttribute("130497E3-5CDB-4F29-9804-A2AF805016D7")>]
type IVsRefactorNotify =  interface end
public interface IVsRefactorNotify

The IVsRefactorNotify type exposes the following members.

Methods

  Name Description
Public method OnAddParams Called after a method had the parameters added.
Public method OnBeforeAddParams Called when a method is about to have the parameters added.
Public method OnBeforeGlobalSymbolRenamed Called when a symbol is about to be renamed.
Public method OnBeforeRemoveParams Called when a method is about to have the parameters removed.
Public method OnBeforeReorderParams Called when a method is about to have the parameters reordered.
Public method OnGlobalSymbolRenamed Called after a symbol is renamed.
Public method OnRemoveParams Called after a method had the parameters removed.
Public method OnReorderParams Called after a method had the parameters reordered.

Top

Remarks

By implementing the IVsRefactorNotify interface, you provide the Visual Studio language service with the capability to notify code generators about refactoring operations, such as symbolic-rename or parameter-reordering. The Visual Studio language service identifies the symbol that is changed by passing a string using Refactor-Qualified Name, RQName, syntax. The RQName syntax description is as follows:

rq_name := rq_ns | rq_agg | rq_membvar | rq_event | rq_meth | rq_prop

rq_ns := "Ns" "(" rq_sym_name_list ")"

rq_agg := "Agg" "(" rq_sym_name_list ")"

rq_membvar := "Membvar" "(" rq_agg "," rq_sym_name ")"

rq_event := "Event" "(" rq_agg "," rq_sym_name ")"

rq_meth := "Meth" "(" rq_agg "," rq_sym_name "," rq_typevarcount ",
                    " rq_params ")"

rq_prop := "Prop" "(" rq_agg "," rq_sym_name "," rq_typevarcount ",
                    " rq_params ")"

rq_params := "Params" "(" rq_param_list ")"

rq_param_list := rq_param |
                 rq_param "," rq_param_list

rq_param := "Param" "(" rq_type_sig ")"

rq_type_sig := rq_aggtype_sig | 
               rq_array_sig | 
               rq_pointer_sig | 
               rq_param_mod_sig | 
               rq_typevar_sig | 
               rq_void_sig | 
               rq_error_sig | 
               rq_null_sig

rq_aggtype_sig := "AggType" "(" rq_agg "," rq_typeparams ")"

rq_typeparams := "TypeParams" "(" rq_type_sig_list ")"

rq_type_sig_list := rq_type_sig |
                    rq_type_sig "," rq_type_sig_list

rq_array_sig := "Array" "(" rq_rank "," rq_type_sig ")"

rq_pointer_sig := "Pointer" "(" rq_type_sig ")"

rq_param_mod_sig := "Ref" "(" rq_type_sig ")" |
                    "Out" "(" rq_type_sig ")"

rq_typevar_sig := "TyVar" "(" rq_simple_name ")"

rq_void_sig := "Void"

rq_error_sig := "Error" "(" rq_text ")"

rq_null_sig := "Null"

rq_sym_name_list := rq_sym_name |
                    rq_sym_name "," rq_sym_name_list

rq_sym_name := rq_aggname | rq_nsname | rq_membvarname | 
               rq_methpropname | rq_intfexplname

rq_nsname := "NsName" "(" rq_simple_name ")"

rq_aggname := "AggName" "(" rq_simple_name "," rq_typevarcount ")"

rq_membvarname := "MembvarName" "(" rq_simple_name ")"

rq_methpropname := rq_methname | rq_propname | rq_eventname

rq_methname := "MethName" "(" rq_simple_name ")"

rq_propname := "PropName" "(" rq_simple_name ")"

rq_eventname := "EventName" "(" rq_simple_name ")"

rq_intfexplname := "IntfExplName" 
                   "(" rq_type_sig "," rq_methpropname ")"

rq_typevarcount := "TypeVarCnt" "(" rq_number ")"

rq_simple_name = rq_text

rq_rank := rq_number

rq_number := [0-9]+

rq_text := [any character except ".", "," "(" and ")"]

Examples

The following example demonstrates how to use RQName syntax to describe the symbols.

System.Collections.Generic;
using System.Text;

namespace ConsoleApplication                   //1
{
    interface ITest<T>                         //2
    {
        void MyTest(T t);                         //3
    }

    delegate void MyDel();                     //4

    class Program : ITest<int>
    {
        const int i = 5;                       //5
        string s;                              //6
        event MyDel e;                         //7
        static void Main(string[] args)        //8
        {
        }
        void ITest<int>.MyTest(int t)             //9
        {
        }
        int this[int i] { get { return 1; } }  //10
    }
}

namespace MyTest.Bar.Blank                        //11
{
}

1: Ns(NsName(ConsoleApplication))

2: Agg(NsName(ConsoleApplication),AggName(ITest,TypeVarCnt(1)))

3: Meth(Agg(NsName(ConsoleApplication),AggName(ITest,TypeVarCnt(1))),
        MethName(MyText),TypeVarCnt(0),Params(Param(TyVar(T))))

4: Agg(NsName(ConsoleApplication),AggName(MyDel,TypeVarCnt(0)))

5: Membvar(Agg(NsName(ConsoleApplication),AggName(Program,TypeVarCnt(0))),
        MembvarName(i))

6: Membvar(Agg(NsName(ConsoleApplication),AggName(Program,TypeVarCnt(0))),
        MembvarName(s))

7: Event(Agg(NsName(ConsoleApplication),AggName(Program,TypeVarCnt(0))),
      EventName(e))

8: Meth(Agg(NsName(ConsoleApplication),AggName(Program,TypeVarCnt(0))),
        MethName(Main),TypeVarCnt(0),
        Params(Param(Array(1,AggType(Agg(NsName(System),
        AggName(String,TypeVarCnt(0))),TypeParams())))))

9: Meth(Agg(NsName(ConsoleApplication),AggName(Program,TypeVarCnt(0))),
        IntfExplName(AggType(Agg(NsName(ConsoleApplication),
        AggName(ITest,TypeVarCnt(1))),TypeParams(AggType(Agg(NsName(System),
        AggName(Int32,TypeVarCnt(0))),TypeParams()))),MethName(MyTest)),

10: Prop(Agg(NsName(ConsoleApplication),AggName(Program,TypeVarCnt(0))),
         PropName($Item$),TypeVarCnt(0),Params(Param(AggType(Agg(NsName(System),
         AggName(Int32,TypeVarCnt(0))),TypeParams()))))

11: Ns(NsName(MyTest),NsName(Bar),NsName(Blank))

See Also

Reference

Microsoft.VisualStudio.Shell.Interop Namespace

Other Resources

Refactoring (C#)