Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Wingmate — SQL toolsNew to Visual Studio Code? Get it now.

Wingmate — SQL tools

chrismwendt

|
54 installs
| (0) | Free
SQL syntax highlighting and syntax error detection within strings in Go code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Wingmate SQL tools

Recognizes SQL queries inside strings and provides syntax highlighting, syntax error detection, hover tooltips, and autocomplete:

Free for non-commercial use.

You need a subscription for commercial use.

Configuration

gopls's semantic highlighting prevents SQL syntax highlighting from working. You can disable it with this user setting (hit Cmd+comma then click the file icon in the top-right):

{
  "gopls.ui.semanticTokens": false
}

Some themes don't support semantic highlighting and you need to force it:

{
  "editor.semanticTokenColorCustomizations": {
    "[Gatito Theme]": {
      "enabled": true
    }
  }
}

In order for Wingmate to find your SQL strings, it needs to know which function parameters are SQL queries. The setting wingmate.sinks is an array of strings, where each string takes the form function:parameter. The function part is the name of your DB function, and the parameter part is the zero-based index of the SQL query parameter to that DB function. For example, for QueryContext(ctx, query, args...), the sink entry would be QueryContext:1. By default, Wingmate knows about the database/sql and github.com/keegancsmith/sqlf packages:

{
  "wingmate.sinks": [
    "ExecContext:1",
    "PrepareContext:1",
    "QueryContext:1",
    "QueryRowContext:1",
    "Exec:0",
    "Prepare:0",
    "Query:0",
    "QueryRow:0",
    "sqlf.Sprintf:0",
  ]
}

To get autocomplete in strings, you need to enable it:

{
  "editor.quickSuggestions.strings": true
}

To get hover tooltips and column name completions, set your database connection:

{
  "wingmate.conn": "postgresql://localhost:5432/postgres"
}

Related

  • Inline SQL supports more languages and performs linting, but doesn't recognize syntax as well and I couldn't get linting to work
  • Highlight String Code supports more langauges and a few other features
  • python-string-sql for Python
  • SQL tagged template literals for JS/TS
  • vscode-sql-template-literal for JS/TS

Star History

Star History Chart

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft