@theia/search-in-workspace 1.34.2 → 1.34.3

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 (50) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +40 -40
  3. package/lib/browser/components/search-in-workspace-input.d.ts +39 -39
  4. package/lib/browser/components/search-in-workspace-input.js +120 -120
  5. package/lib/browser/search-in-workspace-context-key-service.d.ts +23 -23
  6. package/lib/browser/search-in-workspace-context-key-service.js +90 -90
  7. package/lib/browser/search-in-workspace-factory.d.ts +10 -10
  8. package/lib/browser/search-in-workspace-factory.js +68 -68
  9. package/lib/browser/search-in-workspace-frontend-contribution.d.ts +53 -53
  10. package/lib/browser/search-in-workspace-frontend-contribution.js +410 -410
  11. package/lib/browser/search-in-workspace-frontend-module.d.ts +6 -6
  12. package/lib/browser/search-in-workspace-frontend-module.js +70 -70
  13. package/lib/browser/search-in-workspace-label-provider.d.ts +9 -9
  14. package/lib/browser/search-in-workspace-label-provider.js +57 -57
  15. package/lib/browser/search-in-workspace-preferences.d.ts +17 -17
  16. package/lib/browser/search-in-workspace-preferences.js +82 -82
  17. package/lib/browser/search-in-workspace-result-tree-widget.d.ts +253 -253
  18. package/lib/browser/search-in-workspace-result-tree-widget.js +1072 -1072
  19. package/lib/browser/search-in-workspace-service.d.ts +35 -35
  20. package/lib/browser/search-in-workspace-service.js +158 -158
  21. package/lib/browser/search-in-workspace-widget.d.ts +121 -121
  22. package/lib/browser/search-in-workspace-widget.js +602 -602
  23. package/lib/browser/search-layout-migrations.d.ts +5 -5
  24. package/lib/browser/search-layout-migrations.js +64 -64
  25. package/lib/common/search-in-workspace-interface.d.ts +112 -112
  26. package/lib/common/search-in-workspace-interface.js +35 -35
  27. package/lib/node/ripgrep-search-in-workspace-server.d.ts +94 -94
  28. package/lib/node/ripgrep-search-in-workspace-server.js +423 -423
  29. package/lib/node/ripgrep-search-in-workspace-server.slow-spec.d.ts +1 -1
  30. package/lib/node/ripgrep-search-in-workspace-server.slow-spec.js +899 -899
  31. package/lib/node/search-in-workspace-backend-module.d.ts +3 -3
  32. package/lib/node/search-in-workspace-backend-module.js +32 -32
  33. package/package.json +9 -9
  34. package/src/browser/components/search-in-workspace-input.tsx +139 -139
  35. package/src/browser/search-in-workspace-context-key-service.ts +93 -93
  36. package/src/browser/search-in-workspace-factory.ts +59 -59
  37. package/src/browser/search-in-workspace-frontend-contribution.ts +402 -402
  38. package/src/browser/search-in-workspace-frontend-module.ts +82 -82
  39. package/src/browser/search-in-workspace-label-provider.ts +48 -48
  40. package/src/browser/search-in-workspace-preferences.ts +91 -91
  41. package/src/browser/search-in-workspace-result-tree-widget.tsx +1225 -1225
  42. package/src/browser/search-in-workspace-service.ts +152 -152
  43. package/src/browser/search-in-workspace-widget.tsx +711 -711
  44. package/src/browser/search-layout-migrations.ts +53 -53
  45. package/src/browser/styles/index.css +367 -367
  46. package/src/browser/styles/search.svg +6 -6
  47. package/src/common/search-in-workspace-interface.ts +149 -149
  48. package/src/node/ripgrep-search-in-workspace-server.slow-spec.ts +1073 -1073
  49. package/src/node/ripgrep-search-in-workspace-server.ts +482 -482
  50. package/src/node/search-in-workspace-backend-module.ts +33 -33
