File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed
packages/common/src/types Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -141,13 +141,21 @@ export class Position {
141141 }
142142
143143 /**
144- * Return a concise string representation of the position.
144+ * Return a concise string representation of the position. 0-based.
145145 * @returns concise representation
146146 **/
147147 public concise ( ) : string {
148148 return `${ this . line } :${ this . character } ` ;
149149 }
150150
151+ /**
152+ * Return a concise string representation of the position. 1-based.
153+ * @returns concise representation
154+ **/
155+ public conciseOneBase ( ) : string {
156+ return `${ this . line + 1 } :${ this . character + 1 } ` ;
157+ }
158+
151159 public toString ( ) : string {
152160 return this . concise ( ) ;
153161 }
Original file line number Diff line number Diff line change @@ -144,14 +144,22 @@ export class Range {
144144 }
145145
146146 /**
147- * Return a concise string representation of the range
147+ * Return a concise string representation of the range. 0-based.
148148 * @returns concise representation
149149 **/
150150 public concise ( ) : string {
151151 return `${ this . start . concise ( ) } -${ this . end . concise ( ) } ` ;
152152 }
153153
154+ /**
155+ * Return a concise string representation of the range. 1-based.
156+ * @returns concise representation
157+ **/
158+ public conciseOneBase ( ) : string {
159+ return `${ this . start . conciseOneBase ( ) } -${ this . end . conciseOneBase ( ) } ` ;
160+ }
161+
154162 public toString ( ) : string {
155- return this . concise ( ) ;
163+ return ` ${ this . start . concise ( ) } - ${ this . end . concise ( ) } ` ;
156164 }
157165}
Original file line number Diff line number Diff line change @@ -74,13 +74,21 @@ export class Selection extends Range {
7474 }
7575
7676 /**
77- * Return a concise string representation of the selection
77+ * Return a concise string representation of the selection. 0-based.
7878 * @returns concise representation
7979 **/
8080 public concise ( ) : string {
8181 return `${ this . anchor . concise ( ) } ->${ this . active . concise ( ) } ` ;
8282 }
8383
84+ /**
85+ * Return a concise string representation of the selection. 1-based.
86+ * @returns concise representation
87+ **/
88+ public conciseOneBase ( ) : string {
89+ return `${ this . start . conciseOneBase ( ) } ->${ this . end . conciseOneBase ( ) } ` ;
90+ }
91+
8492 public toString ( ) : string {
8593 return this . concise ( ) ;
8694 }
You can’t perform that action at this time.
0 commit comments