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

Help debugging alternate issue #184

Closed
ggrangel opened this issue Aug 21, 2023 · 2 comments
Closed

Help debugging alternate issue #184

ggrangel opened this issue Aug 21, 2023 · 2 comments

Comments

@ggrangel
Copy link

I have the following folder structure:
- src/main/java/com/ggrangel/jaguar/recorder/br/client/fiorino/FiorinoClientWrapperImpl.java
- src/test/java/com/ggrangel/jaguar/recorder/br/client/fiorino/FiorinoClientWrapperImplTest.java

And the following config:

vim.g.projectionist_heuristics = {
    ["*"] = {
        ["src/main/java/*.java"] = {
            alternate = "src/test/java/{}Test.java",
        },
        ["src/test/java/*Test.java"] = {
            alternate = "src/main/java/{}.java",
        },
    },

}

In the source file, I can alternate to the test. However, in the test, I get the following error: No alternate file (and it doesn't give me an option to create one).

Also, if I change the second line of config from ["*"] to ["*.java"], nothing works anymore:

What am I missing?

@GiuseppeMP
Copy link

@ggrangel I'm not sure if it's the best way, but it's working for me:

    ['pom.xml|build.gradle|settings.gradle'] = {

        -- projections for java
        ['src/main/java/*.java'] = {
            type = "source",
            alternate = { "src/test/java/{}Test.java", "src/test/java/{}ITCase.java", "src/test/java/{}Tests.java",
                "src/test/java/{}IT.java" },
        },
        ['src/test/java/*Test.java'] = {
            type = "test",
            alternate = "src/main/java/{}.java"
        },
        ['src/test/java/*IT.java'] = {
            type = "test",
            alternate = "src/main/java/{}.java"
        },
        ['src/test/java/*Tests.java'] = {
            type = "test",
            alternate = "src/main/java/{}.java"
        },
        ['src/test/java/*ITCase.java'] = {
            type = "test",
            alternate = "src/main/java/{}.java"
        }
    },

@tpope
Copy link
Owner

tpope commented Jan 3, 2024

Also, if I change the second line of config from ["*"] to ["*.java"], nothing works anymore:

Using * tells Projectionist that a project exists in literally every directory. This is never what you want to do and Projectionist should probably forbid it entirely.

Instead, try something like src/main/java/&src/test/java/, which tells it that pair of directories indicates the presence of a project.

@tpope tpope closed this as completed Jan 3, 2024
haunt98 added a commit to haunt98/dotfiles that referenced this issue Apr 6, 2024
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

3 participants