@theia/search-in-workspace 1.45.1 → 1.46.0-next.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +40 -40
  2. package/lib/browser/components/search-in-workspace-input.d.ts +39 -39
  3. package/lib/browser/components/search-in-workspace-input.js +123 -123
  4. package/lib/browser/components/search-in-workspace-textarea.d.ts +39 -39
  5. package/lib/browser/components/search-in-workspace-textarea.js +130 -130
  6. package/lib/browser/search-in-workspace-context-key-service.d.ts +23 -23
  7. package/lib/browser/search-in-workspace-context-key-service.js +90 -90
  8. package/lib/browser/search-in-workspace-factory.d.ts +10 -10
  9. package/lib/browser/search-in-workspace-factory.js +68 -68
  10. package/lib/browser/search-in-workspace-frontend-contribution.d.ts +57 -55
  11. package/lib/browser/search-in-workspace-frontend-contribution.d.ts.map +1 -1
  12. package/lib/browser/search-in-workspace-frontend-contribution.js +516 -482
  13. package/lib/browser/search-in-workspace-frontend-contribution.js.map +1 -1
  14. package/lib/browser/search-in-workspace-frontend-module.d.ts +6 -6
  15. package/lib/browser/search-in-workspace-frontend-module.js +71 -71
  16. package/lib/browser/search-in-workspace-label-provider.d.ts +9 -9
  17. package/lib/browser/search-in-workspace-label-provider.js +57 -57
  18. package/lib/browser/search-in-workspace-preferences.d.ts +17 -17
  19. package/lib/browser/search-in-workspace-preferences.js +87 -87
  20. package/lib/browser/search-in-workspace-result-tree-widget.d.ts +259 -255
  21. package/lib/browser/search-in-workspace-result-tree-widget.d.ts.map +1 -1
  22. package/lib/browser/search-in-workspace-result-tree-widget.js +1172 -1099
  23. package/lib/browser/search-in-workspace-result-tree-widget.js.map +1 -1
  24. package/lib/browser/search-in-workspace-service.d.ts +35 -35
  25. package/lib/browser/search-in-workspace-service.js +158 -158
  26. package/lib/browser/search-in-workspace-widget.d.ts +121 -121
  27. package/lib/browser/search-in-workspace-widget.js +629 -629
  28. package/lib/browser/search-layout-migrations.d.ts +5 -5
  29. package/lib/browser/search-layout-migrations.js +64 -64
  30. package/lib/common/search-in-workspace-interface.d.ts +116 -116
  31. package/lib/common/search-in-workspace-interface.js +35 -35
  32. package/lib/node/ripgrep-search-in-workspace-server.d.ts +94 -94
  33. package/lib/node/ripgrep-search-in-workspace-server.js +430 -430
  34. package/lib/node/ripgrep-search-in-workspace-server.js.map +1 -1
  35. package/lib/node/ripgrep-search-in-workspace-server.slow-spec.d.ts +1 -1
  36. package/lib/node/ripgrep-search-in-workspace-server.slow-spec.js +899 -899
  37. package/lib/node/ripgrep-search-in-workspace-server.slow-spec.js.map +1 -1
  38. package/lib/node/search-in-workspace-backend-module.d.ts +3 -3
  39. package/lib/node/search-in-workspace-backend-module.js +32 -32
  40. package/package.json +9 -9
  41. package/src/browser/components/search-in-workspace-input.tsx +139 -139
  42. package/src/browser/components/search-in-workspace-textarea.tsx +153 -153
  43. package/src/browser/search-in-workspace-context-key-service.ts +93 -93
  44. package/src/browser/search-in-workspace-factory.ts +59 -59
  45. package/src/browser/search-in-workspace-frontend-contribution.ts +510 -474
  46. package/src/browser/search-in-workspace-frontend-module.ts +83 -83
  47. package/src/browser/search-in-workspace-label-provider.ts +48 -48
  48. package/src/browser/search-in-workspace-preferences.ts +96 -96
  49. package/src/browser/search-in-workspace-result-tree-widget.tsx +1318 -1245
  50. package/src/browser/search-in-workspace-service.ts +152 -152
  51. package/src/browser/search-in-workspace-widget.tsx +727 -727
  52. package/src/browser/search-layout-migrations.ts +53 -53
  53. package/src/browser/styles/index.css +400 -400
  54. package/src/browser/styles/search.svg +6 -6
  55. package/src/common/search-in-workspace-interface.ts +153 -153
  56. package/src/node/ripgrep-search-in-workspace-server.slow-spec.ts +1073 -1073
  57. package/src/node/ripgrep-search-in-workspace-server.ts +490 -490
  58. package/src/node/search-in-workspace-backend-module.ts +33 -33
