rexebin / F12-Open-File

VSCode extension: F12 Open File
4 stars 2 forks source link

FR infer filepaths for imports which are missing a file extension #2

Closed ptim closed 4 years ago

ptim commented 5 years ago

I'm using the convention in my React code whereby I import files without their extension, which F12-Open-File doesn't recognise. Works well if I add the .js, but I'd rather not 😁

Maybe there could be a mapping of context to file extension which could be configured in workspace settings in the case where multiple candidates are found (eg Loading.js, Loading.css)?

Thanks for your work!

import Loading from './Loading'
rexebin commented 5 years ago

Sorry for the delay in replying.

At the moment, the extention simply take the file name and relative path and try to find a file. It should be easy to set a configuration for a default extension if no extension is found.

I will try go to get it done after my short holiday leave.

Thank you!

rexebin commented 4 years ago

@ptim I tried in my TS project, when I press F12 in import statements, vscode opens ts file correctly. It should work for js imports as well.