@codingame/monaco-vscode-a793b3ee-7ba9-5176-a019-30ec806fdd95-common 20.0.0
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/empty.js +1 -0
- package/package.json +50 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +159 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +1318 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.d.ts +172 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +482 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +86 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +377 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.d.ts +70 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +456 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +276 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +318 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +59 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.d.ts +69 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +318 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
import { diffSets } from '@codingame/monaco-vscode-api/vscode/vs/base/common/collections';
|
3
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
4
|
+
import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
5
|
+
import { isDefined } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
6
|
+
import { cellRangesToIndexes } from '@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common/vscode/vs/workbench/contrib/notebook/common/notebookRange';
|
7
|
+
|
8
|
+
class NotebookVisibleCellObserver extends Disposable {
|
9
|
+
get visibleCells() {
|
10
|
+
return this._visibleCells;
|
11
|
+
}
|
12
|
+
constructor(_notebookEditor) {
|
13
|
+
super();
|
14
|
+
this._notebookEditor = _notebookEditor;
|
15
|
+
this._onDidChangeVisibleCells = this._register(( new Emitter()));
|
16
|
+
this.onDidChangeVisibleCells = this._onDidChangeVisibleCells.event;
|
17
|
+
this._viewModelDisposables = this._register(( new DisposableStore()));
|
18
|
+
this._visibleCells = [];
|
19
|
+
this._register(this._notebookEditor.onDidChangeVisibleRanges(this._updateVisibleCells, this));
|
20
|
+
this._register(this._notebookEditor.onDidChangeModel(this._onModelChange, this));
|
21
|
+
this._updateVisibleCells();
|
22
|
+
}
|
23
|
+
_onModelChange() {
|
24
|
+
this._viewModelDisposables.clear();
|
25
|
+
if (this._notebookEditor.hasModel()) {
|
26
|
+
this._viewModelDisposables.add(this._notebookEditor.onDidChangeViewCells(() => this.updateEverything()));
|
27
|
+
}
|
28
|
+
this.updateEverything();
|
29
|
+
}
|
30
|
+
updateEverything() {
|
31
|
+
this._onDidChangeVisibleCells.fire({ added: [], removed: Array.from(this._visibleCells) });
|
32
|
+
this._visibleCells = [];
|
33
|
+
this._updateVisibleCells();
|
34
|
+
}
|
35
|
+
_updateVisibleCells() {
|
36
|
+
if (!this._notebookEditor.hasModel()) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
const newVisibleCells = ( cellRangesToIndexes(this._notebookEditor.visibleRanges)
|
40
|
+
.map(index => this._notebookEditor.cellAt(index)))
|
41
|
+
.filter(isDefined);
|
42
|
+
const newVisibleHandles = ( new Set(( newVisibleCells.map(cell => cell.handle))));
|
43
|
+
const oldVisibleHandles = ( new Set(( this._visibleCells.map(cell => cell.handle))));
|
44
|
+
const diff = diffSets(oldVisibleHandles, newVisibleHandles);
|
45
|
+
const added = ( diff.added
|
46
|
+
.map(handle => this._notebookEditor.getCellByHandle(handle)))
|
47
|
+
.filter(isDefined);
|
48
|
+
const removed = ( diff.removed
|
49
|
+
.map(handle => this._notebookEditor.getCellByHandle(handle)))
|
50
|
+
.filter(isDefined);
|
51
|
+
this._visibleCells = newVisibleCells;
|
52
|
+
this._onDidChangeVisibleCells.fire({
|
53
|
+
added,
|
54
|
+
removed
|
55
|
+
});
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
export { NotebookVisibleCellObserver };
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
2
|
+
import { Range } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range";
|
3
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
4
|
+
import { IContextKey } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey";
|
5
|
+
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
6
|
+
import { IContextMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
|
7
|
+
import { IContextViewService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
|
8
|
+
import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
|
9
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
10
|
+
import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
11
|
+
import { FindModel } from "@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/contrib/find/findModel";
|
12
|
+
import { SimpleFindReplaceWidget } from "@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget";
|
13
|
+
import { ICellViewModel, INotebookEditor, INotebookEditorContribution } from "@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
14
|
+
import { INotebookFindScope } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
|
15
|
+
export interface IShowNotebookFindWidgetOptions {
|
16
|
+
isRegex?: boolean;
|
17
|
+
wholeWord?: boolean;
|
18
|
+
matchCase?: boolean;
|
19
|
+
matchIndex?: number;
|
20
|
+
focus?: boolean;
|
21
|
+
searchStringSeededFrom?: {
|
22
|
+
cell: ICellViewModel;
|
23
|
+
range: Range;
|
24
|
+
};
|
25
|
+
findScope?: INotebookFindScope;
|
26
|
+
}
|
27
|
+
export declare class NotebookFindContrib extends Disposable implements INotebookEditorContribution {
|
28
|
+
private readonly notebookEditor;
|
29
|
+
private readonly instantiationService;
|
30
|
+
static readonly id: string;
|
31
|
+
private readonly _widget;
|
32
|
+
constructor(notebookEditor: INotebookEditor, instantiationService: IInstantiationService);
|
33
|
+
get widget(): NotebookFindWidget;
|
34
|
+
show(initialInput?: string, options?: IShowNotebookFindWidgetOptions): Promise<void>;
|
35
|
+
hide(): void;
|
36
|
+
replace(searchString: string | undefined): void;
|
37
|
+
}
|
38
|
+
declare class NotebookFindWidget extends SimpleFindReplaceWidget implements INotebookEditorContribution {
|
39
|
+
protected _findWidgetFocused: IContextKey<boolean>;
|
40
|
+
private _isFocused;
|
41
|
+
private _showTimeout;
|
42
|
+
private _hideTimeout;
|
43
|
+
private _previousFocusElement?;
|
44
|
+
private _findModel;
|
45
|
+
constructor(_notebookEditor: INotebookEditor, contextViewService: IContextViewService, contextKeyService: IContextKeyService, configurationService: IConfigurationService, contextMenuService: IContextMenuService, hoverService: IHoverService, instantiationService: IInstantiationService, storageService: IStorageService);
|
46
|
+
get findModel(): FindModel;
|
47
|
+
get isFocused(): boolean;
|
48
|
+
private _onFindInputKeyDown;
|
49
|
+
private _onReplaceInputKeyDown;
|
50
|
+
protected onInputChanged(): boolean;
|
51
|
+
private findIndex;
|
52
|
+
protected find(previous: boolean): void;
|
53
|
+
protected replaceOne(): void;
|
54
|
+
protected replaceAll(): void;
|
55
|
+
protected findFirst(): void;
|
56
|
+
protected onFocusTrackerFocus(): void;
|
57
|
+
protected onFocusTrackerBlur(): void;
|
58
|
+
protected onReplaceInputFocusTrackerFocus(): void;
|
59
|
+
protected onReplaceInputFocusTrackerBlur(): void;
|
60
|
+
protected onFindInputFocusTrackerFocus(): void;
|
61
|
+
protected onFindInputFocusTrackerBlur(): void;
|
62
|
+
show(initialInput?: string, options?: IShowNotebookFindWidgetOptions): Promise<void>;
|
63
|
+
replace(initialFindInput?: string, initialReplaceInput?: string): void;
|
64
|
+
hide(): void;
|
65
|
+
protected _updateMatchesCount(): void;
|
66
|
+
private _getAriaLabel;
|
67
|
+
dispose(): void;
|
68
|
+
}
|
69
|
+
export {};
|
@@ -0,0 +1,318 @@
|
|
1
|
+
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
3
|
+
import { append, addDisposableListener, EventType, isHTMLElement, getWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
4
|
+
import { alert } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/aria/aria';
|
5
|
+
import { KeyCode, KeyMod } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
6
|
+
import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
7
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
8
|
+
import { format } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
9
|
+
import { MATCHES_LIMIT } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/find/browser/findModel';
|
10
|
+
import { FindReplaceState } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/find/browser/findState';
|
11
|
+
import { NLS_MATCHES_LOCATION, NLS_NO_RESULTS } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/find/browser/findWidget';
|
12
|
+
import { FindWidgetSearchHistory } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/find/browser/findWidgetSearchHistory';
|
13
|
+
import { ReplaceWidgetHistory } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/find/browser/replaceWidgetHistory';
|
14
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
15
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
16
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
17
|
+
import { IContextViewService, IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
|
18
|
+
import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
|
19
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
20
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
21
|
+
import { FindModel } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/contrib/find/findModel';
|
22
|
+
import { SimpleFindReplaceWidget } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget';
|
23
|
+
import { CellEditState } from '@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
24
|
+
import { KEYBINDING_CONTEXT_NOTEBOOK_FIND_WIDGET_FOCUSED } from '@codingame/monaco-vscode-eda30bac-0984-5b42-9362-c68996b85232-common/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
25
|
+
|
26
|
+
const FIND_HIDE_TRANSITION = 'find-hide-transition';
|
27
|
+
const FIND_SHOW_TRANSITION = 'find-show-transition';
|
28
|
+
let MAX_MATCHES_COUNT_WIDTH = 69;
|
29
|
+
const PROGRESS_BAR_DELAY = 200;
|
30
|
+
let NotebookFindContrib = class NotebookFindContrib extends Disposable {
|
31
|
+
static { this.id = 'workbench.notebook.find'; }
|
32
|
+
constructor(notebookEditor, instantiationService) {
|
33
|
+
super();
|
34
|
+
this.notebookEditor = notebookEditor;
|
35
|
+
this.instantiationService = instantiationService;
|
36
|
+
this._widget = ( new Lazy(
|
37
|
+
() => this._register(this.instantiationService.createInstance(NotebookFindWidget, this.notebookEditor))
|
38
|
+
));
|
39
|
+
}
|
40
|
+
get widget() {
|
41
|
+
return this._widget.value;
|
42
|
+
}
|
43
|
+
show(initialInput, options) {
|
44
|
+
return this._widget.value.show(initialInput, options);
|
45
|
+
}
|
46
|
+
hide() {
|
47
|
+
this._widget.rawValue?.hide();
|
48
|
+
}
|
49
|
+
replace(searchString) {
|
50
|
+
return this._widget.value.replace(searchString);
|
51
|
+
}
|
52
|
+
};
|
53
|
+
NotebookFindContrib = ( __decorate([
|
54
|
+
( __param(1, IInstantiationService))
|
55
|
+
], NotebookFindContrib));
|
56
|
+
let NotebookFindWidget = class NotebookFindWidget extends SimpleFindReplaceWidget {
|
57
|
+
constructor(_notebookEditor, contextViewService, contextKeyService, configurationService, contextMenuService, hoverService, instantiationService, storageService) {
|
58
|
+
const findSearchHistory = FindWidgetSearchHistory.getOrCreate(storageService);
|
59
|
+
const replaceHistory = ReplaceWidgetHistory.getOrCreate(storageService);
|
60
|
+
super(contextViewService, contextKeyService, configurationService, contextMenuService, instantiationService, hoverService, ( new FindReplaceState()), _notebookEditor, findSearchHistory, replaceHistory);
|
61
|
+
this._isFocused = false;
|
62
|
+
this._showTimeout = null;
|
63
|
+
this._hideTimeout = null;
|
64
|
+
this._findModel = ( new FindModel(this._notebookEditor, this._state, this._configurationService));
|
65
|
+
append(this._notebookEditor.getDomNode(), this.getDomNode());
|
66
|
+
this._findWidgetFocused = KEYBINDING_CONTEXT_NOTEBOOK_FIND_WIDGET_FOCUSED.bindTo(contextKeyService);
|
67
|
+
this._register(this._findInput.onKeyDown((e) => this._onFindInputKeyDown(e)));
|
68
|
+
this._register(this._replaceInput.onKeyDown((e) => this._onReplaceInputKeyDown(e)));
|
69
|
+
this._register(this._state.onFindReplaceStateChange((e) => {
|
70
|
+
this.onInputChanged();
|
71
|
+
if (e.isSearching) {
|
72
|
+
if (this._state.isSearching) {
|
73
|
+
this._progressBar.infinite().show(PROGRESS_BAR_DELAY);
|
74
|
+
}
|
75
|
+
else {
|
76
|
+
this._progressBar.stop().hide();
|
77
|
+
}
|
78
|
+
}
|
79
|
+
if (this._findModel.currentMatch >= 0) {
|
80
|
+
const currentMatch = this._findModel.getCurrentMatch();
|
81
|
+
this._replaceBtn.setEnabled(currentMatch.isModelMatch);
|
82
|
+
}
|
83
|
+
const matches = this._findModel.findMatches;
|
84
|
+
this._replaceAllBtn.setEnabled(matches.length > 0 && matches.find(match => match.webviewMatches.length > 0) === undefined);
|
85
|
+
if (e.filters) {
|
86
|
+
this._findInput.updateFilterState(this._state.filters?.isModified() ?? false);
|
87
|
+
}
|
88
|
+
}));
|
89
|
+
this._register(addDisposableListener(this.getDomNode(), EventType.FOCUS, e => {
|
90
|
+
this._previousFocusElement = isHTMLElement(e.relatedTarget) ? e.relatedTarget : undefined;
|
91
|
+
}, true));
|
92
|
+
}
|
93
|
+
get findModel() {
|
94
|
+
return this._findModel;
|
95
|
+
}
|
96
|
+
get isFocused() {
|
97
|
+
return this._isFocused;
|
98
|
+
}
|
99
|
+
_onFindInputKeyDown(e) {
|
100
|
+
if (e.equals(KeyCode.Enter)) {
|
101
|
+
this.find(false);
|
102
|
+
e.preventDefault();
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
else if (e.equals(KeyMod.Shift | KeyCode.Enter)) {
|
106
|
+
this.find(true);
|
107
|
+
e.preventDefault();
|
108
|
+
return;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
_onReplaceInputKeyDown(e) {
|
112
|
+
if (e.equals(KeyCode.Enter)) {
|
113
|
+
this.replaceOne();
|
114
|
+
e.preventDefault();
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
onInputChanged() {
|
119
|
+
this._state.change({ searchString: this.inputValue }, false);
|
120
|
+
const findMatches = this._findModel.findMatches;
|
121
|
+
if (findMatches && findMatches.length) {
|
122
|
+
return true;
|
123
|
+
}
|
124
|
+
return false;
|
125
|
+
}
|
126
|
+
findIndex(index) {
|
127
|
+
this._findModel.find({ index });
|
128
|
+
}
|
129
|
+
find(previous) {
|
130
|
+
this._findModel.find({ previous });
|
131
|
+
}
|
132
|
+
replaceOne() {
|
133
|
+
if (!this._notebookEditor.hasModel()) {
|
134
|
+
return;
|
135
|
+
}
|
136
|
+
if (!this._findModel.findMatches.length) {
|
137
|
+
return;
|
138
|
+
}
|
139
|
+
this._findModel.ensureFindMatches();
|
140
|
+
if (this._findModel.currentMatch < 0) {
|
141
|
+
this._findModel.find({ previous: false });
|
142
|
+
}
|
143
|
+
const currentMatch = this._findModel.getCurrentMatch();
|
144
|
+
const cell = currentMatch.cell;
|
145
|
+
if (currentMatch.isModelMatch) {
|
146
|
+
const match = currentMatch.match;
|
147
|
+
this._progressBar.infinite().show(PROGRESS_BAR_DELAY);
|
148
|
+
const replacePattern = this.replacePattern;
|
149
|
+
const replaceString = replacePattern.buildReplaceString(match.matches, this._state.preserveCase);
|
150
|
+
const viewModel = this._notebookEditor.getViewModel();
|
151
|
+
viewModel.replaceOne(cell, match.range, replaceString).then(() => {
|
152
|
+
this._progressBar.stop();
|
153
|
+
});
|
154
|
+
}
|
155
|
+
else {
|
156
|
+
console.error('Replace does not work for output match');
|
157
|
+
}
|
158
|
+
}
|
159
|
+
replaceAll() {
|
160
|
+
if (!this._notebookEditor.hasModel()) {
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
this._progressBar.infinite().show(PROGRESS_BAR_DELAY);
|
164
|
+
const replacePattern = this.replacePattern;
|
165
|
+
const cellFindMatches = this._findModel.findMatches;
|
166
|
+
const replaceStrings = [];
|
167
|
+
cellFindMatches.forEach(cellFindMatch => {
|
168
|
+
cellFindMatch.contentMatches.forEach(match => {
|
169
|
+
const matches = match.matches;
|
170
|
+
replaceStrings.push(replacePattern.buildReplaceString(matches, this._state.preserveCase));
|
171
|
+
});
|
172
|
+
});
|
173
|
+
const viewModel = this._notebookEditor.getViewModel();
|
174
|
+
viewModel.replaceAll(this._findModel.findMatches, replaceStrings).then(() => {
|
175
|
+
this._progressBar.stop();
|
176
|
+
});
|
177
|
+
}
|
178
|
+
findFirst() { }
|
179
|
+
onFocusTrackerFocus() {
|
180
|
+
this._findWidgetFocused.set(true);
|
181
|
+
this._isFocused = true;
|
182
|
+
}
|
183
|
+
onFocusTrackerBlur() {
|
184
|
+
this._previousFocusElement = undefined;
|
185
|
+
this._findWidgetFocused.reset();
|
186
|
+
this._isFocused = false;
|
187
|
+
}
|
188
|
+
onReplaceInputFocusTrackerFocus() {
|
189
|
+
}
|
190
|
+
onReplaceInputFocusTrackerBlur() {
|
191
|
+
}
|
192
|
+
onFindInputFocusTrackerFocus() { }
|
193
|
+
onFindInputFocusTrackerBlur() { }
|
194
|
+
async show(initialInput, options) {
|
195
|
+
const searchStringUpdate = this._state.searchString !== initialInput;
|
196
|
+
super.show(initialInput, options);
|
197
|
+
this._state.change({ searchString: initialInput ?? this._state.searchString, isRevealed: true }, false);
|
198
|
+
if (typeof options?.matchIndex === 'number') {
|
199
|
+
if (!this._findModel.findMatches.length) {
|
200
|
+
await this._findModel.research();
|
201
|
+
}
|
202
|
+
this.findIndex(options.matchIndex);
|
203
|
+
}
|
204
|
+
else {
|
205
|
+
this._findInput.select();
|
206
|
+
}
|
207
|
+
if (!searchStringUpdate && options?.searchStringSeededFrom) {
|
208
|
+
this._findModel.refreshCurrentMatch(options.searchStringSeededFrom);
|
209
|
+
}
|
210
|
+
if (this._showTimeout === null) {
|
211
|
+
if (this._hideTimeout !== null) {
|
212
|
+
getWindow(this.getDomNode()).clearTimeout(this._hideTimeout);
|
213
|
+
this._hideTimeout = null;
|
214
|
+
this._notebookEditor.removeClassName(FIND_HIDE_TRANSITION);
|
215
|
+
}
|
216
|
+
this._notebookEditor.addClassName(FIND_SHOW_TRANSITION);
|
217
|
+
this._showTimeout = getWindow(this.getDomNode()).setTimeout(() => {
|
218
|
+
this._notebookEditor.removeClassName(FIND_SHOW_TRANSITION);
|
219
|
+
this._showTimeout = null;
|
220
|
+
}, 200);
|
221
|
+
}
|
222
|
+
}
|
223
|
+
replace(initialFindInput, initialReplaceInput) {
|
224
|
+
super.showWithReplace(initialFindInput, initialReplaceInput);
|
225
|
+
this._state.change({ searchString: initialFindInput ?? '', replaceString: initialReplaceInput ?? '', isRevealed: true }, false);
|
226
|
+
this._replaceInput.select();
|
227
|
+
if (this._showTimeout === null) {
|
228
|
+
if (this._hideTimeout !== null) {
|
229
|
+
getWindow(this.getDomNode()).clearTimeout(this._hideTimeout);
|
230
|
+
this._hideTimeout = null;
|
231
|
+
this._notebookEditor.removeClassName(FIND_HIDE_TRANSITION);
|
232
|
+
}
|
233
|
+
this._notebookEditor.addClassName(FIND_SHOW_TRANSITION);
|
234
|
+
this._showTimeout = getWindow(this.getDomNode()).setTimeout(() => {
|
235
|
+
this._notebookEditor.removeClassName(FIND_SHOW_TRANSITION);
|
236
|
+
this._showTimeout = null;
|
237
|
+
}, 200);
|
238
|
+
}
|
239
|
+
}
|
240
|
+
hide() {
|
241
|
+
super.hide();
|
242
|
+
this._state.change({ isRevealed: false }, false);
|
243
|
+
this._findModel.clear();
|
244
|
+
this._notebookEditor.findStop();
|
245
|
+
this._progressBar.stop();
|
246
|
+
if (this._hideTimeout === null) {
|
247
|
+
if (this._showTimeout !== null) {
|
248
|
+
getWindow(this.getDomNode()).clearTimeout(this._showTimeout);
|
249
|
+
this._showTimeout = null;
|
250
|
+
this._notebookEditor.removeClassName(FIND_SHOW_TRANSITION);
|
251
|
+
}
|
252
|
+
this._notebookEditor.addClassName(FIND_HIDE_TRANSITION);
|
253
|
+
this._hideTimeout = getWindow(this.getDomNode()).setTimeout(() => {
|
254
|
+
this._notebookEditor.removeClassName(FIND_HIDE_TRANSITION);
|
255
|
+
}, 200);
|
256
|
+
}
|
257
|
+
if (this._previousFocusElement && this._previousFocusElement.offsetParent) {
|
258
|
+
this._previousFocusElement.focus();
|
259
|
+
this._previousFocusElement = undefined;
|
260
|
+
}
|
261
|
+
if (this._notebookEditor.hasModel()) {
|
262
|
+
for (let i = 0; i < this._notebookEditor.getLength(); i++) {
|
263
|
+
const cell = this._notebookEditor.cellAt(i);
|
264
|
+
if (cell.getEditState() === CellEditState.Editing && cell.editStateSource === 'find') {
|
265
|
+
cell.updateEditState(CellEditState.Preview, 'closeFind');
|
266
|
+
}
|
267
|
+
}
|
268
|
+
}
|
269
|
+
}
|
270
|
+
_updateMatchesCount() {
|
271
|
+
if (!this._findModel || !this._findModel.findMatches) {
|
272
|
+
return;
|
273
|
+
}
|
274
|
+
this._matchesCount.style.minWidth = MAX_MATCHES_COUNT_WIDTH + 'px';
|
275
|
+
this._matchesCount.title = '';
|
276
|
+
this._matchesCount.firstChild?.remove();
|
277
|
+
let label;
|
278
|
+
if (this._state.matchesCount > 0) {
|
279
|
+
let matchesCount = String(this._state.matchesCount);
|
280
|
+
if (this._state.matchesCount >= MATCHES_LIMIT) {
|
281
|
+
matchesCount += '+';
|
282
|
+
}
|
283
|
+
const matchesPosition = this._findModel.currentMatch < 0 ? '?' : String((this._findModel.currentMatch + 1));
|
284
|
+
label = format(NLS_MATCHES_LOCATION, matchesPosition, matchesCount);
|
285
|
+
}
|
286
|
+
else {
|
287
|
+
label = NLS_NO_RESULTS;
|
288
|
+
}
|
289
|
+
this._matchesCount.appendChild(document.createTextNode(label));
|
290
|
+
alert(this._getAriaLabel(label, this._state.currentMatch, this._state.searchString));
|
291
|
+
MAX_MATCHES_COUNT_WIDTH = Math.max(MAX_MATCHES_COUNT_WIDTH, this._matchesCount.clientWidth);
|
292
|
+
}
|
293
|
+
_getAriaLabel(label, currentMatch, searchString) {
|
294
|
+
if (label === NLS_NO_RESULTS) {
|
295
|
+
return searchString === ''
|
296
|
+
? ( localize(8589, "{0} found", label))
|
297
|
+
: ( localize(8590, "{0} found for '{1}'", label, searchString));
|
298
|
+
}
|
299
|
+
return localize(8591, "{0} found for '{1}'", label, searchString);
|
300
|
+
}
|
301
|
+
dispose() {
|
302
|
+
this._notebookEditor?.removeClassName(FIND_SHOW_TRANSITION);
|
303
|
+
this._notebookEditor?.removeClassName(FIND_HIDE_TRANSITION);
|
304
|
+
this._findModel.dispose();
|
305
|
+
super.dispose();
|
306
|
+
}
|
307
|
+
};
|
308
|
+
NotebookFindWidget = ( __decorate([
|
309
|
+
( __param(1, IContextViewService)),
|
310
|
+
( __param(2, IContextKeyService)),
|
311
|
+
( __param(3, IConfigurationService)),
|
312
|
+
( __param(4, IContextMenuService)),
|
313
|
+
( __param(5, IHoverService)),
|
314
|
+
( __param(6, IInstantiationService)),
|
315
|
+
( __param(7, IStorageService))
|
316
|
+
], NotebookFindWidget));
|
317
|
+
|
318
|
+
export { NotebookFindContrib };
|