viewLineRenderer.ts ×18

Frontier kind: Code frontier

unlabeled · c_bd1ede3e35fc

26 tests · 9409 LOC · 43 files · introduces 0 tests · 74 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
18 ranges74 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1258 ranges9409 lines · 43 files · Browse complete extent
All tests (intent)
26 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 74 introduced LOC across 18 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/viewLayout/viewLineRenderer.ts 74 introduced LOC · 18 ranges

Open complete file

490 (input.renderWhitespace === RenderWhitespace.Trailing && !input.continuesWithWrappedLine)
491 ) {
492 > tokens = _applyRenderWhitespace(input, lineContent, len, tokens); viewLineRenderer.ts
493 > }
494 let containsForeignElements = ForeignElementType.None;
495 if (input.lineDecorations.length > 0) {
750 * The rendering phase will generate `style="width:..."` for these tokens.
751 */
752 > function _applyRenderWhitespace(input: RenderLineInput, lineContent: string, len: number, tokens: LinePart[]): LinePart[] { viewLineRenderer.ts
753 >
754 > const continuesWithWrappedLine = input.continuesWithWrappedLine;
755 > const fauxIndentLength = input.fauxIndentLength;
756 > const tabSize = input.tabSize;
757 > const startVisibleColumn = input.startVisibleColumn;
758 > const useMonospaceOptimizations = input.useMonospaceOptimizations;
759 > const selections = input.selectionsOnLine;
760 > const onlyBoundary = (input.renderWhitespace === RenderWhitespace.Boundary);
761 > const onlyTrailing = (input.renderWhitespace === RenderWhitespace.Trailing);
762 > const generateLinePartForEachWhitespace = (input.renderSpaceWidth !== input.spaceWidth);
763 >
764 > const result: LinePart[] = [];
765 > let resultLen = 0;
766 > let tokenIndex = 0;
767 > let tokenType = tokens[tokenIndex].type;
768 > let tokenContainsRTL = tokens[tokenIndex].containsRTL;
769 > let tokenEndIndex = tokens[tokenIndex].endIndex;
770 > const tokensLength = tokens.length;
771 >
772 > let lineIsEmptyOrWhitespace = false;
773 > let firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(lineContent);
774 > let lastNonWhitespaceIndex: number;
775 > if (firstNonWhitespaceIndex === -1) {
776 lineIsEmptyOrWhitespace = true;
777 firstNonWhitespaceIndex = len;
778 lastNonWhitespaceIndex = len;
779 > } else { viewLineRenderer.ts
780 lastNonWhitespaceIndex = strings.lastNonWhitespaceIndex(lineContent);
781 }
783 > let wasInWhitespace = false;
784 > let currentSelectionIndex = 0;
785 > let currentSelection = selections && selections[currentSelectionIndex];
786 > let tmpIndent = startVisibleColumn % tabSize;
787 > for (let charIndex = fauxIndentLength; charIndex < len; charIndex++) {
788 > const chCode = lineContent.charCodeAt(charIndex);
789 >
790 > if (currentSelection && currentSelection.endExclusive <= charIndex) {
791 currentSelectionIndex++;
792 currentSelection = selections && selections[currentSelectionIndex];
793 }
795 > let isInWhitespace: boolean;
796 > if (charIndex < firstNonWhitespaceIndex || charIndex > lastNonWhitespaceIndex) {
797 // in leading or trailing whitespace
798 isInWhitespace = true;
799 > } else if (chCode === CharCode.Tab) { viewLineRenderer.ts
800 // a tab character is rendered both in all and boundary cases
801 isInWhitespace = true;
816 isInWhitespace = false;
817 }
819 > // If rendering whitespace on selection, check that the charIndex falls within a selection
820 > if (isInWhitespace && selections) {
821 isInWhitespace = !!currentSelection && currentSelection.start <= charIndex && charIndex < currentSelection.endExclusive;
822 }
824 > // If rendering only trailing whitespace, check that the charIndex points to trailing whitespace.
825 > if (isInWhitespace && onlyTrailing) {
826 isInWhitespace = lineIsEmptyOrWhitespace || charIndex > lastNonWhitespaceIndex;
827 }
829 > if (isInWhitespace && tokenContainsRTL) {
830 // If the token contains RTL text, breaking it up into multiple line parts
831 // to render whitespace might affect the browser's bidi layout.
838 }
839 }
841 > if (wasInWhitespace) {
842 // was in whitespace token
843 if (!isInWhitespace || (!useMonospaceOptimizations && tmpIndent >= tabSize)) {
853 tmpIndent = tmpIndent % tabSize;
854 }
855 > } else { viewLineRenderer.ts
856 > // was in regular token
857 > if (charIndex === tokenEndIndex || (isInWhitespace && charIndex > fauxIndentLength)) {
858 result[resultLen++] = new LinePart(charIndex, tokenType, 0, tokenContainsRTL);
859 tmpIndent = tmpIndent % tabSize;
860 }
862 >
863 > if (chCode === CharCode.Tab) {
864 tmpIndent = tabSize;
865 > } else if (strings.isFullWidthCharacter(chCode)) { viewLineRenderer.ts
866 tmpIndent += 2;
867 > } else { viewLineRenderer.ts
868 > tmpIndent++;
869 > }
870 >
871 > wasInWhitespace = isInWhitespace;
872 >
873 > while (charIndex === tokenEndIndex) {
874 tokenIndex++;
875 if (tokenIndex < tokensLength) {
881 }
882 }
884 >
885 > let generateWhitespace = false;
886 > if (wasInWhitespace) {
887 // was in whitespace token
888 if (continuesWithWrappedLine && onlyBoundary) {
897 }
898 }
900 > if (generateWhitespace) {
901 if (generateLinePartForEachWhitespace) {
902 const lastEndIndex = (resultLen > 0 ? result[resultLen - 1].endIndex : fauxIndentLength);
907 result[resultLen++] = new LinePart(len, 'mtkw', LinePartMetadata.IS_WHITESPACE, false);
908 }
909 > } else { viewLineRenderer.ts
910 result[resultLen++] = new LinePart(len, tokenType, 0, tokenContainsRTL);
911 }
913 > return result;
914 > }
915
916 /**