facebook

Quick fix for 'xx is declared but never user' behaves incorrectly

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

    Fedor Losev
    Participant

    1) When file with the error is closed, quick fix is suggested but does nothing. When relevant file editor is opened, quick fix removes the declaration properly.

    Expected: should work like any other fix, no file is required to be open.

    2) Does not work on multiple errors: ‘The selected problems do not have a common applicable quick fix’. Expected: should work for multiple ‘never used’ errors.

    Unused errors frequently come in large bursts, making this quick fix completely pointless, now it is faster to remove by hand.

    #527264 Reply

    support-swapna
    Moderator

    Fedor,

    I see the error markers on a closed file go away when I apply the Quick Fix from the Markers view. It did not require me to open the file in the editor.

    Can you please share with us the exact error details for which the Quick Fix does not work unless the file is opened in the editor to help us investigate further?

    I have filed an enhancement request for the dev team to work on the quick fix for multiple ‘never used’ errors.

    Thank you for raising it.

    –Swapna
    MyEclipse Support

    #527266 Reply

    Fedor Losev
    Participant

    Hi Swapna, I wrote the exact error in the title, “xx is declared but never used”.

    To reproduce:

    Add any unused import, say add import { Component } from '@angular/core'; to empty ts file.
    Put "noUnusedLocals": true, in tsconfig compilerOptions.

    'Component' is declared but never used error will appear. Select the error in Problems or Markers view and apply the quick fix.

    – Apply quick fix for this error when file is closed. Import is not removed, nothing happens. Expected: import is removed.

    – Open the file without changes and apply the fix (in Problems or Markers view). The import is removed in editor but the file is not saved and the editor becomes unsaved. Expected: the import is removed without changing the editor to the unsaved state.

    – Open the file, make some changes without saving and apply the fix. Import is not removed and there is an NPE error in eclipse log. Expected: either should work like the fix was applied from an inline editor error marker (which works in this case) or display a message “can’t apply this quick fix to unsaved files”.

    #527272 Reply

    support-swapna
    Moderator

    Fedor,

    Thank you for the detailed steps. While I could replicate the inconsistent behavior with the Quick Fix, I could not replicate the problem when the Quick Fix is applied without saving the file. The Import is removed and no NPE is logged at my end.

    Are you working with the latest version i.e CI 6a which released on Friday?
    Can you please also share the .log file located at workspace dir/.metadata/.log for further investigation?

    –Swapna
    MyEclipse Support

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Quick fix for 'xx is declared but never user' behaves incorrectly

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