IDEA:“将语句分配给新的局部变量”? [英] IDEA: "Assign statement to new local variable"?

查看:1421
本文介绍了IDEA:“将语句分配给新的局部变量”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

长期以来,Eclipse用户正在使用IntelliJ IDEA 10进行一些操作。我似乎无法找到如何执行为新的本地变量分配语句代码完成。

As a long time Eclipse user, I'm playing around a little bit with IntelliJ IDEA 10. I can't seem to find out how to perform an "Assign statement to new local variable" code completion.

功能说明:

我输入如下

new BufferedOutputStream(out)

然后点击 Cmd(或Ctrl) + 1 并输入,Eclipse将该行更改为:

and then hit Cmd (or Ctrl)+1 and enter, and Eclipse changes the line into:

BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(out);

同时,我可以立即输入bufferedOutputStream来重命名它(或从选项bufferedOutputStream,outputStream和stream来自一个下拉列表)。

At the same time, I can type over "bufferedOutputStream" immediately to rename it (or select from the options "bufferedOutputStream", "outputStream" and "stream" from a dropdown).

我使用这个功能来完成每个任务,这是一个巨大的时间保护 - 这必须可以在IDEA中使用 - 但是它隐藏在哪里?

I use this feature for absolutely every assignment, and it's an enormous time saver - this must be available in IDEA, too - but where is it hidden?

推荐答案

Refactor |在Windows上引入变量 Ctrl + Alt + V )。请注意,如果文本是当前行中唯一的文本,则不需要选择该文本。然后,您可以像您所描述的一样更改变量名称,然后按 Enter 完成编辑。

Refactor | Introduce Variable (Ctrl+Alt+V on Windows). Note that you don't need to select the text if it's the only text in the current line. Then you can change the variable name in-line just like you've described and press Enter to complete editing.

这篇关于IDEA:“将语句分配给新的局部变量”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