Condividi tramite


ProvideLanguageServiceAttribute(Object, String, Int32) Constructor

Definition

Initializes a new instance of the Shell.ProvideLanguageServiceAttribute class.

public:
 ProvideLanguageServiceAttribute(System::Object ^ languageService, System::String ^ strLanguageName, int languageResourceID);
public:
 ProvideLanguageServiceAttribute(Platform::Object ^ languageService, Platform::String ^ strLanguageName, int languageResourceID);
 ProvideLanguageServiceAttribute(winrt::Windows::Foundation::IInspectable const & languageService, std::wstring const & strLanguageName, int languageResourceID);
public ProvideLanguageServiceAttribute (object languageService, string strLanguageName, int languageResourceID);
new Microsoft.VisualStudio.Shell.ProvideLanguageServiceAttribute : obj * string * int -> Microsoft.VisualStudio.Shell.ProvideLanguageServiceAttribute
Public Sub New (languageService As Object, strLanguageName As String, languageResourceID As Integer)

Parameters

languageService
Object
strLanguageName
String
languageResourceID
Int32

Examples

using Microsoft.VisualStudio.Shell;  

namespace MyLanguagePackage  
{  
    internal class MyConstants  
    {  
        public const string languageName           = "MyLanguage";  
        public const int    languageNameResourceID = 106;  
    }  

    [ProvideLanguageService(typeof(MyLanguageService),           // Required  
                            MyConstants.languageName,            // Required  
                            MyConstants.languageNameResourceID,  // Required  
        // Optional language service properties  
        CodeSense             = true,  // General IntelliSense support  
        RequestStockColors    = false, // Custom colorable items  
        EnableASyncCompletion = true,  // supports background parsing  
        MatchBraces           = true,  // Match braces on command  
        MatchBracesAtCaret    = true   // Match braces while typing  
                           )]  

    class MyLanguagePackage  
    {  
    }  
}  

Remarks

The following registry layout shows where each of the required parameters is used.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[X.Y]\Languages\  
  Language Services\  
    [strLanguageName]\  
      (Default) = reg_sz: [languageService.GUID]  
       Package   = reg_sz: [Package GUID]  
       LangResID = reg_dword: [languageResourceID]  

The [Package GUID] value is automatically obtained from the class that implements the IVsPackage interface in the assembly.

In addition to the required parameters listed in the Parameters section, the constructor also accepts optional named parameters after the required parameters. This is a special form supported only in user-defined attributes. These named parameters correspond to the public properties on this class that have both get and set operators.

Applies to