Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop VSCode from changing import paths on moving file?

My import react from 'react'

got changed to

import React from '../../../../../../../Library/Caches/typescript/2.9/node_modules/@types/react';

How do i revert this? I accidentally hit YES when VSCode asked me.

like image 716
Spacemoose Avatar asked Jul 24 '18 12:07

Spacemoose


People also ask

How do I turn off saved changes in Visual Studio code?

Click the (...) button and then select Undo Last Commit to undo the previous commit. The changes are added to the Staged Changes section.

What does VS Code sync changes do?

There is a Synchronize Changes action in the Status Bar, next to the branch indicator, when the current checked out branch has an upstream branch configured. Synchronize Changes will pull remote changes down to your local repository and then push local commits to the upstream branch.


1 Answers

How to stop VSCode from changing import paths on moving file?

Open VSCode settings (menu -> File -> Preferences -> Settings) and search for typescript.updateImportsOnFileMove.enabled.
Click on the pen icon in the gutter of the configuration line and choose prompt or never.

How do i revert this? I accidentally hit YES when VSCode asked me.

I'm afraid there is no way to undo this change. VSCode does the refactoring in all files where the moved files is included but afaik it doesn't provide a way to undo such operations.

like image 116
axiac Avatar answered Sep 17 '22 12:09

axiac