如何使用“sysout” Eclipse中带有选定文本的代码片段? [英] How to use the "sysout" snippet in Eclipse with selected text?

查看:146
本文介绍了如何使用“sysout” Eclipse中带有选定文本的代码片段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Eclipse代码片段sysout,它完全被System.out.println()替换;



这是非常有用的,但有时我需要在System.out.println();

$ b中包装一些现有的代码
$ b

在Eclipse内部构件中,模板被定义为能够包裹所选择的单词。但是如何使用代码段选择文本,因为键入sysout显然会删除选定的文本。



任何想法?

解决方案

sysout模板适用于整个Java语句。


  1. 突出显示编辑器。

  2. 点击CTRL-SPACE(或任何您为内容辅助设置的内容)。

  3. 键入sysout,然后按Enter键。请注意,当您输入sysout时,暂时覆盖您的声明(但是当您点击时,它将会被 System.out.println 包裹起来输入。)


I am aware of the Eclipse snippet "sysout" which is neatly replaced with System.out.println(); when tab-completed.

This is very useful but sometimes, I need to wrap some existing code in a System.out.println();

In Eclipse internals, the template is defined as being able to wrap a "selected word". But how can I use the snippet with selected text since typing "sysout" obviously removes the selected text.

Any idea?

解决方案

The sysout template acts upon entire Java statements.

  1. Highlight a statement in the editor.
  2. Hit CTRL-SPACE (or whatever you have set up for content assist.)
  3. Type sysout then hit enter. Note that when you're typing sysout it will temporarily overwrite your statement (but it will come back wrapped by System.out.println when you hit enter.)

这篇关于如何使用“sysout” Eclipse中带有选定文本的代码片段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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