共用方式為


ProvideLanguageServiceAttribute.EnableLineNumbers Property

Definition

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

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

Property Value

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

Examples

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

Remarks

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  

Applies to