# Nginx Language Server
[![image-version](https://img.shields.io/pypi/v/nginx-language-server.svg)](https://python.org/pypi/nginx-language-server)
[![image-license](https://img.shields.io/badge/license-GPL%203.0--only-orange)](https://python.org/pypi/jedi-language-server)
[![image-python-versions](https://img.shields.io/badge/python->=3.8-blue)](https://python.org/pypi/jedi-language-server)
A [Language Server](https://microsoft.github.io/language-server-protocol/) 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
- [textDocument/completion](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion)
- [textDocument/hover](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover)
## Installation
From your command line (bash / zsh), run:
```bash
pip install -U nginx-language-server
```
`-U` ensures that you're pulling the latest version from pypi.
Alternatively, consider using [pipx](https://github.com/pipxproject/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](https://github.com/neoclide/coc.nvim), put the following in `coc-settings.json`:
```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:
```vim
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](https://github.com/yaegassy/coc-nginx).
```vim
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.
```console
$ 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](https://github.com/hangxingliu/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_
Raw data
{
"_id": null,
"home_page": "https://github.com/pappasam/nginx-language-server",
"name": "nginx-language-server",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<3.12",
"maintainer_email": "",
"keywords": "nginx,completion,refactoring,vim,neovim,lsp,language-server-protocol",
"author": "Sam Roeca",
"author_email": "samuel.roeca@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ae/2f/3707beee0d3e9ccb372b6326f63d7dcf565d5bfd52b93eeb28cc1f853622/nginx_language_server-0.8.0.tar.gz",
"platform": null,
"description": "# Nginx Language Server\n\n[![image-version](https://img.shields.io/pypi/v/nginx-language-server.svg)](https://python.org/pypi/nginx-language-server)\n[![image-license](https://img.shields.io/badge/license-GPL%203.0--only-orange)](https://python.org/pypi/jedi-language-server)\n[![image-python-versions](https://img.shields.io/badge/python->=3.8-blue)](https://python.org/pypi/jedi-language-server)\n\nA [Language Server](https://microsoft.github.io/language-server-protocol/) for `nginx.conf`.\n\nStill under construction, expect big / potentially breaking changes for a while.\n\n## Capabilities\n\nnginx-language-server currently partially supports the following Language Server capabilities with more to be added in the future.\n\n### Language Features\n\n- [textDocument/completion](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion)\n- [textDocument/hover](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover)\n\n## Installation\n\nFrom your command line (bash / zsh), run:\n\n```bash\npip install -U nginx-language-server\n```\n\n`-U` ensures that you're pulling the latest version from pypi.\n\nAlternatively, consider using [pipx](https://github.com/pipxproject/pipx) to keep nginx-language-server isolated from your other Python dependencies.\n\n## Editor Setup\n\nThe following instructions show how to use nginx-language-server with your development tooling. The instructions assume you have already installed nginx-language-server.\n\n### Vim / Neovim\n\nWith [coc.nvim](https://github.com/neoclide/coc.nvim), put the following in `coc-settings.json`:\n\n```json\n{\n \"languageserver\": {\n \"nginx-language-server\": {\n \"command\": \"nginx-language-server\",\n \"filetypes\": [\"nginx\"],\n \"rootPatterns\": [\"nginx.conf\", \".git\"]\n }\n }\n}\n```\n\nIn your vimrc, I recommend putting in the following lines to ensure variables complete / hover correctly:\n\n```vim\naugroup custom_nginx\n autocmd!\n autocmd FileType nginx setlocal iskeyword+=$\n autocmd FileType nginx let b:coc_additional_keywords = ['$']\naugroup end\n```\n\nAlternatively, you can use [coc-nginx](https://github.com/yaegassy/coc-nginx).\n\n```vim\nlet g:coc_global_extensions = ['@yaegassy/coc-nginx']\n```\n\nNote: this list is non-exhaustive. If you know of a great choice not included in this list, please submit a PR!\n\n## Command line\n\nnginx-language-server can be run directly from the command line.\n\n```console\n$ nginx-language-server --help\nusage: nginx-language-server [-h] [--version] [--tcp] [--host HOST]\n [--port PORT] [--log-file LOG_FILE] [-v]\n\nNginx language server: an LSP server for nginx.conf.\n\noptional arguments:\n -h, --help show this help message and exit\n --version display version information and exit\n --tcp use TCP server instead of stdio\n --host HOST host for TCP server (default 127.0.0.1)\n --port PORT port for TCP server (default 2088)\n --log-file LOG_FILE redirect logs to the given file instead of writing to\n stderr\n -v, --verbose increase verbosity of log output\n\nExamples:\n\n Run from stdio: nginx-language-server\n```\n\n## Inspiration\n\nThe useful language data for nginx is ported from [vscode-nginx-conf-hint](https://github.com/hangxingliu/vscode-nginx-conf-hint). I would have used this library directly, but alas! It's written only for VSCode and I use Neovim.\n\n## Written by\n\nSamuel Roeca _samuel.roeca@gmail.com_\n",
"bugtrack_url": null,
"license": "GPL-3.0-only",
"summary": "A language server for nginx.conf",
"version": "0.8.0",
"split_keywords": [
"nginx",
"completion",
"refactoring",
"vim",
"neovim",
"lsp",
"language-server-protocol"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b84cb20870d3c9f013858c48b62a973efbfcaa1a8bc9e4802eba05e0ecdf2d18",
"md5": "e25a055adb26a16d5683317db087f88e",
"sha256": "be2c9a3e66ed4c4ba2af6b9417afe8fcf9135489f30f78e49806b50ca7a2c995"
},
"downloads": -1,
"filename": "nginx_language_server-0.8.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e25a055adb26a16d5683317db087f88e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<3.12",
"size": 233895,
"upload_time": "2023-02-03T17:33:29",
"upload_time_iso_8601": "2023-02-03T17:33:29.995045Z",
"url": "https://files.pythonhosted.org/packages/b8/4c/b20870d3c9f013858c48b62a973efbfcaa1a8bc9e4802eba05e0ecdf2d18/nginx_language_server-0.8.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ae2f3707beee0d3e9ccb372b6326f63d7dcf565d5bfd52b93eeb28cc1f853622",
"md5": "0a53d259da8a3f02e8e53ee5dbd3cc6f",
"sha256": "34223dcf53bca6e297c38c2c4b7af152dbe5205ecaf2b09b09217de70717e5f2"
},
"downloads": -1,
"filename": "nginx_language_server-0.8.0.tar.gz",
"has_sig": false,
"md5_digest": "0a53d259da8a3f02e8e53ee5dbd3cc6f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<3.12",
"size": 228033,
"upload_time": "2023-02-03T17:33:31",
"upload_time_iso_8601": "2023-02-03T17:33:31.799635Z",
"url": "https://files.pythonhosted.org/packages/ae/2f/3707beee0d3e9ccb372b6326f63d7dcf565d5bfd52b93eeb28cc1f853622/nginx_language_server-0.8.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-03 17:33:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "pappasam",
"github_project": "nginx-language-server",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nginx-language-server"
}