ProvideLanguageServiceAttribute.EnableLineNumbers Property

Determines if the Line numbers option can be selected in the Options dialog box.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)


Public Property EnableLineNumbers As Boolean
public bool EnableLineNumbers { get; set; }
property bool EnableLineNumbers {
    bool get ();
    void set (bool value);
member EnableLineNumbers : bool with get, set
function get EnableLineNumbers () : boolean
function set EnableLineNumbers (value : boolean)

Property Value

Type: System.Boolean
Returns true if the Line numbers option is enabled for use; otherwise, returns false.


Visual Studio can display line numbers for any source file, helping users find particular lines of source. This ability is controlled from the Options dialog box (available from the Tools -> Options menu) with the option Line numbers. If a language service cannot support line numbers for some reason, then the EnableLineNumbers property should be set to false, thereby disabling the Line numbers option.

This property is available to any language service implementation.

The default is true when the corresponding registry entry is accessed through the LanguagePreferences class.

The registry entry looks like this:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[X.Y]\Languages\Language Services\
  [Language Name]\
    EnableLineNumbersOption = reg_dword: 0x00000001


    [ProvideLanguageService(typeof(MyLanguageService),           // Required
                            MyConstants.languageName,            // Required
                            MyConstants.languageNameResourceID,  // Required
        // Optional language service properties
        EnableLineNumbers = true,  // line numbers are supported

.NET Framework Security

See Also


ProvideLanguageServiceAttribute Class

Microsoft.VisualStudio.Shell Namespace