inlineDecorations.ts ×7

Frontier kind: Code frontier

unlabeled · c_65493e3cae82

11 tests · 40928 LOC · 241 files · introduces 0 tests · 44 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
13 ranges44 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5005 ranges40928 lines · 241 files · Browse complete extent
All tests (intent)
11 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.

3 files ranked by introduced lines: 44 introduced LOC across 13 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/viewModel/inlineDecorations.ts 31 introduced LOC · 7 ranges

Open complete file

91
92 for (let i = 0, len = modelDecorations.length; i < len; i++) {
93 > const modelDecoration = modelDecorations[i]; inlineDecorations.ts
94 > const decorationOptions = modelDecoration.options;
95 >
96 > if (!isModelDecorationVisible(this.model, modelDecoration)) {
97 continue;
98 }
100 > const viewModelDecoration = this._getOrCreateViewModelDecoration(modelDecoration);
101 > const viewRange = viewModelDecoration.range;
102 >
103 > decorationsInViewport[decorationsInViewportLen++] = viewModelDecoration;
104 >
105 > if (decorationOptions.inlineClassName) {
106 const inlineDecoration = new InlineDecoration(viewRange, decorationOptions.inlineClassName, decorationOptions.inlineClassNameAffectsLetterSpacing ? InlineDecorationType.RegularAffectingLetterSpacing : InlineDecorationType.Regular);
107 const intersectedStartLineNumber = Math.max(startLineNumber, viewRange.startLineNumber);
114 }
115 }
116 > if (decorationOptions.beforeContentClassName) { inlineDecorations.ts
117 if (startLineNumber <= viewRange.startLineNumber && viewRange.startLineNumber <= endLineNumber) {
118 const inlineDecoration = new InlineDecoration(
127 }
128 }
129 > if (decorationOptions.afterContentClassName) { inlineDecorations.ts
130 if (startLineNumber <= viewRange.endLineNumber && viewRange.endLineNumber <= endLineNumber) {
131 const inlineDecoration = new InlineDecoration(
162
163 private _getOrCreateViewModelDecoration(modelDecoration: IModelDecoration): ViewModelDecoration {
164 > const id = modelDecoration.id; inlineDecorations.ts
165 > let r = this._decorationsCache[id];
166 > if (!r) {
167 > const modelRange = modelDecoration.range;
168 > const options = modelDecoration.options;
169 > let viewRange: Range;
170 > if (options.isWholeLine) {
171 const start = this.coordinatesConverter.convertModelPositionToViewPosition(new Position(modelRange.startLineNumber, 1), PositionAffinity.Left, false, true);
172 const end = this.coordinatesConverter.convertModelPositionToViewPosition(new Position(modelRange.endLineNumber, this.model.getLineMaxColumn(modelRange.endLineNumber)), PositionAffinity.Right);
173 viewRange = new Range(start.lineNumber, start.column, end.lineNumber, end.column);
174 > } else { inlineDecorations.ts
175 > // For backwards compatibility reasons, we want injected text before any decoration.
176 > // Thus, move decorations to the right.
177 > viewRange = this.coordinatesConverter.convertModelRangeToViewRange(modelRange, PositionAffinity.Right);
178 > }
179 > r = new ViewModelDecoration(viewRange, options);
180 > this._decorationsCache[id] = r;
181 > }
182 > return r;
183 > }
184 }
185
src/vs/editor/common/viewModel/viewModelDecoration.ts 9 introduced LOC · 4 ranges

Open complete file

15
16 constructor(range: Range, options: IModelDecorationOptions) {
17 > this.range = range; viewModelDecoration.ts
18 > this.options = options;
19 > }
20 }
21
22 export function isModelDecorationVisible(model: ITextModel, decoration: IModelDecoration): boolean {
23 > if (decoration.options.hideInCommentTokens && isModelDecorationInComment(model, decoration)) { viewModelDecoration.ts
24 return false;
25 }
27 > if (decoration.options.hideInStringTokens && isModelDecorationInString(model, decoration)) {
28 return false;
29 }
31 > return true;
32 > }
33
34 export function isModelDecorationInComment(model: ITextModel, decoration: IModelDecoration): boolean {
src/vs/editor/common/coordinatesConverter.ts 4 introduced LOC · 2 ranges

Open complete file

43
44 private _validRange(range: Range): Range {
45 > return this._model.validateRange(range); coordinatesConverter.ts
46 > }
47
48 // View -> Model conversion and related methods
71
72 public convertModelRangeToViewRange(modelRange: Range): Range {
73 > return this._validRange(modelRange); coordinatesConverter.ts
74 > }
75
76 public modelPositionIsVisible(modelPosition: Position): boolean {