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 (in Microsoft.VisualStudio.Package.LanguageService.dll)
Syntax
'宣告
Public Overridable Function CreateSource ( _
buffer As IVsTextLines _
) As Source
'用途
Dim instance As LanguageService
Dim buffer As IVsTextLines
Dim returnValue As Source
returnValue = instance.CreateSource(buffer)
public virtual Source CreateSource(
IVsTextLines buffer
)
public:
virtual Source^ CreateSource(
IVsTextLines^ buffer
)
abstract CreateSource :
buffer:IVsTextLines -> Source
override CreateSource :
buffer:IVsTextLines -> Source
public function CreateSource(
buffer : IVsTextLines
) : Source
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.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.