cmoog / vscode-sql-notebook

Open SQL files as VSCode Notebooks.
https://marketplace.visualstudio.com/items?itemName=cmoog.sqlnotebook
MIT License
130 stars 18 forks source link

SQL Server (msql) formatting not working inside cells #24

Closed RollsChris closed 2 years ago

RollsChris commented 2 years ago

Hi

I have the SQL Server extension im trying to format the cells but nothing is happening.

Is formatting supported?

Thanks

cmoog commented 2 years ago

If you have a SQL formatter installed through a different extension, Format Cell should work as expected from the command pallet. Otherwise, it might be appropriate to add built-in support to vscode-sql-notebook so users get this built-in.

RollsChris commented 2 years ago

Do you need help with that.. i could do it. But i have only recently started looking at custom vscode extensions.. might need some direction

cmoog commented 2 years ago

I'd be happy to accept a contribution with added support for formatting. The npm module sql-formatter looks like it could be a good path forward.

RollsChris commented 2 years ago

I have forked the code and will investigate :) i think it should first try and use the default formatter the user has if they have one and if not offer to install one?

cmoog commented 2 years ago

After some further testing, I think it is a deficiency in ms-mssql.mssql that prevents it from working when SQL files are opened as notebooks. When testing adpyke.vscode-sql-formatter, the Format Cell command pallet action works just as expected.

So, seeing as this is not a bug fixable in vscode-sql-notebook, I'm going to close this issue. We can open a new issue to track integration of sql-formatter as an embedded format provider exposed by this extension.