emilycares / jumpwire.nvim

Jump easily between related files.
GNU General Public License v3.0
19 stars 0 forks source link

Could not find a test for file Hyperlink.test.tsx.snap #3

Open thijssmudde opened 1 year ago

thijssmudde commented 1 year ago

Hi! Awesome nvim plugin. It's exactly what I'm looking for. Can you help me in achieving the following?

I have the following example:

Hyperlink.helpers.tsx
Hyperlink.stories.tsx
Hyperlink.test.tsx
Hyperlink.test.tsx.snap
Hyperlink.tsx

Here is the current mapping:

jumpwire.setup({
  language = {
    ["tsx"] = {
      test = { type = "fileExtension", data = "test.tsx" },
      snap = { type = "fileExtension", data = "test.tsx.snap" },
      stories = { type = "fileExtension", data = "stories.tsx" },
      helpers = { type = "fileExtension", data = "helpers.tsx" },
    },
    ["test.tsx"] = {
      implementation = { type = "fileExtension", data = "tsx" },
      snap = { type = "fileExtension", data = "test.tsx.snap" },
      stories = { type = "fileExtension", data = "stories.tsx" },
      helpers = { type = "fileExtension", data = "helpers.tsx" },
    },
    ["text.tsx.snap"] = {
      implementation = { type = "fileExtension", data = "tsx" },
      test = { type = "fileExtension", data = "test.tsx" },
      stories = { type = "fileExtension", data = "stories.tsx" },
      helpers = { type = "fileExtension", data = "helpers.tsx" },
    },
    ["stories.tsx"] = {
      implementation = { type = "fileExtension", data = "tsx" },
      test = { type = "fileExtension", data = "test.tsx" },
      snap = { type = "fileExtension", data = "test.tsx.snap" },
      helpers = { type = "fileExtension", data = "helpers.tsx" },
    },
    ["helpers.tsx"] = {
      implementation = { type = "fileExtension", data = "tsx" },
      test = { type = "fileExtension", data = "test.tsx" },
      snap = { type = "fileExtension", data = "test.tsx.snap" },
      stories = { type = "fileExtension", data = "stories.tsx" },
    },
  },
})

This works fine if my startpoint is Hyperlink.tsx => HyperLink.test.tsx or a helpers/stories/snapshot.

However, this setup does not work when moving back from from test/helpers/stories/snapshot back to the implementation file. The plugin says: "Could not find a test for file Hyperlink.test.tsx.snap"

emilycares commented 1 year ago

Thanks for creating an issue @fullhdpixel. It seems to be that you have a typing error. You have specified a language "text.tsx.snap" instead of "test.tsx.snap" then it started working normally. But I see your point it is not very user-friendly when you got to test twice you cannot go to the other files because you end up with a file called "Hyperlink.test.test.tsx". That is an unwanted feature that could be addressed. Usually when this happens to me, I do a ctrl o