Open OliverJAsh opened 6 years ago
Are you using es6 style import/export in your .js
files?
@stringham Yes we are.
It would be possible to make this work, but I don't know how to tell the difference between a generated Js file and one that is part of the sources we care about. A lot of projects put the compiled js files next to their ts sources.
To make it work, changing the following might do it:
1) include .js
and .jsx
in the extensions array (we could make this user configurable).
2) Set the movets.filesToScan
user preference to include the javascript files you care about in your project.
I don't have a project to test this on though, but if we tried this, it definitely won't affect users who don't care about allowJs
/checkJs
.
Couldn't we check if the file is in the dependency graph of the current TS project? I.e. by tracing the graph from the files
, include
and exclude
options in tsconfig.json
.
@stringham @OliverJAsh I just tried @stringham 's suggestion above and it does indeed work for JS-only projects. I'm not sure about mixed js-ts projects. Maybe @OliverJAsh's suggestion would work:
Couldn't we check if the file is in the dependency graph of the current TS project? I.e. by tracing the graph from the files, include and exclude options in tsconfig.json.
@stringham I definitely think adding a "Move JS" command would be super useful. In the meantime I'm going to publish a fork of this repo that allows for JS to be moved.
@tnrich I'm happy to accept a pull request for this feature.
@stringham I just published my fork which should do the trick for me. https://marketplace.visualstudio.com/items?itemName=tnrich.move-ts-js
I'm afraid that making a whole new command might be a bit too much work for me atm.
VS Code now has this functionality out of the box, so isn't this package now redundant?
@OliverJAsh I haven't found that it works very well.. Maybe I'm mistaken but don't all the files in question have to be open for the path updates to take place?
I have a TS project that uses the
allowJs
andcheckJs
compiler options.Currently, if I use this extension to move a TS file/folder, none of the references from JS files are updated.
Is this due to https://github.com/stringham/move-ts/blob/b07397650865ef385d5ff49068bf7ae8d4bf28b4/src/index/referenceindexer.ts#L32?
Would this be easy to add support for?