New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
moving TypeScript files in explorer fails to update/prompt imports when containing folder is moved #58987
Comments
Found that this issue has bigger impact:
Minimal reproduce:
// lib/components/a.js
module.exports = 1; // app.js
const a = require('./lib/components/a.js');
IssueExpected ( // app.js
const a = require('./components/a.js'); In reality ( // 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, 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. |
I've got this problem as well. Moving files works well, but moving folders doesn't update the paths. |
I have the same problem, I am working on an ionic project |
For a typescript project faced similar issue from in my end for the following settings,
I have changed the settings to
My VS Code Version
|
This comment was marked as duplicate.
This comment was marked as duplicate.
I have this same issue with this settings: "typescript.updateImportsOnFileMove.enabled": "always", For me this settings don't help "javascript.updateImportsOnFileMove.enabled": "prompt",
"typescript.updateImportsOnFileMove.enabled": "prompt", 665f959d-f30d-46ac-b813-b882dfe5ae88.mp4I'm expect that import path will be updated once file/files moved to antoher directory |
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: