Telerik blogs

Last time we looked at the basics of JustCode color identifiers. In this blog I will go a bit more in-depth about each of the available markers.  There are quite a few, and we will be adding more as we mature JustCode.   

What Do All of Those Markers DO?

There are many markers listed in the “Display Item” list view, and you might not immediately know what some of these affect in the UI.  That is why I have come up with this “cheat sheet” explaining each setting.

Note: This code snippet contains at least one of every item JustCode colorizes. I turned off all colors in VS, and then adjusted the single JustCode setting to show how that single setting affects the UI.  Where specified 2 markers may work together.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Telerik.JustCodeTest
{
public interface IFoo
{
string Value { get; set; }
void Do(string test);
}

public abstract class FooBase : IFoo
{
protected const string constantValue = "hellojustcode";
private string value;

private int testVal = 5;

public int TestVal
{
get
{
return testVa;
}
set
{
testVal = value;
}
}

public string Value
{
get { return value; }
set { this.value = value; }
}

public virtual void Do(string test)
{
return;
test = "a different value";
}

public abstract int Bar(int val);
}

public class Foo : FooBase
{
public event EventHandler<EventArgs> TestEvent;

public Telerik.JustCodeTest.IFoo NestedIFoo
{
get;
set;
}

public override void Do(string test)
{
var localVar = constantValue;

if (TestEvent != null)
{
TestEvent(this, EventArgs.Empty);
}

Value = test.Substring(0, this.CountToFoo());
Value = localVar;
}

public override int Bar(int val)
{
return val;
}
}

public static class FooExtensions
{
public static int CountToFoo( this Foo foo)
{
return foo.Bar( foo.TestVal ) - 1;
}
}
}

JustCode Border Chain Marker

The border around an object you are currently refactoring.

JustCode Foreground Chain Marker

The foreground/background color of the item you are currently refactoring.

These 2 markers work in conjunction.  When you do a JustCode refactoring, these two settings control how each usage will be highlighted.

Here the border chain foreground color is set to red, the foreground chain marker’s foreground color is set to blue 

image[56]  

JustCode Constant Identifier Marker

This controls the settings that JustCode will apply to every usage of a constant.

image[59]  

JustCode Dead Code Marker 

This controls the settings that JustCode will apply to unused code.  Dead code is also affected by the warning marker settings (the underline). In the image the first dead code is unreachable, the second dead code is an unused local variable.

image[62]  

JustCode Error Marker (VS 2008 Only)

This controls the settings that JustCode will apply to flawed code. In this case, “testVa” does not exist.

image[65]  

JustCode Event Identifier Marker

This controls the settings that JustCode will apply to every usage of an event.

image[68]  

JustCode Extension Method Identifier Marker

This controls the settings that JustCode will apply to every usage of an extension method.

image[71]  

JustCode Field Identifier Marker

This controls the settings that JustCode will apply to every usage of a field OR property

image[74]  

JustCode Hidden Marker

Internal use – Changing will not affect UI. 

JustCode Local Variable Identifier Marker

This controls the settings that JustCode will apply to every usage of a local variable

image[77]  

JustCode Method Identifier Marker

This controls the settings that JustCode will apply to every usage of a method

image[80]  

JustCode Namespace Identifier Marker 

This controls the settings that JustCode will apply to every usage of a namespace

image[83]  

JustCode Outline Marker 

This controls the settings that JustCode will use to surround the generated code when you insert a template.

image[86]  

JustCode Overridden Marker  (Only shown as a marker in VS 2008)

JustCode Overriding Marker  (Only shown as a marker in VS 2008)

Both of these are special markers, and adjusting them will not change change the UI.  These markers are for the arrows displayed on the left side of your screen that allow you to quickly navigate between overriding and overridden methods.

image[89]  

JustCode Parameter Identifier Marker

This controls the settings that JustCode will apply to every usage of a parameter

image[92]  

JustCode Tip Marker

Currently not used – will be used in Q2 :) 

JustCode Type Identifier Marker

This controls the settings that JustCode will apply to every usage of a type

image[95]  

JustCode Usage Definition Marker

These are the settings that will be applied when JustCode finds the definiton of the object you are trying to find usages for.

JustCode Usage Marker

These are the settings that will be applied when JustCode finds a usage you are looking for.

The above two markers work together when you are searching or highlighting usages.  In this image I have the “Usage Defintion Marker” set to have a red forecolor, while I have the “Usage Marker” set to have a blue forecolor.

image[98]  

JustCode Warning Marker (VS2008 Only)

This controls the settings for code which JustCode wants to warn you about.  The first warning is for unreachable code, and the second is because the class name does not match the file name.

image[101]  

Putting it Together

Hopefully, this will make it easier to quickly find and adjust the markers you want to adjust.  Now to put it all together here is a VS theme with custom JC marker settings.  It is based on Rob Conery’s Vibrant Ink theme :) Enjoy!

JustCode

Download theme 

If you have a custom JC theme email it over to me, and I will post it up here for everyone to share!


About the Author

Chris Eargle

is a Microsoft C# MVP with over a decade of experience designing and developing enterprise applications, and he runs the local .NET User Group: the Columbia Enterprise Developers Guild. He is a frequent guest of conferences and community events promoting best practices and new technologies. Chris is a native Carolinian; his family settled the Dutch Form region of South Carolina in 1752. He currently resides in Columbia with his wife, Binyue, his dog, Laika, and his three cats: Meeko, Tigger, and Sookie. Amazingly, they all get along... except for Meeko, who is by no means meek.

Comments

Comments are disabled in preview mode.