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

How to use exact and include mode meantime? #34

Open
cesaryuan opened this issue Dec 20, 2023 · 1 comment
Open

How to use exact and include mode meantime? #34

cesaryuan opened this issue Dec 20, 2023 · 1 comment

Comments

@cesaryuan
Copy link

cesaryuan commented Dec 20, 2023

For example, I want the following query

(() => {
    function needExactMatch() {
        var a = 1;
        var a = 2;
    }
})()

to match

(() => {
    OtherStatements1;
    OtherStatements2;
    function needExactMatch() {
        var a = 1;
        var a = 2;
    }
    OtherStatements;
})()

and not match

(() => {
    OtherStatements1;
    OtherStatements2;
    function needExactMatch() {
        OtherStatements;
        var a = 1;
        OtherStatements;
        var a = 2;
        OtherStatements;
    }
    OtherStatements;
})()

Maybe some multiple statements wildcard like $$$$ cound be imported?

So I can use this query in exact mode to achieve this.

(() => {
    $$$$;
    function needExactMatch() {
        var a = 1;
        var a = 2;
    }
    $$$$;
})()
@jayu
Copy link
Contributor

jayu commented Dec 21, 2023

Good use case.

The problem is that match mode cannot be changed for given query, so it cannot be include for some parts and exact for some other parts.

I'm working on a feature that I call "Query builder" for now, that will allow for matching code with different match modes, using boolean conditions, matching code in nested scopes etc.

It's still work in progress, I don't have ETA, but it will definitely support your use case.

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