Autocomplete Import relative paths in Javascript (or other languages where possible)

When I import files as relative paths in my project, I would like the paths to autocomplete. Komodo already knows the directory structure of the project, because at the bottom bar I can click on a folder and it lists all the files in that folder, so I am guessing it could be a fairly easy implementation? (Just a guess).

For example,

import ComponentName from ‘…/…/components/ComponentName’;

‘components’ directory should be available on autocomplete.
‘componentName’ filename should be available on autocomplete

To take this to the next level, what if we use aliases? If we use aliases we don’t have relative paths, but the webpack config file is where we define which directories are made as aliases, for example:

import ComponentName from ‘components/ComponentName’;

alias: {
Components: path.join(__dirname, ‘src’, ‘Components’),
},

If we have an option to select the webpack config in our project settings, then you could check for aliases and add them to the autocomplete for import statements?

@stereofx I created a addon that does allow you to generate relative paths (from file or project root):

It only does not implement any aliases.

@babobski that’s great! I will install now. Just having relative paths is a big help anyway.

Thanks for letting me know about that!

1 Like