Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

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 (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)

public virtual Source CreateSource(
	IVsTextLines buffer
)

Parameters

buffer
Type: Microsoft.VisualStudio.TextManager.Interop.IVsTextLines

[in] The IVsTextLines buffer that the Source object represents.

Return Value

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

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.

Show:
© 2015 Microsoft