@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.
- package/LICENSE +641 -641
- package/README.md +40 -40
- package/lib/browser/components/search-in-workspace-input.d.ts +39 -39
- package/lib/browser/components/search-in-workspace-input.js +120 -120
- package/lib/browser/search-in-workspace-context-key-service.d.ts +23 -23
- package/lib/browser/search-in-workspace-context-key-service.js +90 -90
- package/lib/browser/search-in-workspace-factory.d.ts +10 -10
- package/lib/browser/search-in-workspace-factory.js +68 -68
- package/lib/browser/search-in-workspace-frontend-contribution.d.ts +53 -53
- package/lib/browser/search-in-workspace-frontend-contribution.js +410 -410
- package/lib/browser/search-in-workspace-frontend-module.d.ts +6 -6
- package/lib/browser/search-in-workspace-frontend-module.js +70 -70
- package/lib/browser/search-in-workspace-label-provider.d.ts +9 -9
- package/lib/browser/search-in-workspace-label-provider.js +57 -57
- package/lib/browser/search-in-workspace-preferences.d.ts +17 -17
- package/lib/browser/search-in-workspace-preferences.js +82 -82
- package/lib/browser/search-in-workspace-result-tree-widget.d.ts +253 -253
- package/lib/browser/search-in-workspace-result-tree-widget.js +1072 -1072
- package/lib/browser/search-in-workspace-service.d.ts +35 -35
- package/lib/browser/search-in-workspace-service.js +158 -158
- package/lib/browser/search-in-workspace-widget.d.ts +121 -121
- package/lib/browser/search-in-workspace-widget.js +602 -602
- package/lib/browser/search-layout-migrations.d.ts +5 -5
- package/lib/browser/search-layout-migrations.js +64 -64
- package/lib/common/search-in-workspace-interface.d.ts +112 -112
- package/lib/common/search-in-workspace-interface.js +35 -35
- package/lib/node/ripgrep-search-in-workspace-server.d.ts +94 -94
- package/lib/node/ripgrep-search-in-workspace-server.js +423 -423
- package/lib/node/ripgrep-search-in-workspace-server.slow-spec.d.ts +1 -1
- package/lib/node/ripgrep-search-in-workspace-server.slow-spec.js +899 -899
- package/lib/node/search-in-workspace-backend-module.d.ts +3 -3
- package/lib/node/search-in-workspace-backend-module.js +32 -32
- package/package.json +9 -9
- package/src/browser/components/search-in-workspace-input.tsx +139 -139
- package/src/browser/search-in-workspace-context-key-service.ts +93 -93
- package/src/browser/search-in-workspace-factory.ts +59 -59
- package/src/browser/search-in-workspace-frontend-contribution.ts +402 -402
- package/src/browser/search-in-workspace-frontend-module.ts +82 -82
- package/src/browser/search-in-workspace-label-provider.ts +48 -48
- package/src/browser/search-in-workspace-preferences.ts +91 -91
- package/src/browser/search-in-workspace-result-tree-widget.tsx +1225 -1225
- package/src/browser/search-in-workspace-service.ts +152 -152
- package/src/browser/search-in-workspace-widget.tsx +711 -711
- package/src/browser/search-layout-migrations.ts +53 -53
- package/src/browser/styles/index.css +367 -367
- package/src/browser/styles/search.svg +6 -6
- package/src/common/search-in-workspace-interface.ts +149 -149
- package/src/node/ripgrep-search-in-workspace-server.slow-spec.ts +1073 -1073
- package/src/node/ripgrep-search-in-workspace-server.ts +482 -482
- package/src/node/search-in-workspace-backend-module.ts +33 -33
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
2
|
-
declare const _default: ContainerModule;
|
|
3
|
-
export default _default;
|
|
1
|
+
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
2
|
+
declare const _default: ContainerModule;
|
|
3
|
+
export default _default;
|
|
4
4
|
//# sourceMappingURL=search-in-workspace-backend-module.d.ts.map
|
|
@@ -1,33 +1,33 @@
|
|
|
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 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
19
|
-
const common_1 = require("@theia/core/lib/common");
|
|
20
|
-
const search_in_workspace_interface_1 = require("../common/search-in-workspace-interface");
|
|
21
|
-
const ripgrep_search_in_workspace_server_1 = require("./ripgrep-search-in-workspace-server");
|
|
22
|
-
const ripgrep_1 = require("@vscode/ripgrep");
|
|
23
|
-
exports.default = new inversify_1.ContainerModule(bind => {
|
|
24
|
-
bind(search_in_workspace_interface_1.SearchInWorkspaceServer).to(ripgrep_search_in_workspace_server_1.RipgrepSearchInWorkspaceServer);
|
|
25
|
-
bind(common_1.ConnectionHandler).toDynamicValue(ctx => new common_1.JsonRpcConnectionHandler(search_in_workspace_interface_1.SIW_WS_PATH, client => {
|
|
26
|
-
const server = ctx.container.get(search_in_workspace_interface_1.SearchInWorkspaceServer);
|
|
27
|
-
server.setClient(client);
|
|
28
|
-
client.onDidCloseConnection(() => server.dispose());
|
|
29
|
-
return server;
|
|
30
|
-
}));
|
|
31
|
-
bind(ripgrep_search_in_workspace_server_1.RgPath).toConstantValue(ripgrep_1.rgPath);
|
|
32
|
-
});
|
|
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 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
19
|
+
const common_1 = require("@theia/core/lib/common");
|
|
20
|
+
const search_in_workspace_interface_1 = require("../common/search-in-workspace-interface");
|
|
21
|
+
const ripgrep_search_in_workspace_server_1 = require("./ripgrep-search-in-workspace-server");
|
|
22
|
+
const ripgrep_1 = require("@vscode/ripgrep");
|
|
23
|
+
exports.default = new inversify_1.ContainerModule(bind => {
|
|
24
|
+
bind(search_in_workspace_interface_1.SearchInWorkspaceServer).to(ripgrep_search_in_workspace_server_1.RipgrepSearchInWorkspaceServer);
|
|
25
|
+
bind(common_1.ConnectionHandler).toDynamicValue(ctx => new common_1.JsonRpcConnectionHandler(search_in_workspace_interface_1.SIW_WS_PATH, client => {
|
|
26
|
+
const server = ctx.container.get(search_in_workspace_interface_1.SearchInWorkspaceServer);
|
|
27
|
+
server.setClient(client);
|
|
28
|
+
client.onDidCloseConnection(() => server.dispose());
|
|
29
|
+
return server;
|
|
30
|
+
}));
|
|
31
|
+
bind(ripgrep_search_in_workspace_server_1.RgPath).toConstantValue(ripgrep_1.rgPath);
|
|
32
|
+
});
|
|
33
33
|
//# sourceMappingURL=search-in-workspace-backend-module.js.map
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/search-in-workspace",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.3",
|
|
4
4
|
"description": "Theia - Search in workspace",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.34.
|
|
7
|
-
"@theia/editor": "1.34.
|
|
8
|
-
"@theia/filesystem": "1.34.
|
|
9
|
-
"@theia/navigator": "1.34.
|
|
10
|
-
"@theia/process": "1.34.
|
|
11
|
-
"@theia/workspace": "1.34.
|
|
6
|
+
"@theia/core": "1.34.3",
|
|
7
|
+
"@theia/editor": "1.34.3",
|
|
8
|
+
"@theia/filesystem": "1.34.3",
|
|
9
|
+
"@theia/navigator": "1.34.3",
|
|
10
|
+
"@theia/process": "1.34.3",
|
|
11
|
+
"@theia/workspace": "1.34.3",
|
|
12
12
|
"@vscode/ripgrep": "^1.14.2",
|
|
13
13
|
"minimatch": "^5.1.0"
|
|
14
14
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"watch": "theiaext watch"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@theia/ext-scripts": "1.34.
|
|
49
|
+
"@theia/ext-scripts": "1.34.3"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "a6cf9fe96b1624d6e27a11dce2ebdeae820478e5"
|
|
52
52
|
}
|
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2021 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 * as React from '@theia/core/shared/react';
|
|
18
|
-
import { Key, KeyCode } from '@theia/core/lib/browser';
|
|
19
|
-
import debounce = require('@theia/core/shared/lodash.debounce');
|
|
20
|
-
|
|
21
|
-
interface HistoryState {
|
|
22
|
-
history: string[];
|
|
23
|
-
index: number;
|
|
24
|
-
};
|
|
25
|
-
type InputAttributes = React.InputHTMLAttributes<HTMLInputElement>;
|
|
26
|
-
|
|
27
|
-
export class SearchInWorkspaceInput extends React.Component<InputAttributes, HistoryState> {
|
|
28
|
-
static LIMIT = 100;
|
|
29
|
-
|
|
30
|
-
private input = React.createRef<HTMLInputElement>();
|
|
31
|
-
|
|
32
|
-
constructor(props: InputAttributes) {
|
|
33
|
-
super(props);
|
|
34
|
-
this.state = {
|
|
35
|
-
history: [],
|
|
36
|
-
index: 0,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
updateState(index: number, history?: string[]): void {
|
|
41
|
-
this.value = history ? history[index] : this.state.history[index];
|
|
42
|
-
this.setState(prevState => {
|
|
43
|
-
const newState = {
|
|
44
|
-
...prevState,
|
|
45
|
-
index,
|
|
46
|
-
};
|
|
47
|
-
if (history) {
|
|
48
|
-
newState.history = history;
|
|
49
|
-
}
|
|
50
|
-
return newState;
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
get value(): string {
|
|
55
|
-
return this.input.current?.value ?? '';
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
set value(value: string) {
|
|
59
|
-
if (this.input.current) {
|
|
60
|
-
this.input.current.value = value;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Handle history navigation without overriding the parent's onKeyDown handler, if any.
|
|
66
|
-
*/
|
|
67
|
-
protected readonly onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>): void => {
|
|
68
|
-
if (Key.ARROW_UP.keyCode === KeyCode.createKeyCode(e.nativeEvent).key?.keyCode) {
|
|
69
|
-
e.preventDefault();
|
|
70
|
-
this.previousValue();
|
|
71
|
-
} else if (Key.ARROW_DOWN.keyCode === KeyCode.createKeyCode(e.nativeEvent).key?.keyCode) {
|
|
72
|
-
e.preventDefault();
|
|
73
|
-
this.nextValue();
|
|
74
|
-
}
|
|
75
|
-
this.props.onKeyDown?.(e);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Switch the input's text to the previous value, if any.
|
|
80
|
-
*/
|
|
81
|
-
previousValue(): void {
|
|
82
|
-
const { history, index } = this.state;
|
|
83
|
-
if (!this.value) {
|
|
84
|
-
this.value = history[index];
|
|
85
|
-
} else if (index > 0 && index < history.length) {
|
|
86
|
-
this.updateState(index - 1);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Switch the input's text to the next value, if any.
|
|
92
|
-
*/
|
|
93
|
-
nextValue(): void {
|
|
94
|
-
const { history, index } = this.state;
|
|
95
|
-
if (index === history.length - 1) {
|
|
96
|
-
this.value = '';
|
|
97
|
-
} else if (!this.value) {
|
|
98
|
-
this.value = history[index];
|
|
99
|
-
} else if (index >= 0 && index < history.length - 1) {
|
|
100
|
-
this.updateState(index + 1);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Handle history collection without overriding the parent's onChange handler, if any.
|
|
106
|
-
*/
|
|
107
|
-
protected readonly onChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
|
|
108
|
-
this.addToHistory();
|
|
109
|
-
this.props.onChange?.(e);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Add a nonempty current value to the history, if not already present. (Debounced, 1 second delay.)
|
|
114
|
-
*/
|
|
115
|
-
readonly addToHistory = debounce(this.doAddToHistory, 1000);
|
|
116
|
-
|
|
117
|
-
private doAddToHistory(): void {
|
|
118
|
-
if (!this.value) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const history = this.state.history
|
|
122
|
-
.filter(term => term !== this.value)
|
|
123
|
-
.concat(this.value)
|
|
124
|
-
.slice(-SearchInWorkspaceInput.LIMIT);
|
|
125
|
-
this.updateState(history.length - 1, history);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
override render(): React.ReactNode {
|
|
129
|
-
return (
|
|
130
|
-
<input
|
|
131
|
-
{...this.props}
|
|
132
|
-
onKeyDown={this.onKeyDown}
|
|
133
|
-
onChange={this.onChange}
|
|
134
|
-
spellCheck={false}
|
|
135
|
-
ref={this.input}
|
|
136
|
-
/>
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2021 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 * as React from '@theia/core/shared/react';
|
|
18
|
+
import { Key, KeyCode } from '@theia/core/lib/browser';
|
|
19
|
+
import debounce = require('@theia/core/shared/lodash.debounce');
|
|
20
|
+
|
|
21
|
+
interface HistoryState {
|
|
22
|
+
history: string[];
|
|
23
|
+
index: number;
|
|
24
|
+
};
|
|
25
|
+
type InputAttributes = React.InputHTMLAttributes<HTMLInputElement>;
|
|
26
|
+
|
|
27
|
+
export class SearchInWorkspaceInput extends React.Component<InputAttributes, HistoryState> {
|
|
28
|
+
static LIMIT = 100;
|
|
29
|
+
|
|
30
|
+
private input = React.createRef<HTMLInputElement>();
|
|
31
|
+
|
|
32
|
+
constructor(props: InputAttributes) {
|
|
33
|
+
super(props);
|
|
34
|
+
this.state = {
|
|
35
|
+
history: [],
|
|
36
|
+
index: 0,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
updateState(index: number, history?: string[]): void {
|
|
41
|
+
this.value = history ? history[index] : this.state.history[index];
|
|
42
|
+
this.setState(prevState => {
|
|
43
|
+
const newState = {
|
|
44
|
+
...prevState,
|
|
45
|
+
index,
|
|
46
|
+
};
|
|
47
|
+
if (history) {
|
|
48
|
+
newState.history = history;
|
|
49
|
+
}
|
|
50
|
+
return newState;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get value(): string {
|
|
55
|
+
return this.input.current?.value ?? '';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
set value(value: string) {
|
|
59
|
+
if (this.input.current) {
|
|
60
|
+
this.input.current.value = value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Handle history navigation without overriding the parent's onKeyDown handler, if any.
|
|
66
|
+
*/
|
|
67
|
+
protected readonly onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>): void => {
|
|
68
|
+
if (Key.ARROW_UP.keyCode === KeyCode.createKeyCode(e.nativeEvent).key?.keyCode) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
this.previousValue();
|
|
71
|
+
} else if (Key.ARROW_DOWN.keyCode === KeyCode.createKeyCode(e.nativeEvent).key?.keyCode) {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
this.nextValue();
|
|
74
|
+
}
|
|
75
|
+
this.props.onKeyDown?.(e);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Switch the input's text to the previous value, if any.
|
|
80
|
+
*/
|
|
81
|
+
previousValue(): void {
|
|
82
|
+
const { history, index } = this.state;
|
|
83
|
+
if (!this.value) {
|
|
84
|
+
this.value = history[index];
|
|
85
|
+
} else if (index > 0 && index < history.length) {
|
|
86
|
+
this.updateState(index - 1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Switch the input's text to the next value, if any.
|
|
92
|
+
*/
|
|
93
|
+
nextValue(): void {
|
|
94
|
+
const { history, index } = this.state;
|
|
95
|
+
if (index === history.length - 1) {
|
|
96
|
+
this.value = '';
|
|
97
|
+
} else if (!this.value) {
|
|
98
|
+
this.value = history[index];
|
|
99
|
+
} else if (index >= 0 && index < history.length - 1) {
|
|
100
|
+
this.updateState(index + 1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Handle history collection without overriding the parent's onChange handler, if any.
|
|
106
|
+
*/
|
|
107
|
+
protected readonly onChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
|
|
108
|
+
this.addToHistory();
|
|
109
|
+
this.props.onChange?.(e);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Add a nonempty current value to the history, if not already present. (Debounced, 1 second delay.)
|
|
114
|
+
*/
|
|
115
|
+
readonly addToHistory = debounce(this.doAddToHistory, 1000);
|
|
116
|
+
|
|
117
|
+
private doAddToHistory(): void {
|
|
118
|
+
if (!this.value) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const history = this.state.history
|
|
122
|
+
.filter(term => term !== this.value)
|
|
123
|
+
.concat(this.value)
|
|
124
|
+
.slice(-SearchInWorkspaceInput.LIMIT);
|
|
125
|
+
this.updateState(history.length - 1, history);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
override render(): React.ReactNode {
|
|
129
|
+
return (
|
|
130
|
+
<input
|
|
131
|
+
{...this.props}
|
|
132
|
+
onKeyDown={this.onKeyDown}
|
|
133
|
+
onChange={this.onChange}
|
|
134
|
+
spellCheck={false}
|
|
135
|
+
ref={this.input}
|
|
136
|
+
/>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -1,93 +1,93 @@
|
|
|
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, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
19
|
-
|
|
20
|
-
@injectable()
|
|
21
|
-
export class SearchInWorkspaceContextKeyService {
|
|
22
|
-
|
|
23
|
-
@inject(ContextKeyService)
|
|
24
|
-
protected readonly contextKeyService: ContextKeyService;
|
|
25
|
-
|
|
26
|
-
protected _searchViewletVisible: ContextKey<boolean>;
|
|
27
|
-
get searchViewletVisible(): ContextKey<boolean> {
|
|
28
|
-
return this._searchViewletVisible;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
protected _searchViewletFocus: ContextKey<boolean>;
|
|
32
|
-
get searchViewletFocus(): ContextKey<boolean> {
|
|
33
|
-
return this._searchViewletFocus;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
protected searchInputBoxFocus: ContextKey<boolean>;
|
|
37
|
-
setSearchInputBoxFocus(searchInputBoxFocus: boolean): void {
|
|
38
|
-
this.searchInputBoxFocus.set(searchInputBoxFocus);
|
|
39
|
-
this.updateInputBoxFocus();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
protected replaceInputBoxFocus: ContextKey<boolean>;
|
|
43
|
-
setReplaceInputBoxFocus(replaceInputBoxFocus: boolean): void {
|
|
44
|
-
this.replaceInputBoxFocus.set(replaceInputBoxFocus);
|
|
45
|
-
this.updateInputBoxFocus();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
protected patternIncludesInputBoxFocus: ContextKey<boolean>;
|
|
49
|
-
setPatternIncludesInputBoxFocus(patternIncludesInputBoxFocus: boolean): void {
|
|
50
|
-
this.patternIncludesInputBoxFocus.set(patternIncludesInputBoxFocus);
|
|
51
|
-
this.updateInputBoxFocus();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
protected patternExcludesInputBoxFocus: ContextKey<boolean>;
|
|
55
|
-
setPatternExcludesInputBoxFocus(patternExcludesInputBoxFocus: boolean): void {
|
|
56
|
-
this.patternExcludesInputBoxFocus.set(patternExcludesInputBoxFocus);
|
|
57
|
-
this.updateInputBoxFocus();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
protected inputBoxFocus: ContextKey<boolean>;
|
|
61
|
-
protected updateInputBoxFocus(): void {
|
|
62
|
-
this.inputBoxFocus.set(
|
|
63
|
-
this.searchInputBoxFocus.get() ||
|
|
64
|
-
this.replaceInputBoxFocus.get() ||
|
|
65
|
-
this.patternIncludesInputBoxFocus.get() ||
|
|
66
|
-
this.patternExcludesInputBoxFocus.get()
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
protected _replaceActive: ContextKey<boolean>;
|
|
71
|
-
get replaceActive(): ContextKey<boolean> {
|
|
72
|
-
return this._replaceActive;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
protected _hasSearchResult: ContextKey<boolean>;
|
|
76
|
-
get hasSearchResult(): ContextKey<boolean> {
|
|
77
|
-
return this._hasSearchResult;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@postConstruct()
|
|
81
|
-
protected init(): void {
|
|
82
|
-
this._searchViewletVisible = this.contextKeyService.createKey<boolean>('searchViewletVisible', false);
|
|
83
|
-
this._searchViewletFocus = this.contextKeyService.createKey<boolean>('searchViewletFocus', false);
|
|
84
|
-
this.inputBoxFocus = this.contextKeyService.createKey<boolean>('inputBoxFocus', false);
|
|
85
|
-
this.searchInputBoxFocus = this.contextKeyService.createKey<boolean>('searchInputBoxFocus', false);
|
|
86
|
-
this.replaceInputBoxFocus = this.contextKeyService.createKey<boolean>('replaceInputBoxFocus', false);
|
|
87
|
-
this.patternIncludesInputBoxFocus = this.contextKeyService.createKey<boolean>('patternIncludesInputBoxFocus', false);
|
|
88
|
-
this.patternExcludesInputBoxFocus = this.contextKeyService.createKey<boolean>('patternExcludesInputBoxFocus', false);
|
|
89
|
-
this._replaceActive = this.contextKeyService.createKey<boolean>('replaceActive', false);
|
|
90
|
-
this._hasSearchResult = this.contextKeyService.createKey<boolean>('hasSearchResult', false);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
}
|
|
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, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
19
|
+
|
|
20
|
+
@injectable()
|
|
21
|
+
export class SearchInWorkspaceContextKeyService {
|
|
22
|
+
|
|
23
|
+
@inject(ContextKeyService)
|
|
24
|
+
protected readonly contextKeyService: ContextKeyService;
|
|
25
|
+
|
|
26
|
+
protected _searchViewletVisible: ContextKey<boolean>;
|
|
27
|
+
get searchViewletVisible(): ContextKey<boolean> {
|
|
28
|
+
return this._searchViewletVisible;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected _searchViewletFocus: ContextKey<boolean>;
|
|
32
|
+
get searchViewletFocus(): ContextKey<boolean> {
|
|
33
|
+
return this._searchViewletFocus;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
protected searchInputBoxFocus: ContextKey<boolean>;
|
|
37
|
+
setSearchInputBoxFocus(searchInputBoxFocus: boolean): void {
|
|
38
|
+
this.searchInputBoxFocus.set(searchInputBoxFocus);
|
|
39
|
+
this.updateInputBoxFocus();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected replaceInputBoxFocus: ContextKey<boolean>;
|
|
43
|
+
setReplaceInputBoxFocus(replaceInputBoxFocus: boolean): void {
|
|
44
|
+
this.replaceInputBoxFocus.set(replaceInputBoxFocus);
|
|
45
|
+
this.updateInputBoxFocus();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
protected patternIncludesInputBoxFocus: ContextKey<boolean>;
|
|
49
|
+
setPatternIncludesInputBoxFocus(patternIncludesInputBoxFocus: boolean): void {
|
|
50
|
+
this.patternIncludesInputBoxFocus.set(patternIncludesInputBoxFocus);
|
|
51
|
+
this.updateInputBoxFocus();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
protected patternExcludesInputBoxFocus: ContextKey<boolean>;
|
|
55
|
+
setPatternExcludesInputBoxFocus(patternExcludesInputBoxFocus: boolean): void {
|
|
56
|
+
this.patternExcludesInputBoxFocus.set(patternExcludesInputBoxFocus);
|
|
57
|
+
this.updateInputBoxFocus();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
protected inputBoxFocus: ContextKey<boolean>;
|
|
61
|
+
protected updateInputBoxFocus(): void {
|
|
62
|
+
this.inputBoxFocus.set(
|
|
63
|
+
this.searchInputBoxFocus.get() ||
|
|
64
|
+
this.replaceInputBoxFocus.get() ||
|
|
65
|
+
this.patternIncludesInputBoxFocus.get() ||
|
|
66
|
+
this.patternExcludesInputBoxFocus.get()
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
protected _replaceActive: ContextKey<boolean>;
|
|
71
|
+
get replaceActive(): ContextKey<boolean> {
|
|
72
|
+
return this._replaceActive;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
protected _hasSearchResult: ContextKey<boolean>;
|
|
76
|
+
get hasSearchResult(): ContextKey<boolean> {
|
|
77
|
+
return this._hasSearchResult;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@postConstruct()
|
|
81
|
+
protected init(): void {
|
|
82
|
+
this._searchViewletVisible = this.contextKeyService.createKey<boolean>('searchViewletVisible', false);
|
|
83
|
+
this._searchViewletFocus = this.contextKeyService.createKey<boolean>('searchViewletFocus', false);
|
|
84
|
+
this.inputBoxFocus = this.contextKeyService.createKey<boolean>('inputBoxFocus', false);
|
|
85
|
+
this.searchInputBoxFocus = this.contextKeyService.createKey<boolean>('searchInputBoxFocus', false);
|
|
86
|
+
this.replaceInputBoxFocus = this.contextKeyService.createKey<boolean>('replaceInputBoxFocus', false);
|
|
87
|
+
this.patternIncludesInputBoxFocus = this.contextKeyService.createKey<boolean>('patternIncludesInputBoxFocus', false);
|
|
88
|
+
this.patternExcludesInputBoxFocus = this.contextKeyService.createKey<boolean>('patternExcludesInputBoxFocus', false);
|
|
89
|
+
this._replaceActive = this.contextKeyService.createKey<boolean>('replaceActive', false);
|
|
90
|
+
this._hasSearchResult = this.contextKeyService.createKey<boolean>('hasSearchResult', false);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
}
|