@theia/search-in-workspace 1.45.0 → 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.
- 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 +123 -123
- package/lib/browser/components/search-in-workspace-textarea.d.ts +39 -39
- package/lib/browser/components/search-in-workspace-textarea.js +130 -130
- 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 +57 -55
- package/lib/browser/search-in-workspace-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/search-in-workspace-frontend-contribution.js +516 -482
- package/lib/browser/search-in-workspace-frontend-contribution.js.map +1 -1
- package/lib/browser/search-in-workspace-frontend-module.d.ts +6 -6
- package/lib/browser/search-in-workspace-frontend-module.js +71 -71
- 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 +87 -87
- package/lib/browser/search-in-workspace-result-tree-widget.d.ts +259 -255
- package/lib/browser/search-in-workspace-result-tree-widget.d.ts.map +1 -1
- package/lib/browser/search-in-workspace-result-tree-widget.js +1172 -1099
- package/lib/browser/search-in-workspace-result-tree-widget.js.map +1 -1
- 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 +629 -629
- 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 +116 -116
- 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 +430 -430
- package/lib/node/ripgrep-search-in-workspace-server.js.map +1 -1
- 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/ripgrep-search-in-workspace-server.slow-spec.js.map +1 -1
- 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/components/search-in-workspace-textarea.tsx +153 -153
- 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 +510 -474
- package/src/browser/search-in-workspace-frontend-module.ts +83 -83
- package/src/browser/search-in-workspace-label-provider.ts +48 -48
- package/src/browser/search-in-workspace-preferences.ts +96 -96
- package/src/browser/search-in-workspace-result-tree-widget.tsx +1318 -1245
- package/src/browser/search-in-workspace-service.ts +152 -152
- package/src/browser/search-in-workspace-widget.tsx +727 -727
- package/src/browser/search-layout-migrations.ts +53 -53
- package/src/browser/styles/index.css +400 -400
- package/src/browser/styles/search.svg +6 -6
- package/src/common/search-in-workspace-interface.ts +153 -153
- package/src/node/ripgrep-search-in-workspace-server.slow-spec.ts +1073 -1073
- package/src/node/ripgrep-search-in-workspace-server.ts +490 -490
- package/src/node/search-in-workspace-backend-module.ts +33 -33
package/README.md
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
<div align='center'>
|
|
2
|
-
|
|
3
|
-
<br />
|
|
4
|
-
|
|
5
|
-
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
-
|
|
7
|
-
<h2>ECLIPSE THEIA - SEARCH-IN-WORKSPACE EXTENSION</h2>
|
|
8
|
-
|
|
9
|
-
<hr />
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
## Description
|
|
14
|
-
|
|
15
|
-
The `@theia/search-in-workspace` extension provides the ability to perform searches over all files in a given workspace using different search techniques.
|
|
16
|
-
|
|
17
|
-
## Search Widget
|
|
18
|
-
|
|
19
|
-
The `@theia/search-in-workspace` extension contributes the `Search` widget which is capable of performing different types of searches include the possibility to:
|
|
20
|
-
- Perform standard searches
|
|
21
|
-
- Perform searches using regular expressions
|
|
22
|
-
- Perform searches within an `include` list (search for specific types of files (ex: `*.ts`))
|
|
23
|
-
- Perform searches excluding files or directories (using `exclude`)
|
|
24
|
-
- Perform searches ignoring hidden or excluded files/folders
|
|
25
|
-
- Perform search and replace (to quickly update multiple occurrences of a search term)
|
|
26
|
-
|
|
27
|
-
## Additional Information
|
|
28
|
-
|
|
29
|
-
- [API documentation for `@theia/search-in-workspace`](https://eclipse-theia.github.io/theia/docs/next/modules/search_in_workspace.html)
|
|
30
|
-
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
31
|
-
- [Theia - Website](https://theia-ide.org/)
|
|
32
|
-
|
|
33
|
-
## License
|
|
34
|
-
|
|
35
|
-
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
36
|
-
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
37
|
-
|
|
38
|
-
## Trademark
|
|
39
|
-
"Theia" is a trademark of the Eclipse Foundation
|
|
40
|
-
https://www.eclipse.org/theia
|
|
1
|
+
<div align='center'>
|
|
2
|
+
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
+
|
|
7
|
+
<h2>ECLIPSE THEIA - SEARCH-IN-WORKSPACE EXTENSION</h2>
|
|
8
|
+
|
|
9
|
+
<hr />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## Description
|
|
14
|
+
|
|
15
|
+
The `@theia/search-in-workspace` extension provides the ability to perform searches over all files in a given workspace using different search techniques.
|
|
16
|
+
|
|
17
|
+
## Search Widget
|
|
18
|
+
|
|
19
|
+
The `@theia/search-in-workspace` extension contributes the `Search` widget which is capable of performing different types of searches include the possibility to:
|
|
20
|
+
- Perform standard searches
|
|
21
|
+
- Perform searches using regular expressions
|
|
22
|
+
- Perform searches within an `include` list (search for specific types of files (ex: `*.ts`))
|
|
23
|
+
- Perform searches excluding files or directories (using `exclude`)
|
|
24
|
+
- Perform searches ignoring hidden or excluded files/folders
|
|
25
|
+
- Perform search and replace (to quickly update multiple occurrences of a search term)
|
|
26
|
+
|
|
27
|
+
## Additional Information
|
|
28
|
+
|
|
29
|
+
- [API documentation for `@theia/search-in-workspace`](https://eclipse-theia.github.io/theia/docs/next/modules/search_in_workspace.html)
|
|
30
|
+
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
31
|
+
- [Theia - Website](https://theia-ide.org/)
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
36
|
+
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
37
|
+
|
|
38
|
+
## Trademark
|
|
39
|
+
"Theia" is a trademark of the Eclipse Foundation
|
|
40
|
+
https://www.eclipse.org/theia
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
/// <reference types="
|
|
2
|
-
/// <reference types="
|
|
3
|
-
import * as React from '@theia/core/shared/react';
|
|
4
|
-
interface HistoryState {
|
|
5
|
-
history: string[];
|
|
6
|
-
index: number;
|
|
7
|
-
}
|
|
8
|
-
declare type InputAttributes = React.InputHTMLAttributes<HTMLInputElement>;
|
|
9
|
-
export declare class SearchInWorkspaceInput extends React.Component<InputAttributes, HistoryState> {
|
|
10
|
-
static LIMIT: number;
|
|
11
|
-
private input;
|
|
12
|
-
constructor(props: InputAttributes);
|
|
13
|
-
updateState(index: number, history?: string[]): void;
|
|
14
|
-
get value(): string;
|
|
15
|
-
set value(value: string);
|
|
16
|
-
/**
|
|
17
|
-
* Handle history navigation without overriding the parent's onKeyDown handler, if any.
|
|
18
|
-
*/
|
|
19
|
-
protected readonly onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Switch the input's text to the previous value, if any.
|
|
22
|
-
*/
|
|
23
|
-
previousValue(): void;
|
|
24
|
-
/**
|
|
25
|
-
* Switch the input's text to the next value, if any.
|
|
26
|
-
*/
|
|
27
|
-
nextValue(): void;
|
|
28
|
-
/**
|
|
29
|
-
* Handle history collection without overriding the parent's onChange handler, if any.
|
|
30
|
-
*/
|
|
31
|
-
protected readonly onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
32
|
-
/**
|
|
33
|
-
* Add a nonempty current value to the history, if not already present. (Debounced, 1 second delay.)
|
|
34
|
-
*/
|
|
35
|
-
readonly addToHistory: import("lodash").DebouncedFunc<() => void>;
|
|
36
|
-
private doAddToHistory;
|
|
37
|
-
render(): React.ReactNode;
|
|
38
|
-
}
|
|
39
|
-
export {};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="lodash" />
|
|
3
|
+
import * as React from '@theia/core/shared/react';
|
|
4
|
+
interface HistoryState {
|
|
5
|
+
history: string[];
|
|
6
|
+
index: number;
|
|
7
|
+
}
|
|
8
|
+
declare type InputAttributes = React.InputHTMLAttributes<HTMLInputElement>;
|
|
9
|
+
export declare class SearchInWorkspaceInput extends React.Component<InputAttributes, HistoryState> {
|
|
10
|
+
static LIMIT: number;
|
|
11
|
+
private input;
|
|
12
|
+
constructor(props: InputAttributes);
|
|
13
|
+
updateState(index: number, history?: string[]): void;
|
|
14
|
+
get value(): string;
|
|
15
|
+
set value(value: string);
|
|
16
|
+
/**
|
|
17
|
+
* Handle history navigation without overriding the parent's onKeyDown handler, if any.
|
|
18
|
+
*/
|
|
19
|
+
protected readonly onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Switch the input's text to the previous value, if any.
|
|
22
|
+
*/
|
|
23
|
+
previousValue(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Switch the input's text to the next value, if any.
|
|
26
|
+
*/
|
|
27
|
+
nextValue(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Handle history collection without overriding the parent's onChange handler, if any.
|
|
30
|
+
*/
|
|
31
|
+
protected readonly onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Add a nonempty current value to the history, if not already present. (Debounced, 1 second delay.)
|
|
34
|
+
*/
|
|
35
|
+
readonly addToHistory: import("lodash").DebouncedFunc<() => void>;
|
|
36
|
+
private doAddToHistory;
|
|
37
|
+
render(): React.ReactNode;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
40
|
//# sourceMappingURL=search-in-workspace-input.d.ts.map
|
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2021 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.SearchInWorkspaceInput = void 0;
|
|
19
|
-
const React = require("@theia/core/shared/react");
|
|
20
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
21
|
-
const debounce = require("@theia/core/shared/lodash.debounce");
|
|
22
|
-
;
|
|
23
|
-
class SearchInWorkspaceInput extends React.Component {
|
|
24
|
-
constructor(props) {
|
|
25
|
-
super(props);
|
|
26
|
-
this.input = React.createRef();
|
|
27
|
-
/**
|
|
28
|
-
* Handle history navigation without overriding the parent's onKeyDown handler, if any.
|
|
29
|
-
*/
|
|
30
|
-
this.onKeyDown = (e) => {
|
|
31
|
-
var _a, _b, _c, _d;
|
|
32
|
-
if (browser_1.Key.ARROW_UP.keyCode === ((_a = browser_1.KeyCode.createKeyCode(e.nativeEvent).key) === null || _a === void 0 ? void 0 : _a.keyCode)) {
|
|
33
|
-
e.preventDefault();
|
|
34
|
-
this.previousValue();
|
|
35
|
-
}
|
|
36
|
-
else if (browser_1.Key.ARROW_DOWN.keyCode === ((_b = browser_1.KeyCode.createKeyCode(e.nativeEvent).key) === null || _b === void 0 ? void 0 : _b.keyCode)) {
|
|
37
|
-
e.preventDefault();
|
|
38
|
-
this.nextValue();
|
|
39
|
-
}
|
|
40
|
-
(_d = (_c = this.props).onKeyDown) === null || _d === void 0 ? void 0 : _d.call(_c, e);
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Handle history collection without overriding the parent's onChange handler, if any.
|
|
44
|
-
*/
|
|
45
|
-
this.onChange = (e) => {
|
|
46
|
-
var _a, _b;
|
|
47
|
-
this.addToHistory();
|
|
48
|
-
(_b = (_a = this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Add a nonempty current value to the history, if not already present. (Debounced, 1 second delay.)
|
|
52
|
-
*/
|
|
53
|
-
this.addToHistory = debounce(this.doAddToHistory, 1000);
|
|
54
|
-
this.state = {
|
|
55
|
-
history: [],
|
|
56
|
-
index: 0,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
updateState(index, history) {
|
|
60
|
-
this.value = history ? history[index] : this.state.history[index];
|
|
61
|
-
this.setState(prevState => {
|
|
62
|
-
const newState = {
|
|
63
|
-
...prevState,
|
|
64
|
-
index,
|
|
65
|
-
};
|
|
66
|
-
if (history) {
|
|
67
|
-
newState.history = history;
|
|
68
|
-
}
|
|
69
|
-
return newState;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
get value() {
|
|
73
|
-
var _a, _b;
|
|
74
|
-
return (_b = (_a = this.input.current) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '';
|
|
75
|
-
}
|
|
76
|
-
set value(value) {
|
|
77
|
-
if (this.input.current) {
|
|
78
|
-
this.input.current.value = value;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Switch the input's text to the previous value, if any.
|
|
83
|
-
*/
|
|
84
|
-
previousValue() {
|
|
85
|
-
const { history, index } = this.state;
|
|
86
|
-
if (!this.value) {
|
|
87
|
-
this.value = history[index];
|
|
88
|
-
}
|
|
89
|
-
else if (index > 0 && index < history.length) {
|
|
90
|
-
this.updateState(index - 1);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Switch the input's text to the next value, if any.
|
|
95
|
-
*/
|
|
96
|
-
nextValue() {
|
|
97
|
-
const { history, index } = this.state;
|
|
98
|
-
if (index === history.length - 1) {
|
|
99
|
-
this.value = '';
|
|
100
|
-
}
|
|
101
|
-
else if (!this.value) {
|
|
102
|
-
this.value = history[index];
|
|
103
|
-
}
|
|
104
|
-
else if (index >= 0 && index < history.length - 1) {
|
|
105
|
-
this.updateState(index + 1);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
doAddToHistory() {
|
|
109
|
-
if (!this.value) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const history = this.state.history
|
|
113
|
-
.filter(term => term !== this.value)
|
|
114
|
-
.concat(this.value)
|
|
115
|
-
.slice(-SearchInWorkspaceInput.LIMIT);
|
|
116
|
-
this.updateState(history.length - 1, history);
|
|
117
|
-
}
|
|
118
|
-
render() {
|
|
119
|
-
return (React.createElement("input", { ...this.props, onKeyDown: this.onKeyDown, onChange: this.onChange, spellCheck: false, ref: this.input }));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
exports.SearchInWorkspaceInput = SearchInWorkspaceInput;
|
|
123
|
-
SearchInWorkspaceInput.LIMIT = 100;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2021 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.SearchInWorkspaceInput = void 0;
|
|
19
|
+
const React = require("@theia/core/shared/react");
|
|
20
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
21
|
+
const debounce = require("@theia/core/shared/lodash.debounce");
|
|
22
|
+
;
|
|
23
|
+
class SearchInWorkspaceInput extends React.Component {
|
|
24
|
+
constructor(props) {
|
|
25
|
+
super(props);
|
|
26
|
+
this.input = React.createRef();
|
|
27
|
+
/**
|
|
28
|
+
* Handle history navigation without overriding the parent's onKeyDown handler, if any.
|
|
29
|
+
*/
|
|
30
|
+
this.onKeyDown = (e) => {
|
|
31
|
+
var _a, _b, _c, _d;
|
|
32
|
+
if (browser_1.Key.ARROW_UP.keyCode === ((_a = browser_1.KeyCode.createKeyCode(e.nativeEvent).key) === null || _a === void 0 ? void 0 : _a.keyCode)) {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
this.previousValue();
|
|
35
|
+
}
|
|
36
|
+
else if (browser_1.Key.ARROW_DOWN.keyCode === ((_b = browser_1.KeyCode.createKeyCode(e.nativeEvent).key) === null || _b === void 0 ? void 0 : _b.keyCode)) {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
this.nextValue();
|
|
39
|
+
}
|
|
40
|
+
(_d = (_c = this.props).onKeyDown) === null || _d === void 0 ? void 0 : _d.call(_c, e);
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Handle history collection without overriding the parent's onChange handler, if any.
|
|
44
|
+
*/
|
|
45
|
+
this.onChange = (e) => {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
this.addToHistory();
|
|
48
|
+
(_b = (_a = this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Add a nonempty current value to the history, if not already present. (Debounced, 1 second delay.)
|
|
52
|
+
*/
|
|
53
|
+
this.addToHistory = debounce(this.doAddToHistory, 1000);
|
|
54
|
+
this.state = {
|
|
55
|
+
history: [],
|
|
56
|
+
index: 0,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
updateState(index, history) {
|
|
60
|
+
this.value = history ? history[index] : this.state.history[index];
|
|
61
|
+
this.setState(prevState => {
|
|
62
|
+
const newState = {
|
|
63
|
+
...prevState,
|
|
64
|
+
index,
|
|
65
|
+
};
|
|
66
|
+
if (history) {
|
|
67
|
+
newState.history = history;
|
|
68
|
+
}
|
|
69
|
+
return newState;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
get value() {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
return (_b = (_a = this.input.current) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '';
|
|
75
|
+
}
|
|
76
|
+
set value(value) {
|
|
77
|
+
if (this.input.current) {
|
|
78
|
+
this.input.current.value = value;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Switch the input's text to the previous value, if any.
|
|
83
|
+
*/
|
|
84
|
+
previousValue() {
|
|
85
|
+
const { history, index } = this.state;
|
|
86
|
+
if (!this.value) {
|
|
87
|
+
this.value = history[index];
|
|
88
|
+
}
|
|
89
|
+
else if (index > 0 && index < history.length) {
|
|
90
|
+
this.updateState(index - 1);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Switch the input's text to the next value, if any.
|
|
95
|
+
*/
|
|
96
|
+
nextValue() {
|
|
97
|
+
const { history, index } = this.state;
|
|
98
|
+
if (index === history.length - 1) {
|
|
99
|
+
this.value = '';
|
|
100
|
+
}
|
|
101
|
+
else if (!this.value) {
|
|
102
|
+
this.value = history[index];
|
|
103
|
+
}
|
|
104
|
+
else if (index >= 0 && index < history.length - 1) {
|
|
105
|
+
this.updateState(index + 1);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
doAddToHistory() {
|
|
109
|
+
if (!this.value) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const history = this.state.history
|
|
113
|
+
.filter(term => term !== this.value)
|
|
114
|
+
.concat(this.value)
|
|
115
|
+
.slice(-SearchInWorkspaceInput.LIMIT);
|
|
116
|
+
this.updateState(history.length - 1, history);
|
|
117
|
+
}
|
|
118
|
+
render() {
|
|
119
|
+
return (React.createElement("input", { ...this.props, onKeyDown: this.onKeyDown, onChange: this.onChange, spellCheck: false, ref: this.input }));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.SearchInWorkspaceInput = SearchInWorkspaceInput;
|
|
123
|
+
SearchInWorkspaceInput.LIMIT = 100;
|
|
124
124
|
//# sourceMappingURL=search-in-workspace-input.js.map
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
/// <reference types="
|
|
2
|
-
/// <reference types="
|
|
3
|
-
import * as React from '@theia/core/shared/react';
|
|
4
|
-
interface HistoryState {
|
|
5
|
-
history: string[];
|
|
6
|
-
index: number;
|
|
7
|
-
}
|
|
8
|
-
declare type TextareaAttributes = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
9
|
-
export declare class SearchInWorkspaceTextArea extends React.Component<TextareaAttributes, HistoryState> {
|
|
10
|
-
static LIMIT: number;
|
|
11
|
-
private textarea;
|
|
12
|
-
constructor(props: TextareaAttributes);
|
|
13
|
-
updateState(index: number, history?: string[]): void;
|
|
14
|
-
get value(): string;
|
|
15
|
-
set value(value: string);
|
|
16
|
-
/**
|
|
17
|
-
* Handle history navigation without overriding the parent's onKeyDown handler, if any.
|
|
18
|
-
*/
|
|
19
|
-
protected readonly onKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Switch the textarea's text to the previous value, if any.
|
|
22
|
-
*/
|
|
23
|
-
previousValue(): void;
|
|
24
|
-
/**
|
|
25
|
-
* Switch the textarea's text to the next value, if any.
|
|
26
|
-
*/
|
|
27
|
-
nextValue(): void;
|
|
28
|
-
/**
|
|
29
|
-
* Handle history collection and textarea resizing without overriding the parent's onChange handler, if any.
|
|
30
|
-
*/
|
|
31
|
-
protected readonly onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
32
|
-
/**
|
|
33
|
-
* Add a nonempty current value to the history, if not already present. (Debounced, 1 second delay.)
|
|
34
|
-
*/
|
|
35
|
-
readonly addToHistory: import("lodash").DebouncedFunc<() => void>;
|
|
36
|
-
private doAddToHistory;
|
|
37
|
-
render(): React.ReactNode;
|
|
38
|
-
}
|
|
39
|
-
export {};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="lodash" />
|
|
3
|
+
import * as React from '@theia/core/shared/react';
|
|
4
|
+
interface HistoryState {
|
|
5
|
+
history: string[];
|
|
6
|
+
index: number;
|
|
7
|
+
}
|
|
8
|
+
declare type TextareaAttributes = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
9
|
+
export declare class SearchInWorkspaceTextArea extends React.Component<TextareaAttributes, HistoryState> {
|
|
10
|
+
static LIMIT: number;
|
|
11
|
+
private textarea;
|
|
12
|
+
constructor(props: TextareaAttributes);
|
|
13
|
+
updateState(index: number, history?: string[]): void;
|
|
14
|
+
get value(): string;
|
|
15
|
+
set value(value: string);
|
|
16
|
+
/**
|
|
17
|
+
* Handle history navigation without overriding the parent's onKeyDown handler, if any.
|
|
18
|
+
*/
|
|
19
|
+
protected readonly onKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Switch the textarea's text to the previous value, if any.
|
|
22
|
+
*/
|
|
23
|
+
previousValue(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Switch the textarea's text to the next value, if any.
|
|
26
|
+
*/
|
|
27
|
+
nextValue(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Handle history collection and textarea resizing without overriding the parent's onChange handler, if any.
|
|
30
|
+
*/
|
|
31
|
+
protected readonly onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Add a nonempty current value to the history, if not already present. (Debounced, 1 second delay.)
|
|
34
|
+
*/
|
|
35
|
+
readonly addToHistory: import("lodash").DebouncedFunc<() => void>;
|
|
36
|
+
private doAddToHistory;
|
|
37
|
+
render(): React.ReactNode;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
40
|
//# sourceMappingURL=search-in-workspace-textarea.d.ts.map
|