other.nvim icon indicating copy to clipboard operation
other.nvim copied to clipboard

Pattern matching issues

Open alexgorbatchev opened this issue 1 year ago • 2 comments

Odd issue in pattern matching:

  • src/.*/([^.]+).(tsx?)$ - works
  • .*/([^.]+).(tsx?)$ - doesn't (same as above, minus src/. I would expect this to work as well.

alexgorbatchev avatar Jul 06 '24 01:07 alexgorbatchev

Try removing the leading part completely. (starting with "/") That should do the trick.

cheers

rgroli avatar Jul 06 '24 18:07 rgroli

This config causes my neovim (0.10) to freeze for about a minute on a macbook pro m3

          {
            pattern = "([^.]+).(tsx?)$",
            target = {
              { target = "**/%1.test.%2", context = "test" },
              { target = "**/%1.stories.%2", context = "stories" },
            },
          },

I have to use this, which works, but not ideal, i would prefer not to have src/ prefix. The /.*/([^.]+).(tsx?)$ also causes neovim to freeze

          {
            pattern = "src/.*/([^.]+).(tsx?)$",
            target = {
              { target = "**/%1.test.%2", context = "test" },
              { target = "**/%1.stories.%2", context = "stories" },
            },
          },

my full config is

      require("other-nvim").setup({
        rememberBuffers = false,
        showMissingFiles = false,
        mappings = {
          {
            pattern = "src/.*/([^.]+).(tsx?)$",
            target = {
              { target = "**/%1.test.%2", context = "test" },
              { target = "**/%1.stories.%2", context = "stories" },
            },
          },
          {
            pattern = "src/.*/([^.]+).test.(tsx?)$",
            target = {
              { target = "**/%1.%2", context = "source" },
              { target = "**/%1.stories.%2", context = "stories" },
            },
          },
          {
            pattern = "src/.*/([^.]+).stories.(tsx?)$",
            target = {
              { target = "**/%1.%2", context = "source" },
              { target = "**/%1.test.%2", context = "test" },
            },
          },
        },
      })

alexgorbatchev avatar Jul 08 '24 18:07 alexgorbatchev