java – 通过HotKey防止Eclipse中的代码格式化
发布时间:2020-12-14 05:58:14 所属栏目:Java 来源:网络整理
导读:我知道可以通过包含代码来阻止 eclipse中的代码格式化 // @formatter:off// my awesome formatted code...public SetPerson transformCustomersToPersons(ListCustomer customers){ SetPerson persons = new HashSetPerson(); for (Customer customer : cust
我知道可以通过包含代码来阻止
eclipse中的代码格式化
// @formatter:off // my awesome formatted code... public Set<Person> transformCustomersToPersons(List<Customer> customers){ Set<Person> persons = new HashSet<Person>(); for (Customer customer : customers) { persons.add(new Person( customer.getFirstname(),customer.getLastname(),customer.getTitle(),customer.getBirthday(),customer.getAddress(0).getCity(),customer.getAddress(0).getStreet(),customer.getAddress(0).getHousenumber(),customer.isMan() ? "m" : "w",customer.getCardNumber()) ); } return persons; } // @formatter:on 但我不想一直手动编写它.只需标记代码,按热键即可防止格式化,这将是完美的. 谁知道怎么样?谢谢! 解决方法
是的,这是可能的:
创建新模板: 给模板命名像非格式化器并放置模式: // @formatter:off ${line_selection}${cursor} // @formatter:on 现在,您可以选择文本并键入Alt Shift Z和一些模板 – 此处为4 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |