Steps to Reproduce:
Found that this issue has bigger impact:
javascript.updateImportsOnFileMove.enabled optionjavascript.updateImportsOnFileMove.enabled can be of: {'prompt', 'always'} and fail to update imports in both cases.Minimal reproduce:
"javascript.updateImportsOnFileMove": "always" in VSCode settingsapp.js and lib/components/a.js in the following filesystem hierarchy:โโโ app.js
โโโ lib
โโโ components
โโโ a.js
// lib/components/a.js
module.exports = 1;
// app.js
const a = require('./lib/components/a.js');
lib/components directory to components (one hierarchy level up) using the Explorer (drag and drop with mouse):โโโ app.js
โโโ components
โย ย โโโ a.js
โโโ lib
Expected (app.js import should be updated):
// app.js
const a = require('./components/a.js');
In reality (app.js import was not updated):
// app.js
const a = require('./lib/components/a.js');
Tested on VSCode stable 1.32.3
UPDATE: Bug still present at VSCode stable 1.33.1
Still present in VS Code 1.35.1
Hi All,
@mjbvz
This issue seems fixed now in the latest update 1.40.1
However.. it is not prompting even if I selected prompt.
settings.json shows "javascript.updateImportsOnFileMove.enabled": "prompt" but its behaving as if user selected always.
Having said that, I still believe the current behavior is the correct one as there may be times where user rejects the auto update prompt accidentally which may break the code.
It's not properly fixed. Sometimes moving a folder updates the imports of the TS files inside it. Sometimes it doesn't. There doesn't seem to be any reason for why/when, it's just random. E.g. I can try to move a folder and none of the imports are updated. I reset my git state, try again, and it works. Sometimes even when it does work, broken copies of the original files get left behind in the source directory.
I am also experiencing this issue still. TypeScript or JS files regardless of whether it is in a folder or not. Auto import enabled in settings
I am also experiencing what @jonrimmer describes. I moved a folder containing subfolders and files to a new folder and was shown the prompt asking if I'd like to update imports and clicked yes. The folder and its contents were moved the new location but versions of some of the files - identical apart from containing non-updated import paths - were left behind in the original location.
I've the same problem. Has somebody done it?
Might be caused by the consecutive prompts, one for confirming the Move, one for the import updating.
The second prompt seems to open reliably when you tick "Don't show again" on the first one.
I've got this problem as well. Moving files works well, but moving folders doesn't update the paths.
Most helpful comment
It's not properly fixed. Sometimes moving a folder updates the imports of the TS files inside it. Sometimes it doesn't. There doesn't seem to be any reason for why/when, it's just random. E.g. I can try to move a folder and none of the imports are updated. I reset my git state, try again, and it works. Sometimes even when it does work, broken copies of the original files get left behind in the source directory.