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

Cannot get to work (parsing error) #3

Closed Archinowsk closed 5 years ago

Archinowsk commented 5 years ago

I'm unable to get this to work. When I hit format, VSCode Developer Tools only prints following and nothing happens:

[Extension Host] SQLcl: Release 18.2 Production on Mon Sep 10 17:03:18 2018
Copyright (c) 1982, 2018, Oracle.  All rights reserved.
Formatter rules loaded

I tried with the default settings and with the default XML exported from SQL Developer. I'm able to use the formatter with SQLcl.

My specs:

SQLcl 18.2
VSCode 1.27.1
NodeJS 8.9.3
Linux 64bit

Thanks for a great idea!

mickeypearce commented 5 years ago

Hej @Archinowsk ! What happens if you try with default formatter (remove or comment out rules xml from settings)?

If that works maybe you should downgrade SQLcl to 18.1 as 18.2 has a problem (bug?) with piping several commands: https://community.oracle.com/thread/4164273

Archinowsk commented 5 years ago

The same thing with the default formatter.

mickeypearce commented 5 years ago

Unfortunately it wasn't tested on Linux. 🤔

Could you please try executing from command line (bash?). (echo format file ${file} ${file}) | sql /nolog

Where ${file} is the path to a file you try to format.

Thanks for your help.

Archinowsk commented 5 years ago

Seems to work. The file test.sql is formatted.

(echo format file test.sql test2.sql) | sql /nolog
SQLcl: Release 18.2 Production on Tue Sep 11 09:19:32 2018
Copyright (c) 1982, 2018, Oracle.  All rights reserved.
mickeypearce commented 5 years ago

Can you please post console ouput from VSCode Developer Tools when you format document with default formater (without "oracle-format.rules" setting).

Archinowsk commented 5 years ago

I was able to get it to work. The issue was an invalid SQL file that I thought was ok. The extension just failed silently. Failure notification could be useful. The extension now works with default rules and custom rules. Sorry for the trouble and thanks!

Developer Tools prints the same with default and custom rules:

[Extension Host] SQLcl: Release 18.2 Production on Wed Sep 12 12:39:44 2018
Copyright (c) 1982, 2018, Oracle.  All rights reserved.
Formatter rules loaded
mickeypearce commented 5 years ago

No problem! Unfortunatelly SQLcl doesn't return an error code when loading or formatting fails...

mickeypearce commented 5 years ago

Well, I could search output for parsing error string and raise the error to UI... :thinking:

Sqlcl Output: Skipped formatting ...\format_temp.sql -- parse error