mirror of
https://github.com/enso-org/enso.git
synced 2024-11-23 08:08:34 +03:00
doc: Range datatype (#3296)
This commit is contained in:
parent
5c6c882c38
commit
9010a2c3a3
@ -983,17 +983,44 @@ struct Position {
|
||||
|
||||
A representation of a range of text in a text file.
|
||||
|
||||
For example, given the function.
|
||||
|
||||
```
|
||||
0|inc x =
|
||||
1| x + 1
|
||||
^^^^^^^^^
|
||||
012345678
|
||||
```
|
||||
|
||||
The range of `inc` is
|
||||
|
||||
```typescript
|
||||
{
|
||||
start: { line: 0, character: 0},
|
||||
end: { line: 0, character: 3}
|
||||
}
|
||||
```
|
||||
|
||||
The range of `1` is
|
||||
|
||||
```typescript
|
||||
{
|
||||
start: { line: 1, character: 8},
|
||||
end: { line: 1, character: 9}
|
||||
}
|
||||
```
|
||||
|
||||
#### Format
|
||||
|
||||
```typescript
|
||||
interface Range {
|
||||
/**
|
||||
* The range's start position.
|
||||
* The range's start position (inclusive).
|
||||
*/
|
||||
start: Position;
|
||||
|
||||
/**
|
||||
* The range's end position.
|
||||
* The range's end position (exclusive).
|
||||
*/
|
||||
end: Position;
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ object model {
|
||||
|
||||
/** A representation of a position in a text file.
|
||||
*
|
||||
* @param line a line position in a document (zero-based).
|
||||
* @param character a character offset
|
||||
* @param line a line position in a document (zero-based)
|
||||
* @param character a character offset (zero-based)
|
||||
*/
|
||||
case class Position(line: Int, character: Int) extends Ordered[Position] {
|
||||
|
||||
@ -26,8 +26,28 @@ object model {
|
||||
|
||||
/** A representation of a range of text in a text file.
|
||||
*
|
||||
* @param start the range's start position
|
||||
* @param end the range's end position
|
||||
* ==Example==
|
||||
* Given the function.
|
||||
*
|
||||
* {{{
|
||||
* 0|inc x =
|
||||
1| x + 1
|
||||
* ^^^^^^^^^
|
||||
* 012345678
|
||||
* }}}
|
||||
*
|
||||
* The range of `inc` is
|
||||
* {{{
|
||||
* Range(Position(0, 0), Position(0, 3))
|
||||
* }}}
|
||||
*
|
||||
* The range of `1` is
|
||||
* {{{
|
||||
* Range(Position(1, 8), Position(1, 9))
|
||||
* }}}
|
||||
*
|
||||
* @param start the range's start position (inclusive)
|
||||
* @param end the range's end position (exclusive)
|
||||
*/
|
||||
case class Range(start: Position, end: Position)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user