UncutSQL for VS Code
Language support for UncutSQL schema files.
- Problems: syntax errors in your schema appear as you type, at the exact position. Across
the project, a
REFERENCES target that no file declares is a warning (SQLite accepts it,
and your migrations remain the authority), and a table or column declared more than once is an
error that links to the other declarations. While any project file has a syntax error,
these two checks are suspended and each open file says which file fails to parse.
- Outline: tables and their columns, indexes, views (and, for PostgreSQL, schemas) in the
Outline view and breadcrumbs.
- Go to Definition (F12): from a table or column in a
REFERENCES clause to its
declaration, even in another schema file.
- Hover: over a
REFERENCES target, the declaration it resolves to, with its file, line and
source line. Over a table or column declaration, how many foreign key references in the project
point to it. An unresolved reference shows no hover.
- Find references (Shift+F12): on a table or column declaration, or on a reference to it, lists
every foreign key reference to it in the project, and the declaration when the request includes
it. Only foreign key clauses are indexed: uses in indexes, constraints, views and triggers are not
listed yet.
- Rename (F2): on a table or column declaration or reference, renames it in every project file,
open or not, quoting the new name when the dialect requires it (
order becomes "order"). A
qualifier such as public. is never edited. Rename is all or nothing and is refused, with a
message naming the file, when a project file fails to parse; when a view, trigger, CHECK
constraint, DEFAULT or generated column expression, or index expression contains the same name
(even if it denotes another table or column); for SQLite TEMP tables; and for an invalid name
(in PostgreSQL, longer than 63 bytes). Dialects without a language service rename support, such
as a custom one, do not offer rename.
Completion is not available yet.
The extension works in trusted local workspaces and requires VS Code 1.110 or later.
Install UncutSQL from the Extensions view, or with
code --install-extension uncutsql.uncutsql-vscode. VS Code forks such as VSCodium and Cursor
install it from Open VSX.
Which files are checked
The extension looks for the nearest UncutSQL configuration (uncutsql.config.json or any
other configuration file) from the SQL file up to the
workspace folder.
- If the configuration's
schema is a file, that file is checked.
- If it is a directory, every
*.uncut.sql file inside it is checked, and references
resolve across them.
- Without a configured schema, each
*.uncut.sql file is checked on its own.
Dialects
The extension uses the dialect from your configuration, loaded from your project's
node_modules, so it always matches the version the CLI uses.
| Dialect |
Support |
@uncutsql/sqlite |
Built in. Used when there is no configuration or no dialect in it. |
@uncutsql/postgresql |
Unquoted names fold to lower case; unqualified tables resolve in public. |
@uncutsql/d1 |
Same as SQLite. |
@uncutsql/mysql |
Not available yet. |
@uncutsql/mariadb |
Not available yet. |
@uncutsql/duckdb |
Not available yet. |
@uncutsql/libsql |
Not available yet. |
If the configured dialect cannot be loaded or has no editor support, the extension shows a
warning once and leaves that project's files alone. It never falls back to SQLite for a project
that selects another dialect.
Troubleshooting
- Nothing happens. Check that the workspace is trusted and that the dialect package is
installed in the project.
- Changes to a local dialect module are ignored. If your configuration points to a module
file such as
./dialect.mjs, run Developer: Restart Extension Host after editing it.
Changes to configuration files are picked up automatically.
To build and run the extension from the repository, see DEVELOPMENT.md.
| |