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 correcty:
augroup custom_nginx
autocmd!
autocmd FileType nginx setlocal iskeyword+=$
autocmd FileType nginx let b:coc_additional_keywords = ['$']
augroup end
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.7.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84e1e31d1179ebfab6b01eef5ff30ede4a4fb52768d5296f83a2faa14d9918c5 |
|
MD5 | 189ccd569e2f2444a9eeb1e9766d62cb |
|
BLAKE2b-256 | c93715750eda2662807d6c444f14da77b9e9f50282241fe7e5de0eea99f71e09 |
Hashes for nginx_language_server-0.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2e308a40a1cfa8ab12243933e0d65b63c0bad0413ec89a0612bbbb58deea97b |
|
MD5 | 53b7d84add710549d5cec84fa41da720 |
|
BLAKE2b-256 | 6faa1c1563928899f8dc77b391560d57c1394ac71e27aa42dee953845eabcce3 |