Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317971 - Code completion inserts unnecessary qualified name
Summary: Code completion inserts unnecessary qualified name
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: SR1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-25 09:23 EDT by Sebastian Benz CLA
Modified: 2017-09-19 16:03 EDT (History)
2 users (show)

See Also:
sebastian.zarnekow: helios+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Benz CLA 2010-06-25 09:23:19 EDT
When importing a namespace and its subnamespace, the code completion inserts a qualified name for an referenced element even though the subnamespace is imported. 

Example:
...
import datatypes.*
import datatypes.subtypes.*

interface senderReceiver MyTest {
  data subtypes.MyUInt8 <- inserted by code completion
       ################  
}

The problem is that in:
ImportedNamespaceAwareLocalScopeProvider#getImportedElements(...)

...
for (ImportNormalizer normalizer : normalizers) {
  final String newName = normalizer.longToShortName(input.getName());
  if (newName != null) {
    return new AliasedEObjectDescription(newName, input);
   ...

the first shortened name is returned (which might not be the shortest one). A workaround is to store the importNormalizers in a Set that is ordered by the length of the imported name.
Comment 1 Sven Efftinge CLA 2010-08-03 05:05:53 EDT
The precedence has been inverted, such that given your example the shorter name comes first (i.e. precedence is bottom up). 
This allows to reference using the longer name as well, and lets the user control the precedence of imports.
Comment 2 Karsten Thoms CLA 2017-09-19 16:03:42 EDT
Closing bug which were set to RESOLVED before Eclipse Neon.0.