Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextSearchQueryNew has conflicting options #223310

Closed
alexr00 opened this issue Jul 23, 2024 · 2 comments · Fixed by #224654
Closed

TextSearchQueryNew has conflicting options #223310

alexr00 opened this issue Jul 23, 2024 · 2 comments · Fixed by #224654
Assignees
Labels
insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue search Search widget and operation issues search-api
Milestone

Comments

@alexr00
Copy link
Member

alexr00 commented Jul 23, 2024

Testing #223154

From the API:

export interface TextSearchQueryNew {
		/**
		 * The text pattern to search for.
		 */
		pattern: string;

		/**
		 * Whether or not `pattern` should match multiple lines of text.
		 */
		isMultiline?: boolean;

		/**
		 * Whether or not `pattern` should be interpreted as a regular expression.
		 */
		isRegExp?: boolean;

		/**
		 * Whether or not the search should be case-sensitive.
		 */
		isCaseSensitive?: boolean;

		/**
		 * Whether or not to search for whole word matches only.
		 */
		isWordMatch?: boolean;
	}

What is the behavior supposed to be in the following cases:

  • The pattern contains \n.
  • The pattern contains \n and isMultiline is false.
  • The pattern is a regex and isCaseSessitive is false.
  • The pattern contains whitespace and isWordMatch is true.
@andreamah
Copy link
Contributor

The pattern contains \n.

If regex is not on, it just looks for \n literally.

The pattern contains \n and isMultiline is false.

I believe that this actually acts as if isMultiline is true (if I'm interpreting this code correctly). Any time that you have regex enabled and explicitly match a newline, it will be multi-line. I should probably document this.

The pattern is a regex and isCaseSessitive is false.

Any characters in the regex will also match the other case. ie: [a-z] should also match all characters, not just lowercase letters.

The pattern contains whitespace and isWordMatch is true.

It will look for the whitespace, and will look for line boundaries on either side of the search string.

@andreamah
Copy link
Contributor

I can also add extra examples for corner cases so that this is more clear.

@andreamah andreamah added search Search widget and operation issues polish Cleanup and polish issue labels Jul 23, 2024
@andreamah andreamah added this to the August 2024 milestone Jul 23, 2024
@vs-code-engineering vs-code-engineering bot added the unreleased Patch has not yet been released in VS Code Insiders label Aug 2, 2024
@vs-code-engineering vs-code-engineering bot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Aug 24, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Sep 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue search Search widget and operation issues search-api
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants