Skip to main content
Back to Extensions Directory
coc.nvim fallback icon

SQL extension for coc.nvim

Installation CommandVim prompt
:CocInstall coc-sql
GitHub owner
Heyward Fann
Version
v0.15.0
npm package
coc-sql
Requirements
coc ^0.0.80
License
MIT
Repository
GitHub
npm latest published 2025-11-25Registry checked 2026-08-31Registry summary

A practical first workflow

Choose coc-sql for formatting SQL text and checking whether its syntax can be parsed. Its formatter and parser do not connect to your database. A clean diagnostic list does not prove that a table exists, that a query has the right permissions, or that running it is safe.

Format a small query, then check syntax

Install with :CocInstall coc-sql. Save the following as example.sql and confirm :set filetype? reports sql:

example.sql
1select name, age from users where age >= 18 order by name;

Run :CocCommand sql.Format. The query should be laid out across clauses with indentation; exact keyword casing depends on your format options. No database or users table is required for this text-only operation. Review the edit before saving.

For a separate parser check, temporarily remove users after from and inspect :CocDiagnostics, then restore the original query. If the project uses dialect-specific syntax, set sql.database to the appropriate supported dialect before treating a parser message as a database error.

If formatting works but syntax messages do not update, inspect sql.lintOnOpen, sql.lintOnChange and sql.lintOnSave. If your save action produces competing edits, choose one formatting provider. A project .sql-formatter.json takes precedence over sql.formatOptions; sql.database selects the lint dialect. Check the formatter’s own language option when the formatting dialect also needs to change.

Checked against the 0.15.0 configuration and upstream implementation. Expected formatting and parser results are example checks, not a recorded database execution.

Site-authored guidance reviewed on 2026-09-11. Content sources and maintainers · Choose extension responsibilities

Published Package Summary

coc-sql

SQL extension for coc.nvim

Features

Install

:CocInstall coc-sql

Usage

Format document

  • :call CocAction('format')
  • :CocCommand sql.Format

Format selected content

xmap <leader>f  <Plug>(coc-format-selected)
nmap <leader>f  <Plug>(coc-format-selected)

License

MIT

Read the complete README
  • SQL extension for coc.nvim
Activation Events
  • onLanguage:sql
Developer Resources

Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.

Open Developer Guide

Version History

This published npm package does not include a history.md or changelog.md file. Browse its npm versions or repository releases for available release information.