Skip to content

Commit 2b0bc55

Browse files
committed
Remove unused code for #38414
1 parent ed99496 commit 2b0bc55

File tree

3 files changed

+61
-141
lines changed

3 files changed

+61
-141
lines changed

src/vs/workbench/services/search/node/ripgrepTextSearch.ts

+2-70
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ import * as paths from 'vs/base/common/paths';
1818
import * as extfs from 'vs/base/node/extfs';
1919
import * as encoding from 'vs/base/node/encoding';
2020
import * as glob from 'vs/base/common/glob';
21-
import { ILineMatch, ISearchLog } from 'vs/platform/search/common/search';
21+
import { ISearchLog } from 'vs/platform/search/common/search';
2222
import { TPromise } from 'vs/base/common/winjs.base';
2323

24-
import { ISerializedFileMatch, ISerializedSearchComplete, IRawSearch, IFolderSearch } from './search';
24+
import { ISerializedFileMatch, ISerializedSearchComplete, IRawSearch, IFolderSearch, LineMatch, FileMatch } from './search';
2525

2626
export class RipgrepEngine {
2727
private isDone = false;
@@ -328,74 +328,6 @@ export class RipgrepParser extends EventEmitter {
328328
}
329329
}
330330

331-
export class FileMatch implements ISerializedFileMatch {
332-
path: string;
333-
lineMatches: LineMatch[];
334-
335-
constructor(path: string) {
336-
this.path = path;
337-
this.lineMatches = [];
338-
}
339-
340-
addMatch(lineMatch: LineMatch): void {
341-
this.lineMatches.push(lineMatch);
342-
}
343-
344-
isEmpty(): boolean {
345-
return this.lineMatches.length === 0;
346-
}
347-
348-
serialize(): ISerializedFileMatch {
349-
let lineMatches: ILineMatch[] = [];
350-
let numMatches = 0;
351-
352-
for (let i = 0; i < this.lineMatches.length; i++) {
353-
numMatches += this.lineMatches[i].offsetAndLengths.length;
354-
lineMatches.push(this.lineMatches[i].serialize());
355-
}
356-
357-
return {
358-
path: this.path,
359-
lineMatches,
360-
numMatches
361-
};
362-
}
363-
}
364-
365-
export class LineMatch implements ILineMatch {
366-
preview: string;
367-
lineNumber: number;
368-
offsetAndLengths: number[][];
369-
370-
constructor(preview: string, lineNumber: number) {
371-
this.preview = preview.replace(/(\r|\n)*$/, '');
372-
this.lineNumber = lineNumber;
373-
this.offsetAndLengths = [];
374-
}
375-
376-
getText(): string {
377-
return this.preview;
378-
}
379-
380-
getLineNumber(): number {
381-
return this.lineNumber;
382-
}
383-
384-
addMatch(offset: number, length: number): void {
385-
this.offsetAndLengths.push([offset, length]);
386-
}
387-
388-
serialize(): ILineMatch {
389-
const result = {
390-
preview: this.preview,
391-
lineNumber: this.lineNumber,
392-
offsetAndLengths: this.offsetAndLengths
393-
};
394-
395-
return result;
396-
}
397-
}
398-
399331
export interface IRgGlobResult {
400332
globArgs: string[];
401333
siblingClauses: glob.IExpression;

src/vs/workbench/services/search/node/search.ts

+58-1
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,61 @@ export interface ISerializedFileMatch {
7272

7373
// Type of the possible values for progress calls from the engine
7474
export type ISerializedSearchProgressItem = ISerializedFileMatch | ISerializedFileMatch[] | IProgress | ISearchLog;
75-
export type IFileSearchProgressItem = IRawFileMatch | IRawFileMatch[] | IProgress;
75+
export type IFileSearchProgressItem = IRawFileMatch | IRawFileMatch[] | IProgress;
76+
77+
78+
export class FileMatch implements ISerializedFileMatch {
79+
path: string;
80+
lineMatches: LineMatch[];
81+
82+
constructor(path: string) {
83+
this.path = path;
84+
this.lineMatches = [];
85+
}
86+
87+
addMatch(lineMatch: LineMatch): void {
88+
this.lineMatches.push(lineMatch);
89+
}
90+
91+
serialize(): ISerializedFileMatch {
92+
let lineMatches: ILineMatch[] = [];
93+
let numMatches = 0;
94+
95+
for (let i = 0; i < this.lineMatches.length; i++) {
96+
numMatches += this.lineMatches[i].offsetAndLengths.length;
97+
lineMatches.push(this.lineMatches[i].serialize());
98+
}
99+
100+
return {
101+
path: this.path,
102+
lineMatches,
103+
numMatches
104+
};
105+
}
106+
}
107+
108+
export class LineMatch implements ILineMatch {
109+
preview: string;
110+
lineNumber: number;
111+
offsetAndLengths: number[][];
112+
113+
constructor(preview: string, lineNumber: number) {
114+
this.preview = preview.replace(/(\r|\n)*$/, '');
115+
this.lineNumber = lineNumber;
116+
this.offsetAndLengths = [];
117+
}
118+
119+
addMatch(offset: number, length: number): void {
120+
this.offsetAndLengths.push([offset, length]);
121+
}
122+
123+
serialize(): ILineMatch {
124+
const result = {
125+
preview: this.preview,
126+
lineNumber: this.lineNumber,
127+
offsetAndLengths: this.offsetAndLengths
128+
};
129+
130+
return result;
131+
}
132+
}

src/vs/workbench/services/search/node/worker/searchWorker.ts

+1-70
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ gracefulFs.gracefulify(fs);
1212
import { onUnexpectedError } from 'vs/base/common/errors';
1313
import * as strings from 'vs/base/common/strings';
1414
import { TPromise } from 'vs/base/common/winjs.base';
15-
import { ISerializedFileMatch } from '../search';
15+
import { LineMatch, FileMatch } from '../search';
1616
import * as baseMime from 'vs/base/common/mime';
17-
import { ILineMatch } from 'vs/platform/search/common/search';
1817
import { UTF16le, UTF16be, UTF8, UTF8_with_bom, encodingExists, decode, bomLength } from 'vs/base/node/encoding';
1918
import { detectMimeAndEncodingFromBuffer } from 'vs/base/node/mime';
2019

@@ -299,71 +298,3 @@ export class SearchWorkerEngine {
299298
});
300299
}
301300
}
302-
303-
export class FileMatch implements ISerializedFileMatch {
304-
path: string;
305-
lineMatches: LineMatch[];
306-
307-
constructor(path: string) {
308-
this.path = path;
309-
this.lineMatches = [];
310-
}
311-
312-
addMatch(lineMatch: LineMatch): void {
313-
this.lineMatches.push(lineMatch);
314-
}
315-
316-
isEmpty(): boolean {
317-
return this.lineMatches.length === 0;
318-
}
319-
320-
serialize(): ISerializedFileMatch {
321-
let lineMatches: ILineMatch[] = [];
322-
let numMatches = 0;
323-
324-
for (let i = 0; i < this.lineMatches.length; i++) {
325-
numMatches += this.lineMatches[i].offsetAndLengths.length;
326-
lineMatches.push(this.lineMatches[i].serialize());
327-
}
328-
329-
return {
330-
path: this.path,
331-
lineMatches,
332-
numMatches
333-
};
334-
}
335-
}
336-
337-
export class LineMatch implements ILineMatch {
338-
preview: string;
339-
lineNumber: number;
340-
offsetAndLengths: number[][];
341-
342-
constructor(preview: string, lineNumber: number) {
343-
this.preview = preview.replace(/(\r|\n)*$/, '');
344-
this.lineNumber = lineNumber;
345-
this.offsetAndLengths = [];
346-
}
347-
348-
getText(): string {
349-
return this.preview;
350-
}
351-
352-
getLineNumber(): number {
353-
return this.lineNumber;
354-
}
355-
356-
addMatch(offset: number, length: number): void {
357-
this.offsetAndLengths.push([offset, length]);
358-
}
359-
360-
serialize(): ILineMatch {
361-
const result = {
362-
preview: this.preview,
363-
lineNumber: this.lineNumber,
364-
offsetAndLengths: this.offsetAndLengths
365-
};
366-
367-
return result;
368-
}
369-
}

0 commit comments

Comments
 (0)