Compare commits
70 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0cfa8b13f | ||
|
|
722dae419e | ||
|
|
6a3140f105 | ||
|
|
4dec2f5afa | ||
|
|
9f7754f0e6 | ||
|
|
9630b96935 | ||
|
|
76e34ae628 | ||
|
|
cbb6bdd1ae | ||
|
|
a5af5b505f | ||
|
|
4d120a6a98 | ||
|
|
6e839f7675 | ||
|
|
cade1e2c45 | ||
|
|
d16d3b24ef | ||
|
|
4be7657edb | ||
|
|
040f0b9f0c | ||
|
|
ef2c31c6a3 | ||
|
|
87879ee5df | ||
|
|
01b1fac73e | ||
|
|
5550cb259c | ||
|
|
466c5b7bcc | ||
|
|
0ec120f391 | ||
|
|
5d916b6989 | ||
|
|
1c606ee8a8 | ||
|
|
cdb62adce3 | ||
|
|
6ac3b1d17f | ||
|
|
ce2c3a21db | ||
|
|
3697fae2d3 | ||
|
|
48d5980a36 | ||
|
|
e07b3242c8 | ||
|
|
2d36887b26 | ||
|
|
67aced6544 | ||
|
|
3c171b9e25 | ||
|
|
c8c284e061 | ||
|
|
6bf08e0f14 | ||
|
|
40d93525d9 | ||
|
|
f8136d6dbc | ||
|
|
5af6555d3c | ||
|
|
310c449250 | ||
|
|
bd4f357e59 | ||
|
|
02ae7c4a7c | ||
|
|
6e03b145ba | ||
|
|
b3123db464 | ||
|
|
7d85c2c8dd | ||
|
|
b08dc91e53 | ||
|
|
894b38d55d | ||
|
|
cc9877adbe | ||
|
|
66af586b2a | ||
|
|
c870e3d512 | ||
|
|
9e6fc1a277 | ||
|
|
79864d24ee | ||
|
|
6f93218462 | ||
|
|
600659fe81 | ||
|
|
af59e9b3f6 | ||
|
|
39aa03cd55 | ||
|
|
8d5c6b588c | ||
|
|
b2d8e66ef1 | ||
|
|
4624bdf4e8 | ||
|
|
6628dfe5d0 | ||
|
|
e73b0bab0f | ||
|
|
06f7a4669d | ||
|
|
1a8267bb74 | ||
|
|
9670ecfb59 | ||
|
|
3b8c225d06 | ||
|
|
ff727b7793 | ||
|
|
1ac3bf421d | ||
|
|
7919cf5025 | ||
|
|
b4dd6c840d | ||
|
|
0021c07b56 | ||
|
|
5e2736a710 | ||
|
|
f89f0d6b56 |
12
.editorconfig
Normal file
12
.editorconfig
Normal file
@@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
insert_final_newline = true
|
||||
end_of_line = lf
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
poetry.lock linguist-generated=true
|
||||
42
.github/workflows/tests.yml
vendored
42
.github/workflows/tests.yml
vendored
@@ -1,35 +1,45 @@
|
||||
name: Tests
|
||||
|
||||
on: [push]
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
env:
|
||||
CMAKE_VERSION: 3.14.7
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-18.04]
|
||||
python: [3.6, 3.7, 3.8]
|
||||
python: ["3.6", "3.7", "3.8", "3.9", "3.10"]
|
||||
os: [ubuntu-18.04, windows-2019]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Cache .tox
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: .tox
|
||||
key: ${{ runner.OS }}-tox-${{ hashFiles('poetry.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.OS }}-tox-
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python }}
|
||||
uses: actions/setup-python@v1
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
- name: Setup VC
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
if: contains(matrix.os, 'windows')
|
||||
- name: Install CMake
|
||||
if: contains(matrix.os, 'ubuntu')
|
||||
run: |
|
||||
CMAKE_VERSION=3.17.3
|
||||
curl -sSL https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz | tar xz
|
||||
sudo cp -rT cmake-$CMAKE_VERSION-Linux-x86_64 /usr/local
|
||||
rm -rf cmake-$CMAKE_VERSION-Linux-x86_64
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
curl -sSL https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz | tar xz
|
||||
cmake --version
|
||||
python -m pip install --upgrade setuptools pip wheel
|
||||
python -m pip install poetry tox-gh-actions
|
||||
- name: Test with tox
|
||||
run: |
|
||||
export PATH=$GITHUB_WORKSPACE/cmake-$CMAKE_VERSION-Linux-x86_64/bin:$PATH
|
||||
tox
|
||||
env:
|
||||
os: ${{ matrix.os }}
|
||||
- name: Upload coverage reports to Codecov
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
flags: unittests
|
||||
name: Python ${{ matrix.python }} on ${{ matrix.os }}
|
||||
fail_ci_if_error: false
|
||||
|
||||
129
.gitignore
vendored
129
.gitignore
vendored
@@ -1,133 +1,4 @@
|
||||
### https://raw.github.com/github/gitignore/cb0c6ef7ac68f2300409ee85501d9ad432cb4c7e/Python.gitignore
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
pip-wheel-metadata/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
[style]
|
||||
based_on_style = pep8
|
||||
42
README.md
42
README.md
@@ -1,5 +1,9 @@
|
||||
# cmake-language-server
|
||||
[](https://pypi.org/project/cmake-language-server)
|
||||
[](https://aur.archlinux.org/packages/cmake-language-server/)
|
||||
[](https://github.com/regen100/cmake-language-server/actions)
|
||||
[](https://codecov.io/gh/regen100/cmake-language-server)
|
||||
[](https://github.com/regen100/cmake-language-server/blob/master/LICENSE)
|
||||
|
||||
CMake LSP Implementation.
|
||||
|
||||
@@ -12,17 +16,23 @@ Alpha Stage, work in progress.
|
||||
|
||||
## Commands
|
||||
|
||||
- cmake-language-server: LSP server
|
||||
- cmake-format: CLI frontend for formatting
|
||||
- `cmake-language-server`: LSP server
|
||||
- `python -m cmake_language_server.formatter`: CLI frontend for formatting
|
||||
|
||||
## Installation
|
||||
|
||||
### Clients
|
||||
```bash
|
||||
$ pip install cmake-language-server
|
||||
```
|
||||
|
||||
- Neovim ([neoclide/coc.nvim][coc.nvim])
|
||||
### Tested Clients
|
||||
|
||||
- Neovim ([neoclide/coc.nvim][coc.nvim], [prabirshrestha/vim-lsp][vim-lsp])
|
||||
|
||||
#### Neovim
|
||||
|
||||
##### coc.nvim
|
||||
|
||||
```jsonc
|
||||
"languageserver": {
|
||||
"cmake": {
|
||||
@@ -38,5 +48,29 @@ Alpha Stage, work in progress.
|
||||
}
|
||||
```
|
||||
|
||||
##### vim-lsp
|
||||
|
||||
```vim
|
||||
if executable('cmake-language-server')
|
||||
au User lsp_setup call lsp#register_server({
|
||||
\ 'name': 'cmake',
|
||||
\ 'cmd': {server_info->['cmake-language-server']},
|
||||
\ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'build/'))},
|
||||
\ 'whitelist': ['cmake'],
|
||||
\ 'initialization_options': {
|
||||
\ 'buildDirectory': 'build',
|
||||
\ }
|
||||
\})
|
||||
endif
|
||||
```
|
||||
|
||||
### Configuration
|
||||
* `buildDirectory`
|
||||
This language server uses CMake's file API to get cached variables.
|
||||
The API communicates using `<buildDirectory>/.cmake/api/`.
|
||||
`buildDirectory` is relative path to the root uri of the workspace.
|
||||
To configure the build tree, you need to run the cmake command such as `cmake .. -DFOO=bar`.
|
||||
|
||||
|
||||
[coc.nvim]: https://github.com/neoclide/coc.nvim
|
||||
[vim-lsp]: https://github.com/prabirshrestha/vim-lsp
|
||||
|
||||
7
codecov.yml
Normal file
7
codecov.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
threshold: 10%
|
||||
patch:
|
||||
default: off
|
||||
6
mypy.ini
6
mypy.ini
@@ -1,6 +0,0 @@
|
||||
[mypy]
|
||||
ignore_missing_imports = True
|
||||
allow_redefinition = True
|
||||
|
||||
[mypy-re.Scanner]
|
||||
ignore_errors = True
|
||||
540
poetry.lock
generated
540
poetry.lock
generated
@@ -1,346 +1,390 @@
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Atomic file writes."
|
||||
name = "atomicwrites"
|
||||
version = "1.4.0"
|
||||
description = "Atomic file writes."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "1.3.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Classes Without Boilerplate"
|
||||
name = "attrs"
|
||||
version = "21.4.0"
|
||||
description = "Classes Without Boilerplate"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "19.3.0"
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[package.extras]
|
||||
dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"]
|
||||
docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"]
|
||||
tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "cloudpickle"]
|
||||
tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "cloudpickle"]
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Cross-platform colored terminal text."
|
||||
marker = "sys_platform == \"win32\""
|
||||
name = "colorama"
|
||||
version = "0.4.4"
|
||||
description = "Cross-platform colored terminal text."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "0.4.1"
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[[package]]
|
||||
name = "coverage"
|
||||
version = "6.2"
|
||||
description = "Code coverage measurement for Python"
|
||||
category = "dev"
|
||||
description = "Discover and load entry points from installed packages."
|
||||
name = "entrypoints"
|
||||
optional = false
|
||||
python-versions = ">=2.7"
|
||||
version = "0.3"
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.extras]
|
||||
toml = ["tomli"]
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "A platform independent file lock."
|
||||
name = "filelock"
|
||||
name = "dataclasses"
|
||||
version = "0.8"
|
||||
description = "A backport of the dataclasses module for Python 3.6"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "3.0.12"
|
||||
python-versions = ">=3.6, <3.7"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "the modular source code checker: pep8, pyflakes and co"
|
||||
name = "flake8"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "3.7.8"
|
||||
|
||||
[package.dependencies]
|
||||
entrypoints = ">=0.3.0,<0.4.0"
|
||||
mccabe = ">=0.6.0,<0.7.0"
|
||||
pycodestyle = ">=2.5.0,<2.6.0"
|
||||
pyflakes = ">=2.1.0,<2.2.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Read metadata from Python packages"
|
||||
marker = "python_version < \"3.8\""
|
||||
name = "importlib-metadata"
|
||||
version = "4.8.3"
|
||||
description = "Read metadata from Python packages"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7,!=3.0,!=3.1,!=3.2,!=3.3"
|
||||
version = "0.23"
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""}
|
||||
zipp = ">=0.5"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "A Python utility / library to sort Python imports."
|
||||
name = "isort"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "4.3.21"
|
||||
[package.extras]
|
||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||
perf = ["ipython"]
|
||||
testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"]
|
||||
|
||||
[[package]]
|
||||
name = "iniconfig"
|
||||
version = "1.1.1"
|
||||
description = "iniconfig: brain-dead simple config-ini parsing"
|
||||
category = "dev"
|
||||
description = "McCabe checker, plugin for flake8"
|
||||
name = "mccabe"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "0.6.1"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "More routines for operating on iterables, beyond itertools"
|
||||
name = "more-itertools"
|
||||
optional = false
|
||||
python-versions = ">=3.4"
|
||||
version = "7.2.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Optional static typing for Python"
|
||||
name = "mypy"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
version = "0.740"
|
||||
|
||||
[package.dependencies]
|
||||
mypy-extensions = ">=0.4.0,<0.5.0"
|
||||
typed-ast = ">=1.4.0,<1.5.0"
|
||||
typing-extensions = ">=3.7.4"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Experimental type system extensions for programs checked with the mypy typechecker."
|
||||
name = "mypy-extensions"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "0.4.3"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Core utilities for Python packages"
|
||||
name = "packaging"
|
||||
version = "21.3"
|
||||
description = "Core utilities for Python packages"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "19.2"
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
pyparsing = ">=2.0.2"
|
||||
six = "*"
|
||||
pyparsing = ">=2.0.2,<3.0.5 || >3.0.5"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "plugin and hook calling mechanisms for python"
|
||||
name = "pluggy"
|
||||
version = "1.0.0"
|
||||
description = "plugin and hook calling mechanisms for python"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "0.13.0"
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
[package.dependencies.importlib-metadata]
|
||||
python = "<3.8"
|
||||
version = ">=0.12"
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
|
||||
[package.extras]
|
||||
dev = ["pre-commit", "tox"]
|
||||
testing = ["pytest", "pytest-benchmark"]
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "library with cross-python path, ini-parsing, io, code, log facilities"
|
||||
name = "py"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "1.8.0"
|
||||
|
||||
[[package]]
|
||||
version = "1.11.0"
|
||||
description = "library with cross-python path, ini-parsing, io, code, log facilities"
|
||||
category = "dev"
|
||||
description = "Python style guide checker"
|
||||
name = "pycodestyle"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "2.5.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "passive checker of Python programs"
|
||||
name = "pyflakes"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "2.1.1"
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[[package]]
|
||||
name = "pydantic"
|
||||
version = "1.7.4"
|
||||
description = "Data validation and settings management using python 3.6 type hinting"
|
||||
category = "main"
|
||||
description = "a pythonic generic language server (pronounced like \"pie glass\")."
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
dataclasses = {version = ">=0.6", markers = "python_version < \"3.7\""}
|
||||
|
||||
[package.extras]
|
||||
dotenv = ["python-dotenv (>=0.10.4)"]
|
||||
email = ["email-validator (>=1.0.3)"]
|
||||
typing_extensions = ["typing-extensions (>=3.7.2)"]
|
||||
|
||||
[[package]]
|
||||
name = "pygls"
|
||||
version = "0.11.3"
|
||||
description = "a pythonic generic language server (pronounced like \"pie glass\")."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "0.8.1"
|
||||
|
||||
[package.dependencies]
|
||||
pydantic = ">=1.7,<1.9"
|
||||
typeguard = ">=2.10.0,<3"
|
||||
|
||||
[package.extras]
|
||||
dev = ["bandit (==1.6.0)", "flake8 (==3.7.7)", "mypy (==0.812)"]
|
||||
docs = ["sphinx (==2.0.1)", "sphinx-rtd-theme (==0.4.3)"]
|
||||
test = ["mock (==3.0.5)", "pytest (==4.5.0)", "pytest-asyncio (==0.10.0)"]
|
||||
ws = ["websockets (>=9.0.0,<10.0.0)"]
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Python parsing module"
|
||||
name = "pyparsing"
|
||||
version = "2.4.7"
|
||||
description = "Python parsing module"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
version = "2.4.2"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "pytest: simple powerful testing with Python"
|
||||
name = "pytest"
|
||||
version = "6.2.5"
|
||||
description = "pytest: simple powerful testing with Python"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
version = "5.2.1"
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
atomicwrites = ">=1.0"
|
||||
attrs = ">=17.4.0"
|
||||
colorama = "*"
|
||||
more-itertools = ">=4.0.0"
|
||||
atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""}
|
||||
attrs = ">=19.2.0"
|
||||
colorama = {version = "*", markers = "sys_platform == \"win32\""}
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
iniconfig = "*"
|
||||
packaging = "*"
|
||||
pluggy = ">=0.12,<1.0"
|
||||
py = ">=1.5.0"
|
||||
wcwidth = "*"
|
||||
pluggy = ">=0.12,<2.0"
|
||||
py = ">=1.8.2"
|
||||
toml = "*"
|
||||
|
||||
[package.dependencies.importlib-metadata]
|
||||
python = "<3.8"
|
||||
version = ">=0.12"
|
||||
[package.extras]
|
||||
testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"]
|
||||
|
||||
[[package]]
|
||||
name = "pytest-cov"
|
||||
version = "2.12.1"
|
||||
description = "Pytest plugin for measuring coverage."
|
||||
category = "dev"
|
||||
description = "pytest plugin for test data directories and files"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[package.dependencies]
|
||||
coverage = ">=5.2.1"
|
||||
pytest = ">=4.6"
|
||||
toml = "*"
|
||||
|
||||
[package.extras]
|
||||
testing = ["fields", "hunter", "process-tests", "six", "pytest-xdist", "virtualenv"]
|
||||
|
||||
[[package]]
|
||||
name = "pytest-datadir"
|
||||
version = "1.3.1"
|
||||
description = "pytest plugin for test data directories and files"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "1.3.1"
|
||||
|
||||
[package.dependencies]
|
||||
pytest = ">=2.7.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Python 2 and 3 compatibility utilities"
|
||||
name = "six"
|
||||
optional = false
|
||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*"
|
||||
version = "1.12.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Python Library for Tom's Obvious, Minimal Language"
|
||||
name = "toml"
|
||||
version = "0.10.2"
|
||||
description = "Python Library for Tom's Obvious, Minimal Language"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "0.10.0"
|
||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "tox is a generic virtualenv management and test command line tool"
|
||||
name = "tox"
|
||||
name = "typeguard"
|
||||
version = "2.13.3"
|
||||
description = "Run-time type checker for Python"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "3.14.0"
|
||||
python-versions = ">=3.5.3"
|
||||
|
||||
[package.dependencies]
|
||||
filelock = ">=3.0.0,<4"
|
||||
packaging = ">=14"
|
||||
pluggy = ">=0.12.0,<1"
|
||||
py = ">=1.4.17,<2"
|
||||
six = ">=1.0.0,<2"
|
||||
toml = ">=0.9.4"
|
||||
virtualenv = ">=14.0.0"
|
||||
|
||||
[package.dependencies.importlib-metadata]
|
||||
python = "<3.8"
|
||||
version = ">=0.12,<1"
|
||||
[package.extras]
|
||||
doc = ["sphinx-rtd-theme", "sphinx-autodoc-typehints (>=1.2.0)"]
|
||||
test = ["pytest", "typing-extensions", "mypy"]
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "a fork of Python 2 and 3 ast modules with type comment support"
|
||||
name = "typed-ast"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "1.4.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Type Hints for Python"
|
||||
name = "typing"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "3.7.4.1"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Backported and Experimental Type Hints for Python 3.5+"
|
||||
name = "typing-extensions"
|
||||
version = "4.1.1"
|
||||
description = "Backported and Experimental Type Hints for Python 3.6+"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "3.7.4"
|
||||
|
||||
[package.dependencies]
|
||||
typing = ">=3.7.4"
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Virtual Python Environment builder"
|
||||
name = "virtualenv"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7"
|
||||
version = "16.7.7"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Measures number of Terminal column cells of wide-character codes"
|
||||
name = "wcwidth"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "0.1.7"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "A formatter for Python code."
|
||||
name = "yapf"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "0.28.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Backport of pathlib-compatible object wrapper for zip files"
|
||||
marker = "python_version < \"3.8\""
|
||||
name = "zipp"
|
||||
version = "3.6.0"
|
||||
description = "Backport of pathlib-compatible object wrapper for zip files"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7"
|
||||
version = "0.6.0"
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
more-itertools = "*"
|
||||
[package.extras]
|
||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||
testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"]
|
||||
|
||||
[metadata]
|
||||
content-hash = "2fa2f64a1c51f6312594f611baa29f434f3a8ede16543988ac0d76a6de587c7f"
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.6"
|
||||
content-hash = "8b534309919acadb4c5b088a7a9aff76066ab695b1d39bf507b32db898450b76"
|
||||
|
||||
[metadata.hashes]
|
||||
atomicwrites = ["03472c30eb2c5d1ba9227e4c2ca66ab8287fbfbbda3888aa93dc2e28fc6811b4", "75a9445bac02d8d058d5e1fe689654ba5a6556a1dfd8ce6ec55a0ed79866cfa6"]
|
||||
attrs = ["08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c", "f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72"]
|
||||
colorama = ["05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d", "f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48"]
|
||||
entrypoints = ["589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19", "c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451"]
|
||||
filelock = ["18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59", "929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"]
|
||||
flake8 = ["19241c1cbc971b9962473e4438a2ca19749a7dd002dd1a946eaba171b4114548", "8e9dfa3cecb2400b3738a42c54c3043e821682b9c840b0448c0503f781130696"]
|
||||
importlib-metadata = ["aa18d7378b00b40847790e7c27e11673d7fed219354109d0e7b9e5b25dc3ad26", "d5f18a79777f3aa179c145737780282e27b508fc8fd688cb17c7a813e8bd39af"]
|
||||
isort = ["54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1", "6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"]
|
||||
mccabe = ["ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", "dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"]
|
||||
more-itertools = ["409cd48d4db7052af495b09dec721011634af3753ae1ef92d2b32f73a745f832", "92b8c4b06dac4f0611c0729b2f2ede52b2e1bac1ab48f089c7ddc12e26bb60c4"]
|
||||
mypy = ["1521c186a3d200c399bd5573c828ea2db1362af7209b2adb1bb8532cea2fb36f", "31a046ab040a84a0fc38bc93694876398e62bc9f35eca8ccbf6418b7297f4c00", "3b1a411909c84b2ae9b8283b58b48541654b918e8513c20a400bb946aa9111ae", "48c8bc99380575deb39f5d3400ebb6a8a1cb5cc669bbba4d3bb30f904e0a0e7d", "540c9caa57a22d0d5d3c69047cc9dd0094d49782603eb03069821b41f9e970e9", "672e418425d957e276c291930a3921b4a6413204f53fe7c37cad7bc57b9a3391", "6ed3b9b3fdc7193ea7aca6f3c20549b377a56f28769783a8f27191903a54170f", "9371290aa2cad5ad133e4cdc43892778efd13293406f7340b9ffe99d5ec7c1d9", "ace6ac1d0f87d4072f05b5468a084a45b4eda970e4d26704f201e06d47ab2990", "b428f883d2b3fe1d052c630642cc6afddd07d5cd7873da948644508be3b9d4a7", "d5bf0e6ec8ba346a2cf35cb55bf4adfddbc6b6576fcc9e10863daa523e418dbb", "d7574e283f83c08501607586b3167728c58e8442947e027d2d4c7dcd6d82f453", "dc889c84241a857c263a2b1cd1121507db7d5b5f5e87e77147097230f374d10b", "f4748697b349f373002656bf32fede706a0e713d67bfdcf04edf39b1f61d46eb"]
|
||||
mypy-extensions = ["090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", "2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"]
|
||||
packaging = ["28b924174df7a2fa32c1953825ff29c61e2f5e082343165438812f00d3a7fc47", "d9551545c6d761f3def1677baf08ab2a3ca17c56879e70fecba2fc4dde4ed108"]
|
||||
pluggy = ["0db4b7601aae1d35b4a033282da476845aa19185c1e6964b25cf324b5e4ec3e6", "fa5fa1622fa6dd5c030e9cad086fa19ef6a0cf6d7a2d12318e10cb49d6d68f34"]
|
||||
py = ["64f65755aee5b381cea27766a3a147c3f15b9b6b9ac88676de66ba2ae36793fa", "dc639b046a6e2cff5bbe40194ad65936d6ba360b52b3c3fe1d08a82dd50b5e53"]
|
||||
pycodestyle = ["95a2219d12372f05704562a14ec30bc76b05a5b297b21a5dfe3f6fac3491ae56", "e40a936c9a450ad81df37f549d676d127b1b66000a6c500caa2b085bc0ca976c"]
|
||||
pyflakes = ["17dbeb2e3f4d772725c777fabc446d5634d1038f234e77343108ce445ea69ce0", "d976835886f8c5b31d47970ed689944a0262b5f3afa00a5a7b4dc81e5449f8a2"]
|
||||
pygls = ["3ee878a828b7bc0873a2ea44208d6846a91aa7dbbbdc052e7fe8cc689f6644fa", "780fd0c5ae95ad02ecaf70b071e43ff8ced8384b7d6bed19311a7b431d26fb88"]
|
||||
pyparsing = ["6f98a7b9397e206d78cc01df10131398f1c8b8510a2f4d97d9abd82e1aacdd80", "d9338df12903bbf5d65a0e4e87c2161968b10d2e489652bb47001d82a9b028b4"]
|
||||
pytest = ["7e4800063ccfc306a53c461442526c5571e1462f61583506ce97e4da6a1d88c8", "ca563435f4941d0cb34767301c27bc65c510cb82e90b9ecf9cb52dc2c63caaa0"]
|
||||
pytest-datadir = ["1847ed0efe0bc54cac40ab3fba6d651c2f03d18dd01f2a582979604d32e7621e", "d3af1e738df87515ee509d6135780f25a15959766d9c2b2dbe02bf4fb979cb18"]
|
||||
six = ["3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"]
|
||||
toml = ["229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c", "235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e", "f1db651f9657708513243e61e6cc67d101a39bad662eaa9b5546f789338e07a3"]
|
||||
tox = ["0bc216b6a2e6afe764476b4a07edf2c1dab99ed82bb146a1130b2e828f5bff5e", "c4f6b319c20ba4913dbfe71ebfd14ff95d1853c4231493608182f66e566ecfe1"]
|
||||
typed-ast = ["1170afa46a3799e18b4c977777ce137bb53c7485379d9706af8a59f2ea1aa161", "18511a0b3e7922276346bcb47e2ef9f38fb90fd31cb9223eed42c85d1312344e", "262c247a82d005e43b5b7f69aff746370538e176131c32dda9cb0f324d27141e", "2b907eb046d049bcd9892e3076c7a6456c93a25bebfe554e931620c90e6a25b0", "354c16e5babd09f5cb0ee000d54cfa38401d8b8891eefa878ac772f827181a3c", "48e5b1e71f25cfdef98b013263a88d7145879fbb2d5185f2a0c79fa7ebbeae47", "4e0b70c6fc4d010f8107726af5fd37921b666f5b31d9331f0bd24ad9a088e631", "630968c5cdee51a11c05a30453f8cd65e0cc1d2ad0d9192819df9978984529f4", "66480f95b8167c9c5c5c87f32cf437d585937970f3fc24386f313a4c97b44e34", "71211d26ffd12d63a83e079ff258ac9d56a1376a25bc80b1cdcdf601b855b90b", "7954560051331d003b4e2b3eb822d9dd2e376fa4f6d98fee32f452f52dd6ebb2", "838997f4310012cf2e1ad3803bce2f3402e9ffb71ded61b5ee22617b3a7f6b6e", "95bd11af7eafc16e829af2d3df510cecfd4387f6453355188342c3e79a2ec87a", "bc6c7d3fa1325a0c6613512a093bc2a2a15aeec350451cbdf9e1d4bffe3e3233", "cc34a6f5b426748a507dd5d1de4c1978f2eb5626d51326e43280941206c209e1", "d755f03c1e4a51e9b24d899561fec4ccaf51f210d52abdf8c07ee2849b212a36", "d7c45933b1bdfaf9f36c579671fec15d25b06c8398f113dab64c18ed1adda01d", "d896919306dd0aa22d0132f62a1b78d11aaf4c9fc5b3410d3c666b818191630a", "fdc1c9bbf79510b76408840e009ed65958feba92a88833cdceecff93ae8fff66", "ffde2fbfad571af120fcbfbbc61c72469e72f550d676c3342492a9dfdefb8f12"]
|
||||
typing = ["91dfe6f3f706ee8cc32d38edbbf304e9b7583fb37108fef38229617f8b3eba23", "c8cabb5ab8945cd2f54917be357d134db9cc1eb039e59d1606dc1e60cb1d9d36", "f38d83c5a7a7086543a0f649564d661859c5146a85775ab90c0d2f93ffaa9714"]
|
||||
typing-extensions = ["2ed632b30bb54fc3941c382decfd0ee4148f5c591651c9272473fea2c6397d95", "b1edbbf0652660e32ae780ac9433f4231e7339c7f9a8057d0f042fcbcea49b87", "d8179012ec2c620d3791ca6fe2bf7979d979acdbef1fca0bc56b37411db682ed"]
|
||||
virtualenv = ["11cb4608930d5fd3afb545ecf8db83fa50e1f96fc4fca80c94b07d2c83146589", "d257bb3773e48cac60e475a19b608996c73f4d333b3ba2e4e57d5ac6134e0136"]
|
||||
wcwidth = ["3df37372226d6e63e1b1e1eda15c594bca98a22d33a23832a90998faa96bc65e", "f4ebe71925af7b40a864553f761ed559b43544f8f71746c2d756c7fe788ade7c"]
|
||||
yapf = ["02ace10a00fa2e36c7ebd1df2ead91dbfbd7989686dc4ccbdc549e95d19f5780", "6f94b6a176a7c114cfa6bad86d40f259bbe0f10cf2fa7f2f4b3596fc5802a41b"]
|
||||
zipp = ["3718b1cbcd963c7d4c5511a8240812904164b7f381b647143a89d3b98f9bcd8e", "f06903e9f1f43b12d371004b4ac7b06ab39a44adc747266928ae6debfa7b3335"]
|
||||
[metadata.files]
|
||||
atomicwrites = [
|
||||
{file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"},
|
||||
{file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"},
|
||||
]
|
||||
attrs = [
|
||||
{file = "attrs-21.4.0-py2.py3-none-any.whl", hash = "sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4"},
|
||||
{file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"},
|
||||
]
|
||||
colorama = [
|
||||
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
|
||||
{file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
|
||||
]
|
||||
coverage = [
|
||||
{file = "coverage-6.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6dbc1536e105adda7a6312c778f15aaabe583b0e9a0b0a324990334fd458c94b"},
|
||||
{file = "coverage-6.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:174cf9b4bef0db2e8244f82059a5a72bd47e1d40e71c68ab055425172b16b7d0"},
|
||||
{file = "coverage-6.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:92b8c845527eae547a2a6617d336adc56394050c3ed8a6918683646328fbb6da"},
|
||||
{file = "coverage-6.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:c7912d1526299cb04c88288e148c6c87c0df600eca76efd99d84396cfe00ef1d"},
|
||||
{file = "coverage-6.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d5d2033d5db1d58ae2d62f095e1aefb6988af65b4b12cb8987af409587cc0739"},
|
||||
{file = "coverage-6.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:3feac4084291642165c3a0d9eaebedf19ffa505016c4d3db15bfe235718d4971"},
|
||||
{file = "coverage-6.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:276651978c94a8c5672ea60a2656e95a3cce2a3f31e9fb2d5ebd4c215d095840"},
|
||||
{file = "coverage-6.2-cp310-cp310-win32.whl", hash = "sha256:f506af4f27def639ba45789fa6fde45f9a217da0be05f8910458e4557eed020c"},
|
||||
{file = "coverage-6.2-cp310-cp310-win_amd64.whl", hash = "sha256:3f7c17209eef285c86f819ff04a6d4cbee9b33ef05cbcaae4c0b4e8e06b3ec8f"},
|
||||
{file = "coverage-6.2-cp311-cp311-macosx_10_14_x86_64.whl", hash = "sha256:13362889b2d46e8d9f97c421539c97c963e34031ab0cb89e8ca83a10cc71ac76"},
|
||||
{file = "coverage-6.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:22e60a3ca5acba37d1d4a2ee66e051f5b0e1b9ac950b5b0cf4aa5366eda41d47"},
|
||||
{file = "coverage-6.2-cp311-cp311-win_amd64.whl", hash = "sha256:b637c57fdb8be84e91fac60d9325a66a5981f8086c954ea2772efe28425eaf64"},
|
||||
{file = "coverage-6.2-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f467bbb837691ab5a8ca359199d3429a11a01e6dfb3d9dcc676dc035ca93c0a9"},
|
||||
{file = "coverage-6.2-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2641f803ee9f95b1f387f3e8f3bf28d83d9b69a39e9911e5bfee832bea75240d"},
|
||||
{file = "coverage-6.2-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:1219d760ccfafc03c0822ae2e06e3b1248a8e6d1a70928966bafc6838d3c9e48"},
|
||||
{file = "coverage-6.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:9a2b5b52be0a8626fcbffd7e689781bf8c2ac01613e77feda93d96184949a98e"},
|
||||
{file = "coverage-6.2-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:8e2c35a4c1f269704e90888e56f794e2d9c0262fb0c1b1c8c4ee44d9b9e77b5d"},
|
||||
{file = "coverage-6.2-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:5d6b09c972ce9200264c35a1d53d43ca55ef61836d9ec60f0d44273a31aa9f17"},
|
||||
{file = "coverage-6.2-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:e3db840a4dee542e37e09f30859f1612da90e1c5239a6a2498c473183a50e781"},
|
||||
{file = "coverage-6.2-cp36-cp36m-win32.whl", hash = "sha256:4e547122ca2d244f7c090fe3f4b5a5861255ff66b7ab6d98f44a0222aaf8671a"},
|
||||
{file = "coverage-6.2-cp36-cp36m-win_amd64.whl", hash = "sha256:01774a2c2c729619760320270e42cd9e797427ecfddd32c2a7b639cdc481f3c0"},
|
||||
{file = "coverage-6.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:fb8b8ee99b3fffe4fd86f4c81b35a6bf7e4462cba019997af2fe679365db0c49"},
|
||||
{file = "coverage-6.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:619346d57c7126ae49ac95b11b0dc8e36c1dd49d148477461bb66c8cf13bb521"},
|
||||
{file = "coverage-6.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:0a7726f74ff63f41e95ed3a89fef002916c828bb5fcae83b505b49d81a066884"},
|
||||
{file = "coverage-6.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:cfd9386c1d6f13b37e05a91a8583e802f8059bebfccde61a418c5808dea6bbfa"},
|
||||
{file = "coverage-6.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:17e6c11038d4ed6e8af1407d9e89a2904d573be29d51515f14262d7f10ef0a64"},
|
||||
{file = "coverage-6.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c254b03032d5a06de049ce8bca8338a5185f07fb76600afff3c161e053d88617"},
|
||||
{file = "coverage-6.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:dca38a21e4423f3edb821292e97cec7ad38086f84313462098568baedf4331f8"},
|
||||
{file = "coverage-6.2-cp37-cp37m-win32.whl", hash = "sha256:600617008aa82032ddeace2535626d1bc212dfff32b43989539deda63b3f36e4"},
|
||||
{file = "coverage-6.2-cp37-cp37m-win_amd64.whl", hash = "sha256:bf154ba7ee2fd613eb541c2bc03d3d9ac667080a737449d1a3fb342740eb1a74"},
|
||||
{file = "coverage-6.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f9afb5b746781fc2abce26193d1c817b7eb0e11459510fba65d2bd77fe161d9e"},
|
||||
{file = "coverage-6.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:edcada2e24ed68f019175c2b2af2a8b481d3d084798b8c20d15d34f5c733fa58"},
|
||||
{file = "coverage-6.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:a9c8c4283e17690ff1a7427123ffb428ad6a52ed720d550e299e8291e33184dc"},
|
||||
{file = "coverage-6.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f614fc9956d76d8a88a88bb41ddc12709caa755666f580af3a688899721efecd"},
|
||||
{file = "coverage-6.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:9365ed5cce5d0cf2c10afc6add145c5037d3148585b8ae0e77cc1efdd6aa2953"},
|
||||
{file = "coverage-6.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:8bdfe9ff3a4ea37d17f172ac0dff1e1c383aec17a636b9b35906babc9f0f5475"},
|
||||
{file = "coverage-6.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:63c424e6f5b4ab1cf1e23a43b12f542b0ec2e54f99ec9f11b75382152981df57"},
|
||||
{file = "coverage-6.2-cp38-cp38-win32.whl", hash = "sha256:49dbff64961bc9bdd2289a2bda6a3a5a331964ba5497f694e2cbd540d656dc1c"},
|
||||
{file = "coverage-6.2-cp38-cp38-win_amd64.whl", hash = "sha256:9a29311bd6429be317c1f3fe4bc06c4c5ee45e2fa61b2a19d4d1d6111cb94af2"},
|
||||
{file = "coverage-6.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:03b20e52b7d31be571c9c06b74746746d4eb82fc260e594dc662ed48145e9efd"},
|
||||
{file = "coverage-6.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:215f8afcc02a24c2d9a10d3790b21054b58d71f4b3c6f055d4bb1b15cecce685"},
|
||||
{file = "coverage-6.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:a4bdeb0a52d1d04123b41d90a4390b096f3ef38eee35e11f0b22c2d031222c6c"},
|
||||
{file = "coverage-6.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:c332d8f8d448ded473b97fefe4a0983265af21917d8b0cdcb8bb06b2afe632c3"},
|
||||
{file = "coverage-6.2-cp39-cp39-win32.whl", hash = "sha256:6e1394d24d5938e561fbeaa0cd3d356207579c28bd1792f25a068743f2d5b282"},
|
||||
{file = "coverage-6.2-cp39-cp39-win_amd64.whl", hash = "sha256:86f2e78b1eff847609b1ca8050c9e1fa3bd44ce755b2ec30e70f2d3ba3844644"},
|
||||
{file = "coverage-6.2-pp36.pp37.pp38-none-any.whl", hash = "sha256:5829192582c0ec8ca4a2532407bc14c2f338d9878a10442f5d03804a95fac9de"},
|
||||
{file = "coverage-6.2.tar.gz", hash = "sha256:e2cad8093172b7d1595b4ad66f24270808658e11acf43a8f95b41276162eb5b8"},
|
||||
]
|
||||
dataclasses = [
|
||||
{file = "dataclasses-0.8-py3-none-any.whl", hash = "sha256:0201d89fa866f68c8ebd9d08ee6ff50c0b255f8ec63a71c16fda7af82bb887bf"},
|
||||
{file = "dataclasses-0.8.tar.gz", hash = "sha256:8479067f342acf957dc82ec415d355ab5edb7e7646b90dc6e2fd1d96ad084c97"},
|
||||
]
|
||||
importlib-metadata = [
|
||||
{file = "importlib_metadata-4.8.3-py3-none-any.whl", hash = "sha256:65a9576a5b2d58ca44d133c42a241905cc45e34d2c06fd5ba2bafa221e5d7b5e"},
|
||||
{file = "importlib_metadata-4.8.3.tar.gz", hash = "sha256:766abffff765960fcc18003801f7044eb6755ffae4521c8e8ce8e83b9c9b0668"},
|
||||
]
|
||||
iniconfig = [
|
||||
{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
|
||||
{file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"},
|
||||
]
|
||||
packaging = [
|
||||
{file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"},
|
||||
{file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"},
|
||||
]
|
||||
pluggy = [
|
||||
{file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"},
|
||||
{file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"},
|
||||
]
|
||||
py = [
|
||||
{file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"},
|
||||
{file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"},
|
||||
]
|
||||
pydantic = [
|
||||
{file = "pydantic-1.7.4-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:3c60039e84552442defbcb5d56711ef0e057028ca7bfc559374917408a88d84e"},
|
||||
{file = "pydantic-1.7.4-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:6e7e314acb170e143c6f3912f93f2ec80a96aa2009ee681356b7ce20d57e5c62"},
|
||||
{file = "pydantic-1.7.4-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:8ef77cd17b73b5ba46788d040c0e820e49a2d80cfcd66fda3ba8be31094fd146"},
|
||||
{file = "pydantic-1.7.4-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:115d8aa6f257a1d469c66b6bfc7aaf04cd87c25095f24542065c68ebcb42fe63"},
|
||||
{file = "pydantic-1.7.4-cp36-cp36m-win_amd64.whl", hash = "sha256:66757d4e1eab69a3cfd3114480cc1d72b6dd847c4d30e676ae838c6740fdd146"},
|
||||
{file = "pydantic-1.7.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:4c92863263e4bd89e4f9cf1ab70d918170c51bd96305fe7b00853d80660acb26"},
|
||||
{file = "pydantic-1.7.4-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:3b8154babf30a5e0fa3aa91f188356763749d9b30f7f211fafb247d4256d7877"},
|
||||
{file = "pydantic-1.7.4-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:80cc46378505f7ff202879dcffe4bfbf776c15675028f6e08d1d10bdfbb168ac"},
|
||||
{file = "pydantic-1.7.4-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:dda60d7878a5af2d8560c55c7c47a8908344aa78d32ec1c02d742ede09c534df"},
|
||||
{file = "pydantic-1.7.4-cp37-cp37m-win_amd64.whl", hash = "sha256:4c1979d5cc3e14b35f0825caddea5a243dd6085e2a7539c006bc46997ef7a61a"},
|
||||
{file = "pydantic-1.7.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8857576600c32aa488f18d30833aa833b54a48e3bab3adb6de97e463af71f8f8"},
|
||||
{file = "pydantic-1.7.4-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1f86d4da363badb39426a0ff494bf1d8510cd2f7274f460eee37bdbf2fd495ec"},
|
||||
{file = "pydantic-1.7.4-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:3ea1256a9e782149381e8200119f3e2edea7cd6b123f1c79ab4bbefe4d9ba2c9"},
|
||||
{file = "pydantic-1.7.4-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:e28455b42a0465a7bf2cde5eab530389226ce7dc779de28d17b8377245982b1e"},
|
||||
{file = "pydantic-1.7.4-cp38-cp38-win_amd64.whl", hash = "sha256:47c5b1d44934375a3311891cabd450c150a31cf5c22e84aa172967bf186718be"},
|
||||
{file = "pydantic-1.7.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:00250e5123dd0b123ff72be0e1b69140e0b0b9e404d15be3846b77c6f1b1e387"},
|
||||
{file = "pydantic-1.7.4-cp39-cp39-manylinux1_i686.whl", hash = "sha256:d24aa3f7f791a023888976b600f2f389d3713e4f23b7a4c88217d3fce61cdffc"},
|
||||
{file = "pydantic-1.7.4-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:2c44a9afd4c4c850885436a4209376857989aaf0853c7b118bb2e628d4b78c4e"},
|
||||
{file = "pydantic-1.7.4-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:e87edd753da0ca1d44e308a1b1034859ffeab1f4a4492276bff9e1c3230db4fe"},
|
||||
{file = "pydantic-1.7.4-cp39-cp39-win_amd64.whl", hash = "sha256:a3026ee105b5360855e500b4abf1a1d0b034d88e75a2d0d66a4c35e60858e15b"},
|
||||
{file = "pydantic-1.7.4-py3-none-any.whl", hash = "sha256:a82385c6d5a77e3387e94612e3e34b77e13c39ff1295c26e3ba664e7b98073e2"},
|
||||
{file = "pydantic-1.7.4.tar.gz", hash = "sha256:0a1abcbd525fbb52da58c813d54c2ec706c31a91afdb75411a73dd1dec036595"},
|
||||
]
|
||||
pygls = [
|
||||
{file = "pygls-0.11.3-py3-none-any.whl", hash = "sha256:5c925b182f2b0aa38d0ce83a9829ca5aed8eb9c7079cffc5bddff2da1033b58f"},
|
||||
{file = "pygls-0.11.3.tar.gz", hash = "sha256:4d86fc854e6d6613cd42bf7511e9c6aac947fc8d62ff973a705570b036d969f2"},
|
||||
]
|
||||
pyparsing = [
|
||||
{file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"},
|
||||
{file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},
|
||||
]
|
||||
pytest = [
|
||||
{file = "pytest-6.2.5-py3-none-any.whl", hash = "sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134"},
|
||||
{file = "pytest-6.2.5.tar.gz", hash = "sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89"},
|
||||
]
|
||||
pytest-cov = [
|
||||
{file = "pytest-cov-2.12.1.tar.gz", hash = "sha256:261ceeb8c227b726249b376b8526b600f38667ee314f910353fa318caa01f4d7"},
|
||||
{file = "pytest_cov-2.12.1-py2.py3-none-any.whl", hash = "sha256:261bb9e47e65bd099c89c3edf92972865210c36813f80ede5277dceb77a4a62a"},
|
||||
]
|
||||
pytest-datadir = [
|
||||
{file = "pytest-datadir-1.3.1.tar.gz", hash = "sha256:d3af1e738df87515ee509d6135780f25a15959766d9c2b2dbe02bf4fb979cb18"},
|
||||
{file = "pytest_datadir-1.3.1-py2.py3-none-any.whl", hash = "sha256:1847ed0efe0bc54cac40ab3fba6d651c2f03d18dd01f2a582979604d32e7621e"},
|
||||
]
|
||||
toml = [
|
||||
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
|
||||
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
|
||||
]
|
||||
typeguard = [
|
||||
{file = "typeguard-2.13.3-py3-none-any.whl", hash = "sha256:5e3e3be01e887e7eafae5af63d1f36c849aaa94e3a0112097312aabfa16284f1"},
|
||||
{file = "typeguard-2.13.3.tar.gz", hash = "sha256:00edaa8da3a133674796cf5ea87d9f4b4c367d77476e185e80251cc13dfbb8c4"},
|
||||
]
|
||||
typing-extensions = [
|
||||
{file = "typing_extensions-4.1.1-py3-none-any.whl", hash = "sha256:21c85e0fe4b9a155d0799430b0ad741cdce7e359660ccbd8b530613e8df88ce2"},
|
||||
{file = "typing_extensions-4.1.1.tar.gz", hash = "sha256:1a9462dcc3347a79b1f1c0271fbe79e844580bb598bafa1ed208b94da3cdcd42"},
|
||||
]
|
||||
zipp = [
|
||||
{file = "zipp-3.6.0-py3-none-any.whl", hash = "sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc"},
|
||||
{file = "zipp-3.6.0.tar.gz", hash = "sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832"},
|
||||
]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "cmake-language-server"
|
||||
version = "0.1.0"
|
||||
version = "0.1.4"
|
||||
description = "CMake LSP Implementation"
|
||||
license = "MIT"
|
||||
authors = ["regen"]
|
||||
@@ -19,22 +19,33 @@ classifiers = [
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.6"
|
||||
pygls = "^0.8.1"
|
||||
pygls = "^0.11"
|
||||
pyparsing = "^2.4"
|
||||
importlib-metadata = {version = "^4.8", python = "<3.8"}
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
flake8 = "^3.7"
|
||||
mypy = "^0.740.0"
|
||||
pytest = "^5.2"
|
||||
yapf = "^0.28.0"
|
||||
pytest = "^6.2"
|
||||
pytest-datadir = "^1.3"
|
||||
tox = "^3.14"
|
||||
isort = "^4.3"
|
||||
pytest-cov = "^2.11"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
cmake-format = "cmake_language_server.formatter:main"
|
||||
cmake-language-server = "cmake_language_server.server:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
build-backend = "poetry.masonry.api"
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.pysen]
|
||||
version = "0.10"
|
||||
|
||||
[tool.pysen.lint]
|
||||
enable_black = true
|
||||
enable_flake8 = true
|
||||
enable_isort = true
|
||||
enable_mypy = true
|
||||
mypy_preset = "strict"
|
||||
line_length = 88
|
||||
py_version = "py36"
|
||||
|
||||
[[tool.pysen.lint.mypy_targets]]
|
||||
paths = ["."]
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
__version__ = '0.1.0'
|
||||
try:
|
||||
import importlib.metadata as importlib_metadata
|
||||
except ModuleNotFoundError:
|
||||
import importlib_metadata
|
||||
|
||||
__version__ = importlib_metadata.version(__name__)
|
||||
|
||||
@@ -10,13 +10,23 @@ from typing import Dict, List, Optional, Pattern
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _tidy_doc(doc: str) -> str:
|
||||
doc = doc.strip()
|
||||
doc = re.sub(r":.+?:`(.+?)`", r"\1", doc)
|
||||
doc = re.sub(r"``([^`]+)``", r"`\1`", doc)
|
||||
doc = doc.replace("\n", " ")
|
||||
doc = doc.replace(". ", ". ")
|
||||
return doc
|
||||
|
||||
|
||||
class API(object):
|
||||
_cmake: str
|
||||
_build: Path
|
||||
_uuid: uuid.UUID
|
||||
_builtin_commands: Dict[str, str]
|
||||
_builtin_variables: Dict[str, str]
|
||||
_builtin_variable_template: Dict[Pattern, str]
|
||||
_builtin_variable_template: Dict[Pattern[str], str]
|
||||
_builtin_modules: Dict[str, str]
|
||||
_targets: List[str]
|
||||
_cached_variables: Dict[str, str]
|
||||
_generated_list_parsed: bool
|
||||
@@ -29,86 +39,103 @@ class API(object):
|
||||
self._builtin_commands = {}
|
||||
self._builtin_variables = {}
|
||||
self._builtin_variable_template = {}
|
||||
self._builtin_modules = {}
|
||||
self._targets = []
|
||||
self._cached_variables = {}
|
||||
self._generated_list_parsed = False
|
||||
|
||||
def query(self) -> bool:
|
||||
"""Use CMake's file API to get JSON information about the build tree
|
||||
|
||||
Generates a JSON request file for the current build tree and runs
|
||||
CMake on the build tree. Deletes the request file immediately
|
||||
after.
|
||||
"""
|
||||
if not self.cmake_cache.exists():
|
||||
return False
|
||||
|
||||
self.query_json.parent.mkdir(parents=True, exist_ok=True)
|
||||
with self.query_json.open('w') as fp:
|
||||
fp.write('''\
|
||||
with self.query_json.open("w") as fp:
|
||||
fp.write(
|
||||
"""\
|
||||
{
|
||||
"requests": [
|
||||
{"kind": "codemodel", "version": 2},
|
||||
{"kind": "cache", "version": 2},
|
||||
{"kind": "cmakeFiles", "version": 1}
|
||||
]
|
||||
}''')
|
||||
}"""
|
||||
)
|
||||
|
||||
proc = subprocess.run([self._cmake, self._build],
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
proc = subprocess.run(
|
||||
[self._cmake, str(self._build)],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
encoding="utf-8",
|
||||
universal_newlines=True,
|
||||
)
|
||||
self.query_json.unlink()
|
||||
self.query_json.parent.rmdir()
|
||||
if proc.returncode != 0:
|
||||
logging.error(
|
||||
f'cmake exited with {proc.returncode}: {proc.stderr}')
|
||||
logging.error(f"cmake exited with {proc.returncode}: {proc.stderr}")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def read_reply(self) -> bool:
|
||||
reply = self._build / '.cmake' / 'api' / 'v1' / 'reply'
|
||||
indices = sorted(reply.glob('index-*.json'))
|
||||
"""Reads the CMake file API reply file and updates internal state
|
||||
|
||||
Reads the result of the previous query file and updates
|
||||
the targets, the cache entries and the cmake files.
|
||||
"""
|
||||
reply = self._build / ".cmake" / "api" / "v1" / "reply"
|
||||
indices = sorted(reply.glob("index-*.json"))
|
||||
if not indices:
|
||||
logger.error('no reply')
|
||||
logger.error("no reply")
|
||||
return False
|
||||
with indices[-1].open() as fp:
|
||||
index = json.load(fp)
|
||||
try:
|
||||
responses = index['reply'][f'client-{self._uuid}']['query.json'][
|
||||
'responses']
|
||||
responses = index["reply"][f"client-{self._uuid}"]["query.json"][
|
||||
"responses"
|
||||
]
|
||||
except KeyError:
|
||||
logger.error('no rensponse')
|
||||
logger.error("no rensponse")
|
||||
return False
|
||||
for response in responses:
|
||||
if response['kind'] == 'codemodel':
|
||||
self._read_codemodel(reply / response['jsonFile'])
|
||||
elif response['kind'] == 'cache':
|
||||
self._read_cache(reply / response['jsonFile'])
|
||||
elif response['kind'] == 'cmakeFiles':
|
||||
self._read_cmake_files(reply / response['jsonFile'])
|
||||
if response["kind"] == "codemodel":
|
||||
self._read_codemodel(reply / response["jsonFile"])
|
||||
elif response["kind"] == "cache":
|
||||
self._read_cache(reply / response["jsonFile"])
|
||||
elif response["kind"] == "cmakeFiles":
|
||||
self._read_cmake_files(reply / response["jsonFile"])
|
||||
|
||||
return True
|
||||
|
||||
def _read_codemodel(self, codemodelpath: Path):
|
||||
def _read_codemodel(self, codemodelpath: Path) -> None:
|
||||
with (codemodelpath).open() as fp:
|
||||
codemodel = json.load(fp)
|
||||
config = codemodel['configurations'][0]
|
||||
self._targets[:] = [x['name'] for x in config['targets']]
|
||||
config = codemodel["configurations"][0]
|
||||
self._targets[:] = [x["name"] for x in config["targets"]]
|
||||
|
||||
def _read_cache(self, cachepath: Path):
|
||||
def _read_cache(self, cachepath: Path) -> None:
|
||||
with cachepath.open() as fp:
|
||||
cache = json.load(fp)
|
||||
self._cached_variables.clear()
|
||||
for entry in cache['entries']:
|
||||
name = entry['name']
|
||||
value = self._truncate_variable(entry['value'])
|
||||
properties = {x['name']: x['value'] for x in entry['properties']}
|
||||
helpstring = properties.get('HELPSTRING', '')
|
||||
for entry in cache["entries"]:
|
||||
name = entry["name"]
|
||||
value = self._truncate_variable(entry["value"])
|
||||
properties = {x["name"]: x["value"] for x in entry["properties"]}
|
||||
helpstring = properties.get("HELPSTRING", "")
|
||||
doc = []
|
||||
if helpstring:
|
||||
doc.append(helpstring)
|
||||
if value:
|
||||
doc.append(f'`{value}`')
|
||||
self._cached_variables[name] = '\n\n'.join(doc)
|
||||
doc.append(f"`{value}`")
|
||||
self._cached_variables[name] = "\n\n".join(doc)
|
||||
|
||||
def _read_cmake_files(self, jsonpath: Path):
|
||||
'''inspect generated list files'''
|
||||
def _read_cmake_files(self, jsonpath: Path) -> None:
|
||||
"""inspect CMake list files that are used during build generation"""
|
||||
|
||||
if not self._builtin_variables or self._generated_list_parsed:
|
||||
return
|
||||
@@ -116,44 +143,48 @@ class API(object):
|
||||
with jsonpath.open() as fp:
|
||||
cmake_files = json.load(fp)
|
||||
|
||||
# inspect generated list files
|
||||
# Inspect generated list files: Get the values of variables in each script
|
||||
with tempfile.TemporaryDirectory() as tmpdirname:
|
||||
tmplist = Path(tmpdirname) / 'dump.cmake'
|
||||
with tmplist.open('w') as fp:
|
||||
for listfile in cmake_files['inputs']:
|
||||
if not listfile.get('isGenerated', False):
|
||||
tmplist = Path(tmpdirname) / "dump.cmake"
|
||||
with tmplist.open("w") as fp:
|
||||
for listfile in cmake_files["inputs"]:
|
||||
if not listfile.get("isGenerated", False):
|
||||
continue
|
||||
path = listfile['path']
|
||||
fp.write(f'include({path})\n')
|
||||
fp.write('''
|
||||
path = listfile["path"]
|
||||
fp.write(f"include({path})\n")
|
||||
fp.write(
|
||||
"""
|
||||
get_cmake_property(variables VARIABLES)
|
||||
foreach (variable ${variables})
|
||||
message("${variable}=${${variable}}")
|
||||
endforeach()
|
||||
''')
|
||||
p = subprocess.run([self._cmake, '-P', tmplist],
|
||||
cwd=cmake_files['paths']['source'],
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
"""
|
||||
)
|
||||
p = subprocess.run(
|
||||
[self._cmake, "-P", str(tmplist)],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
cwd=cmake_files["paths"]["source"],
|
||||
encoding="utf-8",
|
||||
universal_newlines=True,
|
||||
)
|
||||
if p.returncode != 0:
|
||||
return
|
||||
|
||||
for line in p.stderr.split('\n'):
|
||||
for line in p.stderr.split("\n"):
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
k, v = line.split('=', 1)
|
||||
if k.startswith('CMAKE_ARG'):
|
||||
k, v = line.split("=", 1)
|
||||
if k.startswith("CMAKE_ARG"):
|
||||
continue
|
||||
v = self._truncate_variable(v)
|
||||
if k in self._builtin_variables:
|
||||
self._builtin_variables[k] += f'\n\n`{v}`'
|
||||
self._builtin_variables[k] += f"\n\n`{v}`"
|
||||
else:
|
||||
for pattern, doc in self._builtin_variable_template.items(
|
||||
):
|
||||
for pattern, doc in self._builtin_variable_template.items():
|
||||
if pattern.fullmatch(k):
|
||||
self._builtin_variables[k] = f'{doc}\n\n`{v}`'
|
||||
self._builtin_variables[k] = f"{doc}\n\n`{v}`"
|
||||
break
|
||||
else:
|
||||
# ignore variable with no document
|
||||
@@ -163,72 +194,132 @@ endforeach()
|
||||
|
||||
@property
|
||||
def query_json(self) -> Path:
|
||||
return (self._build / '.cmake' / 'api' / 'v1' / 'query' /
|
||||
f'client-{self._uuid}' / 'query.json')
|
||||
return (
|
||||
self._build
|
||||
/ ".cmake"
|
||||
/ "api"
|
||||
/ "v1"
|
||||
/ "query"
|
||||
/ f"client-{self._uuid}"
|
||||
/ "query.json"
|
||||
)
|
||||
|
||||
@property
|
||||
def cmake_cache(self) -> Path:
|
||||
return self._build / 'CMakeCache.txt'
|
||||
return self._build / "CMakeCache.txt"
|
||||
|
||||
def parse_doc(self) -> None:
|
||||
self._parse_commands()
|
||||
self._parse_variables()
|
||||
self._parse_modules()
|
||||
|
||||
def _parse_commands(self) -> None:
|
||||
p = subprocess.run([self._cmake, '--help-commands'],
|
||||
stdout=subprocess.PIPE,
|
||||
universal_newlines=True)
|
||||
"""Load docs for builtin cmake functions
|
||||
|
||||
Loads the documentation for builtin cmake functions from the result
|
||||
of `$ cmake --help-commands`.
|
||||
"""
|
||||
p = subprocess.run(
|
||||
[self._cmake, "--help-commands"],
|
||||
stdout=subprocess.PIPE,
|
||||
encoding="utf-8",
|
||||
universal_newlines=True,
|
||||
)
|
||||
|
||||
if p.returncode != 0:
|
||||
return
|
||||
|
||||
matches = re.finditer(
|
||||
r'''
|
||||
r"""
|
||||
(?P<command>.+)\n
|
||||
-+\n\n
|
||||
-+\n+?
|
||||
[\s\S]*?
|
||||
(?P<signature>\ (?P=command)\s*\([^)]*\))
|
||||
''', p.stdout, re.VERBOSE)
|
||||
(?P<signature>(?P=command)\s*\([^)]*\))
|
||||
""",
|
||||
p.stdout,
|
||||
re.VERBOSE,
|
||||
)
|
||||
self._builtin_commands.clear()
|
||||
for match in matches:
|
||||
command = match.group('command')
|
||||
signature = match.group('signature')
|
||||
signature = re.sub(r'^ ', r'', signature, flags=re.MULTILINE)
|
||||
self._builtin_commands[
|
||||
command] = '```cmake\n' + signature + '\n```'
|
||||
command = match.group("command")
|
||||
signature = match.group("signature")
|
||||
signature = re.sub(r"^ ", r"", signature, flags=re.MULTILINE)
|
||||
self._builtin_commands[command] = "```cmake\n" + signature + "\n```"
|
||||
|
||||
def _parse_variables(self) -> None:
|
||||
p = subprocess.run([self._cmake, '--help-variables'],
|
||||
stdout=subprocess.PIPE,
|
||||
universal_newlines=True)
|
||||
"""Load docs for builtin cmake variables
|
||||
|
||||
Loads the documentation for builtin cmake variables from
|
||||
the result of `$ cmake --help-variables`.
|
||||
"""
|
||||
p = subprocess.run(
|
||||
[self._cmake, "--help-variables"],
|
||||
stdout=subprocess.PIPE,
|
||||
encoding="utf-8",
|
||||
universal_newlines=True,
|
||||
)
|
||||
|
||||
if p.returncode != 0:
|
||||
return
|
||||
|
||||
matches = re.finditer(
|
||||
r'''
|
||||
r"""
|
||||
(?P<variable>.+)\n
|
||||
-+\n\n
|
||||
(?P<doc>[\s\S]+?)(?:\n\n|$)
|
||||
''', p.stdout, re.VERBOSE)
|
||||
""",
|
||||
p.stdout,
|
||||
re.VERBOSE,
|
||||
)
|
||||
self._builtin_variables.clear()
|
||||
for match in matches:
|
||||
variable = match.group('variable')
|
||||
doc = match.group('doc')
|
||||
doc = re.sub(r':.+:`(.+)`', r'\1', doc)
|
||||
doc = re.sub(r'``(.+)``', r'`\1`', doc)
|
||||
doc = doc.replace('\n', ' ')
|
||||
doc = doc.replace('. ', '. ')
|
||||
if variable == 'CMAKE_MATCH_<n>':
|
||||
variable = match.group("variable")
|
||||
doc = _tidy_doc(match.group("doc"))
|
||||
if variable == "CMAKE_MATCH_<n>":
|
||||
for i in range(10):
|
||||
self._builtin_variables[f'CMAKE_MATCH_{i}'] = doc
|
||||
elif '<' in variable:
|
||||
variable = re.sub(r'<[^>]+>', r'[^_]+', variable)
|
||||
self._builtin_variables[f"CMAKE_MATCH_{i}"] = doc
|
||||
elif "<" in variable:
|
||||
variable = re.sub(r"<[^>]+>", r"[^_]+", variable)
|
||||
pattern = re.compile(variable)
|
||||
self._builtin_variable_template[pattern] = doc
|
||||
else:
|
||||
self._builtin_variables[variable] = doc
|
||||
|
||||
def _parse_modules(self) -> None:
|
||||
"""Loads docs for all modules in the cmake distribution
|
||||
|
||||
Loads the documentation for cmake modules included in the
|
||||
distribution from the result of `$ cmake --help-modules`.
|
||||
"""
|
||||
p = subprocess.run(
|
||||
[self._cmake, "--help-modules"],
|
||||
stdout=subprocess.PIPE,
|
||||
encoding="utf-8",
|
||||
universal_newlines=True,
|
||||
)
|
||||
|
||||
if p.returncode != 0:
|
||||
return
|
||||
|
||||
matches = re.finditer(
|
||||
r"""
|
||||
(?P<module>.+)\n
|
||||
-+\n+?
|
||||
(?:(?P<header>\w[\w\s]+)\n\^+\n+?)?
|
||||
(?P<doc>(?:.|\n)*?\n\n)
|
||||
""",
|
||||
p.stdout + "\n\n",
|
||||
re.VERBOSE,
|
||||
)
|
||||
self._builtin_modules.clear()
|
||||
for match in matches:
|
||||
module = match.group("module")
|
||||
header = match.group("header")
|
||||
doc = _tidy_doc(match.group("doc"))
|
||||
if header != "Overview":
|
||||
doc = ""
|
||||
self._builtin_modules[module] = doc
|
||||
|
||||
def get_command_doc(self, command: str) -> Optional[str]:
|
||||
return self._builtin_commands.get(command)
|
||||
|
||||
@@ -243,15 +334,32 @@ endforeach()
|
||||
return self._builtin_variables.get(variable)
|
||||
|
||||
def search_variable(self, variable: str) -> List[str]:
|
||||
cached = frozenset(x for x in self._cached_variables
|
||||
if x.startswith(variable))
|
||||
builtin = frozenset(x for x in self._builtin_variables
|
||||
if x.startswith(variable))
|
||||
cached = frozenset(x for x in self._cached_variables if x.startswith(variable))
|
||||
builtin = frozenset(
|
||||
x for x in self._builtin_variables if x.startswith(variable)
|
||||
)
|
||||
return list(cached | builtin)
|
||||
|
||||
def get_module_doc(self, module: str, package: bool) -> Optional[str]:
|
||||
if package:
|
||||
return self._builtin_modules.get("Find" + module)
|
||||
|
||||
return self._builtin_modules.get(module)
|
||||
|
||||
def search_module(self, module: str, package: bool) -> List[str]:
|
||||
if package:
|
||||
module = "Find" + module
|
||||
return [x[4:] for x in self._builtin_modules if x.startswith(module)]
|
||||
|
||||
return [
|
||||
x
|
||||
for x in self._builtin_modules
|
||||
if x.startswith(module) and not x.startswith("Find")
|
||||
]
|
||||
|
||||
def search_target(self, target: str) -> List[str]:
|
||||
return [x for x in self._targets if x.startswith(target)]
|
||||
|
||||
def _truncate_variable(self, v: str) -> str:
|
||||
width = 70
|
||||
return v[:width] + (v[width:] and '...')
|
||||
return v[:width] + (v[width:] and "...")
|
||||
|
||||
@@ -1,123 +1,160 @@
|
||||
from typing import List
|
||||
from typing import List, Optional
|
||||
|
||||
from .parser import TokenList
|
||||
|
||||
|
||||
class Formatter(object):
|
||||
indnt: str
|
||||
indent: str
|
||||
lower_identifier: bool
|
||||
|
||||
def __init__(self, indent=' ', lower_identifier=True):
|
||||
def __init__(self, indent: str = " ", lower_identifier: bool = True):
|
||||
self.indent = indent
|
||||
self.lower_identifier = lower_identifier
|
||||
|
||||
def format(self, tokens: TokenList) -> str:
|
||||
cmds: List[str] = ['']
|
||||
indnet_level = 0
|
||||
cmds: List[str] = [""]
|
||||
indent_level = 0
|
||||
for token in tokens:
|
||||
if isinstance(token, tuple):
|
||||
raw_identifier = token[0]
|
||||
identifier = raw_identifier.lower()
|
||||
if identifier in ('elseif', 'else', 'endif', 'endforeach',
|
||||
'endwhile', 'endmacro', 'endfunction'):
|
||||
if indnet_level > 0:
|
||||
indnet_level -= 1
|
||||
cmds[-1] = self.indent * indnet_level
|
||||
cmds[-1] += (identifier
|
||||
if self.lower_identifier else raw_identifier)
|
||||
if identifier in (
|
||||
"elseif",
|
||||
"else",
|
||||
"endif",
|
||||
"endforeach",
|
||||
"endwhile",
|
||||
"endmacro",
|
||||
"endfunction",
|
||||
):
|
||||
if indent_level > 0:
|
||||
indent_level -= 1
|
||||
cmds[-1] = self.indent * indent_level
|
||||
cmds[-1] += identifier if self.lower_identifier else raw_identifier
|
||||
args = self._format_args(token[1])
|
||||
if len(args) < 2:
|
||||
cmds[-1] += '(' + ''.join(args) + ')'
|
||||
cmds[-1] += "(" + "".join(args) + ")"
|
||||
else:
|
||||
cmds[-1] += '(\n'
|
||||
cmds[-1] += "(\n"
|
||||
for arg in args:
|
||||
cmds[-1] += self.indent * (indnet_level +
|
||||
1) + arg + '\n'
|
||||
cmds[-1] += self.indent * indnet_level + ')'
|
||||
if identifier in ('if', 'elseif', 'else', 'foreach', 'while',
|
||||
'macro', 'function'):
|
||||
indnet_level += 1
|
||||
elif token == '\n':
|
||||
cmds.append('')
|
||||
elif token[0] == '#':
|
||||
cmds[-1] += self.indent * (indent_level + 1) + arg + "\n"
|
||||
cmds[-1] += self.indent * indent_level + ")"
|
||||
if identifier in (
|
||||
"if",
|
||||
"elseif",
|
||||
"else",
|
||||
"foreach",
|
||||
"while",
|
||||
"macro",
|
||||
"function",
|
||||
):
|
||||
indent_level += 1
|
||||
elif token == "\n":
|
||||
cmds.append("")
|
||||
elif token[0] == "#":
|
||||
if cmds[-1]:
|
||||
cmds[-1] += token
|
||||
else:
|
||||
cmds[-1] = self.indent * indnet_level + token
|
||||
cmds[-1] = self.indent * indent_level + token
|
||||
elif cmds[-1]:
|
||||
cmds[-1] += token
|
||||
|
||||
cmds = self._strip_line(cmds)
|
||||
return '\n'.join(cmds) + '\n'
|
||||
return "\n".join(cmds) + "\n"
|
||||
|
||||
def _format_args(self, args: List[str]) -> List[str]:
|
||||
lines = ['']
|
||||
lines = [""]
|
||||
for i in range(len(args)):
|
||||
arg = args[i]
|
||||
if arg[0] == '#':
|
||||
if arg[0] == "#":
|
||||
lines[-1] += arg
|
||||
elif arg[0] == '\n':
|
||||
lines.append('')
|
||||
elif arg[0] == "\n":
|
||||
lines.append("")
|
||||
elif arg.isspace():
|
||||
if lines[-1]:
|
||||
if i + 1 < len(args) and args[i + 1][0] == '#':
|
||||
if i + 1 < len(args) and args[i + 1][0] == "#":
|
||||
lines[-1] += arg
|
||||
else:
|
||||
lines[-1] += ' '
|
||||
lines[-1] += " "
|
||||
else:
|
||||
lines[-1] += arg
|
||||
|
||||
return self._strip_line(lines)
|
||||
|
||||
def _strip_line(self, lines: List[str]) -> List[str]:
|
||||
'''Delete empty lines at the start/end of the input'''
|
||||
"""Delete empty lines at the start/end of the input"""
|
||||
|
||||
ret: List[str] = []
|
||||
for line in lines:
|
||||
line = line.rstrip()
|
||||
if line != '' or len(ret) > 0:
|
||||
if line != "" or len(ret) > 0:
|
||||
ret.append(line)
|
||||
while ret and ret[-1] == '':
|
||||
while ret and ret[-1] == "":
|
||||
del ret[-1]
|
||||
return ret
|
||||
|
||||
|
||||
def main(args: List[str] = None):
|
||||
from pathlib import Path
|
||||
def main(argss: Optional[List[str]] = None) -> None:
|
||||
import sys
|
||||
from argparse import ArgumentParser
|
||||
from .parser import ListParser
|
||||
from difflib import unified_diff
|
||||
from pathlib import Path
|
||||
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('lists', type=Path, nargs='*', help='CMake list files')
|
||||
parser.add_argument('-i',
|
||||
'--inplace',
|
||||
action='store_true',
|
||||
help='inplace edit')
|
||||
parser.add_argument('-d', '--diff', action='store_true', help='show diff')
|
||||
from . import __version__
|
||||
from .parser import ListParser
|
||||
|
||||
args = parser.parse_args(args)
|
||||
parser = ArgumentParser(
|
||||
description="Format CMake list files.",
|
||||
epilog="""
|
||||
If no arguments are specified, it formats the code from
|
||||
standard input and writes the result to the standard output.""",
|
||||
)
|
||||
parser.add_argument("lists", type=Path, nargs="*", help="CMake list files")
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
group.add_argument("-i", "--inplace", action="store_true", help="inplace edit")
|
||||
group.add_argument("-d", "--diff", action="store_true", help="show diff")
|
||||
parser.add_argument(
|
||||
"--version", action="version", version=f"%(prog)s {__version__}"
|
||||
)
|
||||
|
||||
args = parser.parse_args(argss)
|
||||
|
||||
if not args.lists and args.inplace:
|
||||
print("error: cannot use -i when no arguments are specified.", file=sys.stderr)
|
||||
return
|
||||
if not args.lists:
|
||||
args.lists.append(None)
|
||||
|
||||
list_parser = ListParser()
|
||||
formatter = Formatter()
|
||||
for listpath in args.lists:
|
||||
with listpath.open() as fp:
|
||||
content = fp.read()
|
||||
if listpath is None:
|
||||
listpath = "(stdin)"
|
||||
content = sys.stdin.read()
|
||||
else:
|
||||
with listpath.open() as fp:
|
||||
content = fp.read()
|
||||
tokens, remain = list_parser.parse(content)
|
||||
formatted = content if remain else formatter.format(tokens)
|
||||
|
||||
if args.inplace:
|
||||
if not remain:
|
||||
with listpath.open('w') as fp:
|
||||
with listpath.open("w") as fp:
|
||||
fp.write(formatted)
|
||||
elif args.diff:
|
||||
diff = unified_diff(
|
||||
content.splitlines(True),
|
||||
formatted.splitlines(True),
|
||||
str(listpath),
|
||||
str(listpath),
|
||||
"(before formatting)",
|
||||
"(after formatting)",
|
||||
)
|
||||
diffstr = "".join(diff)
|
||||
print(diffstr, end="")
|
||||
else:
|
||||
if args.diff:
|
||||
diff = unified_diff(content.splitlines(True),
|
||||
formatted.splitlines(True), str(listpath),
|
||||
str(listpath), '(before formatting)',
|
||||
'(after formatting)')
|
||||
diffstr = ''.join(diff)
|
||||
if diffstr:
|
||||
print(diffstr, end='')
|
||||
else:
|
||||
print(formatted, end='')
|
||||
print(formatted, end="")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -10,9 +10,9 @@ TokenList = List[TokenType]
|
||||
class ListParser(object):
|
||||
_parser: pp.ParserElement
|
||||
|
||||
def __init__(self):
|
||||
newline = '\n'
|
||||
space_plus = pp.Regex('[ \t]+')
|
||||
def __init__(self) -> None:
|
||||
newline = "\n"
|
||||
space_plus = pp.Regex("[ \t]+")
|
||||
space_star = pp.Optional(space_plus)
|
||||
|
||||
quoted_element = pp.Regex(r'[^\\"]|\\[^A-Za-z0-9]|\\[trn]')
|
||||
@@ -20,12 +20,12 @@ class ListParser(object):
|
||||
|
||||
bracket_content = pp.Forward()
|
||||
|
||||
def action_bracket_open(tokens: pp.ParseResults):
|
||||
def action_bracket_open(tokens: pp.ParseResults) -> None:
|
||||
nonlocal bracket_content
|
||||
marker = ']' + '=' * (len(tokens[0]) - 2) + ']'
|
||||
marker = "]" + "=" * (len(tokens[0]) - 2) + "]"
|
||||
bracket_content <<= pp.SkipTo(marker, include=True)
|
||||
|
||||
bracket_open = pp.Regex(r'\[=*\[').setParseAction(action_bracket_open)
|
||||
bracket_open = pp.Regex(r"\[=*\[").setParseAction(action_bracket_open)
|
||||
bracket_argument = pp.Combine(bracket_open + bracket_content)
|
||||
|
||||
unquoted_element = pp.Regex(r'[^\s()#"\\]|\\[^A-Za-z0-9]|\\[trn]')
|
||||
@@ -33,25 +33,32 @@ class ListParser(object):
|
||||
|
||||
argument = bracket_argument | quoted_argument | unquoted_argument
|
||||
|
||||
line_comment = pp.Combine('#' + ~bracket_open +
|
||||
pp.SkipTo(pp.LineEnd()))
|
||||
bracket_comment = pp.Combine('#' + bracket_argument)
|
||||
line_ending = (space_star +
|
||||
pp.ZeroOrMore(bracket_comment + space_star) +
|
||||
pp.Optional(line_comment) + (newline | pp.lineEnd))
|
||||
line_comment = pp.Combine("#" + ~bracket_open + pp.SkipTo(pp.LineEnd()))
|
||||
bracket_comment = pp.Combine("#" + bracket_argument)
|
||||
line_ending = (
|
||||
space_star
|
||||
+ pp.ZeroOrMore(bracket_comment + space_star)
|
||||
+ pp.Optional(line_comment)
|
||||
+ (newline | pp.lineEnd)
|
||||
)
|
||||
|
||||
identifier = pp.Word(pp.alphas + '_', pp.alphanums + '_')
|
||||
identifier = pp.Word(pp.alphas + "_", pp.alphanums + "_")
|
||||
arguments = pp.Forward()
|
||||
arguments << pp.ZeroOrMore(argument | line_ending | space_plus
|
||||
| '(' + arguments + ')').leaveWhitespace()
|
||||
(
|
||||
arguments
|
||||
<< pp.ZeroOrMore(
|
||||
argument | line_ending | space_plus | "(" + arguments + ")"
|
||||
).leaveWhitespace()
|
||||
)
|
||||
arguments = pp.Group(arguments)
|
||||
PAREN_L, PAREN_R = map(pp.Suppress, '()')
|
||||
PAREN_L, PAREN_R = map(pp.Suppress, "()")
|
||||
command_invocation = (
|
||||
identifier + space_star.suppress() + PAREN_L + arguments +
|
||||
PAREN_R).setParseAction(lambda t: (t[0], t[1].asList()))
|
||||
identifier + space_star.suppress() + PAREN_L + arguments + PAREN_R
|
||||
).setParseAction(lambda t: (t[0], t[1].asList()))
|
||||
|
||||
file_element = (space_star + command_invocation + line_ending
|
||||
| line_ending).leaveWhitespace()
|
||||
file_element = (
|
||||
space_star + command_invocation + line_ending | line_ending
|
||||
).leaveWhitespace()
|
||||
file = pp.ZeroOrMore(file_element)
|
||||
|
||||
self._parser = file
|
||||
|
||||
@@ -1,16 +1,35 @@
|
||||
import logging
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import List, Optional, Tuple
|
||||
from typing import Any, Callable, List, Optional, Tuple
|
||||
|
||||
from pygls.features import (COMPLETION, FORMATTING, HOVER, INITIALIZE,
|
||||
INITIALIZED, TEXT_DOCUMENT_DID_SAVE)
|
||||
from pygls.lsp.methods import (
|
||||
COMPLETION,
|
||||
FORMATTING,
|
||||
HOVER,
|
||||
INITIALIZE,
|
||||
INITIALIZED,
|
||||
TEXT_DOCUMENT_DID_SAVE,
|
||||
)
|
||||
from pygls.lsp.types import (
|
||||
CompletionItem,
|
||||
CompletionItemKind,
|
||||
CompletionList,
|
||||
CompletionOptions,
|
||||
CompletionParams,
|
||||
CompletionTriggerKind,
|
||||
DocumentFormattingParams,
|
||||
Hover,
|
||||
InitializeParams,
|
||||
MarkupContent,
|
||||
MarkupKind,
|
||||
Position,
|
||||
Range,
|
||||
TextDocumentPositionParams,
|
||||
TextDocumentSaveRegistrationOptions,
|
||||
TextEdit,
|
||||
)
|
||||
from pygls.server import LanguageServer
|
||||
from pygls.types import (CompletionItem, CompletionItemKind, CompletionList,
|
||||
CompletionParams, CompletionTriggerKind,
|
||||
DocumentFormattingParams, Hover, InitializeParams,
|
||||
MarkupContent, MarkupKind, Position, Range,
|
||||
TextDocumentPositionParams, TextEdit)
|
||||
|
||||
from .api import API
|
||||
from .formatter import Formatter
|
||||
@@ -21,118 +40,218 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class CMakeLanguageServer(LanguageServer):
|
||||
_parser: ListParser
|
||||
_api: API
|
||||
_api: Optional[API]
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
def __init__(self, *args: Any) -> None:
|
||||
super().__init__(*args)
|
||||
|
||||
self._parser = ListParser()
|
||||
self._api = None
|
||||
|
||||
@self.feature(INITIALIZE)
|
||||
def initialize(params: InitializeParams):
|
||||
opts = params.initializationOptions
|
||||
def initialize(params: InitializeParams) -> None:
|
||||
opts = params.initialization_options
|
||||
|
||||
cmake = getattr(opts, 'cmakeExecutable', 'cmake')
|
||||
builddir = getattr(opts, 'buildDirectory', '')
|
||||
logging.info(f'cmakeExecutable={cmake}, buildDirectory={builddir}')
|
||||
cmake = getattr(opts, "cmakeExecutable", "cmake")
|
||||
builddir = getattr(opts, "buildDirectory", "")
|
||||
logging.info(f"cmakeExecutable={cmake}, buildDirectory={builddir}")
|
||||
|
||||
self._api = API(cmake, Path(builddir))
|
||||
self._api.parse_doc()
|
||||
|
||||
@self.feature(COMPLETION, trigger_characters=['{'])
|
||||
def completions(params: CompletionParams):
|
||||
if (params.context.triggerKind ==
|
||||
CompletionTriggerKind.TriggerCharacter):
|
||||
token = ''
|
||||
trigger = params.context.triggerCharacter
|
||||
trigger_characters = ["{", "("]
|
||||
|
||||
@self.feature(
|
||||
COMPLETION, CompletionOptions(trigger_characters=trigger_characters)
|
||||
)
|
||||
def completions(params: CompletionParams) -> CompletionList:
|
||||
assert self._api is not None
|
||||
|
||||
if (
|
||||
params.context is not None
|
||||
and params.context.trigger_kind
|
||||
== CompletionTriggerKind.TriggerCharacter
|
||||
):
|
||||
token = ""
|
||||
trigger = params.context.trigger_character
|
||||
else:
|
||||
ret = self.cursor_word(params.textDocument.uri,
|
||||
params.position, False)
|
||||
if not ret:
|
||||
return None
|
||||
token = ret[0]
|
||||
trigger = None
|
||||
line = self._cursor_line(params.text_document.uri, params.position)
|
||||
idx = params.position.character - 1
|
||||
if 0 <= idx < len(line) and line[idx] in trigger_characters:
|
||||
token = ""
|
||||
trigger = line[idx]
|
||||
else:
|
||||
word = self._cursor_word(
|
||||
params.text_document.uri, params.position, False
|
||||
)
|
||||
token = "" if word is None else word[0]
|
||||
trigger = None
|
||||
|
||||
items: List[CompletionItem] = []
|
||||
|
||||
if trigger != '{':
|
||||
if trigger is None:
|
||||
commands = self._api.search_command(token)
|
||||
items.extend(
|
||||
CompletionItem(x,
|
||||
CompletionItemKind.Function,
|
||||
documentation=self._api.get_command_doc(x))
|
||||
for x in commands)
|
||||
CompletionItem(
|
||||
label=x,
|
||||
kind=CompletionItemKind.Function,
|
||||
documentation=self._api.get_command_doc(x),
|
||||
insert_text=x,
|
||||
)
|
||||
for x in commands
|
||||
)
|
||||
|
||||
variables = self._api.search_variable(token)
|
||||
items.extend(
|
||||
CompletionItem(x,
|
||||
CompletionItemKind.Variable,
|
||||
documentation=self._api.get_variable_doc(x))
|
||||
for x in variables)
|
||||
if trigger is None or trigger == "{":
|
||||
variables = self._api.search_variable(token)
|
||||
items.extend(
|
||||
CompletionItem(
|
||||
label=x,
|
||||
kind=CompletionItemKind.Variable,
|
||||
documentation=self._api.get_variable_doc(x),
|
||||
insert_text=x,
|
||||
)
|
||||
for x in variables
|
||||
)
|
||||
|
||||
if trigger != '{':
|
||||
if trigger is None:
|
||||
targets = self._api.search_target(token)
|
||||
items.extend(
|
||||
CompletionItem(x, CompletionItemKind.Class)
|
||||
for x in targets)
|
||||
CompletionItem(
|
||||
label=x, kind=CompletionItemKind.Class, insert_text=x
|
||||
)
|
||||
for x in targets
|
||||
)
|
||||
|
||||
return CompletionList(False, items)
|
||||
if trigger == "(":
|
||||
func = self._cursor_function(params.text_document.uri, params.position)
|
||||
if func is not None:
|
||||
func = func.lower()
|
||||
if func == "include":
|
||||
modules = self._api.search_module(token, False)
|
||||
items.extend(
|
||||
CompletionItem(
|
||||
label=x,
|
||||
kind=CompletionItemKind.Module,
|
||||
documentation=self._api.get_module_doc(x, False),
|
||||
insert_text=x,
|
||||
)
|
||||
for x in modules
|
||||
)
|
||||
elif func == "find_package":
|
||||
modules = self._api.search_module(token, True)
|
||||
items.extend(
|
||||
CompletionItem(
|
||||
label=x,
|
||||
kind=CompletionItemKind.Module,
|
||||
documentation=self._api.get_module_doc(x, True),
|
||||
insert_text=x,
|
||||
)
|
||||
for x in modules
|
||||
)
|
||||
|
||||
return CompletionList(is_incomplete=False, items=items)
|
||||
|
||||
@self.feature(FORMATTING)
|
||||
def formatting(params: DocumentFormattingParams):
|
||||
doc = self.workspace.get_document(params.textDocument.uri)
|
||||
def formatting(params: DocumentFormattingParams) -> Optional[List[TextEdit]]:
|
||||
doc = self.workspace.get_document(params.text_document.uri)
|
||||
content = doc.source
|
||||
tokens, remain = self._parser.parse(content)
|
||||
if remain:
|
||||
self.show_message('CMake parser failed')
|
||||
self.show_message("CMake parser failed")
|
||||
return None
|
||||
|
||||
formatted = Formatter().format(tokens)
|
||||
lines = content.count('\n')
|
||||
lines = content.count("\n")
|
||||
return [
|
||||
TextEdit(Range(Position(0, 0), Position(lines + 1, 0)),
|
||||
formatted)
|
||||
TextEdit(
|
||||
range=Range(
|
||||
start=Position(line=0, character=0),
|
||||
end=Position(line=lines + 1, character=0),
|
||||
),
|
||||
new_text=formatted,
|
||||
)
|
||||
]
|
||||
|
||||
@self.feature(HOVER)
|
||||
def hover(params: TextDocumentPositionParams):
|
||||
ret = self.cursor_word(params.textDocument.uri, params.position)
|
||||
if not ret:
|
||||
def hover(params: TextDocumentPositionParams) -> Optional[Hover]:
|
||||
assert self._api is not None
|
||||
api = self._api
|
||||
|
||||
word = self._cursor_word(params.text_document.uri, params.position, True)
|
||||
if not word:
|
||||
return None
|
||||
doc = self._api.get_command_doc(ret[0].lower())
|
||||
if not doc:
|
||||
doc = self._api.get_variable_doc(ret[0])
|
||||
if not doc:
|
||||
return None
|
||||
return Hover(MarkupContent(MarkupKind.Markdown, doc), ret[1])
|
||||
|
||||
candidates: List[Callable[[str], Optional[str]]] = [
|
||||
lambda x: api.get_command_doc(x.lower()),
|
||||
lambda x: api.get_variable_doc(x),
|
||||
lambda x: api.get_module_doc(x, False),
|
||||
lambda x: api.get_module_doc(x, True),
|
||||
]
|
||||
for c in candidates:
|
||||
doc = c(word[0])
|
||||
if doc is None:
|
||||
continue
|
||||
return Hover(
|
||||
contents=MarkupContent(kind=MarkupKind.Markdown, value=doc),
|
||||
range=word[1],
|
||||
)
|
||||
return None
|
||||
|
||||
@self.thread()
|
||||
@self.feature(TEXT_DOCUMENT_DID_SAVE, includeText=False)
|
||||
@self.feature(
|
||||
TEXT_DOCUMENT_DID_SAVE,
|
||||
TextDocumentSaveRegistrationOptions(include_text=False),
|
||||
)
|
||||
@self.feature(INITIALIZED)
|
||||
def run_cmake(*args):
|
||||
def run_cmake(*args: Any) -> None:
|
||||
assert self._api is not None
|
||||
|
||||
if self._api.query():
|
||||
self._api.read_reply()
|
||||
|
||||
def cursor_word(self,
|
||||
uri: str,
|
||||
position: Position,
|
||||
include_all: bool = True) -> Optional[Tuple[str, Range]]:
|
||||
def _cursor_function(self, uri: str, position: Position) -> Optional[str]:
|
||||
doc = self.workspace.get_document(uri)
|
||||
lines = doc.source.split("\n")[: position.line + 1]
|
||||
lines[-1] = lines[-1][: position.character - 1].strip()
|
||||
words = re.split(r"[\s\n()]+", "\n".join(lines))
|
||||
return words[-1] if words else None
|
||||
|
||||
def _cursor_line(self, uri: str, position: Position) -> str:
|
||||
doc = self.workspace.get_document(uri)
|
||||
content = doc.source
|
||||
line = content.split('\n')[position.line]
|
||||
cursor = position.character
|
||||
for m in re.finditer(r'\w+', line):
|
||||
if m.start() <= cursor <= m.end():
|
||||
end = m.end() if include_all else cursor
|
||||
return (line[m.start():end],
|
||||
Range(Position(position.line, m.start()),
|
||||
Position(position.line, end)))
|
||||
line = content.split("\n")[position.line]
|
||||
return str(line)
|
||||
|
||||
def _cursor_word(
|
||||
self, uri: str, position: Position, include_all: bool = True
|
||||
) -> Optional[Tuple[str, Range]]:
|
||||
line = self._cursor_line(uri, position)
|
||||
cursor = position.character
|
||||
for m in re.finditer(r"\w+", line):
|
||||
end = m.end() if include_all else cursor
|
||||
if m.start() <= cursor <= m.end():
|
||||
word = (
|
||||
line[m.start() : end],
|
||||
Range(
|
||||
start=Position(line=position.line, character=m.start()),
|
||||
end=Position(line=position.line, character=end),
|
||||
),
|
||||
)
|
||||
return word
|
||||
return None
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from . import __version__
|
||||
|
||||
parser = ArgumentParser(description="CMake Language Server")
|
||||
parser.add_argument(
|
||||
"--version", action="version", version=f"%(prog)s {__version__}"
|
||||
)
|
||||
parser.parse_args()
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logging.getLogger('pygls').setLevel(logging.WARNING)
|
||||
CMakeLanguageServer().start_io()
|
||||
logging.getLogger("pygls").setLevel(logging.WARNING)
|
||||
CMakeLanguageServer().start_io() # type: ignore
|
||||
|
||||
@@ -1,16 +1,62 @@
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import pprint
|
||||
from pathlib import Path
|
||||
from subprocess import PIPE, run
|
||||
from threading import Thread
|
||||
from typing import Iterable, Tuple
|
||||
|
||||
import pytest
|
||||
from cmake_language_server.server import CMakeLanguageServer
|
||||
from pygls.lsp.methods import EXIT
|
||||
from pygls.server import LanguageServer
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def cmake_build(shared_datadir):
|
||||
from subprocess import run, PIPE
|
||||
source = shared_datadir / 'cmake'
|
||||
build = source / 'build'
|
||||
def cmake_build(shared_datadir: Path) -> Iterable[Path]:
|
||||
source = shared_datadir / "cmake"
|
||||
build = source / "build"
|
||||
build.mkdir()
|
||||
run(['cmake', source],
|
||||
check=True,
|
||||
p = run(
|
||||
["cmake", str(source)],
|
||||
cwd=build,
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
universal_newlines=True)
|
||||
universal_newlines=True,
|
||||
)
|
||||
if p.returncode != 0:
|
||||
logging.error("env:\n" + pprint.pformat(os.environ))
|
||||
logging.error("stdout:\n" + p.stdout)
|
||||
logging.error("stderr:\n" + p.stderr)
|
||||
raise RuntimeError("CMake failed")
|
||||
yield build
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def client_server() -> Iterable[Tuple[LanguageServer, CMakeLanguageServer]]:
|
||||
c2s_r, c2s_w = os.pipe()
|
||||
s2c_r, s2c_w = os.pipe()
|
||||
|
||||
def start(ls: LanguageServer, fdr: int, fdw: int) -> None:
|
||||
# TODO: better patch is needed
|
||||
# disable `close()` to avoid error messages
|
||||
close = ls.loop.close
|
||||
ls.loop.close = lambda: None # type: ignore
|
||||
ls.start_io(os.fdopen(fdr, "rb"), os.fdopen(fdw, "wb")) # type: ignore
|
||||
ls.loop.close = close # type: ignore
|
||||
|
||||
server = CMakeLanguageServer(asyncio.new_event_loop())
|
||||
server_thread = Thread(target=start, args=(server, c2s_r, s2c_w))
|
||||
server_thread.start()
|
||||
|
||||
client = LanguageServer(asyncio.new_event_loop())
|
||||
client_thread = Thread(target=start, args=(client, s2c_r, c2s_w))
|
||||
client_thread.start()
|
||||
|
||||
yield client, server
|
||||
|
||||
client.send_notification(EXIT)
|
||||
server.send_notification(EXIT)
|
||||
server_thread.join()
|
||||
client_thread.join()
|
||||
|
||||
@@ -1,75 +1,122 @@
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from cmake_language_server.api import API
|
||||
|
||||
|
||||
def test_query_with_cache(cmake_build):
|
||||
api = API('cmake', cmake_build)
|
||||
def test_query_with_cache(cmake_build: Path) -> None:
|
||||
api = API("cmake", cmake_build)
|
||||
assert api.query()
|
||||
|
||||
query = cmake_build / '.cmake' / 'api' / 'v1' / 'query'
|
||||
query = cmake_build / ".cmake" / "api" / "v1" / "query"
|
||||
assert query.exists()
|
||||
|
||||
reply = cmake_build / '.cmake' / 'api' / 'v1' / 'reply'
|
||||
reply = cmake_build / ".cmake" / "api" / "v1" / "reply"
|
||||
assert reply.exists()
|
||||
|
||||
|
||||
def test_query_without_cache(cmake_build):
|
||||
api = API('cmake', cmake_build)
|
||||
(cmake_build / 'CMakeCache.txt').unlink()
|
||||
def test_query_without_cache(cmake_build: Path) -> None:
|
||||
api = API("cmake", cmake_build)
|
||||
(cmake_build / "CMakeCache.txt").unlink()
|
||||
|
||||
assert not api.query()
|
||||
|
||||
|
||||
def test_read_variable(cmake_build):
|
||||
api = API('cmake', cmake_build)
|
||||
def test_read_variable(cmake_build: Path) -> None:
|
||||
api = API("cmake", cmake_build)
|
||||
assert api.query()
|
||||
assert api.read_reply()
|
||||
|
||||
assert api.get_variable_doc('testproject_BINARY_DIR')
|
||||
assert api.get_variable_doc("testproject_BINARY_DIR")
|
||||
|
||||
|
||||
def test_read_cmake_files(cmake_build):
|
||||
api = API('cmake', cmake_build)
|
||||
def test_read_cmake_files(cmake_build: Path) -> None:
|
||||
api = API("cmake", cmake_build)
|
||||
api.parse_doc()
|
||||
assert api.query()
|
||||
api.read_reply()
|
||||
|
||||
assert 'GNU' in api.get_variable_doc('CMAKE_CXX_COMPILER_ID')
|
||||
import platform
|
||||
|
||||
system = platform.system()
|
||||
cxx = api.get_variable_doc("CMAKE_CXX_COMPILER_ID")
|
||||
assert cxx is not None
|
||||
if system == "Linux":
|
||||
assert "GNU" in cxx
|
||||
elif system == "Windows":
|
||||
assert "MSVC" in cxx
|
||||
elif system == "Darwin":
|
||||
assert "Clang" in cxx
|
||||
else:
|
||||
raise RuntimeError("Unexpected system")
|
||||
|
||||
|
||||
def test_parse_commands(cmake_build):
|
||||
api = API('cmake', cmake_build)
|
||||
def test_parse_commands(cmake_build: Path) -> None:
|
||||
api = API("cmake", cmake_build)
|
||||
api.parse_doc()
|
||||
|
||||
p = subprocess.run(['cmake', '--help-command-list'],
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
commands = p.stdout.strip().split('\n')
|
||||
p = subprocess.run(
|
||||
["cmake", "--help-command-list"],
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
commands = p.stdout.strip().split("\n")
|
||||
|
||||
for command in commands:
|
||||
assert api.get_command_doc(command) is not None, f'{command} not found'
|
||||
assert api.get_command_doc(command) is not None, f"{command} not found"
|
||||
|
||||
assert 'break()' in api.get_command_doc('break')
|
||||
assert api.get_command_doc('not_existing_command') is None
|
||||
break_doc = api.get_command_doc("break")
|
||||
assert break_doc is not None and "break()" in break_doc
|
||||
assert api.get_command_doc("not_existing_command") is None
|
||||
|
||||
|
||||
def test_parse_variables(cmake_build):
|
||||
api = API('cmake', cmake_build)
|
||||
def test_parse_variables(cmake_build: Path) -> None:
|
||||
api = API("cmake", cmake_build)
|
||||
api.parse_doc()
|
||||
|
||||
p = subprocess.run(['cmake', '--help-variable-list'],
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
variables = p.stdout.strip().split('\n')
|
||||
p = subprocess.run(
|
||||
["cmake", "--help-variable-list"],
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
variables = p.stdout.strip().split("\n")
|
||||
|
||||
for variable in variables:
|
||||
if '<' in variable:
|
||||
if "<" in variable:
|
||||
continue
|
||||
assert api.get_variable_doc(
|
||||
variable) is not None, f'{variable} not found'
|
||||
assert api.get_variable_doc(variable) is not None, f"{variable} not found"
|
||||
|
||||
assert api.get_variable_doc('BUILD_SHARED_LIBS') is not None
|
||||
assert api.get_variable_doc('not_existing_variable') is None
|
||||
assert api.get_variable_doc("BUILD_SHARED_LIBS") is not None
|
||||
assert api.get_variable_doc("not_existing_variable") is None
|
||||
|
||||
|
||||
def test_parse_modules(cmake_build: Path) -> None:
|
||||
api = API("cmake", cmake_build)
|
||||
api.parse_doc()
|
||||
|
||||
p = subprocess.run(
|
||||
["cmake", "--help-module-list"],
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
modules = p.stdout.strip().split("\n")
|
||||
|
||||
for module in modules:
|
||||
if module.startswith("Find"):
|
||||
assert (
|
||||
api.get_module_doc(module[4:], True) is not None
|
||||
), f"{module} not found"
|
||||
else:
|
||||
assert api.get_module_doc(module, False) is not None, f"{module} not found"
|
||||
|
||||
assert api.get_module_doc("GoogleTest", False) is not None
|
||||
assert api.get_module_doc("GoogleTest", True) is None
|
||||
assert api.search_module("GoogleTest", False) == ["GoogleTest"]
|
||||
assert api.search_module("GoogleTest", True) == []
|
||||
assert api.get_module_doc("Boost", False) is None
|
||||
assert api.get_module_doc("Boost", True) is not None
|
||||
assert api.search_module("Boost", False) == []
|
||||
assert api.search_module("Boost", True) == ["Boost"]
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
from cmake_language_server.formatter import Formatter
|
||||
import sys
|
||||
from contextlib import contextmanager
|
||||
from io import StringIO
|
||||
from pathlib import Path
|
||||
from typing import Callable, Iterator
|
||||
|
||||
from cmake_language_server.formatter import Formatter, main
|
||||
from cmake_language_server.parser import ListParser
|
||||
from pytest import CaptureFixture
|
||||
|
||||
|
||||
def make_formatter_test(liststr: str, expect: str):
|
||||
def test():
|
||||
def make_formatter_test(liststr: str, expect: str) -> Callable[[], None]:
|
||||
def test() -> None:
|
||||
tokens, remain = ListParser().parse(liststr)
|
||||
actual = Formatter().format(tokens)
|
||||
assert actual == expect
|
||||
@@ -11,50 +18,57 @@ def make_formatter_test(liststr: str, expect: str):
|
||||
return test
|
||||
|
||||
|
||||
test_command = make_formatter_test('a()', 'a()\n')
|
||||
test_command_tolower = make_formatter_test('A()', 'a()\n')
|
||||
test_remove_space = make_formatter_test('''
|
||||
test_command = make_formatter_test("a()", "a()\n")
|
||||
test_command_tolower = make_formatter_test("A()", "a()\n")
|
||||
test_remove_space = make_formatter_test(
|
||||
"""
|
||||
#a
|
||||
b ( c ) # d
|
||||
''', '''\
|
||||
""",
|
||||
"""\
|
||||
#a
|
||||
b(c) # d
|
||||
''')
|
||||
""",
|
||||
)
|
||||
test_indent_if = make_formatter_test(
|
||||
'''
|
||||
"""
|
||||
if()
|
||||
a() # a
|
||||
else()
|
||||
# b
|
||||
b()
|
||||
endif()
|
||||
''', '''\
|
||||
""",
|
||||
"""\
|
||||
if()
|
||||
a() # a
|
||||
else()
|
||||
# b
|
||||
b()
|
||||
endif()
|
||||
''')
|
||||
""",
|
||||
)
|
||||
test_indent_if_nested = make_formatter_test(
|
||||
'''
|
||||
"""
|
||||
if()
|
||||
if()
|
||||
a()
|
||||
b()
|
||||
endif()
|
||||
endif()
|
||||
''', '''\
|
||||
""",
|
||||
"""\
|
||||
if()
|
||||
if()
|
||||
a()
|
||||
b()
|
||||
endif()
|
||||
endif()
|
||||
''')
|
||||
test_argument = make_formatter_test('a( b c d)', 'a(b c d)\n')
|
||||
""",
|
||||
)
|
||||
test_argument = make_formatter_test("a( b c d)", "a(b c d)\n")
|
||||
test_argument_multiline = make_formatter_test(
|
||||
'''
|
||||
"""
|
||||
if()
|
||||
a(b c
|
||||
d # e
|
||||
@@ -62,7 +76,8 @@ f
|
||||
# g
|
||||
) # h
|
||||
endif()
|
||||
''', '''\
|
||||
""",
|
||||
"""\
|
||||
if()
|
||||
a(
|
||||
b c
|
||||
@@ -71,4 +86,83 @@ if()
|
||||
# g
|
||||
) # h
|
||||
endif()
|
||||
''')
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def mock_stdin(buf: str) -> Iterator[None]:
|
||||
stdin = sys.stdin
|
||||
sys.stdin = StringIO(buf)
|
||||
yield
|
||||
sys.stdin = stdin
|
||||
|
||||
|
||||
def test_main_stdin(capsys: CaptureFixture[str]) -> None:
|
||||
with mock_stdin(" a()"):
|
||||
main([])
|
||||
captured = capsys.readouterr()
|
||||
assert captured.out == "a()\n"
|
||||
assert captured.err == ""
|
||||
|
||||
|
||||
def test_main_stdin_diff(capsys: CaptureFixture[str]) -> None:
|
||||
with mock_stdin(" a()"):
|
||||
main(["-d"])
|
||||
captured = capsys.readouterr()
|
||||
assert "- a()" in captured.out
|
||||
assert "+a()" in captured.out
|
||||
assert captured.err == ""
|
||||
|
||||
|
||||
def test_main_file_1(capsys: CaptureFixture[str], tmp_path: Path) -> None:
|
||||
testfile1 = tmp_path / "list1.cmake"
|
||||
with testfile1.open("w") as fp:
|
||||
fp.write(" a()")
|
||||
|
||||
main([str(testfile1)])
|
||||
captured = capsys.readouterr()
|
||||
assert captured.out == "a()\n"
|
||||
assert captured.err == ""
|
||||
|
||||
|
||||
def test_main_file_2(capsys: CaptureFixture[str], tmp_path: Path) -> None:
|
||||
testfile1 = tmp_path / "list1.cmake"
|
||||
with testfile1.open("w") as fp:
|
||||
fp.write(" a()")
|
||||
testfile2 = tmp_path / "list2.cmake"
|
||||
with testfile2.open("w") as fp:
|
||||
fp.write(" b()")
|
||||
|
||||
main([str(testfile1), str(testfile2)])
|
||||
captured = capsys.readouterr()
|
||||
assert captured.out == "a()\nb()\n"
|
||||
assert captured.err == ""
|
||||
|
||||
|
||||
def test_main_inplace(capsys: CaptureFixture[str], tmp_path: Path) -> None:
|
||||
testfile1 = tmp_path / "list1.cmake"
|
||||
with testfile1.open("w") as fp:
|
||||
fp.write(" a()")
|
||||
|
||||
main(["-i", str(testfile1)])
|
||||
captured = capsys.readouterr()
|
||||
assert captured.out == ""
|
||||
assert captured.err == ""
|
||||
|
||||
with testfile1.open() as fp:
|
||||
content = fp.read()
|
||||
assert content == "a()\n"
|
||||
|
||||
|
||||
def test_main_diff(capsys: CaptureFixture[str], tmp_path: Path) -> None:
|
||||
testfile1 = tmp_path / "list1.cmake"
|
||||
with testfile1.open("w") as fp:
|
||||
fp.write(" a()")
|
||||
|
||||
main(["-d", str(testfile1)])
|
||||
captured = capsys.readouterr()
|
||||
assert str(testfile1) in captured.out
|
||||
assert "- a()" in captured.out
|
||||
assert "+a()" in captured.out
|
||||
assert captured.err == ""
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from typing import List
|
||||
from typing import Callable, List
|
||||
|
||||
from cmake_language_server.parser import ListParser, TokenType
|
||||
|
||||
|
||||
def make_parser_test(liststr: str,
|
||||
expect_token: List[TokenType],
|
||||
expect_remain: str = ''):
|
||||
def test():
|
||||
def make_parser_test(
|
||||
liststr: str, expect_token: List[TokenType], expect_remain: str = ""
|
||||
) -> Callable[[], None]:
|
||||
def test() -> None:
|
||||
actual_token, actual_remain = ListParser().parse(liststr)
|
||||
assert actual_token == expect_token
|
||||
assert actual_remain == expect_remain
|
||||
@@ -14,51 +14,70 @@ def make_parser_test(liststr: str,
|
||||
return test
|
||||
|
||||
|
||||
test_command_no_args = make_parser_test('a()', [('a', [])])
|
||||
test_command_space = make_parser_test(' a ()', [' ', ('a', [])])
|
||||
test_command_arg = make_parser_test('a(b)', [('a', ['b'])])
|
||||
test_command_arg_space = make_parser_test('a ( b )', [('a', ['b'])])
|
||||
test_command_arg_escape = make_parser_test(r'a(\n\")', [('a', [r'\n\"'])])
|
||||
test_command_arg_paren = make_parser_test('a((b))', [('a', ['(', 'b', ')'])])
|
||||
test_command_no_args = make_parser_test("a()", [("a", [])])
|
||||
test_command_space = make_parser_test(" a ()", [" ", ("a", [])])
|
||||
test_command_arg = make_parser_test("a(b)", [("a", ["b"])])
|
||||
test_command_arg_space = make_parser_test("a ( b )", [("a", ["b"])])
|
||||
test_command_arg_escape = make_parser_test(r"a(\n\")", [("a", [r"\n\""])])
|
||||
test_command_arg_paren = make_parser_test("a((b))", [("a", ["(", "b", ")"])])
|
||||
test_command_arg_paren_paren = make_parser_test(
|
||||
'a(((b)))', [('a', ['(', '(', 'b', ')', ')'])])
|
||||
test_command_arg_quote = make_parser_test(r'a("b\"")', [('a', [r'"b\""'])])
|
||||
test_command_arg_quote_cont = make_parser_test('a("\\\n")',
|
||||
[('a', ['"\\\n"'])])
|
||||
test_command_arg_quo_multiline = make_parser_test('''a("b
|
||||
"a(((b)))", [("a", ["(", "(", "b", ")", ")"])]
|
||||
)
|
||||
test_command_arg_quote = make_parser_test(r'a("b\"")', [("a", [r'"b\""'])])
|
||||
test_command_arg_quote_cont = make_parser_test('a("\\\n")', [("a", ['"\\\n"'])])
|
||||
test_command_arg_quo_multiline = make_parser_test(
|
||||
"""a("b
|
||||
c
|
||||
")''', [('a', ['"b\nc\n"'])])
|
||||
test_command_arg_bracket_0 = make_parser_test('a([[b]])', [('a', ['[[b]]'])])
|
||||
test_command_arg_bracket_1 = make_parser_test('a([=[b]=])',
|
||||
[('a', ['[=[b]=]'])])
|
||||
test_command_arg_space = make_parser_test('a ( b )', [('a', [' ', 'b', ' '])])
|
||||
test_command_arg_multi = make_parser_test('a(b c)', [('a', ['b', ' ', 'c'])])
|
||||
test_command_multielement = make_parser_test('''a(
|
||||
")""",
|
||||
[("a", ['"b\nc\n"'])],
|
||||
)
|
||||
test_command_arg_bracket_0 = make_parser_test("a([[b]])", [("a", ["[[b]]"])])
|
||||
test_command_arg_bracket_1 = make_parser_test("a([=[b]=])", [("a", ["[=[b]=]"])])
|
||||
test_command_arg_space = make_parser_test("a ( b )", [("a", [" ", "b", " "])])
|
||||
test_command_arg_multi = make_parser_test("a(b c)", [("a", ["b", " ", "c"])])
|
||||
test_command_multielement = make_parser_test(
|
||||
"""a(
|
||||
b
|
||||
c # c
|
||||
)''', [('a', ['\n', ' ', 'b', '\n', ' ', 'c', ' ', '# c', '\n'])])
|
||||
test_line_comment = make_parser_test('a() # b # c',
|
||||
[('a', []), ' ', '# b # c'])
|
||||
test_bracket_comment = make_parser_test('#[[a]]#[[b]]', ['#[[a]]', '#[[b]]'])
|
||||
test_bracket_comment_nested = make_parser_test('#[=[[[a]]]=]',
|
||||
['#[=[[[a]]]=]'])
|
||||
test_bracket_comment_multiline = make_parser_test('#[[\na\nb\nc\n]]',
|
||||
['#[[\na\nb\nc\n]]'])
|
||||
test_if_block = make_parser_test('''if()
|
||||
)""",
|
||||
[("a", ["\n", " ", "b", "\n", " ", "c", " ", "# c", "\n"])],
|
||||
)
|
||||
test_line_comment = make_parser_test("a() # b # c", [("a", []), " ", "# b # c"])
|
||||
test_bracket_comment = make_parser_test("#[[a]]#[[b]]", ["#[[a]]", "#[[b]]"])
|
||||
test_bracket_comment_nested = make_parser_test("#[=[[[a]]]=]", ["#[=[[[a]]]=]"])
|
||||
test_bracket_comment_multiline = make_parser_test(
|
||||
"#[[\na\nb\nc\n]]", ["#[[\na\nb\nc\n]]"]
|
||||
)
|
||||
test_if_block = make_parser_test(
|
||||
"""if()
|
||||
a()
|
||||
else()
|
||||
b()
|
||||
endif()''', [('if', []), '\n', ' ', ('a', []), '\n', ('else', []), '\n', ' ',
|
||||
('b', []), '\n', ('endif', [])])
|
||||
endif()""",
|
||||
[
|
||||
("if", []),
|
||||
"\n",
|
||||
" ",
|
||||
("a", []),
|
||||
"\n",
|
||||
("else", []),
|
||||
"\n",
|
||||
" ",
|
||||
("b", []),
|
||||
"\n",
|
||||
("endif", []),
|
||||
],
|
||||
)
|
||||
test_comment_multi_linecomment = make_parser_test(
|
||||
'''a()# a
|
||||
"""a()# a
|
||||
b() # b
|
||||
c() # c''', [('a', []), '# a', '\n', ('b', []), ' ', '# b', '\n',
|
||||
('c', []), ' ', '# c'])
|
||||
c() # c""",
|
||||
[("a", []), "# a", "\n", ("b", []), " ", "# b", "\n", ("c", []), " ", "# c"],
|
||||
)
|
||||
|
||||
test_incomplete_id = make_parser_test('a', [], 'a')
|
||||
test_incomplete_command = make_parser_test('a(', [], 'a(')
|
||||
test_incomplete_id_after_command = make_parser_test('a()\nb',
|
||||
[('a', []), '\n'], 'b')
|
||||
test_incomplete_id = make_parser_test("a", [], "a")
|
||||
test_incomplete_command = make_parser_test("a(", [], "a(")
|
||||
test_incomplete_id_after_command = make_parser_test("a()\nb", [("a", []), "\n"], "b")
|
||||
test_incomplete_command_after_command = make_parser_test(
|
||||
'a()\nb(c', [('a', []), '\n'], 'b(c')
|
||||
"a()\nb(c", [("a", []), "\n"], "b(c"
|
||||
)
|
||||
|
||||
205
tests/test_server.py
Normal file
205
tests/test_server.py
Normal file
@@ -0,0 +1,205 @@
|
||||
from concurrent import futures
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Optional, Tuple
|
||||
|
||||
from cmake_language_server.server import CMakeLanguageServer
|
||||
from pygls.lsp.methods import (
|
||||
COMPLETION,
|
||||
FORMATTING,
|
||||
HOVER,
|
||||
INITIALIZE,
|
||||
TEXT_DOCUMENT_DID_OPEN,
|
||||
)
|
||||
from pygls.lsp.types import (
|
||||
ClientCapabilities,
|
||||
CompletionContext,
|
||||
CompletionParams,
|
||||
CompletionTriggerKind,
|
||||
DidOpenTextDocumentParams,
|
||||
DocumentFormattingParams,
|
||||
FormattingOptions,
|
||||
InitializeParams,
|
||||
Position,
|
||||
TextDocumentIdentifier,
|
||||
TextDocumentItem,
|
||||
TextDocumentPositionParams,
|
||||
)
|
||||
from pygls.server import LanguageServer
|
||||
|
||||
CALL_TIMEOUT = 2
|
||||
|
||||
|
||||
def _init(client: LanguageServer, root: Path) -> None:
|
||||
retry = 3
|
||||
while retry > 0:
|
||||
try:
|
||||
client.lsp.send_request(
|
||||
INITIALIZE,
|
||||
InitializeParams(
|
||||
process_id=1234,
|
||||
root_uri=root.as_uri(),
|
||||
capabilities=ClientCapabilities(),
|
||||
),
|
||||
).result(timeout=CALL_TIMEOUT)
|
||||
except futures.TimeoutError:
|
||||
retry -= 1
|
||||
else:
|
||||
break
|
||||
|
||||
|
||||
def _open(client: LanguageServer, path: Path, text: Optional[str] = None) -> None:
|
||||
if text is None:
|
||||
with open(path) as fp:
|
||||
text = fp.read()
|
||||
|
||||
client.lsp.notify(
|
||||
TEXT_DOCUMENT_DID_OPEN,
|
||||
DidOpenTextDocumentParams(
|
||||
text_document=TextDocumentItem(
|
||||
uri=path.as_uri(), language_id="cmake", version=1, text=text
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def _test_completion(
|
||||
client_server: Tuple[LanguageServer, CMakeLanguageServer],
|
||||
datadir: Path,
|
||||
content: str,
|
||||
context: Optional[CompletionContext],
|
||||
) -> Dict[str, Any]:
|
||||
client, server = client_server
|
||||
_init(client, datadir)
|
||||
path = datadir / "CMakeLists.txt"
|
||||
_open(client, path, content)
|
||||
params = CompletionParams(
|
||||
text_document=TextDocumentIdentifier(uri=path.as_uri()),
|
||||
position=Position(line=0, character=len(content)),
|
||||
context=context,
|
||||
)
|
||||
if context is None:
|
||||
# some clients do not send context
|
||||
del params.context
|
||||
ret = client.lsp.send_request(COMPLETION, params).result(timeout=CALL_TIMEOUT)
|
||||
assert isinstance(ret, dict)
|
||||
return ret
|
||||
|
||||
|
||||
def test_initialize(
|
||||
client_server: Tuple[LanguageServer, CMakeLanguageServer], datadir: Path
|
||||
) -> None:
|
||||
client, server = client_server
|
||||
|
||||
assert server._api is None
|
||||
_init(client, datadir)
|
||||
assert server._api is not None
|
||||
|
||||
|
||||
def test_completions_invoked(
|
||||
client_server: Tuple[LanguageServer, CMakeLanguageServer], datadir: Path
|
||||
) -> None:
|
||||
response = _test_completion(
|
||||
client_server,
|
||||
datadir,
|
||||
"projec",
|
||||
CompletionContext(trigger_kind=CompletionTriggerKind.Invoked),
|
||||
)
|
||||
item = next(filter(lambda x: x["label"] == "project", response["items"]), None)
|
||||
assert item is not None
|
||||
assert isinstance(item["documentation"], str)
|
||||
assert "<PROJECT-NAME>" in item["documentation"]
|
||||
|
||||
|
||||
def test_completions_nocontext(
|
||||
client_server: Tuple[LanguageServer, CMakeLanguageServer], datadir: Path
|
||||
) -> None:
|
||||
response = _test_completion(client_server, datadir, "projec", None)
|
||||
item = next(filter(lambda x: x["label"] == "project", response["items"]), None)
|
||||
assert item is not None
|
||||
assert isinstance(item["documentation"], str)
|
||||
assert "<PROJECT-NAME>" in item["documentation"]
|
||||
|
||||
|
||||
def test_completions_triggercharacter_variable(
|
||||
client_server: Tuple[LanguageServer, CMakeLanguageServer], datadir: Path
|
||||
) -> None:
|
||||
response = _test_completion(
|
||||
client_server,
|
||||
datadir,
|
||||
"${",
|
||||
CompletionContext(
|
||||
trigger_kind=CompletionTriggerKind.TriggerCharacter, trigger_character="{"
|
||||
),
|
||||
)
|
||||
assert "PROJECT_VERSION" in [x["label"] for x in response["items"]]
|
||||
|
||||
response_nocontext = _test_completion(client_server, datadir, "${", None)
|
||||
assert response == response_nocontext
|
||||
|
||||
|
||||
def test_completions_triggercharacter_module(
|
||||
client_server: Tuple[LanguageServer, CMakeLanguageServer], datadir: Path
|
||||
) -> None:
|
||||
response = _test_completion(
|
||||
client_server,
|
||||
datadir,
|
||||
"include(",
|
||||
CompletionContext(
|
||||
trigger_kind=CompletionTriggerKind.TriggerCharacter, trigger_character="("
|
||||
),
|
||||
)
|
||||
assert "GoogleTest" in [x["label"] for x in response["items"]]
|
||||
|
||||
response_nocontext = _test_completion(client_server, datadir, "include(", None)
|
||||
assert response == response_nocontext
|
||||
|
||||
|
||||
def test_completions_triggercharacter_package(
|
||||
client_server: Tuple[LanguageServer, CMakeLanguageServer], datadir: Path
|
||||
) -> None:
|
||||
response = _test_completion(
|
||||
client_server,
|
||||
datadir,
|
||||
"find_package(",
|
||||
CompletionContext(
|
||||
trigger_kind=CompletionTriggerKind.TriggerCharacter, trigger_character="("
|
||||
),
|
||||
)
|
||||
assert "Boost" in [x["label"] for x in response["items"]]
|
||||
|
||||
response_nocontext = _test_completion(client_server, datadir, "find_package(", None)
|
||||
assert response == response_nocontext
|
||||
|
||||
|
||||
def test_formatting(
|
||||
client_server: Tuple[LanguageServer, CMakeLanguageServer], datadir: Path
|
||||
) -> None:
|
||||
client, server = client_server
|
||||
_init(client, datadir)
|
||||
path = datadir / "CMakeLists.txt"
|
||||
_open(client, path, "a ( b c ) ")
|
||||
response = client.lsp.send_request(
|
||||
FORMATTING,
|
||||
DocumentFormattingParams(
|
||||
text_document=TextDocumentIdentifier(uri=path.as_uri()),
|
||||
options=FormattingOptions(tab_size=2, insert_spaces=True),
|
||||
),
|
||||
).result(timeout=CALL_TIMEOUT)
|
||||
assert response[0]["newText"] == "a(b c)\n"
|
||||
|
||||
|
||||
def test_hover(
|
||||
client_server: Tuple[LanguageServer, CMakeLanguageServer], datadir: Path
|
||||
) -> None:
|
||||
client, server = client_server
|
||||
_init(client, datadir)
|
||||
path = datadir / "CMakeLists.txt"
|
||||
_open(client, path, "project()")
|
||||
response = client.lsp.send_request(
|
||||
HOVER,
|
||||
TextDocumentPositionParams(
|
||||
text_document=TextDocumentIdentifier(uri=path.as_uri()),
|
||||
position=Position(line=0, character=0),
|
||||
),
|
||||
).result(timeout=CALL_TIMEOUT)
|
||||
assert "<PROJECT-NAME>" in response["contents"]["value"]
|
||||
33
tox.ini
33
tox.ini
@@ -1,27 +1,38 @@
|
||||
[tox]
|
||||
isolated_build = True
|
||||
skipsdist = True
|
||||
envlist = py36, py37, py38, lint
|
||||
envlist = py{36,37,38,39,310}-{linux,windows}
|
||||
|
||||
[gh-actions]
|
||||
python =
|
||||
3.6: py36
|
||||
3.7: py37, lint
|
||||
3.7: py37
|
||||
3.8: py38
|
||||
3.9: py39
|
||||
3.10: py310
|
||||
|
||||
[gh-actions:env]
|
||||
os =
|
||||
ubuntu-18.04: linux
|
||||
windows-2019: windows
|
||||
|
||||
[testenv]
|
||||
whitelist_externals = poetry
|
||||
allowlist_externals =
|
||||
poetry
|
||||
git
|
||||
skip_install = true
|
||||
passenv = *
|
||||
commands_pre =
|
||||
poetry install
|
||||
commands =
|
||||
poetry run pytest -sv tests
|
||||
pytest --cov-report=term --cov-report=xml --cov=src -sv tests
|
||||
|
||||
[testenv:lint]
|
||||
whitelist_externals = poetry
|
||||
skip_install = true
|
||||
pip install "pysen[lint]"
|
||||
pip install "black>=22.3.0"
|
||||
pysen run format
|
||||
git diff --exit-code --ignore-submodules
|
||||
pysen run lint
|
||||
|
||||
[testenv:py310-windows]
|
||||
commands =
|
||||
poetry run isort -c -rc src tests
|
||||
poetry run yapf -d -r src tests
|
||||
poetry run flake8
|
||||
poetry run mypy src tests
|
||||
pytest --cov-report=term --cov-report=xml --cov=src -sv tests
|
||||
|
||||
Reference in New Issue
Block a user