mickeypearce / vscode-oracle-format

PL/SQL formatter (using SQLcl)
https://marketplace.visualstudio.com/items?itemName=mp.vscode-oracle-format
11 stars 4 forks source link

Error on FORMAT FILE #22

Open Treverr opened 3 years ago

Treverr commented 3 years ago

I have everything in stalled, but for some reason when I try to format anything it gives me this error:

Error On FORMAT FILE
/Users/treverchambersewing/.vscode/extensions/mp.vscode-oracle-format-0.1.5/format_temp.sql /Users/treverchambersewing/.vscode/extensions/mp.vscode-oracle-format-0.1.5/format_temp.sql

I checked and it looks like its there, and formatted. Permissions look okay, too.

Any ideas? I'm running macOS.

mickeypearce commented 3 years ago

Hi @Treverr . So the temp file content is formatted (format_temp.sql) but your original file is not? Can you try saving your original file before formatting maybe ?

Treverr commented 3 years ago

Hello,

Yes my original file is saved. I diff'ed the two files (original and format_temp.sql) and they appear to be the same.

This isn't working on my PL/SQLs but is working with standard SQLs. Is that to be expected? This seems to be happening on all PL/SQL files that are kinda complex.

Thank you!

mickeypearce commented 3 years ago

Could be a syntax issue. Take a look at https://github.com/mickeypearce/vscode-oracle-format/issues/19#issuecomment-623910939 I am not sure but maybe / at the end of file causes format error for example..

Treverr commented 3 years ago

Hi,

I am having the same issue with a very simple SQL:

-- need to delete from the db
DELETE FROM xxx WHERE xxx = xxx;

Gives me the same formatting error as before (sorry I had to mask my company stuff)

mickeypearce commented 3 years ago

Take a look at "Output" panel of VS Code in the oracle-format tab you should see original input and output of sqlcl command. Maybe you will find some useful info there... It could be that sqlcl version is having some problems.

Treverr commented 3 years ago

Here is what I see there:

"/Users/treverchambersewing/Downloads/sqlcl/bin/sql" /nolog @"/Users/treverchambersewing/.vscode/extensions/mp.vscode-oracle-format-0.1.5/format.sql"

SQLcl: Release 20.2 Production on Fri Oct 23 13:28:30 2020

Copyright (c) 1982, 2020, Oracle.  All rights reserved.

SQL> format file "/Users/treverchambersewing/.vscode/extensions/mp.vscode-oracle-format-0.1.5/format_temp.sql" "/Users/treverchambersewing/.vscode/extensions/mp.vscode-oracle-format-0.1.5/format_temp.sql"
Error On FORMAT FILE /Users/treverchambersewing/.vscode/extensions/mp.vscode-oracle-format-0.1.5/format_temp.sql /Users/treverchambersewing/.vscode/extensions/mp.vscode-oracle-format-0.1.5/format_temp.sql 
FORMAT
---------

FORMAT BUFFER - formats the script in the SQLcl Buffer
FORMAT RULES <filename> - Loads SQLDeveloper Formatter rules file to formatter.
FORMAT FILE <input_file> <output_file> 

Format used is default or for SQLcl can be chosen by setting an environmental variable
pointing to a SQLDeveloper export (.xml) of formatter options.
The variable is called SQLFORMATPATH
In SQLDeveloper the format options are the default chosen in the preferences.
SQL> exit
mickeypearce commented 3 years ago

No idea unfortunately. You could manually run sqlcl from the terminal to see if there is any difference and try new version of sqlcl (20.3) that was released recently.