Javascript > Eclipse > Automatic Code Normalization

Source: Internet
Author: User

reference:http://blog.csdn.net/jmyue/article/details/11060003

Large projects are often done together by a lot of people, but everyone has their own style, which leads to the fact that the code for the entire project is not only inconsistent with the language specification, but also very difficult to read. Therefore, this kind of project will introduce Checkstyle, to standardize everyone's coding style, try to be unified and reasonable. After we have written the code, we have to take the time to manually solve the problem of the Checkstyle prompt, which is a very boring and time-consuming task. Here's how to take advantage of the eclipse configuration, and after we've written the code and saved it, Eclipse will automatically help us solve the checkstyle problem.

1. Formatter settings

Menu:suitecloudide---Preferences, JavaScript---Code Style--Formatter

Shortcut keys: Command +,

The active profile displays the code that is currently in use to automatically format the configuration. Click the "Export All ..." button to export the Code auto-format configuration in Eclipse, click the "Import ..." button to import the locally existing configuration file, and the imported and exported files are in XML format. You can click on the "New ..." button to create a new configuration of your own, based on an existing configuration in eclipse.

After the formatter is set up, you can format the selected code using OPTION + Command + F or the right-click menu, Source-. (Mac shortcut key)

2. Save Actions Settings

Select "Perform the selected actions on save" and the following three check boxes, where "Format source code" is to automatically format the code in the save file according to the formatter set above, and the entire JS file will be formatted with format.

Javascript > Eclipse > Automatic Code Normalization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.