Comments (6)
Hi,
I cannot reproduce the problem. When I format this:
DECLARE
/* @formatter:off */
full_dnames CLOB :=
'[{"NAME":"ORDERNUMBER","TYPE":"NUMBER","DESIGNATION":"DIMENSION","GRADE":1},
{"NAME":"ORDERNUMBER","TYPE":"VARCHAR","DESIGNATION":"DIMENSION","GRADE":1},
{"NAME":"FIRSTNAME","TYPE":"VARCHAR","DESIGNATION":"ATTRIBUTE","GRADE":1}';
/* @formatter:on */
BEGIN
NULL;
END;
Then I get this formatted result:
declare
/* @formatter:off */
full_dnames CLOB :=
'[{"NAME":"ORDERNUMBER","TYPE":"NUMBER","DESIGNATION":"DIMENSION","GRADE":1},
{"NAME":"ORDERNUMBER","TYPE":"VARCHAR","DESIGNATION":"DIMENSION","GRADE":1},
{"NAME":"FIRSTNAME","TYPE":"VARCHAR","DESIGNATION":"ATTRIBUTE","GRADE":1}';
/* @formatter:on */
begin
null;
end;
I suspect that you do not use the settings provided in this repository. Another Arbori program. Maybe the default provided by SQLDev?
Could you please provide screenshots of your settings? They should look similar to this:
from plsql-formatter-settings.
I should mention that I can work around this with a strategically placed comment. However in the full case the assignment had to be broken up into a couple of strings, and I don't want the default '||' operator alignment (with the ':=') for the same reason as the first line break.
from plsql-formatter-settings.
I tried reloading the settings from the repository, and all my formatting went away. I'll look into this.
from plsql-formatter-settings.
I think you were right, but having reloaded the files there is no formatting. Looks like when I load the advanced xml file it resets the custom code. How can I debug this?
from plsql-formatter-settings.
Looks like the files as downloaded a couple of days ago just don't work with sqldeveloper 22.2.1. I reinstalled v 21.4.3 and it seems to be working.
from plsql-formatter-settings.
I think you were right
Thanks for confirming it.
having reloaded the files there is no formatting.
Looks like when I load the advanced xml file it resets the custom code.
Correct. Just follow the installation instructions. ;-)
How can I debug this?
Debugging in SQLDev is a bit tricky. The simplest approach is to enable logging. You have to change the logging.conf in SQLDev. This comment explains how to do it.
However, you can also check the version of the Arbori program in the Setting under "Code Editor -> Format -> Advanced Format -> Custom Format". As shown in the screenshot above. Here are some links based on released versions:
- For SQLDev 22.2.1 (with
dbtools-common.jar
from SQLcl 22.3.0): trivadis_custom_format.arbori - For SQLDev 22.2.0: trivadis_custom_format.arbori
- For SQLDev 21.4.3: trivadis_custom_format.arbori
Looks like the files as downloaded a couple of days ago just don't work with sqldeveloper 22.2.1.
The current version in the main branch is 5 months old and works with a manually patched version of SQLDev 22.2.1 and SQLcl 22.3.0 and SQLcl 22.4.0.
The latest release is from 2022-10-09.
So, which version did you download? Actually, one that does not match the product version you are using.
The XML configuration file trivadis_advanced_format.xml
is more or less version independent. However, the Arbor file trivadis_custom_format.arbori
is very much dependent on the version of SQLDev and SQLcl. Unfortunately, the release cycles of SQLDev and SQLDev are independent now. This leads to the situation where sometimes no configuration exists that works in the latest versions of both products. The dirty workaround is to manually patch SQLDev with the libraries from SQLcl.
The reason for the version-dependency is that the Arbori program queries the parse-tree and uses specific symbol names expected in the parse tree. When new SQL features are supported in the product or parser bugs are fixed then the parse-tree structure and the used symbol names change as well. This leads to runtime errors in the Arbori program. This is why you really need to check that you install the configuration for the correct product version.
If you are interested in the details you can look at the differences between version sqldev-21.4.3 and sqlcl-22.3.0. There you see that some symbol names in trivadis_custom_format.arbori
have changed, e.g.
column[4,12)
tocolumn___0
create_view#[114,130)
tocreate_view#___0
create_materialized_view[33,79)
tocreate_materialized_view2___0
"inner_cross_join_clause"[26,55)
to"inner_cross_join_clause"___0
in_condition[24,35)
toin_condition___0
simple_case_expression[4,27)#
tosimple_case_expression___0#
create_materialized_view[91,136)
tocreate_materialized_view3___2
create_materialized_view[136,174)
tocreate_materialized_view3___3
create_materialized_view[200,210)
tocreate_materialized_view3___0
insert_into_clause[13,25)
toinsert_into_clause___0
merge_insert_clause[23,35)
tomerge_insert_clause___0
merge_insert_clause[43,50)
tomerge_insert_clause___2
- ...
In other words, a lot changed between these versions making them completely incompatible from a SQL grammar point of view.
In https://github.com/Trivadis/plsql-formatter-settings/releases you find all released versions for the formatter settings. There is also a section that defines the compatibility with SQLDev and SQLcl. In some cases, you have to manually patch SQLDev to make it work (copy a JAR file from the SQLcl installation). If you do not want to do that, you have to use a different version.
from plsql-formatter-settings.
Related Issues (20)
- Package constant formatting HOT 1
- Function header formatting: return deterministic HOT 1
- Support SQLDev 23.1.0 HOT 1
- Add - Formatierung "CASE WHEN" in SELECT statemen HOT 4
- Newlines being inserted into strings HOT 5
- Concatenation Bars being split apart invalidating strings HOT 2
- compiler flag concatenated to same line as end statement HOT 2
- Support SQLcl 23.3
- Do not reset Arbori program when importing trivadis_advanced_format.xml
- Unwanted line break after `whenever oserror` breaks code
- Wrong indentation in subqueries of with_clause in insert statements
- Unwanted line break before `on conversion error` in subquery
- spaces removed in grant statement
- Patching SQL Developer breaks Script Output tab feedback of direct SQL statement execution HOT 8
- Support SQLcl 23.4.0
- Can't export data after patch HOT 2
- Connection window is empty and not able to create any new database connection HOT 4
- Format table/view names in lowercase HOT 6
- Double quotes removed from xmlelement after format. HOT 2
- tvdformat.jar doesn't work with Java 22 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plsql-formatter-settings.