Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jpmorris opened this issue Aug 31, 2024 · 4 comments
Labels
feature vscode Related to the VSCode Extension

Comments

@jpmorris
Copy link

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
Copy link
Collaborator

nene commented Sep 1, 2024

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
Copy link
Author

jpmorris commented Sep 2, 2024

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->). This is a common logging pattern enabled by the python, github, vscode-neovim, pytest (I find it VERY useful for this one), I could go on and on (and vscode supports specifying debug level from the output panel). It would be great to have a place to look when I save and nothing formats that some setting is wrong or some other error to help me easily know what to fix. Currently none of this is exposed for debugging and if it doesn't work it's completely silent.

@nene
Copy link
Collaborator

nene commented Sep 2, 2024

Thanks for the thorough explanation.

Would you perhaps be interested in contributing this log-exposure functionality (which seems like a useful addition)? You seem to know a lot more about this than I do.

@jpmorris
Copy link
Author

jpmorris commented Sep 2, 2024

I'll consider it. I think you give me too much credit, but would love to contribute if I can. I'll look over your source and the solutions, and think it through and if it's not too hard or time-consuming for me, Ill submit a PR to you. Thanks!

@nene nene added the vscode Related to the VSCode Extension label Oct 24, 2024
@nene nene changed the title vscode plugin: expose logs to vscode frontend or describe in documentation how to reach the logs Expose logs to VSCode frontend or describe in documentation how to reach the logs Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature vscode Related to the VSCode Extension
Projects
None yet
Development

No branches or pull requests

2 participants