l-v-yonsama / db-notebook

Javascript, SQL creation and execution, Markdown, etc. can be centrally managed in a file format called a notebook.
MIT License
13 stars 1 forks source link

Semicolons (statement terminators) do not appear in .dbn files created from a .sql file. #12

Open Damocod opened 1 month ago

Damocod commented 1 month ago

Really great extensionm but I noticed that when I create a .dbn file from a .sql file, all the semicolons (statement terminators) that are present in the original .sql file are not present (or vissible) in the .dbn file. All semicolons created directly in the .dbn file do remain there correctly as expected. In the .dbn file, queries seem to work with or without those semicolons, but if I want to copy code from there, I have to manually add all the missing semicolons after paste it. Is there any way to prevent the semicolons removal at the .sql to .dbn convertion?

Damocod commented 1 month ago

Well I have just sent a pull request for the db-drivers repository fixing that 😊

l-v-yonsama commented 1 month ago

Hi, @Damocod .

Thank you for using Database Notebook.

Each SQL cell in this notebook supports only one sql statement. This means that there is no need for a semicolon at the end of the statement. Some people, myself included, find the semicolon at the end of a statement annoying.

However, I can understand the opinion that the semicolon is necessary to clearly indicate the end of a sql statement. So, I will make it possible for those who want a semicolon to set it in the extension's settings screen.

Damocod commented 1 month ago

I stay tuned for news. Excellent work! Thank you very much.

Damocod commented 1 month ago

I managed to do it in my local instalation of the db-notebook extension.

Code_zKuG78M1dF

For the repository version I still don't know how to reference db-drivers utilities/configUtil here in the db-notebook SQLHelper:

const { getKeepSemicolonConfig } = require("C:/Users/Damo/.vscode/extensions/hirotakayoshioka.database-notebook-0.7.15/out/utilities/configUtil")
l-v-yonsama commented 1 month ago

Hi, @Damocod .

Excellent. It is working as intended. I appreciate it very much.

As for the flag that determines whether to leave the semicolon or not, Considering that there may be more settings in the future when creating dbn files from sql files, why not define it as one of the parameters of SQLSeparatorConfigType?

Also, as may be known, the vscode extension working test is, since it can be tested by pressing the F5 key,

Here is a sample implementation. #13

const { getKeepSemicolonConfig } = require("C:/Users/Damo/.vscode/extensions/hirotakayoshioka.database-notebook-0.7.15/out/utilities/ configUtil")

Instead of ↓, it is fine.

import { getSQLSeparatorConfig } from "../utilities/configUtil";
Damocod commented 1 month ago

Very good! I'm quite busy these days, but as soon as I can, I'll try to help get this feature fully working. Again, your work is impeccable and admirable. I am truly grateful.

l-v-yonsama commented 1 month ago

Take your time, no rush.