Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yaegassy/coc-sqlfluff
SQLFluff (A SQL linter and auto-formatter for Humans) extension for coc.nvim
https://github.com/yaegassy/coc-sqlfluff
coc coc-extensions coc-nvim formatter linter neovim sql vim
Last synced: 16 days ago
JSON representation
SQLFluff (A SQL linter and auto-formatter for Humans) extension for coc.nvim
- Host: GitHub
- URL: https://github.com/yaegassy/coc-sqlfluff
- Owner: yaegassy
- License: mit
- Created: 2021-05-11T00:49:48.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-16T06:50:32.000Z (over 1 year ago)
- Last Synced: 2024-10-17T02:26:54.778Z (22 days ago)
- Topics: coc, coc-extensions, coc-nvim, formatter, linter, neovim, sql, vim
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/coc-sqlfluff
- Size: 385 KB
- Stars: 29
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# coc-sqlfluff
[SQLFluff](https://pypi.org/project/sqlfluff/) (A SQL linter and auto-formatter for Humans) extension for [coc.nvim](https://github.com/neoclide/coc.nvim)
## Features
- Lint
- Format
- Code Action
- Built-in installer## Install
**CocInstall**:
```vim
:CocInstall coc-sqlfluff
```**vim-plug**:
```vim
Plug 'yaegassy/coc-sqlfluff', {'do': 'yarn install --frozen-lockfile'}
```## Detect: sqlfluff
1. `sqlfluff.commandPath` setting
1. PATH environment (e.g. system global PATH or venv, etc ...)
1. 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.
```vim
:CocCommand sqlfluff.install
```## SQLFluff 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.
1. `setup.cfg`
1. `tox.ini`
1. `pep8.ini`
1. `.sqlfluff`
1. `pyproject.toml`**REF**:
-
## Configuration options
- `sqlfluff.enable`: Enable coc-sqlfluff extension, default: `true`
- `sqlfluff.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: `true`
- `sqlfluff.lintOnOpen`: Lint file on opening, default: `true`
- `sqlfluff.lintOnChange`: Lint file on change, default: `true`
- `sqlfluff.lintOnSave`: Lint file on save, default: `true`
- `sqlfluff.formatEnable`: Whether the document formatter is enabled or not, default: `true`
- `sqlfluff.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`
- `sqlfluff.fix`: Run sqlfluff fix file
- `sqlfluff.format`: Run sqlfluff format file (Available in sqlfluff `v2.0.0` and later)
- `sqlfluff.showOutput`: Show sqlfluff output channel## Code Actions
**Example key mapping (Code Action related)**:
```vim
nmap ga (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
- [sqlfluff/sqlfluff](https://github.com/sqlfluff/sqlfluff)
## License
MIT
---
> This extension is built with [create-coc-extension](https://github.com/fannheyward/create-coc-extension)