共用方式為


LanguageService.CreateParseRequest Method

Creates a request to satisfy the given reason for parsing that is then passed on to the parser.

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

'宣告
Public Overridable Function CreateParseRequest ( _
    s As Source, _
    line As Integer, _
    idx As Integer, _
    info As TokenInfo, _
    sourceText As String, _
    fname As String, _
    reason As ParseReason, _
    view As IVsTextView _
) As ParseRequest
public virtual ParseRequest CreateParseRequest(
    Source s,
    int line,
    int idx,
    TokenInfo info,
    string sourceText,
    string fname,
    ParseReason reason,
    IVsTextView view
)

Parameters

  • line
    Type: System.Int32
    [in] The line number to start parsing on.
  • idx
    Type: System.Int32
    [in] The character index in the line where parsing starts.
  • sourceText
    Type: System.String
    [in] The text to be parsed. This contains the entire source file's text.
  • fname
    Type: System.String
    [in] The file name of the source file. Can be null or empty.

Return Value

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

Remarks

This method is called whenever a parse operation must be performed on the source file to support the various features of the language service -- other than for support of colorization which is handled entirely in the Colorizer class and the IScanner parser. The parsing process must be able to parse a single token, a single line, a group of lines, or the entire text, all based on the ParseReason value supplied by the ParseRequest object.

The IVsTextView object passed to this method is for internal use only and should not be accessed by the ParseSource method parser. That parser should access the source only through the text that is passed in through the ParseRequest object created by this method.

The base method always returns a new ParseRequest object. Override this if your parser requires changes to the arguments or you need some specialized information to be passed on to your parser. Note that the ParseRequest class has no methods that can be overridden so your class would supply only additional methods.

.NET Framework Security

See Also

Reference

LanguageService Class

Microsoft.VisualStudio.Package Namespace