Issue
An Issue
object defines a single result from a diagnostic pass within a file or workspace. For example, issues may represent parse errors, style warning, and code hints. Issues are delivered to the workspace using IssueCollection objects or an issue assistant registered with the AssistantsRegistry.
The Issue
class is not subclassable.
let issue = new Issue();
issue.message = "Undefined name 'foobar'";
issue.code = "E12";
issue.severity = IssueSeverity.Error;
issue.line = 10;
issue.column = 12;
issueCollection.set(fileURI, [issue]);
Class Methods
constructor()
Creates a new Issue
object.
Properties
code
A client-defined value (string or number) that may be associated with an issue and used to reference the rule or configuration setting that triggered the issue.
This property is settable.
message
The user-readable string that describes the issue. This value should most often be between one and three sentences for clarity.
This property is settable.
severity
The importance of the issue, and how prominently it will be displayed to the user.
Several severity constants are available:
IssueSeverity.Error
, indicating an unrecoverable error (the highest priority)IssueSeverity.Warning
, indicating a recoverable warningIssueSeverity.Hint
, indicating a code hintIssueSeverity.Info
, indicating an informative notice (lowest priority)
This property is settable.
source
An optional value that allows the client to indicate from what tool or checker an issue originated, such as "jslint"
or "pyflakes"
. If null
, the name of the extension will be displayed to the user.
This property is settable.
textRange
A Range value that describes the textual range within the relevant file in which the issue occurred.
Note: the textRange
property operates on linear character positions within the entire file. To report issues using a line-column position, see the line
, column
, endLine
, and endColumn
properties.
This property is settable.
line
The line number within the relevant file on which the issue occurred (or starts, if used with endRange
). Ignored if the textRange
property is set.
This value should be 1-based (The first line of a document is represented by the value 1
).
This property is settable.
column
The column number within the relevant file on which the issue occurred (or starts, if used with endColumn
). Ignored unless the line
property is also set.
This value should be 1-based (The first column of a line is represented by the value 1
).
This property is settable.
endLine
The line number within the relevant file on which the issue ends. Ignored unless the line
property is also set.
This value should be 1-based (The first line of a document is represented by the value 1
).
This property is settable.
endColumn
The column number within the relevant file on which the issue ends. Ignored unless the line
and endLine
properties are also set.
This value should be 1-based (The first column of a line is represented by the value 1
).
This property is settable.