In JetBrains IDE's like PHPStorm this is a built-in feature. E.g. in the code below, editing the SQL inside the string would autocomplete as SQL and suggest table/column names from an active database connection.
query("SELECT * FROM users LIMIT 50");
When using Visual Studio Code or similar editors like Theia, this functionality would be supplied by a plugin. Unfortunately, I haven't come across a plugin on the marketplace that has this feature. Some have autocomplete for .sql
files, but not inline SQL. It's hard to believe this isn't possible yet in such a popular editor.
Has anyone found a solution for this?
Plugins I've tried so far (I'm specifically looking for Postgres):
I've created exactly the extension: sqlsurge you are looking for! This extension supports Postgres, MySQL, and so on. Custom functions are not supported now but comming soon! Try it!
Also I wrote english article: I created a VSCode extension to make developing raw SQL queries incredibly easy [TypeScript+Rust+WASM].
The closest I've found is the Inline SQL extension. It uses a connection to a db to lint inline SQL and it supports postgres.
It doesn't seem to support intellisense, but it is open source under an MIT license if you'd like to extend it or use it for inspiration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With