Class TextLocation
A range of a document of the workspace, as the tools of an assistant say it.
public sealed record TextLocation : IEquatable<TextLocation>
- Inheritance
-
TextLocation
- Implements
- Inherited Members
Constructors
TextLocation(string, TextRange)
A range of a document of the workspace, as the tools of an assistant say it.
public TextLocation(string Path, TextRange Range)
Parameters
PathstringThe document's path relative to the workspace root, with
/between folders (src/Module1.bas); absolute for a document outside the root.RangeTextRangeThe range, 1-based.
Properties
Path
The document's path relative to the workspace root, with / between folders (src/Module1.bas); absolute for a document outside the root.
public string Path { get; init; }
Property Value
Range
The range, 1-based.
public TextRange Range { get; init; }
Property Value
Methods
Of(string, Uri, SourceRange)
The location of a range of a document, its path said from the workspace root (PathOf(string, Uri)).
public static TextLocation Of(string workspaceRoot, Uri document, SourceRange range)
Parameters
workspaceRootstringThe workspace root: a folder.
documentUriThe document: a
file:URI.rangeSourceRangeThe range, 0-based.
Returns
- TextLocation
The location.
PathOf(string, Uri)
The path of a document as a tool says it: relative to the workspace root, with / between folders; the absolute path of a document outside the
root.
public static string PathOf(string workspaceRoot, Uri document)
Parameters
Returns
- string
The path.
ToString()
The location as a listing writes it: src/Module1.bas:12:5.
public override string ToString()
Returns
- string
The path and the start of the range.
UriOf(string, string)
The document a tool's argument names: a path relative to the workspace root (with / or the platform's separator between folders), or absolute.
public static Uri UriOf(string workspaceRoot, string path)
Parameters
Returns
- Uri
The document's
file:URI.
Exceptions
- ArgumentException
pathis empty, or is not a path.