@@ -1,6 +1,6 @@
1
- import { ApplicationShellLayoutMigration, WidgetDescription, ApplicationShellLayoutMigrationContext } from '@theia/core/lib/browser/shell/shell-layout-restorer';
2
- export declare class SearchLayoutVersion3Migration implements ApplicationShellLayoutMigration {
3
- readonly layoutVersion = 6;
4
- onWillInflateWidget(desc: WidgetDescription, { parent }: ApplicationShellLayoutMigrationContext): WidgetDescription | undefined;
5
- }
1
+ import { ApplicationShellLayoutMigration, WidgetDescription, ApplicationShellLayoutMigrationContext } from '@theia/core/lib/browser/shell/shell-layout-restorer';
2
+ export declare class SearchLayoutVersion3Migration implements ApplicationShellLayoutMigration {
3
+ readonly layoutVersion = 6;
4
+ onWillInflateWidget(desc: WidgetDescription, { parent }: ApplicationShellLayoutMigrationContext): WidgetDescription | undefined;
5
+ }
6
6
  //# sourceMappingURL=search-layout-migrations.d.ts.map
@@ -1,65 +1,65 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2021 SAP SE or an SAP affiliate company and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.SearchLayoutVersion3Migration = void 0;
25
- const inversify_1 = require("@theia/core/shared/inversify");
26
- const search_in_workspace_widget_1 = require("./search-in-workspace-widget");
27
- const search_in_workspace_factory_1 = require("./search-in-workspace-factory");
28
- let SearchLayoutVersion3Migration = class SearchLayoutVersion3Migration {
29
- constructor() {
30
- this.layoutVersion = 6.0;
31
- }
32
- onWillInflateWidget(desc, { parent }) {
33
- if (desc.constructionOptions.factoryId === search_in_workspace_widget_1.SearchInWorkspaceWidget.ID && !parent) {
34
- return {
35
- constructionOptions: {
36
- factoryId: search_in_workspace_factory_1.SEARCH_VIEW_CONTAINER_ID
37
- },
38
- innerWidgetState: {
39
- parts: [
40
- {
41
- widget: {
42
- constructionOptions: {
43
- factoryId: search_in_workspace_widget_1.SearchInWorkspaceWidget.ID
44
- },
45
- innerWidgetState: desc.innerWidgetState
46
- },
47
- partId: {
48
- factoryId: search_in_workspace_widget_1.SearchInWorkspaceWidget.ID
49
- },
50
- collapsed: false,
51
- hidden: false
52
- }
53
- ],
54
- title: search_in_workspace_factory_1.SEARCH_VIEW_CONTAINER_TITLE_OPTIONS
55
- }
56
- };
57
- }
58
- return undefined;
59
- }
60
- };
61
- SearchLayoutVersion3Migration = __decorate([
62
- (0, inversify_1.injectable)()
63
- ], SearchLayoutVersion3Migration);
64
- exports.SearchLayoutVersion3Migration = SearchLayoutVersion3Migration;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2021 SAP SE or an SAP affiliate company and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.SearchLayoutVersion3Migration = void 0;
25
+ const inversify_1 = require("@theia/core/shared/inversify");
26
+ const search_in_workspace_widget_1 = require("./search-in-workspace-widget");
27
+ const search_in_workspace_factory_1 = require("./search-in-workspace-factory");
28
+ let SearchLayoutVersion3Migration = class SearchLayoutVersion3Migration {
29
+ constructor() {
30
+ this.layoutVersion = 6.0;
31
+ }
32
+ onWillInflateWidget(desc, { parent }) {
33
+ if (desc.constructionOptions.factoryId === search_in_workspace_widget_1.SearchInWorkspaceWidget.ID && !parent) {
34
+ return {
35
+ constructionOptions: {
36
+ factoryId: search_in_workspace_factory_1.SEARCH_VIEW_CONTAINER_ID
37
+ },
38
+ innerWidgetState: {
39
+ parts: [
40
+ {
41
+ widget: {
42
+ constructionOptions: {
43
+ factoryId: search_in_workspace_widget_1.SearchInWorkspaceWidget.ID
44
+ },
45
+ innerWidgetState: desc.innerWidgetState
46
+ },
47
+ partId: {
48
+ factoryId: search_in_workspace_widget_1.SearchInWorkspaceWidget.ID
49
+ },
50
+ collapsed: false,
51
+ hidden: false
52
+ }
53
+ ],
54
+ title: search_in_workspace_factory_1.SEARCH_VIEW_CONTAINER_TITLE_OPTIONS
55
+ }
56
+ };
57
+ }
58
+ return undefined;
59
+ }
60
+ };
61
+ SearchLayoutVersion3Migration = __decorate([
62
+ (0, inversify_1.injectable)()
63
+ ], SearchLayoutVersion3Migration);
64
+ exports.SearchLayoutVersion3Migration = SearchLayoutVersion3Migration;
65
65
  //# sourceMappingURL=search-layout-migrations.js.map
