facebook

Move refactoring doesn't work properly

  1. CodeMix & Angular IDE
  2.  > 
  3. Webclipse 1.x Help
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #532355 Reply

    Fedor Losev
    Participant

    When moving files either by drag & drop or Refactor -> Move, relative paths are not refactored and this results in errors ‘Cannot find module ../xxx’. These need to be refactored manually.

    Given the nature of typescript imports approach, in an existing codebase there are LOT of them and any folder structure change results in a LOT of manual pain and becomes a major friction source in rapid structure refactoring.

    Expected: no errors after move, file(s)/folder(s) move should refactor all reachable references to affected files and relative imports in these files when folder depth changes.

    Less major but still annoying issue, when moving multiple folders it fails with errors like ‘document is out of range’ and suggest an undo, the undo in turn results in similar errors leaving a complete mess.

    #532359 Reply

    Fedor Losev
    Participant

    The workaround for now is to use Visual Studio Code ts-move add-on. It works reasonable well, though it would not allow to select multiple folders and there is a bug requiring to restart the IDE after each move (second time it refactors but doesn’t move files resulting in a mess).

    But switching to another IDE for a quite frequent operation serves no good, neither for me nor for Genuitec.

    #532369 Reply

    Brian Fernandes
    Moderator

    Fedor,

    In response to your query, I checked with the dev team on this capability, and we believe it should already be working fine in CI 7.

    1) What version of Webclipse are you using?
    2) The refactoring wizard gives you the option of a preview. Does it suggest the right changes in the preview, at least?
    3) Can you give us an example of some refactoring that does not work? Perhaps we are testing a different case. We confirmed that imports using relative paths are corrected to reflect the new paths of the moved resources. Are you talking about something else?
    4) Does it work if you move just one file at a time as opposed to an entire folder?
    5) We’ll look into the multiple selection refactoring problem.

    Thanks!

    #532374 Reply

    Fedor Losev
    Participant

    Sorry, I didn’t clarify that the problem occurs when moving a folder or multiple files, didn’t try single file yet.

    Usually one refactors complete package/folder with many files (and most common refactoring case is moving a folder with multiple level sub-folders and files inside). So single file is not very helpful for this most important case.

    I’m using CI7 1.8.3.20170705

    I checked now and one single file basic case seems to work ok first time.

    But even with single file there seem to be problematic cases too, I don’t have a time now to prepare rigorously all consistently failing cases but you can try the following

    
    /a
      /b
        file1.ts
        file2.ts  -> import x from './file1.ts'
    

    1) Refactor/move file1.ts to /a – OK, file2.ts properly refactored for ‘../file1’
    2) Refactor/move file2.ts to /a – OK, file2.ts properly refactored for ‘./file1’
    3) Refactor/move file2.ts to /a/b – FAIL, file2.ts incorrectly retains ‘./file1’

    But, if I restart IDE after step 2, the step 3 seems to work OK. There are other sequences that don’t work in the similar fashion, first steps ok but then eventually fail unless IDE is restarted.

    Please let me know if you can reproduce or should I investigate what is wrong with my environment.

    This may be related to another, extremely annoying problem, which I didn’t report yet since it has complex inconsistent behavior and I had no time yet to reproduce it consistently (though it occurs frequently during development):
    from time to time, after massive rename, move, many compile errors, everything eventually is fixed and settles up and passes compilation without errors in Problem view. However, opening editor for some ts files still shows old intermediate module import error marks inside the editor, which will not go away until IDE restart (or may be until other major refactoring).
    Moreover, I suspect (but not sure) that until restart it affects refactoring and autocomplete which fail to work properly (that they don’t work properly sometimes until restart I’m sure, but not sure if these stale errors are the root of the problem since I can’t reproduce these failures consistently, they tend to happen on most busy work hours).

    #532379 Reply

    Brian Fernandes
    Moderator

    Fedor,

    Thanks for the detailed notes – it looks like synchronization issues are at the root of most of the problems you have described here.

    We’ll take a more detailed look and I’ll report updates as we learn more.

    #533367 Reply

    Fedor Losev
    Participant

    These sync issues are probably related to many other reported major problems, for example, quite frequently in template editor there are no components in assist drop-down (only generic tags) and no component is underlined/navigable with mouse + CTRL. Sometimes no clean, rebuild helps, but after IDE restart and rebuild it works again in the same template editor. But sometimes (usually not when multiple files caused the “desynchronization”) it can be fixed without restart by closing and opening again the same html file.

    #533499 Reply

    Brian Fernandes
    Moderator

    Fedor,

    You’re right – a synchronization problem would pretty much cause a lot of functionality to break.

    We’ve replicated some of these problems and are taking a serious look at these issues, with a view to making a fix available in our next release. We will let you know when a pre-release is available with a fix that you can test (likely sometime next week).

    Apologies for the inconvenienced caused, and thank you for continuing to report issues, hopefully we’ll get this knocked out soon.

    #535470 Reply

    support-piotr
    Participant

    Fedor,

    we have just released a prerelease of CI8, which includes vast improvements to refactoring. If your Eclipse is not yet configured for prerelease stream, please follow steps from: https://www.genuitec.com/forums/topic/webclipse-angular-ide-prerelease-stream/ , otherwise Help > Webclipse > Check for updates should get you an update. Let us know whether your problems have been correctly addressed!

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Move refactoring doesn't work properly

You must be logged in to post in the forum log in