Can VS Code automatically update JavaScript and TypeScript import paths on file rename/move?

前端 未结 2 1101
日久生厌
日久生厌 2021-02-12 18:28

Is there a module for vscode that would update paths towards files? e.g. if I have:

import \'./someDir/somelib\'

and I rename or move so

2条回答
  •  时光取名叫无心
    2021-02-12 18:59

    This feature was added for JavaScript and TypeScript in VS Code 1.24 (tracking issue)

    When you move or rename a file, you will now be prompted to see if you want to update imports:

    This is controlled by the javascript.updateImportsOnFileMove.enabled and typescript.updateImportsOnFileMove.enabled settings. Valid values are:

    • "prompt" — The default. Prompt for each file rename/move
    • "always" — Always try to update imports automatically without prompting
    • "never" — Do not update imports and do not prompt

提交回复
热议问题