Code completion for unknown methods

I just coded a bit and realized that there is one situation that occurs quite often in which I would like IDEA to support me a bit.

Here is what I want:

1. I code and decide that I want to call a method which is not implemented yet. So I just write the method call, but certainly IDEA marks this as an error, because the method does not exist yet.
2. I start implementing the method. When writing the method header I would like to be able to type the first letters, then press CTRL+Space, and get the unknown method (for which a call already exists) proposed.

I know that there is an intention action to create the method, but wouldn't it be cool if IDEA was aware of unknown methods and fields, and propose them on CTRL+Space when you start implementing them?

What are your thoughts? Is this just something that I want, or would you find this feature helpful, too? Or does this even exist already and I just missed it?


0
Avatar
Permanently deleted user

Yes I must say I've often wanted this, more for fields/variables though.
I'm coding along in a method, I realise I need a new field, so I type in the
name of it, but I don't want to create the field there and then, I want to
carry on coding the method. So I continue, but then I want to reference the
field again later in the method, but code completion does not include it
anywhere. Is there an RFE for this?

N.

Jan Boesenberg wrote:

I just coded a bit and realized that there is one situation that
occurs quite often in which I would like IDEA to support me a bit.

>

Here is what I want:

>

1. I code and decide that I want to call a method which is not
implemented yet. So I just write the method call, but certainly IDEA
marks this as an error, because the method does not exist yet.
2. I start implementing the method. When writing the method header I
would like to be able to type the first letters, then press
CTRL+Space, and get the unknown method (for which a call already
exists) proposed.

>

I know that there is an intention action to create the method, but
wouldn't it be cool if IDEA was aware of unknown methods and fields,
and propose them on CTRL+Space when you start implementing them?

>

What are your thoughts? Is this just something that I want, or would
you find this feature helpful, too? Or does this even exist already
and I just missed it?



0
Avatar
Permanently deleted user

Personally, I just use the intentions and am quite happy with that solution. Is there a good reason you don't want to use the intention action?

0
Avatar
Permanently deleted user

Yes, there is. Usually when I do programming, I do not want to stop, exceute the intention action, implement the method, and then go on coding. I just want to code along and create the new methods when I am done.

Also the problem with this particular intention is that the new method usually gets created at a place where I do not want it to be. So I have to move the method up or down in the code to the place where I want it to be.

Its all not a great deal, but we all know that IDEA's strength is the sum of all those little things that make a coder's life easier.

0
Avatar
Permanently deleted user

I explicitly asked for this EXACT behavior long time ago
(definitely more than a year ago). I didn't get a positive
answer and there seemed to be no demand among the IDEA
users.

Perhaps, the situation is different now?

r.

Jan Boesenberg wrote:

I just coded a bit and realized that there is one situation that occurs quite often in which I would like IDEA to support me a bit.

Here is what I want:

1. I code and decide that I want to call a method which is not implemented yet. So I just write the method call, but certainly IDEA marks this as an error, because the method does not exist yet.
2. I start implementing the method. When writing the method header I would like to be able to type the first letters, then press CTRL+Space, and get the unknown method (for which a call already exists) proposed.

I know that there is an intention action to create the method, but wouldn't it be cool if IDEA was aware of unknown methods and fields, and propose them on CTRL+Space when you start implementing them?

What are your thoughts? Is this just something that I want, or would you find this feature helpful, too? Or does this even exist already and I just missed it?



0
Avatar
Permanently deleted user

I see your point, but when I create the method, I immediately hit CTRL-ALT-LEFT and go back to where I was and continue coding. I keep doing that, creating methods along the way, until I'm done coding the root method. Then I go and re-organize and implement all the newly created methods. I feel like this is ideal and I'm not wasting any time nor am I losing my train of thought.

0
Avatar
Permanently deleted user

i just click on the intention and have it implement it.

0
Avatar
Permanently deleted user

+10

I have a little story for u, that often occurs...:


I write the following code:

list.remove(obj);

if (


Uups, at that moment I want to check if "list.remove" returned true or false...
I continue:

if ( removedSuccesfully ){



then I add that bool to the upper statement, typing:


boolean r| list.remove(obj);

Trying Ctrl-Space
-->

boolean rB list.remove(obj);



And that is definitly not what I wanted Idea to do for me :)




0
Avatar
Permanently deleted user

See http://www.intellij.net/tracker/idea/viewSCR?publicId=1093 (btw it has
only one vote at the moment).

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"

