rgroli/other.nvim

Not work on next.js & sveltekit

Closed this issue Β· 11 comments

I am using other.nvim, and when the file path like this:

src/routes/[slug]/+page.js
src/routes/[slug]/+page.svelte

other.nvim does not recognize the relevant files.
Maybe regex problem?

rgroli commented

Can you give me your regex, I will be happy to help πŸ˜„

rgroli commented

For testing I used your mappings and setup two files with the following structure:

/src/routes/mylitte/thing/+page.js
/src/routes/mylitte/thing/+page.svelte

and it worked flawlessly.. I suspect there is something else going on..

Also your regex seems good - I first thought I must be something with the plus sign in the filename, but you escaped it correctly. As much as I hate this sentence but: I works on my machine πŸ˜„

rgroli commented

Also, If your mapping are usable for standard sveltekit projects I encourage you to make a pr :) Would be great if we could add this to the builtin mappings.

It's really simple: just add a file under lua/other-nvim/builtin/mappings

πŸ™

@rgroli Thank you for check this out and I'd like to make a pr for this one!

For testing I used your mappings and setup two files with the following structure:

/src/routes/mylitte/thing/+page.js
/src/routes/mylitte/thing/+page.svelte
and it worked flawlessly.. I suspect there is something else going on..

Yeah, that type of path is ok for my regex!

My problem is my regex does not work on the path like this

src/routes/[slug]/+page.js
src/routes/[slug]/+page.svelte

idk how to fix it. Could you help me?

EDIT: jic, here is the doc of sveltekit routing!! https://kit.svelte.dev/docs/routing

rgroli commented

@ryoppippi Ahh, now I see you mean literally "[slug]" I thought this was just a placeholder.. Short look into the routing doc makes it clear. Alright, I will check how to solve this ..

rgroli commented

@ryoppippi Problem was that the [and the ] character have special meaning when used with the lua glob function. You can update the plugin and it should be fixed.

perfect! it works!! Thanks!
I'll create a pr later!!!

@rgroli
hi!
I have tested your fix and use it for all my day today
Then I started to see options that were not there before.
Why is this?
I have builtin angular on in my settings.
Before the update, there was no option to create a new file for this.

γ‚Ήγ‚―γƒͺγƒΌγƒ³γ‚·γƒ§γƒƒγƒˆ 2023-06-02 22 31 09

rgroli commented

@ryoppippi
That's a feature I introduced in the previous update. see #22
It is not related to the fix from later.

If you don't want it you can turn it off easily by setting showMissingFiles = false in the config :)

I see thanks!!!