15 Commits

Author SHA1 Message Date
Joao Azevedo
85d9fa11d5 Allow formatting of No_Document
Assertions that check that no No_Documents are present were removed.
The reason is because one could create a Document_Type object as
follows:
`Document : Document_Type;`
This is equivalent to No_Document.
To disallow this, we would have to make the type Document_Type limited,
which is not desirable.
Therefore, we should allow `No_Document` and simply skip any operations
on it.
2024-10-09 09:32:48 +00:00
Joao Azevedo
eefbf82dc7 Flatten nested lists inside table rows 2024-08-29 12:20:12 +00:00
Joao Azevedo
1f517e6143 Add Continuation_Line_Indent command
Fix Align Inner_Root kind logic when preceded by Align Text kind and
clarify its description.
2024-07-24 13:55:42 +00:00
Joao Azevedo
395f1806e6 Implement Table_Alignment algorithm 2024-07-04 14:50:37 +00:00
Joao Azevedo
45b59a9582 Improve Group builder spec and add Conditional_Group builder 2024-07-02 12:54:31 +00:00
Joao Azevedo
67797f5ef4 Add indentation Offset to the first line of the formatted document
Fix computation of indentation offset when indentation Kind is Tabs and
add test for it.
Move Indentation_Offset from Format_Options_Type to
Identation_Options_Type. The indentation offset now models smart tabs
where spaces are used both for indentation and alignemnt, or, tabs
are used for indentation and spaces for alignment.
This is needed for range formatting with tabs. For instance:
```
declare
   Obj_Foo : constant Type_Foo :=
     Value_Foo;
```
To range format Value_Foo we need an offset of 1 tab and 2 spaces.
2024-06-17 18:23:32 +00:00
Joao Azevedo
07cff3d659 Add Indentation_Offset option to Format_Options_Type
All the indentation added has an offset equal to Indentation_Offset.
The main purpose of this options is to be used with range formatting.
This option does not affect the formatted document initial indentation.
2024-06-04 13:24:45 +00:00
Pierre-Marie de Rodat
f364faf768 json_tester.adb: fix a simple memory leak 2024-03-12 14:27:18 +00:00
Joao Azevedo
2ceb6d9c18 Add builders test for Inner_Root alignemnt 2024-02-13 11:20:50 +00:00
Joao Azevedo
d4266b5b84 Add builders_tester test driver
This driver tests all builders under Prettier_Ada.Documents.Builders
2024-02-12 11:32:41 +00:00
Joao Azevedo
ec4d5638ca Fix test_programs.gpr path 2024-02-01 11:19:22 +00:00
Fabien Chouteau
c704160b0e Simplify project files
- Remove prettier_ada_common.gpr
 - Move project files to project root dir
 - Remove BUILD_MODE external to avoid conflicts with other projects
 - Default to "prod" BUILD_MODE
 - Fix external variable names in Makefile
 - Add LLVM-exception to license identifier
2024-01-09 16:07:08 +00:00
Fabien Chouteau
5797f6d06a Add LLVM-exception to license expression, and a LICENSE.txt file 2023-12-12 15:32:45 +01:00
Pierre-Marie de Rodat
8adad50529 Prettier_Ada.Documents.JSON: implement serialization
Also add a test program/driver to check this feature, and add
representative tests.
2023-10-20 20:21:48 +00:00
Pierre-Marie de Rodat
524734e99e Reorganize test programs
Rename the "document_formatter" project to "test_programs": upcoming
work will add more test programs, and having a single project file to
cover all of them will make it easier to build/install them, as well as
making it easier to share sources between test programs.
2023-10-20 20:21:48 +00:00