searchExtConversionTypes.ts ×10

Frontier kind: Code frontier

unlabeled · c_7b13d65c97b9

10 tests · 79830 LOC · 282 files · introduces 0 tests · 60 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
24 ranges60 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5712 ranges79830 lines · 282 files · Browse complete extent
All tests (intent)
10 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: 60 introduced LOC across 24 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/services/search/common/searchExtConversionTypes.ts 28 introduced LOC · 10 ranges

Open complete file

308 * @returns True if the object is a TextSearchMatch, false otherwise.
309 */
310 > function isTextSearchMatch(object: any): object is TextSearchMatch { searchExtConversionTypes.ts
311 > return 'uri' in object && 'ranges' in object && 'preview' in object;
312 > }
313
314 /**
497
498 export function oldToNewTextSearchResult(result: TextSearchResult): TextSearchResult2 {
499 > if (isTextSearchMatch(result)) { searchExtConversionTypes.ts
500 > const ranges = asArray(result.ranges).map((r, i) => {
501 > const previewArr = asArray(result.preview.matches);
502 > const matchingPreviewRange = previewArr[i];
503 > return { sourceRange: r, previewRange: matchingPreviewRange };
504 > });
505 > return new TextSearchMatch2(result.uri, ranges, result.preview.text);
506 > } else {
507 return new TextSearchContext2(result.uri, result.text, result.lineNumber);
508 }
510
511 export class OldTextSearchProviderConverter implements TextSearchProvider2 {
515
516 const progressShim = (oldResult: TextSearchResult) => {
517 > if (!validateProviderResult(oldResult)) { searchExtConversionTypes.ts
518 return;
519 }
520 > progress.report(oldToNewTextSearchResult(oldResult)); searchExtConversionTypes.ts
521 > };
522
523 const getResult = async () => {
540 }
541
542 > function validateProviderResult(result: TextSearchResult): boolean { searchExtConversionTypes.ts
543 > if (extensionResultIsMatch(result)) {
544 > if (Array.isArray(result.ranges)) {
545 > if (!Array.isArray(result.preview.matches)) {
546 console.warn('INVALID - A text search provider match\'s`ranges` and`matches` properties must have the same type.');
547 return false;
548 }
550 > if ((<Range[]>result.preview.matches).length !== result.ranges.length) {
551 console.warn('INVALID - A text search provider match\'s`ranges` and`matches` properties must have the same length.');
552 return false;
553 }
555 if (Array.isArray(result.preview.matches)) {
556 console.warn('INVALID - A text search provider match\'s`ranges` and`matches` properties must have the same length.');
src/vs/workbench/api/common/extHostTypes/range.ts 19 introduced LOC · 6 ranges

Open complete file

37
38 get start(): Position {
39 > return this._start; range.ts
40 > }
41
42 get end(): Position {
43 > return this._end; range.ts
44 > }
45
46 constructor(start: vscode.Position, end: vscode.Position);
48 constructor(startLine: number, startColumn: number, endLine: number, endColumn: number);
49 constructor(startLineOrStart: number | Position | vscode.Position, startColumnOrEnd: number | Position | vscode.Position, endLine?: number, endColumn?: number) {
50 > let start: Position | undefined; range.ts
51 > let end: Position | undefined;
52 >
53 > if (typeof startLineOrStart === 'number' && typeof startColumnOrEnd === 'number' && typeof endLine === 'number' && typeof endColumn === 'number') {
54 > start = new Position(startLineOrStart, startColumnOrEnd);
55 > end = new Position(endLine, endColumn);
56 > } else if (Position.isPosition(startLineOrStart) && Position.isPosition(startColumnOrEnd)) {
57 start = Position.of(startLineOrStart);
58 end = Position.of(startColumnOrEnd);
59 }
60 > range.ts
61 > if (!start || !end) {
62 throw new Error('Invalid arguments');
63 }
64 > range.ts
65 > if (start.isBefore(end)) {
66 > this._start = start;
67 > this._end = end;
68 > } else {
69 this._start = end;
70 this._end = start;
71 }
72 > } range.ts
73
74 contains(positionOrRange: Position | Range): boolean {
src/vs/workbench/api/common/extHostTypes/position.ts 13 introduced LOC · 8 ranges

Open complete file

66
67 get line(): number {
68 > return this._line; position.ts
69 > }
70
71 get character(): number {
72 > return this._character; position.ts
73 > }
74
75 constructor(line: number, character: number) {
76 > if (line < 0) { position.ts
77 throw illegalArgument('line must be non-negative');
78 }
79 > if (character < 0) { position.ts
80 throw illegalArgument('character must be non-negative');
81 }
82 > this._line = line; position.ts
83 > this._character = character;
84 > }
85
86 isBefore(other: Position): boolean {
87 > if (this._line < other._line) { position.ts
88 return true;
89 }
90 > if (other._line < this._line) { position.ts
91 return false;
92 }
93 > return this._character < other._character; position.ts
94 > }
95
96 isBeforeOrEqual(other: Position): boolean {