This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 152079 - Fix Imports remove duplicate and unused imports
Summary: Fix Imports remove duplicate and unused imports
Status: CLOSED INVALID
Alias: None
Product: python
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Torbjorn Norbye
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-01 09:02 UTC by Peter Lam
Modified: 2017-06-23 08:05 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Lam 2008-11-01 09:02:25 UTC
build 126 (20081031)

When the Imports options for 'Remove Duplicate Imports' and 'Unused imports: Leave Alone' are set
(Tools->Options->Editor->Formatting->'Language:Python & Category:Imports'), doing the 'Fix Imports' action on in the
editor still remove all the duplicate and unused imports.
Comment 1 Peter Lam 2008-11-01 09:05:42 UTC
Selecting 'Unused imports: Comment Out' also remove unused imports instead of commenting out unused imports.
Comment 2 Torbjorn Norbye 2008-11-01 17:54:51 UTC
Hi Peter,

Those settings pertain to formatting. When people format their code, they may not want it to add/remove imports. But that's precisely what "Fix Imports" is 
for - it tries to add imports (if any are missing) and remove imports (if some aren't needed).  "Fix Imports" is more invasive, and takes more time to 
compute. That's why you have the option of turning it off during formatting - you can turn off touching the imports at all, or you can have it organizing the 
imports but not adding/removing. Fix Imports is independent of that.

When you run "Fix Imports", it also organizes the imports, so it will use the formatting settings for that. It probably -should- use the comment-out versus 
delete preference from the formatting settings in this case. Leave the bug open to track that issue.
Comment 3 Peter Lam 2008-11-05 06:45:00 UTC
You're right, Tor. I confused with Fix Imports, but it seems to make sense for Fix Imports to share a few of the
settings too.
Comment 4 Jenselme 2017-06-22 19:20:45 UTC
Not sure it is still relevant with the current version. Closing this as old bug. If this is still a thing, please reopen and accept my apologies.
Comment 5 Jiri Kovalsky 2017-06-23 08:05:46 UTC
Thanks for your evaluation Julien. Reporter, if you think your issue is still valid and needs to be addressed, don't hesitate to reopen it with additional information. Closing for now.