Compartilhar via


LanguageService.CreateSource Method

Instantiates a Source class.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)

Syntax

'Declaração
Public Overridable Function CreateSource ( _
    buffer As IVsTextLines _
) As Source
public virtual Source CreateSource(
    IVsTextLines buffer
)

Parameters

Return Value

Type: Microsoft.VisualStudio.Package.Source
If successful, returns a Source object; otherwise, returns a null value.

Remarks

A Source object controls various features of the language service including colorization and code snippet expansion, as well as all parsing other than that used for colorization (which is done by the Colorizer object directly). If you need to support additional features such as commands associated with markers, or to override an existing method to provide additional handling, then you must derive a class from the Source class and return an instance of your class from this method.

The base method always returns a new Source object that has been initialized with a Colorizer object that in turn has been initialized with an IScanner object returned from GetScanner.

Note that the Source object returned by this method will not be parsed automatically (by OnIdle) after loading. To accomplish automatic parsing, override this method and set LastParseTime to 0.

.NET Framework Security

See Also

Reference

LanguageService Class

Microsoft.VisualStudio.Package Namespace