raesl.types
¶
Some general types, inspired by the Language Server Protocol.
Reference
Diagnostic
¶
Diagnostic(
message: str,
range: Range,
severity: DiagnosticSeverity = Error,
code: str = None,
source: str = None,
related_information: List[
DiagnosticRelatedInformation
] = None,
)
Represents a diagnostic, such as a compiler error or warning.
Diagnostic objects are only valid in the scope of a resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
str
|
The diagnostic's message. |
required |
range
|
Range
|
The range at which the message applies. |
required |
severity
|
DiagnosticSeverity
|
The diagnostic's severity. Can be omitted. If omitted it is up to the client to interpret diagnostics as error, warning, info or hint. |
Error
|
code
|
str
|
The diagnostic's code, which might appear in the user interface. |
None
|
source
|
str
|
A human-readable string describing the source of this diagnostic, e.g. 'esl', or 'esl compiler'. |
None
|
related_information
|
List[DiagnosticRelatedInformation]
|
A list of related diagnostic information, e.g. when symbol-names within a scope collide you can mark all definitions via this property. |
None
|
Source code in src/raesl/types.py
DiagnosticRelatedInformation
¶
DiagnosticRelatedInformation(
location: Location, message: str
)
Represents a related message and source code location for a diagnostic.
This should be used to point to code locations that cause or are related to a diagnostic, e.g when duplicating a symbol in a scope.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location
|
Location
|
The location of this related diagnostic information. |
required |
message
|
str
|
The message of this related diagnostic information. |
required |
Source code in src/raesl/types.py
Location
¶
Location(uri: str, range: Range)
Position
¶
Position in a text document expressed as zero-based line and character offset.
A position is between two characters like an 'insert' cursor in an editor. Special values like for example -1 to denote the end of a line are not supported.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line
|
int
|
Line position in a document (zero-based). |
0
|
character
|
int
|
Character offset on a line in a document (zero-based). Assuming that the line is represented as a string, the 'character' value represents the gap between 'character' and 'character + 1'. |
0
|
Source code in src/raesl/types.py
Range
¶
A range in a text document expressed as (zero-based) start and end positions.
A range is comparable to a selection in an editor. Therefore the end position is exclusive. If you want to specify a range that contains a line including the ending character(s) then use an end position denoting the start of the next line.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
Position
|
The range's start position. |
required |
end
|
Position
|
The range's end position. |
required |