This repository provides formatter settings for the coding style rules of the Trivadis PL/SQL & SQL Coding Guidelines.
Settings are provided for
These settings have been defined and tested with the product versions mentioned above. They might not work in other versions.
Please note that these settings do not comply with rule 5. Line breaks are placed after a comma and not before. All other rules are followed. However, you can easily change this in the settings for both products.
Clone this repository or download the ZIP file and extract it.
- Start SQL Developer
- Open
Preferences
- Select
Code Editor
->Format
->Advanced Format
- Press
Import...
- Select
trivadis_advanced_format.xml
- Press
Open
- Select
Code Editor
->Format
->Advanced Format
->Custom Format
- Press
Import...
- Select
trivadis_custom_format.arbori
- Press
Open
- Press
OK
to save the settings
- Start PL/SQL Developer
- Open
Preferences
- Select
User interface
->PL/SQL Beautifier
- Press
Edit...
- Press
Open...
- Select
trivadis_beautifier.br
- Press
Open
- Press
Save as...
- Select a permanent location for these settings and press
Save
- Press
Close
- Select the rule file you've saved previoulsy.
- Press
OK
SQL Developer uses its own parse tree query language called Arbori for its advanced formatter configuration. Here is some additional information that might be useful if you plan to tweak the behavior of the formatter yourself.
- Formatting Code With SQL Developer
- SQL Developer 20.2 User Guide, Code Editor: Format
- Arbori Starter Manual
- Semantic Analysis with Arbori
- Arbori Semantic Actions
- Custom Formatting in SQLDev 4.2
- Formula for Formatting
- Custom Syntax Coloring
Thank you, Vadim Tropashko for providing this valuable information.
To get the most out of the dynamic JavaScript actions from an Arbori program, you should know the following global variables and their corresponding Java class.
Variable | Type | JAR File |
---|---|---|
struct |
oracle.dbtools.raptor.config.CustomFormat | oracle.sqldeveloper.jar |
target |
oracle.dbtools.parser.Parsed | dbtools-common.jar |
tuple |
HashMap<String, oracle.dbtools.parser.ParseNode> | dbtools-common.jar |
logger |
oracle.dbtools.util.Logger | dbtools-common.jar |
Please file your bug reports, enhancement requests, questions and other support requests within Github's issue tracker.
- Describe your idea by submitting an issue
- Fork the PL/SQL & SQL Formatter Settings respository
- Create a branch, commit and publish your changes and enhancements
- Create a pull request
The Trivadis PL/SQL & SQL Formatter Settings are licensed under the Apache License, Version 2.0. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.