Freigeben über


AuthoringSink.AddError Method

Adds an error in parsing message for later reporting.

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

'Declaration
Public Overridable Sub AddError ( _
    path As String, _
    message As String, _
    context As TextSpan, _
    sev As Severity _
)
'Usage
Dim instance As AuthoringSink
Dim path As String
Dim message As String
Dim context As TextSpan
Dim sev As Severity

instance.AddError(path, message, context, _
    sev)
public virtual void AddError(
    string path,
    string message,
    TextSpan context,
    Severity sev
)
public:
virtual void AddError(
    String^ path, 
    String^ message, 
    TextSpan context, 
    Severity sev
)
abstract AddError : 
        path:string * 
        message:string * 
        context:TextSpan * 
        sev:Severity -> unit 
override AddError : 
        path:string * 
        message:string * 
        context:TextSpan * 
        sev:Severity -> unit 
public function AddError(
    path : String, 
    message : String, 
    context : TextSpan, 
    sev : Severity
)

Parameters

Remarks

If the parser encounters any errors in the parsing operation, it can store the errors for later reporting through this method. The assumption here is the parser can recover from simple syntax errors and continue on parsing. This allows the user to see all the errors encountered and fix them all before committing to a compilation.

Note that this approach to storing errors is used in support of checking the source code dynamically, before the user actually compiles the code. All the errors in the list are shown in the code (typically with the squiggly underline) and the error message is shown when the user holds the cursor over the error line.

.NET Framework Security

See Also

Reference

AuthoringSink Class

AuthoringSink Members

Microsoft.VisualStudio.Package Namespace