@@ -1,117 +1,117 @@
1
- import { RpcServer } from '@theia/core';
2
- export interface SearchInWorkspaceOptions {
3
- /**
4
- * Maximum number of results to return. Defaults to unlimited.
5
- */
6
- maxResults?: number;
7
- /**
8
- * accepts suffixes of K, M or G which correspond to kilobytes,
9
- * megabytes and gigabytes, respectively. If no suffix is provided the input is
10
- * treated as bytes.
11
- *
12
- * defaults to '20M'
13
- */
14
- maxFileSize?: string;
15
- /**
16
- * Search case sensitively if true.
17
- */
18
- matchCase?: boolean;
19
- /**
20
- * Search whole words only if true.
21
- */
22
- matchWholeWord?: boolean;
23
- /**
24
- * Use regular expressions for search if true.
25
- */
26
- useRegExp?: boolean;
27
- /**
28
- * Use multiline search if true.
29
- */
30
- multiline?: boolean;
31
- /**
32
- * Include all .gitignored and hidden files.
33
- */
34
- includeIgnored?: boolean;
35
- /**
36
- * Glob pattern for matching files and directories to include the search.
37
- */
38
- include?: string[];
39
- /**
40
- * Glob pattern for matching files and directories to exclude the search.
41
- */
42
- exclude?: string[];
43
- /**
44
- * Whether symlinks should be followed while searching.
45
- */
46
- followSymlinks?: boolean;
47
- }
48
- export interface SearchInWorkspaceResult {
49
- /**
50
- * The string uri to the root folder that the search was performed.
51
- */
52
- root: string;
53
- /**
54
- * The string uri to the file containing the result.
55
- */
56
- fileUri: string;
57
- /**
58
- * matches found in the file
59
- */
60
- matches: SearchMatch[];
61
- }
62
- export interface SearchMatch {
63
- /**
64
- * The (1-based) line number of the result.
65
- */
66
- line: number;
67
- /**
68
- * The (1-based) character number in the result line. For UTF-8 files,
69
- * one multi-byte character counts as one character.
70
- */
71
- character: number;
72
- /**
73
- * The length of the match, in characters. For UTF-8 files, one
74
- * multi-byte character counts as one character.
75
- */
76
- length: number;
77
- /**
78
- * The text of the line containing the result.
79
- */
80
- lineText: string | LinePreview;
81
- }
82
- export interface LinePreview {
83
- text: string;
84
- character: number;
85
- }
86
- export declare namespace SearchInWorkspaceResult {
87
- /**
88
- * Sort search in workspace results according to file, line, character position
89
- * and then length.
90
- */
91
- function compare(a: SearchInWorkspaceResult, b: SearchInWorkspaceResult): number;
92
- }
93
- export declare const SearchInWorkspaceClient: unique symbol;
94
- export interface SearchInWorkspaceClient {
95
- /**
96
- * Called by the server for every search match.
97
- */
98
- onResult(searchId: number, result: SearchInWorkspaceResult): void;
99
- /**
100
- * Called when no more search matches will come.
101
- */
102
- onDone(searchId: number, error?: string): void;
103
- }
104
- export declare const SIW_WS_PATH = "/services/search-in-workspace";
105
- export declare const SearchInWorkspaceServer: unique symbol;
106
- export interface SearchInWorkspaceServer extends RpcServer<SearchInWorkspaceClient> {
107
- /**
108
- * Start a search for WHAT in directories ROOTURIS. Return a unique search id.
109
- */
110
- search(what: string, rootUris: string[], opts?: SearchInWorkspaceOptions): Promise<number>;
111
- /**
112
- * Cancel an ongoing search.
113
- */
114
- cancel(searchId: number): Promise<void>;
115
- dispose(): void;
116
- }
1
+ import { RpcServer } from '@theia/core';
2
+ export interface SearchInWorkspaceOptions {
3
+ /**
4
+ * Maximum number of results to return. Defaults to unlimited.
5
+ */
6
+ maxResults?: number;
7
+ /**
8
+ * accepts suffixes of K, M or G which correspond to kilobytes,
9
+ * megabytes and gigabytes, respectively. If no suffix is provided the input is
10
+ * treated as bytes.
11
+ *
12
+ * defaults to '20M'
13
+ */
14
+ maxFileSize?: string;
15
+ /**
16
+ * Search case sensitively if true.
17
+ */
18
+ matchCase?: boolean;
19
+ /**
20
+ * Search whole words only if true.
21
+ */
22
+ matchWholeWord?: boolean;
23
+ /**
24
+ * Use regular expressions for search if true.
25
+ */
26
+ useRegExp?: boolean;
27
+ /**
28
+ * Use multiline search if true.
29
+ */
30
+ multiline?: boolean;
31
+ /**
32
+ * Include all .gitignored and hidden files.
33
+ */
34
+ includeIgnored?: boolean;
35
+ /**
36
+ * Glob pattern for matching files and directories to include the search.
37
+ */
38
+ include?: string[];
39
+ /**
40
+ * Glob pattern for matching files and directories to exclude the search.
41
+ */
42
+ exclude?: string[];
43
+ /**
44
+ * Whether symlinks should be followed while searching.
45
+ */
46
+ followSymlinks?: boolean;
47
+ }
48
+ export interface SearchInWorkspaceResult {
49
+ /**
50
+ * The string uri to the root folder that the search was performed.
51
+ */
52
+ root: string;
53
+ /**
54
+ * The string uri to the file containing the result.
55
+ */
56
+ fileUri: string;
57
+ /**
58
+ * matches found in the file
59
+ */
60
+ matches: SearchMatch[];
61
+ }
62
+ export interface SearchMatch {
63
+ /**
64
+ * The (1-based) line number of the result.
65
+ */
66
+ line: number;
67
+ /**
68
+ * The (1-based) character number in the result line. For UTF-8 files,
69
+ * one multi-byte character counts as one character.
70
+ */
71
+ character: number;
72
+ /**
73
+ * The length of the match, in characters. For UTF-8 files, one
74
+ * multi-byte character counts as one character.
75
+ */
76
+ length: number;
77
+ /**
78
+ * The text of the line containing the result.
79
+ */
80
+ lineText: string | LinePreview;
81
+ }
82
+ export interface LinePreview {
83
+ text: string;
84
+ character: number;
85
+ }
86
+ export declare namespace SearchInWorkspaceResult {
87
+ /**
88
+ * Sort search in workspace results according to file, line, character position
89
+ * and then length.
90
+ */
91
+ function compare(a: SearchInWorkspaceResult, b: SearchInWorkspaceResult): number;
92
+ }
93
+ export declare const SearchInWorkspaceClient: unique symbol;
94
+ export interface SearchInWorkspaceClient {
95
+ /**
96
+ * Called by the server for every search match.
97
+ */
98
+ onResult(searchId: number, result: SearchInWorkspaceResult): void;
99
+ /**
100
+ * Called when no more search matches will come.
101
+ */
102
+ onDone(searchId: number, error?: string): void;
103
+ }
104
+ export declare const SIW_WS_PATH = "/services/search-in-workspace";
105
+ export declare const SearchInWorkspaceServer: unique symbol;
106
+ export interface SearchInWorkspaceServer extends RpcServer<SearchInWorkspaceClient> {
107
+ /**
108
+ * Start a search for WHAT in directories ROOTURIS. Return a unique search id.
109
+ */
110
+ search(what: string, rootUris: string[], opts?: SearchInWorkspaceOptions): Promise<number>;
111
+ /**
112
+ * Cancel an ongoing search.
113
+ */
114
+ cancel(searchId: number): Promise<void>;
115
+ dispose(): void;
116
+ }
117
117
  //# sourceMappingURL=search-in-workspace-interface.d.ts.map
@@ -1,36 +1,36 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2017-2018 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.SearchInWorkspaceServer = exports.SIW_WS_PATH = exports.SearchInWorkspaceClient = exports.SearchInWorkspaceResult = void 0;
19
- var SearchInWorkspaceResult;
20
- (function (SearchInWorkspaceResult) {
21
- /**
22
- * Sort search in workspace results according to file, line, character position
23
- * and then length.
24
- */
25
- function compare(a, b) {
26
- if (a.fileUri !== b.fileUri) {
27
- return a.fileUri < b.fileUri ? -1 : 1;
28
- }
29
- return 0;
30
- }
31
- SearchInWorkspaceResult.compare = compare;
32
- })(SearchInWorkspaceResult = exports.SearchInWorkspaceResult || (exports.SearchInWorkspaceResult = {}));
33
- exports.SearchInWorkspaceClient = Symbol('SearchInWorkspaceClient');
34
- exports.SIW_WS_PATH = '/services/search-in-workspace';
35
- exports.SearchInWorkspaceServer = Symbol('SearchInWorkspaceServer');
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2017-2018 Ericsson and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.SearchInWorkspaceServer = exports.SIW_WS_PATH = exports.SearchInWorkspaceClient = exports.SearchInWorkspaceResult = void 0;
19
+ var SearchInWorkspaceResult;
20
+ (function (SearchInWorkspaceResult) {
21
+ /**
22
+ * Sort search in workspace results according to file, line, character position
23
+ * and then length.
24
+ */
25
+ function compare(a, b) {
26
+ if (a.fileUri !== b.fileUri) {
27
+ return a.fileUri < b.fileUri ? -1 : 1;
28
+ }
29
+ return 0;
30
+ }
31
+ SearchInWorkspaceResult.compare = compare;
32
+ })(SearchInWorkspaceResult = exports.SearchInWorkspaceResult || (exports.SearchInWorkspaceResult = {}));
33
+ exports.SearchInWorkspaceClient = Symbol('SearchInWorkspaceClient');
34
+ exports.SIW_WS_PATH = '/services/search-in-workspace';
35
+ exports.SearchInWorkspaceServer = Symbol('SearchInWorkspaceServer');
36
36
  //# sourceMappingURL=search-in-workspace-interface.js.map
