observablehq / feedback

Customer submitted bugs and feature requests
42 stars 3 forks source link

SQL cells should ignore commented interpolated parameters #584

Open nachocab opened 11 months ago

nachocab commented 11 months ago

On a SQL cell like this one, commenting an interpolated parameter should not give an error:

CleanShot 2023-07-28 at 14 18 33@2x
mootari commented 11 months ago

I don't think we can prevent that, as it would require parsing the query syntax to determine where the interpolation happens.

nachocab commented 11 months ago

I understand, but remember that comments in SQL are easier than in JS. It would be as simple as running this regex: query.replace(/--.+/g, '')

mootari commented 11 months ago

No, multiline comments (/* ... */) are also supported.

nachocab commented 11 months ago

Oh, I didn't know that. Anyway, handling single line comments would be already be an improvement