Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 473574

Summary: Content assist is confused by parentheses inside string
Product: [Eclipse Project] JDT Reporter: Nathan Ridge <zeratul976>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: stephan.herrmann
Version: 4.6   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Nathan Ridge CLA 2015-07-25 17:21:24 EDT
Steps to reproduce:

  1. Start with the following code:

       class X {
           void foo(String a) {}
       
           void bar() {
               // type here
           }
       };

  2. At the indicated location, type 'foo', and then press Ctrl+Space
     to get content assist to complete the parentheses and show foo's
     arguments in a hover.

     Now the line looks like this:
    
       foo(a);

     with the 'a' being selected.

  3. Now start typing the string "(x)" as the argument.

     When you type the closing parentheses in the string, rather than
     entering the closing parenthesis, content assist skips ahead to
     the end of the line without entering anything, leaving the
     following malformed line:

       foo("(x);

It looks like content assist is interpreting the closing parenthesis as closing the argument list of the function, but it should know that since I'm typing inside a string, the parenthesis must be part of the string.
Comment 1 Stephan Herrmann CLA 2015-07-26 06:31:12 EDT
I agree that ")" is sometimes overeager in jumping forward instead of inserting.

This particular issue only happens on the last argument and if you start typing while 'a' is still selected. Enter or DEL make it behave.

At first I wondered if this is caused by failing to insert a pair of " as the editor normally does, but even if you type "", go back one, and try to insert (x) the undesired jump-to-end happens.
Comment 2 Eclipse Genie CLA 2020-03-20 12:10:07 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.