共用方式為


Source Class

Represents a source file in the language service and controls parsing operations on that source.

This API is not CLS-compliant. 

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)

Syntax

'宣告
<CLSCompliantAttribute(False)> _
Public Class Source _
    Implements IDisposable, IVsTextLinesEvents, IVsFinalTextChangeCommitEvents, IVsHiddenTextClient,  _
    IVsUserDataEvents
'用途
Dim instance As Source
[CLSCompliantAttribute(false)]
public class Source : IDisposable, IVsTextLinesEvents, 
    IVsFinalTextChangeCommitEvents, IVsHiddenTextClient, IVsUserDataEvents
[CLSCompliantAttribute(false)]
public ref class Source : IDisposable, IVsTextLinesEvents, 
    IVsFinalTextChangeCommitEvents, IVsHiddenTextClient, IVsUserDataEvents
[<CLSCompliantAttribute(false)>]
type Source =  
    class
        interface IDisposable
        interface IVsTextLinesEvents
        interface IVsFinalTextChangeCommitEvents
        interface IVsHiddenTextClient
        interface IVsUserDataEvents
    end
public class Source implements IDisposable, IVsTextLinesEvents, IVsFinalTextChangeCommitEvents, IVsHiddenTextClient, IVsUserDataEvents

Remarks

A Source object represents the entire source file associated with a particular view. Information about the source file can be obtained from this class. However, the primary functionality of this class is to handle parsing operations on the source in support for IntelliSense operations and source file-specific editing operations such as adding comments to and removing comments from blocks of code and reporting parsing errors.

Notes to Implementers

The base class supports all of the IntelliSense operations in coordination with methods on the LanguageService class (these are detailed in the Source class's method descriptions). If you:

  • support different comment delimiters other than the standard C#/C++ delimiters,

  • reformat code,

    and/or

  • support advanced functionality for hidden regions (monitoring change of state, ensuring a span is visible, and marker-oriented context menu commands),

you must derive a class from the Source class and instantiate your class in CreateSource.

Notes to Callers

This class is instantiated by a call to the CreateSource method. This is done when the CodeWindowManager object is instantiated (the Source object is passed to the CodeWindowManager constructor). A Colorizer object can be instantiated and passed to the Source class's constructor.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Package.Source

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Source Members

Microsoft.VisualStudio.Package Namespace