coc-sqlfluff v0.11.4
coc-sqlfluff
SQLFluff (A SQL linter and auto-formatter for Humans) extension for coc.nvim
Features
- Lint
- Format
- Code Action
- Built-in installer
Install
CocInstall:
:CocInstall coc-sqlfluffvim-plug:
Plug 'yaegassy/coc-sqlfluff', {'do': 'yarn install --frozen-lockfile'}Detect: sqlfluff
sqlfluff.commandPathsetting- PATH environment (e.g. system global PATH or venv, etc ...)
- builtin: extension-only "venv" (Installation commands are also provided)
Bult-in install
coc-sqlfluff allows you to create an extension-only "venv" and install "sqlfluff".
The first time you use coc-sqlfluff, if sqlfluff is not detected, you will be prompted to do a built-in installation.
You can also run the installation command manually.
:CocCommand sqlfluff.installSQLFluff configuration file (setup.cfg, tox.ini, pep8.ini, .sqlfluff, pyproject.toml)
SQLFluff is able to read project-specific default values for its command line options, or from a configuration file.
SQLFluff will look for the following files in order. Later files will (if found) will be used to overwrite any vales read from earlier files.
setup.cfgtox.inipep8.ini.sqlfluffpyproject.toml
REF:
Configuration options
sqlfluff.enable: Enable coc-sqlfluff extension, default:truesqlfluff.commandPath: The path to the sqlfluff command (Absolute path), default:""sqlfluff.builtin.pythonPath: Python 3.x path (Absolute path) to be used for built-in install, default:""sqlfluff.dialect: The dialect of SQL to lint, valid option:["ansi", "bigquery", "clickhouse", "databricks", "db2", "duckdb", "exasol", "hive", "mysql", "oracle", "postgres", "redshift", "snowflake", "soql", "sparksql", "sqlite", "teradata", "tsql"], default:"ansi"sqlfluff.linter.ignoreParsing: Whether the sql linter should ignore parsing errors, default:truesqlfluff.lintOnOpen: Lint file on opening, default:truesqlfluff.lintOnChange: Lint file on change, default:truesqlfluff.lintOnSave: Lint file on save, default:truesqlfluff.formatEnable: Whether the document formatter is enabled or not, default:truesqlfluff.formatIgnoreStderrAlert: Ignore stderr message output when formatting is executed, e.g.Unfixable violations detected, default:true
Commands
sqlfluff.install: Install sqlfluff- It will be installed in this path:
- Mac/Linux:
~/.config/coc/extensions/coc-sqlfluff-data/sqlfluff/venv/bin/sqlfluff - Windows:
~/AppData/Local/coc/extensions/coc-sqlfluff-data/sqlfluff/venv/Scripts/sqlfluff.exe
- Mac/Linux:
- It will be installed in this path:
sqlfluff.fix: Run sqlfluff fix filesqlfluff.format: Run sqlfluff format file (Available in sqlfluffv2.0.0and later)sqlfluff.showOutput: Show sqlfluff output channel
Code Actions
Example key mapping (Code Action related):
nmap <silent> ga <Plug>(coc-codeaction-line)Usage:
In the line with diagnostic message, enter the mapped key (e.g. ga) and you will see a list of code actions that can be performed.
Actions:
Ignoring Errors for current line (-- noqa)Ignoring Errors for current line (-- noqa: disable=all)Ignoring Errors for current line (-- noqa: enable=all)Show web documentation for {RULE_ID}
Thanks
License
MIT
This extension is built with create-coc-extension
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago