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

Feature request: transforming rg -e/-F queries with vscode regular expressions #51

Open
PiotrSokol opened this issue May 25, 2024 · 1 comment

Comments

@PiotrSokol
Copy link

Hi, I just came across this project and I love it!

The idea to use vscode regexp can potentially save a lot of time while writing complicated queries for rg.

My example use case is querying '^\h*\\begin\{$2[\w\*]*?\}\s*(?:\\label\{([^\}])\}|\[(.*)\])', where $2 is transformed according to

"periscope.rgQueryParams": [
        {
            "regex": "((?<=(?<![\\w\\#\\@]))@([a-zA-Z]+(?:\\\\*)?)(?=(?:$|\\s)))",
            "param": "-e '^\\h*\\\\begin\\{$2[\\w\\*]*?\\}\\s*(?:\\\\label\\{([^\\}])\\}|\\[(.*)\\])'"
        }
]

I clumsily implemented this-- I pass the query as and additional flag -e ....
If you're interested I can make a PR and discuss the specifics.

@joshmu
Copy link
Owner

joshmu commented May 26, 2024

Hey @PiotrSokol

If you think there is value for others then feel free to raise a PR.

I'm always curious to understand how periscope is being used. :) glad you like it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants