A language server for nginx.conf
Project description
Nginx Language Server
A Language Server for nginx.conf
.
Still under construction, expect big / potentially breaking changes for a while.
Capabilities
nginx-language-server currently partially supports the following Language Server capabilities with more to be added in the future.
Language Features
Installation
From your command line (bash / zsh), run:
pip install -U nginx-language-server
-U
ensures that you're pulling the latest version from pypi.
Alternatively, consider using pipx to keep nginx-language-server isolated from your other Python dependencies.
Editor Setup
The following instructions show how to use nginx-language-server with your development tooling. The instructions assume you have already installed nginx-language-server.
Vim / Neovim
With coc.nvim, put the following in coc-settings.json
:
{
"languageserver": {
"nginx-language-server": {
"command": "nginx-language-server",
"filetypes": ["nginx"],
"rootPatterns": ["nginx.conf", ".git"]
}
}
}
In your vimrc, I recommend putting in the following lines to ensure variables complete / hover correctly:
augroup custom_nginx
autocmd!
autocmd FileType nginx setlocal iskeyword+=$
autocmd FileType nginx let b:coc_additional_keywords = ['$']
augroup end
Alternatively, you can use coc-nginx.
let g:coc_global_extensions = ['@yaegassy/coc-nginx']
Note: this list is non-exhaustive. If you know of a great choice not included in this list, please submit a PR!
Command line
nginx-language-server can be run directly from the command line.
$ nginx-language-server --help
usage: nginx-language-server [-h] [--version] [--tcp] [--host HOST]
[--port PORT] [--log-file LOG_FILE] [-v]
Nginx language server: an LSP server for nginx.conf.
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 host for TCP server (default 127.0.0.1)
--port PORT port for TCP server (default 2088)
--log-file LOG_FILE redirect logs to the given file instead of writing to
stderr
-v, --verbose increase verbosity of log output
Examples:
Run from stdio: nginx-language-server
Inspiration
The useful language data for nginx is ported from vscode-nginx-conf-hint. I would have used this library directly, but alas! It's written only for VSCode and I use Neovim.
Written by
Samuel Roeca samuel.roeca@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for nginx_language_server-0.8.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34223dcf53bca6e297c38c2c4b7af152dbe5205ecaf2b09b09217de70717e5f2 |
|
MD5 | 0a53d259da8a3f02e8e53ee5dbd3cc6f |
|
BLAKE2b-256 | ae2f3707beee0d3e9ccb372b6326f63d7dcf565d5bfd52b93eeb28cc1f853622 |
Hashes for nginx_language_server-0.8.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be2c9a3e66ed4c4ba2af6b9417afe8fcf9135489f30f78e49806b50ca7a2c995 |
|
MD5 | e25a055adb26a16d5683317db087f88e |
|
BLAKE2b-256 | b84cb20870d3c9f013858c48b62a973efbfcaa1a8bc9e4802eba05e0ecdf2d18 |