@@ -12,7 +12,6 @@ import { IViewWhitespaceViewportData } from 'vs/editor/common/viewModel/viewMode
1212 *
1313 * These objects are basically either text (lines) or spaces between those lines (whitespaces).
1414 * This provides commodity operations for working with lines that contain whitespace that pushes lines lower (vertically).
15- * This is written with no knowledge of an editor in mind.
1615 */
1716export class LinesLayout {
1817
@@ -475,4 +474,67 @@ export class LinesLayout {
475474 public getWhitespaces ( ) : IEditorWhitespace [ ] {
476475 return this . _whitespaces . getWhitespaces ( this . _lineHeight ) ;
477476 }
477+
478+ /**
479+ * The number of whitespaces.
480+ */
481+ public getWhitespacesCount ( ) : number {
482+ return this . _whitespaces . getCount ( ) ;
483+ }
484+
485+ /**
486+ * Get the `id` for whitespace at index `index`.
487+ *
488+ * @param index The index of the whitespace.
489+ * @return `id` of whitespace at `index`.
490+ */
491+ public getIdForWhitespaceIndex ( index : number ) : string {
492+ return this . _whitespaces . getIdForWhitespaceIndex ( index ) ;
493+ }
494+
495+ /**
496+ * Get the `afterLineNumber` for whitespace at index `index`.
497+ *
498+ * @param index The index of the whitespace.
499+ * @return `afterLineNumber` of whitespace at `index`.
500+ */
501+ public getAfterLineNumberForWhitespaceIndex ( index : number ) : number {
502+ return this . _whitespaces . getAfterLineNumberForWhitespaceIndex ( index ) ;
503+ }
504+
505+ /**
506+ * Get the `height` for whitespace at index `index`.
507+ *
508+ * @param index The index of the whitespace.
509+ * @return `height` of whitespace at `index`.
510+ */
511+ public getHeightForWhitespaceIndex ( index : number ) : number {
512+ return this . _whitespaces . getHeightForWhitespaceIndex ( index ) ;
513+ }
514+
515+ /**
516+ * Find the index of the first whitespace which has `afterLineNumber` >= `lineNumber`.
517+ * @return The index of the first whitespace with `afterLineNumber` >= `lineNumber` or -1 if no whitespace is found.
518+ */
519+ public getFirstWhitespaceIndexAfterLineNumber ( lineNumber : number ) : number {
520+ return this . _whitespaces . getFirstWhitespaceIndexAfterLineNumber ( lineNumber ) ;
521+ }
522+
523+ /**
524+ * Return the sum of the heights of the whitespaces at [0..index].
525+ * This includes the whitespace at `index`.
526+ *
527+ * @param index The index of the whitespace.
528+ * @return The sum of the heights of all whitespaces before the one at `index`, including the one at `index`.
529+ */
530+ public getWhitespacesAccumulatedHeight ( index : number ) : number {
531+ return this . _whitespaces . getAccumulatedHeight ( index ) ;
532+ }
533+
534+ /**
535+ * Get the sum of all the whitespaces.
536+ */
537+ public getWhitespacesTotalHeight ( ) : number {
538+ return this . _whitespaces . getTotalHeight ( ) ;
539+ }
478540}
0 commit comments