Divide by Zero
Divide by Zero

Reputation: 1474

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.

Upvotes: 13

Views: 9294

Answers (1)

axiac
axiac

Reputation: 72256

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.

Upvotes: 27

Related Questions