stringham / move-ts

A Visual Studio Code plugin for updating relative imports when moving typescript files and folders in your workspace.
MIT License
52 stars 15 forks source link

absolute paths are not found #10

Closed scottwio closed 6 years ago

scottwio commented 7 years ago

Typescript allows you to us absolute paths to references imports. These however do not get detected by this plugin. Is there any way you could find and change these paths.

import { PromotionEffect } from 'app/shared/store-effects/promotions.effect';

Thanks for the plugin, so helpful

stringham commented 7 years ago

Yes, if the module resolution is set to "classic" then typescript will look for other ways to resolve paths other than the relative path.

However, it's more complicated than just being "absolute" from the root of the project. See https://www.typescriptlang.org/docs/handbook/module-resolution.html#classic for the description.

Currently, this extension resolves and updates relative paths with a combination of regular expressions. In order to update imports for their "classic" module resolution it would either require a lot of work, or potentially may need an API from the TypeScript team to be implemented: https://github.com/Microsoft/TypeScript/issues/6487 .

stringham commented 6 years ago

Added a user setting in version 1.9.0. Set movets.relativeToTsconfig to true to enable.