[BUG] Go to file is capturing surrounding single quotes
files
index.js
example.js
consider a file example.js that contains the line
import './index.js' or
import 'index.js'
You cannot navigate to index.js by using gf on either line
What's interesting is you can manually select index.js and hit gf and it works.
It looks like gf is capturing the surrounding single quotes. Neovim does not exhibit that behavior.
So in Helix you have to mi'gf and in Neovim you do gf
Is removing quotes/double quotes from the selection an acceptable approach here?
I wonder if it makes sense to have something "smarter" at work here. In this example one could have import 'index' without the file extension, and with the current approach this would not open the correct file.
In this particular case I think it's okay to Do It Like Neovim™. It's just too common to drop a cursor on the line import './index.js' hit gf and expect it to open ./index.js
When there's only a single cursor with a selection width of 1, the current LONG word is considered as the filename, so it's similar to doing miWgf:
https://github.com/helix-editor/helix/blob/7f75458e6f29f2dc0717557a1072b70deee27acb/helix-term/src/commands.rs#L1028-L1044
We could trim surround character pairs like () and ' before trying to open the file like @dariooddenino suggested.
I wonder if it makes sense to have something "smarter" at work here. In this example one could have
import 'index'without the file extension, and with the current approach this would not open the correct file.
Cases like these are better handled by the LSP that has the additional context at hand to resolve the path reliably.