开发者

IDE underlining custom attributes

开发者 https://www.devze.com 2022-12-26 06:38 出处:网络
I have a custom attribute... [System.AttributeUsage(System.AttributeTargets.All)] public class Refactor : System.Attribute

I have a custom attribute...

[System.AttributeUsage(System.AttributeTargets.All)]
public class Refactor : System.Attribute
{
    private string _message;

    public Refactor()
    {
        _message = string.Empty;
    }

    public Refactor(string message)
    {
        _message = message;
    }               
}

Applied to

[Refactor("this should be less rubbish"开发者_开发问答)]
public virtual void RubbishMethod()    
{    
…    
}

Now when someone makes a call to RubbishMethod I'd like the IDE (vs2008) to underline that call in a deep brown colour, similar to if I mark as Obsolete you get a green wave line. Is this possible? I've been racking my brain and hitting the google but I can't find how and where to do this.


You'd have to write a VS extension. You would need to create a Classifier. The Ook! language extension has a good sample of making classifiers.

0

精彩评论

暂无评论...
验证码 换一张
取 消