Bug 15589 - code assist adds extra semicolons in import type declarations
Summary: code assist adds extra semicolons in import type declarations
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: 4.15 M3   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
: 392897 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-05-08 19:03 EDT by Luc Bourlier CLA
Modified: 2020-03-19 05:05 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luc Bourlier CLA 2002-05-08 19:03:43 EDT
1. open a compilation unit.
2. put the cursor at the end of a import type line, just before the semicolon.
3. hit [CTRL SPACE], select the right type if necessary, the code is completed
and a simecolon is added, even if there is already one.
Comment 1 Erich Gamma CLA 2002-05-11 06:29:57 EDT
we insert the completion proposal we get from code assist.
Code assist should check whether there is already a semicolon before adding 
one. 

Moving to JDT CORE
Comment 2 Philipe Mulet CLA 2002-05-13 06:14:29 EDT
Nice to have
Comment 3 Philipe Mulet CLA 2002-06-11 08:25:47 EDT
Defer
Comment 4 Philipe Mulet CLA 2002-06-11 08:38:21 EDT
Defer
Comment 5 Philipe Mulet CLA 2002-06-11 08:39:33 EDT
Defer
Comment 6 Eclipse Webmaster CLA 2009-08-30 02:43:20 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.
Comment 7 Eclipse Genie CLA 2020-02-11 15:04:29 EST
New Gerrit change created: https://git.eclipse.org/r/157519
Comment 8 Stephan Herrmann CLA 2020-02-11 15:08:35 EST
(In reply to Eclipse Genie from comment #7)
> New Gerrit change created: https://git.eclipse.org/r/157519

Wow, it's risen from the dead :)

Not inserting the duplicate ';' is easy. Unfortunately JDT/UI meanwhile abuses presence of a terminating ';' to detect if a proposal is an import proposal, when deciding whether or not to insert type arguments.
I'm preparing for a better solution in JDT/UI by setting a new token location, as CompletionContext.TL_IN_IMPORT;

Change for JDT/UI leveraging TL_IN_IMPORT is coming in a minute. Unfortunately, both have to be released at the same time to avoid test failures.
Comment 9 Stephan Herrmann CLA 2020-02-11 15:09:37 EST
*** Bug 392897 has been marked as a duplicate of this bug. ***
Comment 11 Stephan Herrmann CLA 2020-02-11 17:13:24 EST
I directly pushed corresponding changes in JDT/UI via https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=7819cf0adee7f552aa09935578c327ed58fb38cd

Locally JDT/UI tests ran fine (except for some unrelated intermittent hick-ups).

Here we switch strategy in FillArgumentNamesCompletionProposalCollector from looking for ';' towards using the new constant CompletionContext.TL_IN_IMPORT.

Additionally, I added some tests to CodeCompletionTest to ensure the expected replacement behavior.

Released for 4.15 M3