"Jan Boesenberg" <no_mail@jetbrains.com> wrote in message
news:23546057.1059497364248.JavaMail.itn@is.intellij.net...

I just coded a bit and realized that there is one situation that occurs

quite often in which I would like IDEA to support me a bit.
>

Here is what I want:

>

1. I code and decide that I want to call a method which is not implemented

yet. So I just write the method call, but certainly IDEA marks this as an
error, because the method does not exist yet.

2. I start implementing the method. When writing the method header I would

like to be able to type the first letters, then press CTRL+Space, and get
the unknown method (for which a call already exists) proposed.
>

I know that there is an intention action to create the method, but

wouldn't it be cool if IDEA was aware of unknown methods and fields, and
propose them on CTRL+Space when you start implementing them?
>

What are your thoughts? Is this just something that I want, or would you

find this feature helpful, too? Or does this even exist already and I just
missed it?
>
>
>


0
Avatar
Permanently deleted user

Valentin Kipiatkov wrote:

See http://www.intellij.net/tracker/idea/viewSCR?publicId=1093 (btw it has
only one vote at the moment).


I only get an error when trying to look at that SCR:-(


javax.servlet.jsp.JspException: Unhandled exception thrown from
/trackerpages/thread.jsp:206
at jrun.jsp.tags.RequestDispatchTag.doEndTag(RequestDispatchTag.java:51)
at
jrun__trackerpages__form2ejsp16._jspService(jrun__trackerpages__form2ejsp16.java:518)
at jrun.jsp.runtime.HttpJSPServlet.service(HttpJSPServlet.java:43)
at jrun.jsp.JSPServlet.service(JSPServlet.java:106)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at
jrun.servlet.JRunRequestDispatcher.invokeNext(JRunRequestDispatcher.java:414)
at
jrun.servlet.JRunRequestDispatcher.include(JRunRequestDispatcher.java:348)
at
com.intellij.itn.servlets.DispatchServlet.gotoPage(DispatchServlet.java:47)
at
com.intellij.itn.tracker.servlets.TrackerDispatchServlet.processRequest(TrackerDispatchServlet.java:426)
at com.intellij.itn.servlets.DispatchServlet.doGet(DispatchServlet.java:33)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:241)
at
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
at
jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:348)
at
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
at
jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:294)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

Regards,
Bas

0
Avatar
Permanently deleted user

Timur Zambalayev wrote:

Me too. I just filed:
http://www.intellij.net/tracker/itn/viewSCR?publicId=621


Thanks. I just noticed I had never voted for "project: ITN" SCR before,
so I gave it all my votes:-)

Bas

0
Avatar
Permanently deleted user

Or, just go back when you're done, put the cursor on the undefined function
name, and hit Alt-Enter to implement the method then. There's no law saying
you have to do an intention the moment it pops up. You can always come back
and do it later.

This would seem to be exactly what Jan is looking for, no?

"Kirk Woll" <kirk@digimax.com> wrote in message
news:3611753.1059504389349.JavaMail.itn@is.intellij.net...

I see your point, but when I create the method, I immediately hit

CTRL-ALT-LEFT and go back to where I was and continue coding. I keep doing
that, creating methods along the way, until I'm done coding the root method.
Then I go and re-organize and implement all the newly created methods. I
feel like this is ideal and I'm not wasting any time nor am I losing my
train of thought.


0
Avatar
Permanently deleted user

As an alternative way of solving this problem, I would suggest something like jEdit's "Complete Word" command. This allows you to do autocompletion of arbitrary strings that are found elsewhere in the file. It works nicely for the cases described above, where you want to autocomplete with the name of a method or field that has been referenced but not yet declared. But it is also useful for lots of other things. For example, if you are writing a comment:


you can use it to autocomplete that method name. You can't do anything like this in IDEA.

Peter

0
Avatar
Permanently deleted user

Peter Eastman wrote:

As an alternative way of solving this problem, I would suggest something like jEdit's "Complete Word" command. This allows you to do autocompletion of arbitrary strings that are found elsewhere in the file. It works nicely for the cases described above, where you want to autocomplete with the name of a method or field that has been referenced but not yet declared. But it is also useful for lots of other things. For example, if you are writing a comment:

  * This is a utility method called by methodWithAVeryLongName()
>  */]]>


you can use it to autocomplete that method name. You can't do anything like this in IDEA.


You can do something like it. If you use the {@link} javadoc construct, IDEA
will be able to autocomplete methodWithAVeryLongName() for you:


