microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.2k stars 28.55k forks source link

Auto update import on file move - doesn't work #70689

Closed syedsimanta03 closed 5 years ago

syedsimanta03 commented 5 years ago

Auto update import on file moved not working on VS code latest version for Create React APP. Please save my life.

mjbvz commented 5 years ago

Please share steps to reproduce the problem.

/needsMoreInfo

vscodebot[bot] commented 5 years ago

Thanks for creating this issue! We figured it's missing some basic information or in some other way doesn't follow our issue reporting guidelines. Please take the time to review these and update the issue.

Happy Coding!

syedsimanta03 commented 5 years ago

Steps to Reproduce:

clone https://github.com/g3offrey/example-node-repository try to move file from folder1 to another folder or to the root check if the require path in index.js is updated Does this issue occur when all extensions are disabled?: Yes

If I can do something to help, don't hesitate to ask me.

feature link : https://code.visualstudio.com/updates/v1_24?WT.mc_id=vscodemay18-twitter-brcl#_update-import-paths-when-a-file-is-moved-or-renamed

"javascript.updateImportsOnFileMove.enabled" : "always",

not working. I am working on a react project and it took me 2hrs to change file path again manually Thank you @mjbvz

mjbvz commented 5 years ago

Hi, I can't access that repo.

This sounds like a potential duplicate of #62018 as well. Can you test in the next VS Code insiders build as well (the fix for #62018 was checked in today so it will only go out in the next build)

syedsimanta03 commented 5 years ago

use this repo to reproduce: https://github.com/kabirbaidhya/react-todo-app

Go TO :- react-todo-app/src/components/ui/ into that repo

Move the footer.js

To : - react-todo-app/src/components/ here

and check react-todo-app/src/components/ui/TodoList.js

the import path should be updated automatically according to new vs code release the doc has

"javascript.updateImportsOnFileMove.enabled": "prompt", "typescript.updateImportsOnFileMove.enabled": "always",

But it doesn't even work on VS code insider. I also checked after disabling all extensions. Please try to understand. Everybody saying about it and migrated to webStorm. So plz save my life man. Thanks

@mjbvz

mjbvz commented 5 years ago

Thanks for the project example.

I think you need a jsconfig.json file. This makes VS Code treat all js files in your workspace as part of the same project (even if they have not been opened yet) Just create a file called jsconfig.json at the root of your project:

{
    "compilerOptions": {
        "target": "es6"
    },
    "exclude": [
        "node_modules"
    ]
}

See the jsconfig docs for more info

After creating the config, here are the changes:

Screen Shot 2019-04-08 at 4 53 06 PM