@@ -1,95 +1,95 @@
1
- import { ILogger } from '@theia/core';
2
- import { RawProcessFactory } from '@theia/process/lib/node';
3
- import { SearchInWorkspaceServer, SearchInWorkspaceOptions, SearchInWorkspaceClient } from '../common/search-in-workspace-interface';
4
- export declare const RgPath: unique symbol;
5
- /**
6
- * Typing for ripgrep's arbitrary data object:
7
- *
8
- * https://docs.rs/grep-printer/0.1.0/grep_printer/struct.JSON.html#object-arbitrary-data
9
- */
10
- export declare type IRgBytesOrText = {
11
- bytes: string;
12
- } | {
13
- text: string;
14
- };
15
- export interface IRgSubmatch {
16
- match: IRgBytesOrText;
17
- start: number;
18
- end: number;
19
- }
20
- export declare class RipgrepSearchInWorkspaceServer implements SearchInWorkspaceServer {
21
- protected readonly logger: ILogger;
22
- protected readonly rawProcessFactory: RawProcessFactory;
23
- private ongoingSearches;
24
- private nextSearchId;
25
- private client;
26
- protected readonly rgPath: string;
27
- constructor(logger: ILogger, rawProcessFactory: RawProcessFactory);
28
- setClient(client: SearchInWorkspaceClient | undefined): void;
29
- protected getArgs(options?: SearchInWorkspaceOptions): string[];
30
- /**
31
- * Add glob patterns to ripgrep's arguments
32
- * @param args ripgrep set of arguments
33
- * @param patterns patterns to include as globs
34
- * @param exclude whether to negate the glob pattern or not
35
- */
36
- protected addGlobArgs(args: Set<string>, patterns: string[], exclude?: boolean): void;
37
- /**
38
- * Transforms relative patterns to absolute paths, one for each given search path.
39
- * The resulting paths are not validated in the file system as the pattern keeps glob information.
40
- *
41
- * @returns The resulting list may be larger than the received patterns as a relative pattern may
42
- * resolve to multiple absolute patterns up to the number of search paths.
43
- */
44
- protected replaceRelativeToAbsolute(roots: string[], patterns?: string[]): string[];
45
- /**
46
- * Tests if the pattern is relative and should/can be made absolute.
47
- */
48
- protected isPatternRelative(pattern: string): boolean;
49
- /**
50
- * By default, sets the search directories for the string WHAT to the provided ROOTURIS directories
51
- * and returns the assigned search id.
52
- *
53
- * The include / exclude (options in SearchInWorkspaceOptions) are lists of patterns for files to
54
- * include / exclude during search (glob characters are allowed).
55
- *
56
- * include patterns successfully recognized as absolute paths will override the default search and set
57
- * the search directories to the ones provided as includes.
58
- * Relative paths are allowed, the application will attempt to translate them to valid absolute paths
59
- * based on the applicable search directories.
60
- */
61
- search(what: string, rootUris: string[], options?: SearchInWorkspaceOptions): Promise<number>;
62
- /**
63
- * The default search paths are set to be the root paths associated to a workspace
64
- * however the search scope can be further refined with the include paths available in the search options.
65
- * This method will replace the searching paths to the ones specified in the 'include' options but as long
66
- * as the 'include' paths can be successfully validated as existing.
67
- *
68
- * Therefore the returned array of paths can be either the workspace root paths or a set of validated paths
69
- * derived from the include options which can be used to perform the search.
70
- *
71
- * Any pattern that resulted in a valid search path will be removed from the 'include' list as it is
72
- * provided as an equivalent search path instead.
73
- */
74
- protected extractSearchPathsFromIncludes(rootPaths: string[], options: SearchInWorkspaceOptions): Promise<string[]>;
75
- /**
76
- * Transform include/exclude option patterns from relative patterns to absolute patterns.
77
- * E.g. './abc/foo.*' to '${root}/abc/foo.*', the transformation does not validate the
78
- * pattern against the file system as glob suffixes remain.
79
- *
80
- * @returns undefined if the pattern cannot be converted into an absolute path.
81
- */
82
- protected getAbsolutePathFromPattern(root: string, pattern: string): Promise<string | undefined>;
83
- /**
84
- * Returns the root folder uri that a file belongs to.
85
- * In case that a file belongs to more than one root folders, returns the root folder that is closest to the file.
86
- * If the file is not from the current workspace, returns empty string.
87
- * @param filePath string path of the file
88
- * @param rootUris string URIs of the root folders in the current workspace
89
- */
90
- private getRoot;
91
- cancel(searchId: number): Promise<void>;
92
- private wrapUpSearch;
93
- dispose(): void;
94
- }
1
+ import { ILogger } from '@theia/core';
2
+ import { RawProcessFactory } from '@theia/process/lib/node';
3
+ import { SearchInWorkspaceServer, SearchInWorkspaceOptions, SearchInWorkspaceClient } from '../common/search-in-workspace-interface';
4
+ export declare const RgPath: unique symbol;
5
+ /**
6
+ * Typing for ripgrep's arbitrary data object:
7
+ *
8
+ * https://docs.rs/grep-printer/0.1.0/grep_printer/struct.JSON.html#object-arbitrary-data
9
+ */
10
+ export declare type IRgBytesOrText = {
11
+ bytes: string;
12
+ } | {
13
+ text: string;
14
+ };
15
+ export interface IRgSubmatch {
16
+ match: IRgBytesOrText;
17
+ start: number;
18
+ end: number;
19
+ }
20
+ export declare class RipgrepSearchInWorkspaceServer implements SearchInWorkspaceServer {
21
+ protected readonly logger: ILogger;
22
+ protected readonly rawProcessFactory: RawProcessFactory;
23
+ private ongoingSearches;
24
+ private nextSearchId;
25
+ private client;
26
+ protected readonly rgPath: string;
27
+ constructor(logger: ILogger, rawProcessFactory: RawProcessFactory);
28
+ setClient(client: SearchInWorkspaceClient | undefined): void;
29
+ protected getArgs(options?: SearchInWorkspaceOptions): string[];
30
+ /**
31
+ * Add glob patterns to ripgrep's arguments
32
+ * @param args ripgrep set of arguments
33
+ * @param patterns patterns to include as globs
34
+ * @param exclude whether to negate the glob pattern or not
35
+ */
36
+ protected addGlobArgs(args: Set<string>, patterns: string[], exclude?: boolean): void;
37
+ /**
38
+ * Transforms relative patterns to absolute paths, one for each given search path.
39
+ * The resulting paths are not validated in the file system as the pattern keeps glob information.
40
+ *
41
+ * @returns The resulting list may be larger than the received patterns as a relative pattern may
42
+ * resolve to multiple absolute patterns up to the number of search paths.
43
+ */
44
+ protected replaceRelativeToAbsolute(roots: string[], patterns?: string[]): string[];
45
+ /**
46
+ * Tests if the pattern is relative and should/can be made absolute.
47
+ */
48
+ protected isPatternRelative(pattern: string): boolean;
49
+ /**
50
+ * By default, sets the search directories for the string WHAT to the provided ROOTURIS directories
51
+ * and returns the assigned search id.
52
+ *
53
+ * The include / exclude (options in SearchInWorkspaceOptions) are lists of patterns for files to
54
+ * include / exclude during search (glob characters are allowed).
55
+ *
56
+ * include patterns successfully recognized as absolute paths will override the default search and set
57
+ * the search directories to the ones provided as includes.
58
+ * Relative paths are allowed, the application will attempt to translate them to valid absolute paths
59
+ * based on the applicable search directories.
60
+ */
61
+ search(what: string, rootUris: string[], options?: SearchInWorkspaceOptions): Promise<number>;
62
+ /**
63
+ * The default search paths are set to be the root paths associated to a workspace
64
+ * however the search scope can be further refined with the include paths available in the search options.
65
+ * This method will replace the searching paths to the ones specified in the 'include' options but as long
66
+ * as the 'include' paths can be successfully validated as existing.
67
+ *
68
+ * Therefore the returned array of paths can be either the workspace root paths or a set of validated paths
69
+ * derived from the include options which can be used to perform the search.
70
+ *
71
+ * Any pattern that resulted in a valid search path will be removed from the 'include' list as it is
72
+ * provided as an equivalent search path instead.
73
+ */
74
+ protected extractSearchPathsFromIncludes(rootPaths: string[], options: SearchInWorkspaceOptions): Promise<string[]>;
75
+ /**
76
+ * Transform include/exclude option patterns from relative patterns to absolute patterns.
77
+ * E.g. './abc/foo.*' to '${root}/abc/foo.*', the transformation does not validate the
78
+ * pattern against the file system as glob suffixes remain.
79
+ *
80
+ * @returns undefined if the pattern cannot be converted into an absolute path.
81
+ */
82
+ protected getAbsolutePathFromPattern(root: string, pattern: string): Promise<string | undefined>;
83
+ /**
84
+ * Returns the root folder uri that a file belongs to.
85
+ * In case that a file belongs to more than one root folders, returns the root folder that is closest to the file.
86
+ * If the file is not from the current workspace, returns empty string.
87
+ * @param filePath string path of the file
88
+ * @param rootUris string URIs of the root folders in the current workspace
89
+ */
90
+ private getRoot;
91
+ cancel(searchId: number): Promise<void>;
92
+ private wrapUpSearch;
93
+ dispose(): void;
94
+ }
95
95
  //# sourceMappingURL=ripgrep-search-in-workspace-server.d.ts.map