mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 01:25:37 -05:00
Implemented match case and whole wrd (#8904)
* Implemented match case and whole wrd * removed unused ref * renamed test method * escape \ * refactored search * added more tests * updated tests appying match case and whole word to spcl characters * regex update * spcl to special * non-capturing group added to the regex * test
This commit is contained in:
@@ -430,7 +430,7 @@ export interface INotebookFindModel {
|
||||
findPrevious(): Promise<NotebookRange>;
|
||||
|
||||
/** search the notebook model for the given exp up to maxMatch occurances */
|
||||
find(exp: string, maxMatches?: number): Promise<NotebookRange>;
|
||||
find(exp: string, matchCase?: boolean, wholeWord?: boolean, maxMatches?: number): Promise<NotebookRange>;
|
||||
|
||||
/** clear the results of the find */
|
||||
clearFind(): void;
|
||||
|
||||
@@ -282,12 +282,12 @@ export class NotebookEditor extends BaseEditor implements IFindNotebookControlle
|
||||
}
|
||||
}
|
||||
|
||||
if (e.searchString) {
|
||||
if (e.searchString || e.matchCase || e.wholeWord) {
|
||||
this._findDecorations.clearDecorations();
|
||||
if (this._notebookModel) {
|
||||
if (this._findState.searchString) {
|
||||
let findScope = this._findDecorations.getFindScope();
|
||||
if (this._findState.searchString === this.notebookFindModel.findExpression && findScope !== null) {
|
||||
if (this._findState.searchString === this.notebookFindModel.findExpression && findScope !== null && !e.matchCase && !e.wholeWord) {
|
||||
if (findScope) {
|
||||
this._updateFinderMatchState();
|
||||
this._findState.changeMatchInfo(
|
||||
@@ -300,7 +300,7 @@ export class NotebookEditor extends BaseEditor implements IFindNotebookControlle
|
||||
} else {
|
||||
this.notebookInput.notebookFindModel.clearDecorations();
|
||||
this.notebookFindModel.findExpression = this._findState.searchString;
|
||||
this.notebookInput.notebookFindModel.find(this._findState.searchString, NOTEBOOK_MAX_MATCHES).then(findRange => {
|
||||
this.notebookInput.notebookFindModel.find(this._findState.searchString, this._findState.matchCase, this._findState.wholeWord, NOTEBOOK_MAX_MATCHES).then(findRange => {
|
||||
if (findRange) {
|
||||
this.updatePosition(findRange);
|
||||
} else if (this.notebookFindModel.findMatches.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user