senkenn / sqlsurge

Visual Studio Code extension for SQL language server
https://marketplace.visualstudio.com/items?itemName=senken.sqlsurge
MIT License
10 stars 0 forks source link
rust sql typescript vscode-extension

sqlsurge

sqlsurge is a Visual Studio Code extension for SQL language server using sqls. It works just NOT ONLY with SQL files, but also with RAW SQL QUERIES on other languages such as TypeScript and Rust.

Prisma Example in TypeScript: Alt text

SQLx Example in Rust: Alt text

Requirements

Supported RDBMS

See: https://github.com/sqls-server/sqls?tab=readme-ov-file#support-rdbms

Features

This table shows the features available for each file extension.

Features .sql .ts .rs
Completion
Formatting
Quick Info Symbol on Completion
Quick Info Symbol on Hover
Any Raw SQL Queries Support

Completion

These are the completion items sqlsurge provides:

About raw SQL queries, VSCode's quick suggestion(auto completion) in strings is disabled by default. It can be enabled by adding the following setting to settings.json.

"editor.quickSuggestions": {
    "strings": true
}

Formatting

VSCode Commands

Configurations for raw SQL queries

As a formatter, sqlsurge use sqls for Vanilla SQL files, use SQL Formatter for raw SQL.

Quick Info Symbol

Quick info symbol for tables and columns can be shown by triggering completion with Ctrl + Space or Cmd + Space.

text

Any Raw SQL Queries Support (Experimental)

[!NOTE] This feature is experimental. Feedback is welcome!

sqlsurge supports Prisma in TypeScript and SQLx in Rust by default. But you can use sqlsurge with any raw SQL queries, such as TypeORM or user-defined functions by setting.

This is an example of settings for custom raw SQL queries.

// TypeORM in TypeScript
const someQuery = await entityManager.query(
  "SELECT * FROM todos WHERE id = $1;",
  [1]
);
"sqlsurge.customRawSqlQuery": {
  "language": "typescript",
  "configs": [
    {
      "functionName": "query",
      "sqlArgNo": 1,
      "isTemplateLiteral": false
    }
  ]
}

TODOs