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 246447 - Embrace variable next to cursor when opening parethesis is written
Summary: Embrace variable next to cursor when opening parethesis is written
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-14 02:39 UTC by pekarna
Modified: 2014-08-14 06:17 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pekarna 2014-08-14 02:39:54 UTC
This would be very helpful on many many ocassions:

Imagine you're editing a code:

class Foo {
  String path;

  setPath( String path ){
      this.path = path;
  }
}

Then you decide to change path to Path.

      this.path = Paths.get(path);

So you set the cursor to 
      this.path = |path;

But, when writing the parenthesis, NetBeans will auto-complete:

      this.path = Paths.get(null)path;

So you actually have to delete the "null)" part and fix it.

It would be very convenient if in situations like this (i.e. method has 1 parameter of the type of the variable right after the cursor), NetBeans would  put the closing parenthesis after the variable.

It would also enter that "edit expression in a box" when you can change that, and if rewritten, the original variable would appear again after closing parentheses. But if accepted (i.e. enter pressed), it would stay in.

I hope I described it clearly :)
Thanks for considering.