Where '|' is the caret, pressing Ctrl+Space will expand into the full method
name. As an added bonus, you get a hyperlink to the relevant method in your
generated documentation... :)

I agree that it would be useful to have a "Complete Word" feature like you
suggest, though. I used to use vim, which also had that feature and it's one
of the few (only?) things that I occasionally miss about it.

Vil.
--
Vilya Harvey
vilya.harvey@digitalsteps.com / digital steps /
(W) +44 (0)1483 469 480
(M) +44 (0)7816 678 457 http://www.digitalsteps.com/

Disclaimer

This e-mail and any attachments may be confidential and/or legally
privileged. If you have received this email and you are not a named
addressee, please inform the sender at Digital Steps Ltd by phone on
+44 (0)1483 469 480 or by reply email and then delete the email from
your system. If you are not a named addressee you must not use,
disclose, distribute, copy, print or rely on this email. Although
Digital Steps Ltd routinely screens for viruses, addressees should
check this email and any attachments for viruses. Digital Steps Ltd
makes no representation or warranty as to the absence of viruses in this
email or any attachments.

0
Avatar
Permanently deleted user

But I do not want IDEA to tell me in what order I have to do things. The programmer should be the master, not the tool.

And the problem with the intention is still that you cannot control where the new method will be inserted. In 90% of all cases I will have to move the new method to the location where I want it to be.

0
Avatar
Permanently deleted user

> And the problem with the intention is still that you cannot control
> where the new method will be inserted. In 90% of all cases I will have
> to move the new method to the location where I want it to be.

Yes, this drives me nuts, too.

Tom

0

What if you had more choices on the Generate (Alt-Insert) popup menu?

Now it has Constructor, Getter/Setter, equals/hashcode.
How about adding a choice Intended method/fields. That could give you a dialog box with methods and fields that are referenced elsewhere but not yet implemented.

/Mikael

0
Avatar
Permanently deleted user

Mikael Karlsson wrote:

>What if you had more choices on the Generate (Alt-Insert) popup menu?
>Now it has Constructor, Getter/Setter, equals/hashcode.
>How about adding a ..
>

There was a long discussion about making smarter, by having it
use its context. It didn't end-up positively.

Currently is pretty dumb, as it's active everywhere, even in
aspects :
http://www.intellij.net/tracker/idea/viewSCR?publicId=14565

Alain


0
Avatar
Permanently deleted user

I notices something else that I would like to see.

If I type "public int getMyF" and hit CTRL+Space I want it to search for existing fields, and if a field that starts with "myF" exists, have it used for the completion. For example if "int myField" exists in the class, it should complete as "public int getMyField".

Currently it completes as "getMyFAnInt", which is pretty dumb and IMHO does more harm than good.

Here again, there are already ways to create getter/setter methods, but they do not fit into my natural working style.

0
Avatar
Permanently deleted user

+1

0
Avatar
Permanently deleted user

I submitted this as a request about a week ago (Tracker Request #14760). Unfortunately the status is still "Submitted". Maybe some more votes could help changing the status to "Open".

0
Avatar
Permanently deleted user

I thought, it already worked. At least after the get.

Tom


Jan Boesenberg wrote:

I notices something else that I would like to see.

If I type "public int getMyF" and hit CTRL+Space I want it to search for existing fields, and if a field that starts with "myF" exists, have it used for the completion. For example if "int myField" exists in the class, it should complete as "public int getMyField".

Currently it completes as "getMyFAnInt", which is pretty dumb and IMHO does more harm than good.

Here again, there are already ways to create getter/setter methods, but they do not fit into my natural working style.


0
Avatar
Permanently deleted user

I submitted this as a request about a week ago (Tracker Request #14760).

Unfortunately the status is still "Submitted". Maybe some more votes could
help changing the status to "Open".

The status "Submitted" means that it has not been processed by its
responsible engeneer (his on vacations actually). You may vote for it but
voting has nothing to do with processing of submitted requests.

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"


"Jan Boesenberg" <no_mail@jetbrains.com> wrote in message
news:31780755.1060787884062.JavaMail.itn@is.intellij.net...

I submitted this as a request about a week ago (Tracker Request #14760).

Unfortunately the status is still "Submitted". Maybe some more votes could
help changing the status to "Open".


0
Avatar
Permanently deleted user

Just keeping this thread on first page and in mind :)...

0

请先登录再写评论。