Typescript refactoring
已回答
Hi,
I'm having an issue that has made typescript refactorings really painful. Every time I do a move or rename refactor, PyCharm converts all of the require statements from absolute to relative locations. It compiles but totally breaks our app, which is a bit scary. It's also arguably not great practice to use relative paths for library locations. Is there some way to configure so it forces use of absolute references?
Example:
import Blah = require('src/sibling/Blah');
becomes:
import Blah = require('../sibling/Blah');
cheers,
Miles
请先登录再写评论。
Does it look like this issue? What version of PyCharm are you using? I'll see if I can recreate it.
I guess you don't want to do the normal './src/sibling/Blah' because 'src' isn't actually a sibling of the place you're doing the import. Instead, you're adding to your path somewhere in your Node/webpack setup.
Yeah, actually it looks like the inverse of the issue because we're getting the non ./ changed. And yep we've configured a fixed root where all type information comes from. So refactoring should ideally only change up to the path segments that are affected by the move and not try to 'fix' anything else. :)
Hi Miles, sorry for the delay. I talked to the WebStorm team and they are working on it for 2017.1 on this ticket. It looks like it covers what you are describing. Can you (a) mark yourself as a watcher on that ticket and (b) comment if you have anything different to point out?