Skip to content

[Expelmental] A sql language server exclusively for sqlfluff and coc.nvim extension

License

Notifications You must be signed in to change notification settings

yaegassy/sqlfluff-language-server

Repository files navigation

[Expelmental] sqlfluff-language-server

[Expelmental] A sql language server exclusively for sqlfluff.

sqlfluff-language-server-demo

Overview

  • "Server" by sqlfluff-language-server command (pygls based language server)
  • "Client" by coc-sqlfluff-ls (For operation test)

Features

  • Lint
  • Format
  • Code Action

Note

sqlfluff-language-server is a language server that uses the sqlfluff API.

Server (sqlfluff-language-server)

setup:

poetry install
poetry shell
sqlfluff-language-server --help

help:

usage: sqlfluff-language-server [-h] [--version] [--tcp] [--host HOST]
                                [--port PORT] [--log-file LOG_FILE] [-v]

sqlfluff-language-server

optional arguments:
  -h, --help           show this help message and exit
  --version            display version information and exit
  --tcp                Use TCP server instead of stdio
  --host HOST          Bind to this address
  --port PORT          Bind to this port
  --log-file LOG_FILE  redirect logs to the given file instead of writing to
                       stderr
  -v, --verbose        increase verbosity of log output

default: stdio

Client

coc-sqlfluff-ls

yarn install
# or yarn build

Now set runtimepath^=/path/to/sqlfluff-language-server in "vimrc/init.vim"

vim-lsp

if executable('sqlfluff-language-server')
  augroup LspVim
    au!
    autocmd User lsp_setup call lsp#register_server({
        \ 'name': 'sqlfluff-language-server',
        \ 'cmd': {server_info->['sqlfluff-language-server']},
        \ 'allowlist': ['sql'],
        \ })
  augroup END
endif

Related coc.nvim extension

Thanks

License

MIT

About

[Expelmental] A sql language server exclusively for sqlfluff and coc.nvim extension

Topics

Resources

License

Stars

Watchers

Forks