![]() The formatter modifies only the characters between blocks, and the tree of blocks must be built in such a way that the bottom-level blocks cover all non-whitespace characters in the file: otherwise the characters between blocks may be deleted by the formatter. The structure of blocks is usually built in such a way that it mirrors the PSI structure of the file - for example, in Java code, the top-level formatting block covers the entire file, its children cover individual classes in the file, blocks on the next level cover methods inside classes, and so on. The formatting model is requested to insert the calculated whitespace characters at necessary positions in the file. The formatting engine calculates the sequence of whitespace characters (spaces, tabs and/or line breaks) that needs to be placed at every block boundary, based on the formatting model provided by the plugin. ) with associated indent, wrap, alignment and spacing settings. The formatting model is requested to build the structure of the file as applies to formatting, as a tree of blocks ( ![]() ![]() ), implemented by the plugin, provides a formatting model ( The process of formatting a file or a file fragment consists of the following main steps: In this framework, the plugin specifies the constraints on the spacing between different syntax elements, and the formatting engine, provided by the IDE, calculates the smallest number of whitespace modifications that need to be performed on the file to make it match the constraints. The IntelliJ Platform includes a powerful framework for implementing custom language formatters. Safe Delete Refactoring Code Inspections and Intentions Edit page Code Formatter
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |