mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Only show find when modal is loaded and expand the collapsed cell on find. (#8790)
This commit is contained in:
@@ -334,8 +334,10 @@ export class NotebookEditor extends BaseEditor implements IFindNotebookControlle
|
|||||||
this._currentMatch = range;
|
this._currentMatch = range;
|
||||||
}
|
}
|
||||||
public toggleSearch(): void {
|
public toggleSearch(): void {
|
||||||
|
// reveal only when the model is loaded
|
||||||
|
let isRevealed: boolean = !this._findState.isRevealed && this._notebookModel ? !this._findState.isRevealed : false;
|
||||||
this._findState.change({
|
this._findState.change({
|
||||||
isRevealed: !this._findState.isRevealed
|
isRevealed: isRevealed
|
||||||
}, false);
|
}, false);
|
||||||
if (this._findState.isRevealed) {
|
if (this._findState.isRevealed) {
|
||||||
this._finder.focusFindInput();
|
this._finder.focusFindInput();
|
||||||
|
|||||||
@@ -144,6 +144,8 @@ export class NotebookFindDecorations implements IDisposable {
|
|||||||
|
|
||||||
private _revealRangeInCenterIfOutsideViewport(match: NotebookRange): void {
|
private _revealRangeInCenterIfOutsideViewport(match: NotebookRange): void {
|
||||||
let matchEditor = this._editor.getCellEditor(match.cell.cellGuid);
|
let matchEditor = this._editor.getCellEditor(match.cell.cellGuid);
|
||||||
|
// expand the cell if it's collapsed and scroll into view
|
||||||
|
match.cell.isCollapsed = false;
|
||||||
if (matchEditor) {
|
if (matchEditor) {
|
||||||
matchEditor.getContainer().scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
matchEditor.getContainer().scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||||
matchEditor.getControl().revealRangeInCenterIfOutsideViewport(match, ScrollType.Smooth);
|
matchEditor.getControl().revealRangeInCenterIfOutsideViewport(match, ScrollType.Smooth);
|
||||||
|
|||||||
@@ -649,9 +649,10 @@ abstract class SettingsCommand extends Command {
|
|||||||
|
|
||||||
class SearchNotebookCommand extends SettingsCommand {
|
class SearchNotebookCommand extends SettingsCommand {
|
||||||
|
|
||||||
public runCommand(accessor: ServicesAccessor, args: any): void {
|
public async runCommand(accessor: ServicesAccessor, args: any): Promise<void> {
|
||||||
const notebookEditor = this.getNotebookEditor(accessor);
|
const notebookEditor = this.getNotebookEditor(accessor);
|
||||||
if (notebookEditor) {
|
if (notebookEditor) {
|
||||||
|
await notebookEditor.setNotebookModel();
|
||||||
notebookEditor.toggleSearch();
|
notebookEditor.toggleSearch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user