sql-formatter-org / sql-formatter

A whitespace formatter for different query languages
https://sql-formatter-org.github.io/sql-formatter/
MIT License
2.37k stars 405 forks source link

Expose logs to VSCode frontend or describe in documentation how to reach the logs #774

Open jpmorris opened 2 months ago

jpmorris commented 2 months ago

The vscode plugin is not working for me in Sagemaker, it does work on my laptop. I could have sworn I DONT need to install the sql-formatter binary via npm or yarn if I install the plugin (the docs could be clearer on this--many enter the sql-formatter world via the vscode plugin). So I want to see what might be going wrong when the format command is run against my code (in vscode) but unlike most other plugins there is not output exposed to vscode (via 'output->dropdown') .

This will help tons of people find out immediately what's going wrong rather than just a lack of responsiveness from a plugin.

nene commented 2 months ago

Thanks for the suggestion.

I could have sworn I DONT need to install the sql-formatter binary via npm or yarn if I install the plugin (the docs could be clearer on this--many enter the sql-formatter world via the vscode plugin).

Well, you indeed don't need to install sql-formatter in addition to the SQL Formatter VSCode plugin . I'm not sure what to clarify in the docs about this.. I mean, there are lots of other things one doesn't need to do :)

Though perhaps you are using some other plugin that does require installing sql-formatter separately. There are many different VSCode plugins that use sql-formatter libary, but most of them are not under my control. Perhaps you could first mention which exact plugin you are using.

jpmorris commented 2 months ago

I mean, there are lots of other things one doesn't need to do :)

And only one of those many things is a install pattern similar to this one causing confusion; I'm not talking about NOT needing to eat cupcakes here ;). There are two highly relevant common install patterns and this one is different than the others. Docker Plugin? You need to install docker. Maven Plugin? Same. NeoVim Plugin? Same. I could go find 50 plugins that work this way. SQL-Formatter? Well, it's not clear. There is no 'Installation' section to the Readme for the plugin, and the sister page for the executable talks about installing sql-formatter. So maybe I need to install sql-formmater like the non-plugin page says? It is not obvious. Yes, I'm sure many just install the plugin and things just work. But in my case, it didn't, and so the confusion is just compounded ("why isn't it working? Do I need to install the binary? Do I need it in my path?" I went to install sql-formatter because it wasn't clear whether I needed to with the plugin. Even if the instillation section says nothing more than a single line "just install the plugin it should just work; no need to install sql-formatter with npm or yarn" it would help all of us where it's not working.

Perhaps you could first mention which exact plugin you are using.

I agree all the different SQL formatter plugins do make it confusing. I'm only referring to the 'SQL Formatter VScode ' plugin which VSCode points me to the extension page which takes me to this repo: https://github.com/sql-formatter-org/sql-formatter-vscode (and in terms of the above, I'm referring the link in that page that points here: https://github.com/sql-formatter-org/sql-formatter). I'm assuming these are under your remit; if not please let me know.

But no need to spend your time trying to fix my issue--I can keep working on it. The feature request isn't for tech support or documentation changes (though a low-cost single line in the documentation would clear up an ambiguity compared to other plugins), it's to expose log outputs to VSCode frontend (or specify a readme section on how to read those logs). See here:

https://stackoverflow.com/questions/34085330/how-to-write-to-log-from-vscode-extension

I have no other SQL formatting plugins installed. But, independent of my particular issues of the VSCode plugin not working, it would nice to expose the runtime output to the frontend (->Outputs->