Allow users to control find scopes

This commit is contained in:
rebornix 2023-04-17 17:01:15 -07:00
parent 1f02a97e06
commit e5a432ba0b
No known key found for this signature in database
GPG key ID: 181FC90D15393C20
4 changed files with 26 additions and 15 deletions

View file

@ -125,9 +125,5 @@
],
"application.experimental.rendererProfiling": true,
"editor.experimental.asyncTokenization": true,
"editor.experimental.asyncTokenizationVerification": true,
"notebook.experimental.findInMarkdownMode": {
"source": true,
"preview": true
}
"editor.experimental.asyncTokenizationVerification": true
}

View file

@ -306,9 +306,14 @@ export abstract class SimpleFindReplaceWidget extends Widget {
) {
super();
const findInMarkdownMode = this._configurationService.getValue<{ source: boolean; preview: boolean }>(NotebookSetting.experimentalFindInMarkdownMode) ?? { source: true, preview: false };
const findScope = this._configurationService.getValue<{
markupSource: boolean;
markupPreview: boolean;
codeSource: boolean;
codeOutput: boolean;
}>(NotebookSetting.findScope) ?? { markupSource: true, markupPreview: true, codeSource: true, codeOutput: true };
this._filters = new NotebookFindFilters(findInMarkdownMode.source, findInMarkdownMode.preview, true, true);
this._filters = new NotebookFindFilters(findScope.markupSource, findScope.markupPreview, findScope.codeSource, findScope.codeOutput);
this._state.change({ filters: this._filters }, false);
this._filters.onDidChange(() => {

View file

@ -917,22 +917,32 @@ configurationRegistry.registerConfiguration({
type: 'boolean',
default: true
},
[NotebookSetting.experimentalFindInMarkdownMode]: {
markdownDescription: nls.localize('notebook.experimental.findInMarkdownMode', "Customize the Find Widget behavior for searching within markdown cells. When both are enabled, the Find Widget will search either the content or preview based on the current state of the markdown cell. Toggle the boolean values to control the Find Widget's scope for each mode as needed."),
[NotebookSetting.findScope]: {
markdownDescription: nls.localize('notebook.findScope', "Customize the Find Widget behavior for searching within notebook cells. When both markup source and markup preview are enabled, the Find Widget will search either the source code or preview based on the current state of the cell."),
type: 'object',
properties: {
source: {
markupSource: {
type: 'boolean',
default: true
},
preview: {
markupPreview: {
type: 'boolean',
default: false
default: true
},
codeSource: {
type: 'boolean',
default: true
},
codeOutput: {
type: 'boolean',
default: true
}
},
default: {
source: true,
preview: false
markupSource: true,
markupPreview: true,
codeSource: true,
codeOutput: true
},
tags: ['notebookLayout']
}

View file

@ -944,7 +944,7 @@ export const NotebookSetting = {
outputFontSize: 'notebook.output.fontSize',
outputFontFamilyDeprecated: 'notebook.outputFontFamily',
outputFontFamily: 'notebook.output.fontFamily',
experimentalFindInMarkdownMode: 'notebook.experimental.findInMarkdownMode',
findScope: 'notebook.find.scope',
logging: 'notebook.logging',
confirmDeleteRunningCell: 'notebook.confirmDeleteRunningCell',
} as const;