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 245027 - Codecompletion and method-arguments in Java/JavaScript/HTML for a developer coming from Eclipse
Summary: Codecompletion and method-arguments in Java/JavaScript/HTML for a developer c...
Status: NEW
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P2 normal with 1 vote (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-13 07:23 UTC by colerend
Modified: 2014-10-06 13:25 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 colerend 2014-06-13 07:23:47 UTC
Hello!

As the topic states I have been using eclipse most of my professional life and only started using netbeans in february, I'm really liking it overall, not least how absolutely gorgeous the IDE is to look at, but I have one issue I would really love to get "resolved".

I [b]really[/b] miss the way that code completion works in eclipse, and have been unable to find any setting for my particular issue with the completion in NetBeans. This is in spite of the fact that NetBeans sometimes behave exactly the way I want - something which leads me to believe that the type of functionality I am after could potentially only be a matter of editing the right configuration file.

To elaborate...

What I am after does not have a formal "name" (afaik), so I think it is best to just describe how it works with the one usecase where NetBeans behaves as I prefer. In my examples below I use $c to indicate where the cursor is currently located.

Starting up NetBeans and creating a new class with a main() method, followed by typing:
[code]System.out.println$c[/code]
...continuing with Ctrl+Space for intellisense selection options and picking the first one which has an argument [b](Object x)[/b]. Following up by pressing Enter expands the written expression to the following
[code]System.out.println(<marked argument-stub to overwrite $c>);[/code]

One can now write whichever argument is preferred to replace the argument-stub, which followed by Enter this results in:

[code]System.out.println(myVar);$c[/code]

The key points here are in the details.
1) On selecting an intellisense alternative - the line is completed including a trailing semicolon, and it only needs my input for replacing the autocompleted argument-stubs [b]c[/b].
2) When I have overwritten the argument-stubs I can smoothly continue with pressing Enter, but (and this is important) [b]without[/b] breaking the line up - my cursor is placed [b]after[/b] the semicolon at the end of the row, meaning I can press Enter again and continue with a new statement on the next row. 

All of these things provide me with a very smooth user experience, greatly appreciated! 
Basically I would like this type of code-completion [i]behaviour[/i] in many more places of NetBeans. Specifically being able to hit Enter efter a method- / functioncall to complete my statement, without breaking the line into two rows. Not least I would also like it in both JavaScript and HTML editor.

Here are the problems I'm currently presented with, due to not having the desired behaviour.

[u]Issue 1[/u]
The only issue with the Java-aspect of this functionality is if one [b]doesn't[/b] trigger the intellisense to select one of the overloaded methods. If instead we write the opening parentheses (autocompleting the closing parentheses, placing the cursor inside) and enter a string, followed by pressing Enter, instead of the Enter-keypress moving us smoothly out of the method-call as before, NetBeans now breaks the line to the next row, leaving me with the following:

[code]
System.out.println("testing"
						+ "$c")
[/code]

I would greatly prefer if it instead interpreted my Enter keypress as me being done with the argument/methodcall, and placed me after the method parentheses as when I had picked an intellisense alternative (but without [b];[/b] ) like so:

[code]System.out.println("testing")$c[/code]

[u]Issue 2[/u]
Same issue but when coding JavaScript. If i write a function-call, including the parentheses for it, then input an argument for it, followed by pressing [b]Enter[/b] or [b]Tab[/b], I would like the cursor to jump out of the parentheses without breaking the line into two rows.

Current result:
[code]		console.log("just testing\n\
$c")[/code]

Expected result:
[code]		console.log("just testing")$c[/code]

[u]Issue 3[/u]
This is basically the same issue, but in its HTML-editing representation. If I begin by writing:
[code]<sp$c[/code]
.. intellisense kicks in and shows me the option of inserting a <span> tag. On pressing selecting the span-tag from intellisense I would expect the following:

[code]
<span>$c</span>[/code]
..which followed by [b]Enter or Tab[/b] should result in
[code]<span>"text written after picking the span-tag"</span>$c
[/code]

.. instead, after the intellisense-selection, I end up with this

[code]<span$c[/code]

Like I wrote in the beginning, I have a strong feeling all of this is achievable in NetBeans, perhaps by simply editing the correct configuration-file?

I apologize for the long post, but since I have been unable to find a solution and don't know exactly what to call this functionality, I felt I had to describe it thoroughly so as to not be misunderstood.

Sincerely,
Cole.
Comment 1 Dusan Balek 2014-07-07 10:12:58 UTC
As for Java part of this issue: By picking an intellisense alternative of a method call with arguments, editor switches to the special 'code template editing' mode where 'Enter' and 'Tab' are interpreted as commands to select the next parameter to edit. However, I doubt that the same behavior would be appreciated in the 'plain editing' mode. Imagine a situation that someone really wants to put a newline inside a method call arguments.

Reassigning to HTML editor for evaluation of the HTML part.
Comment 2 colerend 2014-07-23 06:36:05 UTC
(In reply to Dusan Balek from comment #1)
> As for Java part of this issue: By picking an intellisense alternative of a
> method call with arguments, editor switches to the special 'code template
> editing' mode where 'Enter' and 'Tab' are interpreted as commands to select
> the next parameter to edit. However, I doubt that the same behavior would be
> appreciated in the 'plain editing' mode. Imagine a situation that someone
> really wants to put a newline inside a method call arguments.
> 
> Reassigning to HTML editor for evaluation of the HTML part.

Here's the thing though. The "special mode" (code template editing) of modifying the method/function arguments is very slick and productive. What I am after is the same kind of code-completion for the HTML and JavaScript editors.

Note that I am not necessarily asking for this to be defaulted into NetBeans standard behaviour. What I am firstly asking is if there is *any way whatsoever* that I personally can get this behaviour. Ie: would it not be possible to achieve this by editing a configuration file? I get the feeling the amount of configuration possible with NetBeans is probably vastly greater than what is displayed in the Settings.

This is most likely true atleast for the code-completion offered in the HTML editor. Changing this so that an intellisense-selected option inserts not a half-broken HTML tag ('<span ') but an more complete result ('<span></span>') simply "must" be possible... ?

Regarding the JavaScript and Java functionality, I feel much the same way, ie: surely it "must" be possible to somehow trigger a "code template editing"-mode after inserting dual parentheses, or during some other arbitrary, configured, circumstances? (for instance, is there any way of "manually" entering the "code template editing"-mode, "on-demand" ?)

Thank you
Cole