@@ -1,82 +1,82 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017-2018 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import '../../src/browser/styles/index.css';
18
-
19
- import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
20
- import { SearchInWorkspaceService, SearchInWorkspaceClientImpl } from './search-in-workspace-service';
21
- import { SearchInWorkspaceServer, SIW_WS_PATH } from '../common/search-in-workspace-interface';
22
- import {
23
- WebSocketConnectionProvider, WidgetFactory, createTreeContainer, bindViewContribution, FrontendApplicationContribution, LabelProviderContribution,
24
- ApplicationShellLayoutMigration,
25
- StylingParticipant
26
- } from '@theia/core/lib/browser';
27
- import { SearchInWorkspaceWidget } from './search-in-workspace-widget';
28
- import { SearchInWorkspaceResultTreeWidget } from './search-in-workspace-result-tree-widget';
29
- import { SearchInWorkspaceFrontendContribution } from './search-in-workspace-frontend-contribution';
30
- import { SearchInWorkspaceContextKeyService } from './search-in-workspace-context-key-service';
31
- import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
32
- import { bindSearchInWorkspacePreferences } from './search-in-workspace-preferences';
33
- import { SearchInWorkspaceLabelProvider } from './search-in-workspace-label-provider';
34
- import { SearchInWorkspaceFactory } from './search-in-workspace-factory';
35
- import { SearchLayoutVersion3Migration } from './search-layout-migrations';
36
-
37
- export default new ContainerModule(bind => {
38
- bind(SearchInWorkspaceContextKeyService).toSelf().inSingletonScope();
39
-
40
- bind(SearchInWorkspaceWidget).toSelf();
41
- bind<WidgetFactory>(WidgetFactory).toDynamicValue(ctx => ({
42
- id: SearchInWorkspaceWidget.ID,
43
- createWidget: () => ctx.container.get(SearchInWorkspaceWidget)
44
- }));
45
- bind(SearchInWorkspaceResultTreeWidget).toDynamicValue(ctx => createSearchTreeWidget(ctx.container));
46
- bind(SearchInWorkspaceFactory).toSelf().inSingletonScope();
47
- bind(WidgetFactory).toService(SearchInWorkspaceFactory);
48
- bind(ApplicationShellLayoutMigration).to(SearchLayoutVersion3Migration).inSingletonScope();
49
-
50
- bindViewContribution(bind, SearchInWorkspaceFrontendContribution);
51
- bind(FrontendApplicationContribution).toService(SearchInWorkspaceFrontendContribution);
52
- bind(TabBarToolbarContribution).toService(SearchInWorkspaceFrontendContribution);
53
- bind(StylingParticipant).toService(SearchInWorkspaceFrontendContribution);
54
-
55
- // The object that gets notified of search results.
56
- bind(SearchInWorkspaceClientImpl).toSelf().inSingletonScope();
57
-
58
- bind(SearchInWorkspaceService).toSelf().inSingletonScope();
59
-
60
- // The object to call methods on the backend.
61
- bind(SearchInWorkspaceServer).toDynamicValue(ctx => {
62
- const client = ctx.container.get(SearchInWorkspaceClientImpl);
63
- return WebSocketConnectionProvider.createProxy(ctx.container, SIW_WS_PATH, client);
64
- }).inSingletonScope();
65
-
66
- bindSearchInWorkspacePreferences(bind);
67
-
68
- bind(SearchInWorkspaceLabelProvider).toSelf().inSingletonScope();
69
- bind(LabelProviderContribution).toService(SearchInWorkspaceLabelProvider);
70
- });
71
-
72
- export function createSearchTreeWidget(parent: interfaces.Container): SearchInWorkspaceResultTreeWidget {
73
- const child = createTreeContainer(parent, {
74
- widget: SearchInWorkspaceResultTreeWidget,
75
- props: {
76
- contextMenuPath: SearchInWorkspaceResultTreeWidget.Menus.BASE,
77
- globalSelection: true
78
- }
79
- });
80
-
81
- return child.get(SearchInWorkspaceResultTreeWidget);
82
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017-2018 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import '../../src/browser/styles/index.css';
18
+
19
+ import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
20
+ import { SearchInWorkspaceService, SearchInWorkspaceClientImpl } from './search-in-workspace-service';
21
+ import { SearchInWorkspaceServer, SIW_WS_PATH } from '../common/search-in-workspace-interface';
22
+ import {
23
+ WebSocketConnectionProvider, WidgetFactory, createTreeContainer, bindViewContribution, FrontendApplicationContribution, LabelProviderContribution,
24
+ ApplicationShellLayoutMigration,
25
+ StylingParticipant
26
+ } from '@theia/core/lib/browser';
27
+ import { SearchInWorkspaceWidget } from './search-in-workspace-widget';
28
+ import { SearchInWorkspaceResultTreeWidget } from './search-in-workspace-result-tree-widget';
29
+ import { SearchInWorkspaceFrontendContribution } from './search-in-workspace-frontend-contribution';
30
+ import { SearchInWorkspaceContextKeyService } from './search-in-workspace-context-key-service';
31
+ import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
32
+ import { bindSearchInWorkspacePreferences } from './search-in-workspace-preferences';
33
+ import { SearchInWorkspaceLabelProvider } from './search-in-workspace-label-provider';
34
+ import { SearchInWorkspaceFactory } from './search-in-workspace-factory';
35
+ import { SearchLayoutVersion3Migration } from './search-layout-migrations';
36
+
37
+ export default new ContainerModule(bind => {
38
+ bind(SearchInWorkspaceContextKeyService).toSelf().inSingletonScope();
39
+
40
+ bind(SearchInWorkspaceWidget).toSelf();
41
+ bind<WidgetFactory>(WidgetFactory).toDynamicValue(ctx => ({
42
+ id: SearchInWorkspaceWidget.ID,
43
+ createWidget: () => ctx.container.get(SearchInWorkspaceWidget)
44
+ }));
45
+ bind(SearchInWorkspaceResultTreeWidget).toDynamicValue(ctx => createSearchTreeWidget(ctx.container));
46
+ bind(SearchInWorkspaceFactory).toSelf().inSingletonScope();
47
+ bind(WidgetFactory).toService(SearchInWorkspaceFactory);
48
+ bind(ApplicationShellLayoutMigration).to(SearchLayoutVersion3Migration).inSingletonScope();
49
+
50
+ bindViewContribution(bind, SearchInWorkspaceFrontendContribution);
51
+ bind(FrontendApplicationContribution).toService(SearchInWorkspaceFrontendContribution);
52
+ bind(TabBarToolbarContribution).toService(SearchInWorkspaceFrontendContribution);
53
+ bind(StylingParticipant).toService(SearchInWorkspaceFrontendContribution);
54
+
55
+ // The object that gets notified of search results.
56
+ bind(SearchInWorkspaceClientImpl).toSelf().inSingletonScope();
57
+
58
+ bind(SearchInWorkspaceService).toSelf().inSingletonScope();
59
+
60
+ // The object to call methods on the backend.
61
+ bind(SearchInWorkspaceServer).toDynamicValue(ctx => {
62
+ const client = ctx.container.get(SearchInWorkspaceClientImpl);
63
+ return WebSocketConnectionProvider.createProxy(ctx.container, SIW_WS_PATH, client);
64
+ }).inSingletonScope();
65
+
66
+ bindSearchInWorkspacePreferences(bind);
67
+
68
+ bind(SearchInWorkspaceLabelProvider).toSelf().inSingletonScope();
69
+ bind(LabelProviderContribution).toService(SearchInWorkspaceLabelProvider);
70
+ });
71
+
72
+ export function createSearchTreeWidget(parent: interfaces.Container): SearchInWorkspaceResultTreeWidget {
73
+ const child = createTreeContainer(parent, {
74
+ widget: SearchInWorkspaceResultTreeWidget,
75
+ props: {
76
+ contextMenuPath: SearchInWorkspaceResultTreeWidget.Menus.BASE,
77
+ globalSelection: true
78
+ }
79
+ });
80
+
81
+ return child.get(SearchInWorkspaceResultTreeWidget);
82
+ }
@@ -1,48 +1,48 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { injectable, inject } from '@theia/core/shared/inversify';
18
- import { LabelProviderContribution, LabelProvider, DidChangeLabelEvent } from '@theia/core/lib/browser/label-provider';
19
- import { SearchInWorkspaceRootFolderNode, SearchInWorkspaceFileNode } from './search-in-workspace-result-tree-widget';
20
- import URI from '@theia/core/lib/common/uri';
21
-
22
- @injectable()
23
- export class SearchInWorkspaceLabelProvider implements LabelProviderContribution {
24
-
25
- @inject(LabelProvider)
26
- protected readonly labelProvider: LabelProvider;
27
-
28
- canHandle(element: object): number {
29
- return SearchInWorkspaceRootFolderNode.is(element) || SearchInWorkspaceFileNode.is(element) ? 100 : 0;
30
- }
31
-
32
- getIcon(node: SearchInWorkspaceRootFolderNode | SearchInWorkspaceFileNode): string {
33
- if (SearchInWorkspaceFileNode.is(node)) {
34
- return this.labelProvider.getIcon(new URI(node.fileUri).withScheme('file'));
35
- }
36
- return this.labelProvider.folderIcon;
37
- }
38
-
39
- getName(node: SearchInWorkspaceRootFolderNode | SearchInWorkspaceFileNode): string {
40
- const uri = SearchInWorkspaceFileNode.is(node) ? node.fileUri : node.folderUri;
41
- return new URI(uri).displayName;
42
- }
43
-
44
- affects(node: SearchInWorkspaceRootFolderNode | SearchInWorkspaceFileNode, event: DidChangeLabelEvent): boolean {
45
- return SearchInWorkspaceFileNode.is(node) && event.affects(new URI(node.fileUri).withScheme('file'));
46
- }
47
-
48
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { injectable, inject } from '@theia/core/shared/inversify';
18
+ import { LabelProviderContribution, LabelProvider, DidChangeLabelEvent } from '@theia/core/lib/browser/label-provider';
19
+ import { SearchInWorkspaceRootFolderNode, SearchInWorkspaceFileNode } from './search-in-workspace-result-tree-widget';
20
+ import URI from '@theia/core/lib/common/uri';
21
+
22
+ @injectable()
23
+ export class SearchInWorkspaceLabelProvider implements LabelProviderContribution {
24
+
25
+ @inject(LabelProvider)
26
+ protected readonly labelProvider: LabelProvider;
27
+
28
+ canHandle(element: object): number {
29
+ return SearchInWorkspaceRootFolderNode.is(element) || SearchInWorkspaceFileNode.is(element) ? 100 : 0;
30
+ }
31
+
32
+ getIcon(node: SearchInWorkspaceRootFolderNode | SearchInWorkspaceFileNode): string {
33
+ if (SearchInWorkspaceFileNode.is(node)) {
34
+ return this.labelProvider.getIcon(new URI(node.fileUri).withScheme('file'));
35
+ }
36
+ return this.labelProvider.folderIcon;
37
+ }
38
+
39
+ getName(node: SearchInWorkspaceRootFolderNode | SearchInWorkspaceFileNode): string {
40
+ const uri = SearchInWorkspaceFileNode.is(node) ? node.fileUri : node.folderUri;
41
+ return new URI(uri).displayName;
42
+ }
43
+
44
+ affects(node: SearchInWorkspaceRootFolderNode | SearchInWorkspaceFileNode, event: DidChangeLabelEvent): boolean {
45
+ return SearchInWorkspaceFileNode.is(node) && event.affects(new URI(node.fileUri).withScheme('file'));
46
+ }
47
+
48
+ }
@@ -1,91 +1,91 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { nls } from '@theia/core/lib/common/nls';
18
- import { PreferenceSchema, PreferenceProxy, PreferenceService, createPreferenceProxy, PreferenceContribution } from '@theia/core/lib/browser/preferences';
19
- import { interfaces } from '@theia/core/shared/inversify';
20
-
21
- export const searchInWorkspacePreferencesSchema: PreferenceSchema = {
22
- type: 'object',
23
- properties: {
24
- 'search.lineNumbers': {
25
- description: nls.localizeByDefault('Controls whether to show line numbers for search results.'),
26
- default: false,
27
- type: 'boolean',
28
- },
29
- 'search.collapseResults': {
30
- description: nls.localizeByDefault('Controls whether the search results will be collapsed or expanded.'),
31
- default: 'auto',
32
- type: 'string',
33
- enum: ['auto', 'alwaysCollapse', 'alwaysExpand'],
34
- },
35
- 'search.searchOnType': {
36
- description: nls.localizeByDefault('Search all files as you type.'),
37
- default: true,
38
- type: 'boolean',
39
- },
40
- 'search.searchOnTypeDebouncePeriod': {
41
- // eslint-disable-next-line max-len
42
- markdownDescription: nls.localizeByDefault('When `#search.searchOnType#` is enabled, controls the timeout in milliseconds between a character being typed and the search starting. Has no effect when `search.searchOnType` is disabled.'),
43
- default: 300,
44
- type: 'number',
45
- },
46
- 'search.searchOnEditorModification': {
47
- description: nls.localize('theia/search-in-workspace/searchOnEditorModification', 'Search the active editor when modified.'),
48
- default: true,
49
- type: 'boolean',
50
- },
51
- 'search.smartCase': {
52
- // eslint-disable-next-line max-len
53
- description: nls.localizeByDefault('Search case-insensitively if the pattern is all lowercase, otherwise, search case-sensitively.'),
54
- default: false,
55
- type: 'boolean',
56
- },
57
- 'search.followSymlinks': {
58
- description: nls.localizeByDefault('Controls whether to follow symlinks while searching.'),
59
- default: true,
60
- type: 'boolean',
61
- }
62
- }
63
- };
64
-
65
- export class SearchInWorkspaceConfiguration {
66
- 'search.lineNumbers': boolean;
67
- 'search.collapseResults': string;
68
- 'search.searchOnType': boolean;
69
- 'search.searchOnTypeDebouncePeriod': number;
70
- 'search.searchOnEditorModification': boolean;
71
- 'search.smartCase': boolean;
72
- 'search.followSymlinks': boolean;
73
- }
74
-
75
- export const SearchInWorkspacePreferenceContribution = Symbol('SearchInWorkspacePreferenceContribution');
76
- export const SearchInWorkspacePreferences = Symbol('SearchInWorkspacePreferences');
77
- export type SearchInWorkspacePreferences = PreferenceProxy<SearchInWorkspaceConfiguration>;
78
-
79
- export function createSearchInWorkspacePreferences(preferences: PreferenceService, schema: PreferenceSchema = searchInWorkspacePreferencesSchema): SearchInWorkspacePreferences {
80
- return createPreferenceProxy(preferences, schema);
81
- }
82
-
83
- export function bindSearchInWorkspacePreferences(bind: interfaces.Bind): void {
84
- bind(SearchInWorkspacePreferences).toDynamicValue(ctx => {
85
- const preferences = ctx.container.get<PreferenceService>(PreferenceService);
86
- const contribution = ctx.container.get<PreferenceContribution>(SearchInWorkspacePreferenceContribution);
87
- return createSearchInWorkspacePreferences(preferences, contribution.schema);
88
- }).inSingletonScope();
89
- bind(SearchInWorkspacePreferenceContribution).toConstantValue({ schema: searchInWorkspacePreferencesSchema });
90
- bind(PreferenceContribution).toService(SearchInWorkspacePreferenceContribution);
91
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { nls } from '@theia/core/lib/common/nls';
18
+ import { PreferenceSchema, PreferenceProxy, PreferenceService, createPreferenceProxy, PreferenceContribution } from '@theia/core/lib/browser/preferences';
19
+ import { interfaces } from '@theia/core/shared/inversify';
20
+
21
+ export const searchInWorkspacePreferencesSchema: PreferenceSchema = {
22
+ type: 'object',
23
+ properties: {
24
+ 'search.lineNumbers': {
25
+ description: nls.localizeByDefault('Controls whether to show line numbers for search results.'),
26
+ default: false,
27
+ type: 'boolean',
28
+ },
29
+ 'search.collapseResults': {
30
+ description: nls.localizeByDefault('Controls whether the search results will be collapsed or expanded.'),
31
+ default: 'auto',
32
+ type: 'string',
33
+ enum: ['auto', 'alwaysCollapse', 'alwaysExpand'],
34
+ },
35
+ 'search.searchOnType': {
36
+ description: nls.localizeByDefault('Search all files as you type.'),
37
+ default: true,
38
+ type: 'boolean',
39
+ },
40
+ 'search.searchOnTypeDebouncePeriod': {
41
+ // eslint-disable-next-line max-len
42
+ markdownDescription: nls.localizeByDefault('When `#search.searchOnType#` is enabled, controls the timeout in milliseconds between a character being typed and the search starting. Has no effect when `search.searchOnType` is disabled.'),
43
+ default: 300,
44
+ type: 'number',
45
+ },
46
+ 'search.searchOnEditorModification': {
47
+ description: nls.localize('theia/search-in-workspace/searchOnEditorModification', 'Search the active editor when modified.'),
48
+ default: true,
49
+ type: 'boolean',
50
+ },
51
+ 'search.smartCase': {
52
+ // eslint-disable-next-line max-len
53
+ description: nls.localizeByDefault('Search case-insensitively if the pattern is all lowercase, otherwise, search case-sensitively.'),
54
+ default: false,
55
+ type: 'boolean',
56
+ },
57
+ 'search.followSymlinks': {
58
+ description: nls.localizeByDefault('Controls whether to follow symlinks while searching.'),
59
+ default: true,
60
+ type: 'boolean',
61
+ }
62
+ }
63
+ };
64
+
65
+ export class SearchInWorkspaceConfiguration {
66
+ 'search.lineNumbers': boolean;
67
+ 'search.collapseResults': string;
68
+ 'search.searchOnType': boolean;
69
+ 'search.searchOnTypeDebouncePeriod': number;
70
+ 'search.searchOnEditorModification': boolean;
71
+ 'search.smartCase': boolean;
72
+ 'search.followSymlinks': boolean;
73
+ }
74
+
75
+ export const SearchInWorkspacePreferenceContribution = Symbol('SearchInWorkspacePreferenceContribution');
76
+ export const SearchInWorkspacePreferences = Symbol('SearchInWorkspacePreferences');
77
+ export type SearchInWorkspacePreferences = PreferenceProxy<SearchInWorkspaceConfiguration>;
78
+
79
+ export function createSearchInWorkspacePreferences(preferences: PreferenceService, schema: PreferenceSchema = searchInWorkspacePreferencesSchema): SearchInWorkspacePreferences {
80
+ return createPreferenceProxy(preferences, schema);
81
+ }
82
+
83
+ export function bindSearchInWorkspacePreferences(bind: interfaces.Bind): void {
84
+ bind(SearchInWorkspacePreferences).toDynamicValue(ctx => {
85
+ const preferences = ctx.container.get<PreferenceService>(PreferenceService);
86
+ const contribution = ctx.container.get<PreferenceContribution>(SearchInWorkspacePreferenceContribution);
87
+ return createSearchInWorkspacePreferences(preferences, contribution.schema);
88
+ }).inSingletonScope();
89
+ bind(SearchInWorkspacePreferenceContribution).toConstantValue({ schema: searchInWorkspacePreferencesSchema });
90
+ bind(PreferenceContribution).toService(SearchInWorkspacePreferenceContribution);
91
+ }