diff options
125 files changed, 50657 insertions, 0 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..dbe2fa1 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,8 @@ +FROM mcr.microsoft.com/devcontainers/base:bookworm +RUN sudo apt update + +# Pyenv installation of Python versions is missing below packages. +RUN sudo apt install libbz2-dev libncurses5-dev libffi-dev libreadline-dev libsqlite3-dev liblzma-dev -y + +# Install fish. +RUN sudo apt install fish -y
\ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..6b0dac3 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,28 @@ +{ + "name": "LSP Dev Container", + "build": { + "dockerfile": "./Dockerfile", + "context": ".." + }, + "features": { + "ghcr.io/devcontainers/features/powershell:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/dotnet:1": { + "version": "latest" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "esbenp.prettier-vscode", + "ms-python.python", + "ms-python.vscode-pylance", + "ms-python.black-formatter", + "ms-python.isort" + ] + } + }, + "onCreateCommand": "bash scripts/onCreateCommand.sh", + "postCreateCommand": "bash scripts/postCreateCommand.sh" +}
\ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..051cace --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,46 @@ +version: 2 +updates: + - package-ecosystem: 'github-actions' + directory: / + schedule: + interval: monthly + labels: + - 'no-changelog' + + - package-ecosystem: 'github-actions' + directory: .github/actions/lint + schedule: + interval: monthly + labels: + - 'no-changelog' + + - package-ecosystem: 'github-actions' + directory: .github/actions/build-package + schedule: + interval: monthly + labels: + - 'no-changelog' + + - package-ecosystem: 'pip' + directory: /generator + schedule: + interval: daily + labels: + - 'no-changelog' + + - package-ecosystem: 'pip' + directory: /tests + schedule: + interval: daily + labels: + - 'no-changelog' + + - package-ecosystem: 'pip' + directory: / + schedule: + interval: daily + labels: + - 'debt' + commit-message: + include: 'scope' + prefix: 'pip' diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..6dedc3e --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,17 @@ +changelog: + exclude: + labels: + - "no-changelog" + + categories: + - title: Enhancements + labels: + - "feature-request" + + - title: Bug Fixes + labels: + - "bug" + + - title: Code Health + labels: + - "debt" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..054549e --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,70 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [main] + pull_request: + # The branches below must be a subset of the branches above + branches: [main] + schedule: + - cron: "15 16 * * 2" + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ["python"] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://git.io/codeql-language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/issue-labels.yml b/.github/workflows/issue-labels.yml new file mode 100644 index 0000000..c8198c5 --- /dev/null +++ b/.github/workflows/issue-labels.yml @@ -0,0 +1,39 @@ +name: Issue labels + +on: + issues: + types: [opened, reopened] + +permissions: + issues: write + +jobs: + # From https://github.com/marketplace/actions/github-script#apply-a-label-to-an-issue. + add-triage-label: + name: "Add 'triage-needed'" + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const result = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }) + const labels = result.data.map((label) => label.name) + const hasNeeds = labels.some((label) => label.startsWith('needs')) + + if (!hasNeeds) { + console.log('This issue is not labeled with a "needs __" label, add the "triage-needed" label.') + + github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: ['triage-needed'] + }) + } else { + console.log('This issue already has a "needs __" label, do not add the "triage-needed" label.') + } diff --git a/.github/workflows/lsp_updater.py b/.github/workflows/lsp_updater.py new file mode 100644 index 0000000..01f1c91 --- /dev/null +++ b/.github/workflows/lsp_updater.py @@ -0,0 +1,132 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + + +import hashlib +import json +import os +import pathlib +import urllib.request as url_lib +from typing import Optional, Union + +import github +import github.Issue +import github.PullRequest + +MODEL_SCHEMA = "https://raw.githubusercontent.com/microsoft/vscode-languageserver-node/main/protocol/metaModel.schema.json" +MODEL = "https://raw.githubusercontent.com/microsoft/vscode-languageserver-node/main/protocol/metaModel.json" + +LABEL_DEBT = "debt" +LABEL_UPDATE = "lsp-update" + +GH = github.Github(os.getenv("GITHUB_ACCESS_TOKEN")) +GH_REPO = GH.get_repo(os.getenv("GITHUB_REPOSITORY")) + + +def _get_content(uri) -> str: + with url_lib.urlopen(uri) as response: + content = response.read() + if isinstance(content, str): + return content + else: + return content.decode("utf-8") + + +def _get_update_issue_body(schema_hash: str, model_hash: str) -> str: + return "\n".join( + [ + "LSP Schema has changed. Please update the generator.", + f"Schema: [source]({MODEL_SCHEMA})", + f"Model: [source]({MODEL})", + "", + "Instructions:", + "1. Setup a virtual environment and install nox.", + "2. Install all requirements for generator.", + "3. Run `nox --session update_lsp`.", + "", + "Hashes:", + f"* schema: `{schema_hash}`", + f"* model: `{model_hash}`", + ] + ) + + +def is_schema_changed(old_schema: str, new_schema: str) -> bool: + old_schema = json.loads(old_schema) + new_schema = json.loads(new_schema) + return old_schema != new_schema + + +def is_model_changed(old_model: str, new_model: str) -> bool: + old_model = json.loads(old_model) + new_model = json.loads(new_model) + return old_model != new_model + + +def get_hash(text: str) -> str: + hash_object = hashlib.sha256() + hash_object.update(json.dumps(json.loads(text)).encode()) + return hash_object.hexdigest() + + +def get_existing_issue( + schema_hash: str, model_hash: str +) -> Union[github.PullRequest.PullRequest, None]: + issues = GH_REPO.get_issues(state="open", labels=[LABEL_UPDATE, LABEL_DEBT]) + for issue in issues: + if schema_hash in issue.body and model_hash in issue.body: + return issue + + return None + + +def cleanup_stale_issues( + schema_hash: str, model_hash: str, new_issue: Optional[github.Issue.Issue] = None +): + issues = GH_REPO.get_issues(state="open", labels=[LABEL_UPDATE, LABEL_DEBT]) + for issue in issues: + if schema_hash not in issue.body or model_hash not in issue.body: + if new_issue: + issue.create_comment( + "\n".join( + [ + "This issue is stale as the schema has changed.", + f"Closing in favor of {new_issue.url} .", + ] + ) + ) + issue.edit(state="closed") + + +def main(): + lsp_root = pathlib.Path(__file__).parent.parent.parent / "generator" + + old_schema = pathlib.Path(lsp_root / "lsp.schema.json").read_text(encoding="utf-8") + old_model = pathlib.Path(lsp_root / "lsp.json").read_text(encoding="utf-8") + + new_schema = _get_content(MODEL_SCHEMA) + new_model = _get_content(MODEL) + + schema_changed = is_schema_changed(old_schema, new_schema) + model_changed = is_model_changed(old_model, new_model) + + if schema_changed or model_changed: + schema_hash = get_hash(new_schema) + model_hash = get_hash(new_model) + + issue = get_existing_issue(schema_hash, model_hash) + + if not issue: + issue = GH_REPO.create_issue( + title="Update LSP schema and model", + body=_get_update_issue_body(schema_hash, model_hash), + labels=[LABEL_UPDATE, LABEL_DEBT], + ) + cleanup_stale_issues(schema_hash, model_hash, issue) + print(f"Created issue {issue.url}") + else: + print("No changes detected.") + + +if __name__ == "__main__": + main() diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 0000000..7fdb047 --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,238 @@ +name: PR Validation + +on: + pull_request: + +jobs: + build-package: + name: Create PyPI Packages + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Python 3.7 + uses: actions/setup-python@v4 + with: + python-version: 3.7 + + - name: Pip cache + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-build-vsix-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-build-vsix- + + - name: Install nox + run: python -m pip install nox + shell: bash + + - name: Build sdist and wheels + run: python -m nox --session build + shell: bash + + - name: Upload Python Packages to Artifacts + uses: actions/upload-artifact@v3 + with: + name: pypi-packages + path: | + packages/python/dist/*.gz + packages/python/dist/*.whl + if-no-files-found: error + retention-days: 7 + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Pip cache + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-lint-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-lint- + + - name: Install nox + run: python -m pip install nox + shell: bash + + - name: Check linting and formatting + run: python -m nox --session lint + shell: bash + + - name: Rust Tool Chain setup + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 + with: + manifest-path: packages/rust/lsprotocol/Cargo.toml + + - name: Dotnet Tool Chain setup + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + + - name: Dotnet Format Check + run: dotnet format packages/dotnet/lsprotocol/lsprotocol.csproj --verify-no-changes + shell: bash + + python-tests: + name: Python Tests + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + python: ['3.7', '3.8', '3.9', '3.10', '3.11'] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Update pip, install wheel and nox + run: python -m pip install -U pip wheel nox + shell: bash + + - name: Run tests + run: python -m nox --session tests + shell: bash + + dotnet-tests: + name: Dotnet Tests + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Dotnet Tool Chain setup + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + + - name: Install Generator + run: python -m pip install -r ./requirements.txt + + - name: Generate Test Data + run: python -m generator --plugin testdata + + - name: Generate C# Code + run: python -m generator --plugin dotnet + + - name: Dotnet Build Tests + run: dotnet build tests/dotnet/lsprotocol_tests/lsprotocol_tests.csproj + shell: bash + + - name: Dotnet Run Tests + run: dotnet test tests/dotnet/lsprotocol_tests/lsprotocol_tests.csproj + shell: bash + env: + LSP_TEST_DATA_PATH: ${{ github.workspace }}/packages/testdata + + dotnet-project: + name: Dotnet Project + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install Generator + run: python -m pip install -r ./requirements.txt + + - name: Generate C# Code + run: python -m generator --plugin dotnet + + - name: Format generated code + run: dotnet format packages/dotnet/lsprotocol/lsprotocol.csproj + shell: bash + + - name: Upload Dotnet Project to Artifacts + uses: actions/upload-artifact@v3 + with: + name: dotnet-project + path: | + packages/dotnet/lsprotocol/*.csproj + packages/dotnet/lsprotocol/*.cs + if-no-files-found: error + retention-days: 7 + + smoke-tests: + name: Smoke Tests (pygls) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + python: ['3.7', '3.8', '3.9', '3.10', '3.11'] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Checkout Pygls + uses: actions/checkout@v4 + with: + repository: openlawlibrary/pygls + path: smoke_tests + + - name: Use Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Update pip, install wheel + run: python -m pip install -U pip wheel + shell: bash + + - name: Install pip pygls dependencies + run: python -m pip install typeguard mock pytest pytest-asyncio + shell: bash + + - name: Install pip lsprotocol dependencies + run: python -m pip install -r ./packages/python/requirements.txt + shell: bash + + - name: Install pygls + run: python -m pip install --no-deps ./smoke_tests + shell: bash + + - name: Pip List + run: python -m pip list + shell: bash + + - name: Run Tests + run: python -m pytest smoke_tests/tests + env: + PYTHONPATH: ./packages/python + shell: bash diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml new file mode 100644 index 0000000..0bc6130 --- /dev/null +++ b/.github/workflows/pr-labels.yml @@ -0,0 +1,21 @@ +name: "PR labels" +on: + pull_request: + types: + - "opened" + - "reopened" + - "labeled" + - "unlabeled" + - "synchronize" + +jobs: + add-pr-label: + name: "Ensure Required Labels" + runs-on: ubuntu-latest + steps: + - name: "PR impact specified" + uses: mheap/github-action-required-labels@v5 + with: + mode: exactly + count: 1 + labels: "bug, debt, feature-request, no-changelog" diff --git a/.github/workflows/push-check.yml b/.github/workflows/push-check.yml new file mode 100644 index 0000000..091402e --- /dev/null +++ b/.github/workflows/push-check.yml @@ -0,0 +1,189 @@ +name: Push Validation + +on: + push: + branches: + - 'main' + - 'release' + - 'release/*' + - 'release-*' + +jobs: + build-package: + name: Create PyPI Packages + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Python 3.7 + uses: actions/setup-python@v4 + with: + python-version: 3.7 + + - name: Pip cache + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-build-vsix-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-build-vsix- + + - name: Install nox + run: python -m pip install nox + shell: bash + + - name: Build sdist and wheels + run: python -m nox --session build + shell: bash + + - name: Upload Python Packages to Artifacts + uses: actions/upload-artifact@v3 + with: + name: pypi-packages + path: | + packages/python/dist/*.gz + packages/python/dist/*.whl + if-no-files-found: error + retention-days: 7 + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Pip cache + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-lint-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-lint- + + - name: Install nox + run: python -m pip install nox + shell: bash + + - name: Check linting and formatting + run: python -m nox --session lint + shell: bash + + - name: Rust Tool Chain setup + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 + with: + manifest-path: packages/rust/lsprotocol/Cargo.toml + + - name: Dotnet Tool Chain setup + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + + - name: Dotnet Format Check + run: dotnet format packages/dotnet/lsprotocol/lsprotocol.csproj --verify-no-changes + shell: bash + + python-tests: + name: Python Tests + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + python: ['3.7', '3.8', '3.9', '3.10', '3.11'] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Update pip, install wheel and nox + run: python -m pip install -U pip wheel nox + shell: bash + + - name: Run tests + run: python -m nox --session tests + shell: bash + + dotnet-tests: + name: Dotnet Tests + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Dotnet Tool Chain setup + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + + - name: Install Generator + run: python -m pip install -r ./requirements.txt + + - name: Generate Test Data + run: python -m generator --plugin testdata + + - name: Generate C# Code + run: python -m generator --plugin dotnet + + - name: Dotnet Run Tests + run: dotnet test tests/dotnet/lsprotocol_tests/lsprotocol_tests.csproj + shell: bash + env: + LSP_TEST_DATA_PATH: ${{ github.workspace }}/packages/testdata + + dotnet-project: + name: Dotnet Project + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install Generator + run: python -m pip install -r ./requirements.txt + + - name: Generate C# Code + run: python -m generator --plugin dotnet + + - name: Format generated code + run: dotnet format packages/dotnet/lsprotocol/lsprotocol.csproj + shell: bash + + - name: Upload Dotnet Project to Artifacts + uses: actions/upload-artifact@v3 + with: + name: dotnet-project + path: | + packages/dotnet/lsprotocol/*.csproj + packages/dotnet/lsprotocol/*.cs + if-no-files-found: error + retention-days: 7 diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml new file mode 100644 index 0000000..f43b22a --- /dev/null +++ b/.github/workflows/updater.yml @@ -0,0 +1,30 @@ +name: LSP Update check + +on: + schedule: + - cron: '0 10 * * 1-5' # 10AM UTC (2AM PDT) MON-FRI + +jobs: + update-lsp: + name: Check for LSP update and create issue + runs-on: ubuntu-latest + permissions: + issues: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Update pip, install wheel and nox + run: python -m pip install -U pip wheel nox PyGithub + shell: bash + + - name: Run Checker + run: python ./.github/workflows/lsp_updater.py + env: + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml new file mode 100644 index 0000000..628ac66 --- /dev/null +++ b/.github/workflows/version-check.yml @@ -0,0 +1,21 @@ +name: Version Check + +on: + pull_request: + +jobs: + version-check: + name: Ensure Version is as expected + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Python 3.x + uses: actions/setup-python@v4 + with: + python-version: "3.x" + + - name: Version Check + run: python ./.github/workflows/version_check.py + shell: bash diff --git a/.github/workflows/version_check.py b/.github/workflows/version_check.py new file mode 100644 index 0000000..c9b3e54 --- /dev/null +++ b/.github/workflows/version_check.py @@ -0,0 +1,27 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + + +import datetime +import pathlib +import sys + +pyproject = ( + pathlib.Path(__file__).parent.parent.parent + / "packages" + / "python" + / "pyproject.toml" +) + +content = pyproject.read_text(encoding="utf-8") + +for line in content.splitlines(): + if line.startswith("version"): + version = line.split("=")[1].strip().strip('"') + year, minor, micro = version.split(".") + today = datetime.date.today() + if int(year) != today.year: + print(f"Version {version} year should be {today.year}") + sys.exit(1) + +print("Version check passed") diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ff69d08 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +out +dist +.venv*/ +.nox/ +**/__pycache__ +**/.pytest_cache +**/.vs +**/.mypy_cache +packages/rust/**/target/ +packages/rust/**/Cargo.lock +packages/dotnet/lsprotocol/bin/ +packages/dotnet/lsprotocol/obj/ diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..87a94b7 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,15 @@ +module.exports = { + singleQuote: true, + printWidth: 120, + tabWidth: 4, + endOfLine: 'auto', + trailingComma: 'all', + overrides: [ + { + files: ['*.yml', '*.yaml'], + options: { + tabWidth: 2 + } + } + ] +}; diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..e6d1a11 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "esbenp.prettier-vscode", + "ms-python.python", + "ms-python.vscode-pylance", + "ms-python.black-formatter", + "ms-python.isort" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..095615f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,35 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Run Generator", + "type": "python", + "request": "launch", + "module": "generator", + "console": "integratedTerminal", + "justMyCode": true, + "args": ["--plugin", "${input:plugin}"] + }, + { + "name": "DON'T SELECT (test debug config)", + "type": "python", + "request": "launch", + "console": "integratedTerminal", + "justMyCode": false, + "purpose": ["debug-test"], + "presentation": { + "hidden": true, + "group": "", + "order": 4 + } + } + ], + "inputs": [ + { + "id": "plugin", + "type": "pickString", + "description": "Select a plugin to debug", + "options": ["python", "rust", "dotnet", "testdata"] + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9df63e5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,23 @@ +{ + "files.exclude": { + "**/.git": true, + "**/__pycache__": true, + "**/.mypy_cache": true, + "**/.pytest_cache": true, + "**/.nox": true + }, + "python.formatting.provider": "none", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": true + }, + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter" + }, + "isort.args": ["--profile", "black"], + "python.testing.pytestArgs": ["tests"], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "python.analysis.extraPaths": ["packages/python", "tests/python/common"], + "rust-analyzer.linkedProjects": ["packages/rust/lsprotocol/Cargo.toml"] +} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..f9ba8cf --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,9 @@ +# Microsoft Open Source Code of Conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). + +Resources: + +- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) +- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/README.md b/README.md new file mode 100644 index 0000000..5bcdce0 --- /dev/null +++ b/README.md @@ -0,0 +1,78 @@ +# Language Server Protocol types code generator + +This repository contains code to generate Language Server Protocol types and classes for various languages. + +# Code Generator usage + +## Usage + +You will need a python environment to run the generator. Here are the steps: + +1. Create a python environment (min supported python 3.7): `python -m venv .venv` +2. Get this tool: `python -m pip install git+https://github.com/microsoft/lsprotocol.git` +3. Run your plugin: `python -m generator --plugin dotnet --output-dir ./code` + +### Command line + +Clone this repository and run `generator` like a module. + +```console +>python -m generator --help +usage: __main__.py [-h] [--model [MODEL [MODEL ...]]] --plugin PLUGIN + [--output-dir OUTPUT_DIR] + +Generate types from LSP JSON model. + +optional arguments: + -h, --help show this help message and exit + --model [MODEL [MODEL ...]], -m [MODEL [MODEL ...]] + Path to a model JSON file. By default uses packaged + model file. + --plugin PLUGIN, -p PLUGIN + Name of a builtin plugin module. By default uses all + plugins. + --output-dir OUTPUT_DIR, -o OUTPUT_DIR + Path to a directory where the generated content is +``` + +### using `nox` + +This project uses `nox` as a task runner to run the code generator. You can install `nox` and run `build_lsp` session to generate code from spec available in the repo. + +```console +> python -m pip install nox +> nox --session build_lsp +``` + +You can format code, run tests, and other tasks using `nox` as well. + +# Contributing plugins + +## Adding a new plugin + +Follow these steps to generate boiler plate code for new plugin: + +1. Create a virtual environment for python using python 3.7 and activate that environment. + 1. If you have python extension for VS Code installed then run `Python: Create Environment` command. Be sure to select all the `requirements.txt` files in the repo. This should, install all packages needed and select the environment for you. +1. Ensure `nox` is installed. + 1. Run `nox --list`, is nox is installed oyu should see a list of available sessions. Otherwise, run `python -m pip install nox` from the python 3.7 environment you created above. +1. Run `nox --session create_plugin` and follow the prompts to create a new plugin. + +Example: + +```console +> nox --session create_plugin +nox > Running session create_plugin +nox > Creating virtual environment (virtualenv) using python.exe in .nox\create_plugin +Enter the name of the plugin: java +nox > Created plugin java. +nox > Session create_plugin was successful. +``` + +# Supported plugins + +| Language | Plugin Module | Package | Notes | +| -------- | ------------------------ | --------------------------------------------------------------------------------------------------- | ----------- | +| Python | generator.plugins.python | [![PyPI](https://img.shields.io/pypi/v/lsprotocol?label=lsprotocol)](https://pypi.org/p/lsprotocol) | Active | +| Rust | generator.plugins.rust | <in development> | Development | +| Dotnet | generator.plugins.dotnet | <in developemnt> | Development | diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..869fdfe --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,41 @@ +<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK --> + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). + +<!-- END MICROSOFT SECURITY.MD BLOCK --> diff --git a/SUPPORT.md b/SUPPORT.md new file mode 100644 index 0000000..01f48d3 --- /dev/null +++ b/SUPPORT.md @@ -0,0 +1,13 @@ +# Support
+
+## How to file issues and get help
+
+This project uses GitHub Issues to track bugs and feature requests. Please search the existing
+issues before filing new issues to avoid duplicates. For new issues, file your bug or
+feature request as a new Issue.
+
+For help and questions about using this project, please use the GitHub Discussions.
+
+## Microsoft Support Policy
+
+Support for this **PROJECT or PRODUCT** is limited to the resources listed above.
diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml new file mode 100644 index 0000000..37df592 --- /dev/null +++ b/azure-pipelines/release-pypi.yml @@ -0,0 +1,35 @@ +trigger: none +pr: none + +resources: + repositories: + - repository: templates + type: github + name: microsoft/vscode-engineering + ref: main + endpoint: Monaco + +parameters: + - name: publishPackage + displayName: 🚀 Publish Package + type: boolean + default: false + +extends: + template: azure-pipelines/pypi-package/pipeline.yml@templates + parameters: + publishPackage: ${{ parameters.publishPackage }} + pythonVersion: '3.7' + # We don't ship any built in packages. + generateNotice: false + pyProjectTomlPath: $(Build.SourcesDirectory)/packages/python/pyproject.toml + buildSteps: + - script: python -m pip install nox + displayName: Install nox + + - script: python -m nox --session build + displayName: Build package (sdist and wheels) + + - publish: $(Build.SourcesDirectory)/packages/python/dist + artifact: dist + displayName: 🚛 Publish artifact diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml new file mode 100644 index 0000000..6c12d7d --- /dev/null +++ b/azure-pipelines/release.yml @@ -0,0 +1,36 @@ +trigger: none +pr: none + +variables: + Codeql.Enabled: true + +parameters: + - name: publishPyPI + displayName: 🚀 Publish To PyPI + type: string + values: [Skip, Test, Real] + default: Test + +stages: + - stage: pre_build + displayName: Pre-build validation + jobs: + - template: template/static_analysis.yml + + - stage: build + displayName: Build sdist and wheels + dependsOn: pre_build + variables: + skipComponentGovernanceDetection: true # handled by pre_build + jobs: + - template: template/build_packages.yml + + - stage: publish + displayName: Publish + dependsOn: build + variables: + skipComponentGovernanceDetection: true # handled by pre_build + jobs: + - template: template/publish_pypi.yml + parameters: + publishPyPI: ${{parameters.publishPyPI}} diff --git a/azure-pipelines/source_scan.yml b/azure-pipelines/source_scan.yml new file mode 100644 index 0000000..14dc842 --- /dev/null +++ b/azure-pipelines/source_scan.yml @@ -0,0 +1,11 @@ +trigger: + - main + +variables: + Codeql.Enabled: true + +stages: + - stage: pre_build + displayName: Pre-build validation + jobs: + - template: template/static_analysis.yml diff --git a/azure-pipelines/template/build_packages.yml b/azure-pipelines/template/build_packages.yml new file mode 100644 index 0000000..ca99144 --- /dev/null +++ b/azure-pipelines/template/build_packages.yml @@ -0,0 +1,31 @@ +jobs: + - job: BuildPkg + displayName: Build package + + pool: + vmImage: windows-latest + + steps: + - task: UsePythonVersion@0 + displayName: "Use Python 3.7" + inputs: + versionSpec: 3.7 + + - script: python -m pip install -U pip + displayName: Upgrade Pip + + # For faster/better builds of sdists. + - script: python -m pip install wheel + displayName: Install build pre-requisite + + - script: python -m pip install nox + displayName: Install nox + + - script: python -m nox --session build + displayName: Build sdist and wheels + + - task: PublishBuildArtifacts@1 + displayName: "Publish Artifact" + inputs: + pathToPublish: "$(Build.SourcesDirectory)/packages/python/dist" + artifactName: dist diff --git a/azure-pipelines/template/publish_pypi.yml b/azure-pipelines/template/publish_pypi.yml new file mode 100644 index 0000000..1f29e1b --- /dev/null +++ b/azure-pipelines/template/publish_pypi.yml @@ -0,0 +1,43 @@ +parameters: + - name: publishPyPI + displayName: 🚀 Publish To PyPI + type: string + +jobs: + - job: PublishPkg + displayName: Publish Packages + + pool: + vmImage: windows-latest + + steps: + - task: DownloadPipelineArtifact@2 + displayName: "Download Pipeline Artifact" + inputs: + artifactName: dist + targetPath: "$(Build.SourcesDirectory)/dist" + + - task: UsePythonVersion@0 + displayName: "Use Python 3.7" + inputs: + versionSpec: 3.7 + + - script: python -m pip install -U pip + displayName: Upgrade Pip + + - script: python -m pip install twine + displayName: Install Twine + + - ${{ if eq(parameters.publishPyPI, 'Test') }}: + - script: python -m twine upload -r testpypi dist/* + displayName: Publish to Test PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: $(test_pypi_token) + + - ${{ if eq(parameters.publishPyPI, 'Real') }}: + - script: python -m twine upload dist/* + displayName: Publish to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: $(real_pypi_token) diff --git a/azure-pipelines/template/static_analysis.yml b/azure-pipelines/template/static_analysis.yml new file mode 100644 index 0000000..ffd0f44 --- /dev/null +++ b/azure-pipelines/template/static_analysis.yml @@ -0,0 +1,72 @@ +jobs: + - job: SourceScan + displayName: Source Scan + + pool: + vmImage: windows-latest + + steps: + - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3 + displayName: 'Run Credential Scanner' + inputs: + outputFormat: pre + debugMode: false + continueOnError: true + + - task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@2 + displayName: 'Run PoliCheck' + inputs: + targetType: F + continueOnError: true + + - task: securedevelopmentteam.vss-secure-development-tools.build-task-antimalware.AntiMalware@4 + displayName: 'Run AntiMalware' + inputs: + FileDirPath: '$(Build.SourcesDirectory)' + EnableServices: true + continueOnError: true + + - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 + displayName: Component Detection + inputs: + ignoreDirectories: '$(Build.SourcesDirectory)/tests' + continueOnError: true + + - task: securedevelopmentteam.vss-secure-development-tools.build-task-report.SdtReport@2 + displayName: Create Security Analysis Report + inputs: + AllTools: false + AntiMalware: true + BinSkim: false + CredScan: true + PoliCheck: true + APIScan: false + CodesignValidation: false + FortifySCA: false + FxCop: false + ModernCop: false + MSRD: false + RoslynAnalyzers: false + SDLNativeRules: false + Semmle: false + TSLint: false + WebScout: false + continueOnError: true + + - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@3 + displayName: Publish Security Analysis Logs + + - job: VersionChk + displayName: Version Check + + pool: + vmImage: ubuntu-latest + + steps: + - task: UsePythonVersion@0 + displayName: 'Use Python 3.11' + inputs: + versionSpec: 3.11 + + - script: python ./.github/workflows/version_check.py + displayName: Version Check diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..fada2fb --- /dev/null +++ b/conftest.py @@ -0,0 +1,13 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import os +import pathlib +import sys + +import pytest + +sys.path.append(os.fspath(pathlib.Path(__file__).parent / "packages" / "python")) +sys.path.append( + os.fspath(pathlib.Path(__file__).parent / "tests" / "python" / "common") +) diff --git a/generator/__init__.py b/generator/__init__.py new file mode 100644 index 0000000..5b7f7a9 --- /dev/null +++ b/generator/__init__.py @@ -0,0 +1,2 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. diff --git a/generator/__main__.py b/generator/__main__.py new file mode 100644 index 0000000..2ebc7d3 --- /dev/null +++ b/generator/__main__.py @@ -0,0 +1,101 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + + +import argparse +import importlib +import json +import logging +import os +import pathlib +import sys +from typing import Sequence + +import importlib_resources as ir +import jsonschema + +from . import model + +PACKAGES_ROOT = pathlib.Path(__file__).parent.parent / "packages" +LOGGER = logging.getLogger("generator") + + +def setup_logging() -> None: + logging.basicConfig( + stream=sys.stdout, + level=logging.DEBUG, + format="[%(levelname)s][%(asctime)s] %(name)s: %(message)s", + datefmt="%Y-%m-%d %H:%M:%S", + ) + + +def get_parser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser(description="Generate types from LSP JSON model.") + parser.add_argument( + "--model", + "-m", + help="Path to a model JSON file. By default uses packaged model file.", + type=str, + nargs="*", + ) + parser.add_argument( + "--plugin", + "-p", + help="Name of a builtin plugin module. By default uses all plugins.", + type=str, + required=True, + ) + parser.add_argument( + "--output-dir", + "-o", + help="Path to a directory where the generated content is written.", + type=str, + ) + return parser + + +def main(argv: Sequence[str]) -> None: + parser = get_parser() + args = parser.parse_args(argv) + + # Validate against LSP model JSON schema. + schema_file = ir.files("generator") / "lsp.schema.json" + + LOGGER.info("Using schema file %s", os.fspath(schema_file)) + schema = json.load(schema_file.open("rb")) + + if args.model: + model_files = [pathlib.Path(m) for m in args.model] + else: + model_files = [ir.files("generator") / "lsp.json"] + + json_models = [] + for model_file in model_files: + LOGGER.info("Validating model file %s", os.fspath(model_file)) + json_model = json.load(model_file.open("rb")) + jsonschema.validate(json_model, schema) + json_models.append(json_model) + + plugin = args.plugin + LOGGER.info(f"Running plugin {plugin}.") + + output_dir = args.output_dir or os.fspath(PACKAGES_ROOT / plugin) + LOGGER.info(f"Writing output to {output_dir}") + + # load model and generate types for each plugin to avoid + # any conflicts between plugins. + spec: model.LSPModel = model.create_lsp_model(json_models) + + try: + LOGGER.info(f"Loading plugin: {plugin}.") + plugin_module = importlib.import_module(f"generator.plugins.{plugin}") + LOGGER.info(f"Running plugin: {plugin}.") + plugin_module.generate(spec, output_dir) + LOGGER.info(f"Plugin {plugin} completed.") + except Exception as e: + LOGGER.error(f"Error running plugin {plugin}:", exc_info=e) + + +if __name__ == "__main__": + setup_logging() + main(sys.argv[1:]) diff --git a/generator/lsp.json b/generator/lsp.json new file mode 100644 index 0000000..29f33f6 --- /dev/null +++ b/generator/lsp.json @@ -0,0 +1,14835 @@ +{ + "metaData": { + "version": "3.17.0" + }, + "requests": [ + { + "method": "textDocument/implementation", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Definition" + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "DefinitionLink" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "ImplementationParams" + }, + "partialResult": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "Location" + } + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "DefinitionLink" + } + } + ] + }, + "registrationOptions": { + "kind": "reference", + "name": "ImplementationRegistrationOptions" + }, + "documentation": "A request to resolve the implementation locations of a symbol at a given text\ndocument position. The request's parameter is of type {@link TextDocumentPositionParams}\nthe response is of type {@link Definition} or a Thenable that resolves to such." + }, + { + "method": "textDocument/typeDefinition", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Definition" + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "DefinitionLink" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "TypeDefinitionParams" + }, + "partialResult": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "Location" + } + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "DefinitionLink" + } + } + ] + }, + "registrationOptions": { + "kind": "reference", + "name": "TypeDefinitionRegistrationOptions" + }, + "documentation": "A request to resolve the type definition locations of a symbol at a given text\ndocument position. The request's parameter is of type {@link TextDocumentPositionParams}\nthe response is of type {@link Definition} or a Thenable that resolves to such." + }, + { + "method": "workspace/workspaceFolders", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "WorkspaceFolder" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "serverToClient", + "documentation": "The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders." + }, + { + "method": "workspace/configuration", + "result": { + "kind": "array", + "element": { + "kind": "reference", + "name": "LSPAny" + } + }, + "messageDirection": "serverToClient", + "params": { + "kind": "reference", + "name": "ConfigurationParams" + }, + "documentation": "The 'workspace/configuration' request is sent from the server to the client to fetch a certain\nconfiguration setting.\n\nThis pull model replaces the old push model were the client signaled configuration change via an\nevent. If the server still needs to react to configuration changes (since the server caches the\nresult of `workspace/configuration` requests) the server should register for an empty configuration\nchange event and empty the cache if such an event is received." + }, + { + "method": "textDocument/documentColor", + "result": { + "kind": "array", + "element": { + "kind": "reference", + "name": "ColorInformation" + } + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DocumentColorParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "ColorInformation" + } + }, + "registrationOptions": { + "kind": "reference", + "name": "DocumentColorRegistrationOptions" + }, + "documentation": "A request to list all color symbols found in a given text document. The request's\nparameter is of type {@link DocumentColorParams} the\nresponse is of type {@link ColorInformation ColorInformation[]} or a Thenable\nthat resolves to such." + }, + { + "method": "textDocument/colorPresentation", + "result": { + "kind": "array", + "element": { + "kind": "reference", + "name": "ColorPresentation" + } + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "ColorPresentationParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "ColorPresentation" + } + }, + "registrationOptions": { + "kind": "and", + "items": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + }, + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + } + ] + }, + "documentation": "A request to list all presentation for a color. The request's\nparameter is of type {@link ColorPresentationParams} the\nresponse is of type {@link ColorInformation ColorInformation[]} or a Thenable\nthat resolves to such." + }, + { + "method": "textDocument/foldingRange", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "FoldingRange" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "FoldingRangeParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "FoldingRange" + } + }, + "registrationOptions": { + "kind": "reference", + "name": "FoldingRangeRegistrationOptions" + }, + "documentation": "A request to provide folding ranges in a document. The request's\nparameter is of type {@link FoldingRangeParams}, the\nresponse is of type {@link FoldingRangeList} or a Thenable\nthat resolves to such." + }, + { + "method": "workspace/foldingRange/refresh", + "result": { + "kind": "base", + "name": "null" + }, + "messageDirection": "serverToClient", + "documentation": "@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "method": "textDocument/declaration", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Declaration" + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "DeclarationLink" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DeclarationParams" + }, + "partialResult": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "Location" + } + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "DeclarationLink" + } + } + ] + }, + "registrationOptions": { + "kind": "reference", + "name": "DeclarationRegistrationOptions" + }, + "documentation": "A request to resolve the type definition locations of a symbol at a given text\ndocument position. The request's parameter is of type {@link TextDocumentPositionParams}\nthe response is of type {@link Declaration} or a typed array of {@link DeclarationLink}\nor a Thenable that resolves to such." + }, + { + "method": "textDocument/selectionRange", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "SelectionRange" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "SelectionRangeParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "SelectionRange" + } + }, + "registrationOptions": { + "kind": "reference", + "name": "SelectionRangeRegistrationOptions" + }, + "documentation": "A request to provide selection ranges in a document. The request's\nparameter is of type {@link SelectionRangeParams}, the\nresponse is of type {@link SelectionRange SelectionRange[]} or a Thenable\nthat resolves to such." + }, + { + "method": "window/workDoneProgress/create", + "result": { + "kind": "base", + "name": "null" + }, + "messageDirection": "serverToClient", + "params": { + "kind": "reference", + "name": "WorkDoneProgressCreateParams" + }, + "documentation": "The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress\nreporting from the server." + }, + { + "method": "textDocument/prepareCallHierarchy", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "CallHierarchyItem" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "CallHierarchyPrepareParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "CallHierarchyRegistrationOptions" + }, + "documentation": "A request to result a `CallHierarchyItem` in a document at a given position.\nCan be used as an input to an incoming or outgoing call hierarchy.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "callHierarchy/incomingCalls", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "CallHierarchyIncomingCall" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "CallHierarchyIncomingCallsParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CallHierarchyIncomingCall" + } + }, + "documentation": "A request to resolve the incoming calls for a given `CallHierarchyItem`.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "callHierarchy/outgoingCalls", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "CallHierarchyOutgoingCall" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "CallHierarchyOutgoingCallsParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CallHierarchyOutgoingCall" + } + }, + "documentation": "A request to resolve the outgoing calls for a given `CallHierarchyItem`.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "textDocument/semanticTokens/full", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "SemanticTokens" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "SemanticTokensParams" + }, + "partialResult": { + "kind": "reference", + "name": "SemanticTokensPartialResult" + }, + "registrationMethod": "textDocument/semanticTokens", + "registrationOptions": { + "kind": "reference", + "name": "SemanticTokensRegistrationOptions" + }, + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "textDocument/semanticTokens/full/delta", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "SemanticTokens" + }, + { + "kind": "reference", + "name": "SemanticTokensDelta" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "SemanticTokensDeltaParams" + }, + "partialResult": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "SemanticTokensPartialResult" + }, + { + "kind": "reference", + "name": "SemanticTokensDeltaPartialResult" + } + ] + }, + "registrationMethod": "textDocument/semanticTokens", + "registrationOptions": { + "kind": "reference", + "name": "SemanticTokensRegistrationOptions" + }, + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "textDocument/semanticTokens/range", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "SemanticTokens" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "SemanticTokensRangeParams" + }, + "partialResult": { + "kind": "reference", + "name": "SemanticTokensPartialResult" + }, + "registrationMethod": "textDocument/semanticTokens", + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "workspace/semanticTokens/refresh", + "result": { + "kind": "base", + "name": "null" + }, + "messageDirection": "serverToClient", + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "window/showDocument", + "result": { + "kind": "reference", + "name": "ShowDocumentResult" + }, + "messageDirection": "serverToClient", + "params": { + "kind": "reference", + "name": "ShowDocumentParams" + }, + "documentation": "A request to show a document. This request might open an\nexternal program depending on the value of the URI to open.\nFor example a request to open `https://code.visualstudio.com/`\nwill very likely open the URI in a WEB browser.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "textDocument/linkedEditingRange", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "LinkedEditingRanges" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "LinkedEditingRangeParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "LinkedEditingRangeRegistrationOptions" + }, + "documentation": "A request to provide ranges that can be edited together.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "workspace/willCreateFiles", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "WorkspaceEdit" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "CreateFilesParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "FileOperationRegistrationOptions" + }, + "documentation": "The will create files request is sent from the client to the server before files are actually\ncreated as long as the creation is triggered from within the client.\n\nThe request can return a `WorkspaceEdit` which will be applied to workspace before the\nfiles are created. Hence the `WorkspaceEdit` can not manipulate the content of the file\nto be created.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "workspace/willRenameFiles", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "WorkspaceEdit" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "RenameFilesParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "FileOperationRegistrationOptions" + }, + "documentation": "The will rename files request is sent from the client to the server before files are actually\nrenamed as long as the rename is triggered from within the client.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "workspace/willDeleteFiles", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "WorkspaceEdit" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DeleteFilesParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "FileOperationRegistrationOptions" + }, + "documentation": "The did delete files notification is sent from the client to the server when\nfiles were deleted from within the client.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "textDocument/moniker", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "Moniker" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "MonikerParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Moniker" + } + }, + "registrationOptions": { + "kind": "reference", + "name": "MonikerRegistrationOptions" + }, + "documentation": "A request to get the moniker of a symbol at a given text document position.\nThe request parameter is of type {@link TextDocumentPositionParams}.\nThe response is of type {@link Moniker Moniker[]} or `null`." + }, + { + "method": "textDocument/prepareTypeHierarchy", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "TypeHierarchyItem" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "TypeHierarchyPrepareParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "TypeHierarchyRegistrationOptions" + }, + "documentation": "A request to result a `TypeHierarchyItem` in a document at a given position.\nCan be used as an input to a subtypes or supertypes type hierarchy.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "typeHierarchy/supertypes", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "TypeHierarchyItem" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "TypeHierarchySupertypesParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TypeHierarchyItem" + } + }, + "documentation": "A request to resolve the supertypes for a given `TypeHierarchyItem`.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "typeHierarchy/subtypes", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "TypeHierarchyItem" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "TypeHierarchySubtypesParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TypeHierarchyItem" + } + }, + "documentation": "A request to resolve the subtypes for a given `TypeHierarchyItem`.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "textDocument/inlineValue", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "InlineValue" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "InlineValueParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "InlineValue" + } + }, + "registrationOptions": { + "kind": "reference", + "name": "InlineValueRegistrationOptions" + }, + "documentation": "A request to provide inline values in a document. The request's parameter is of\ntype {@link InlineValueParams}, the response is of type\n{@link InlineValue InlineValue[]} or a Thenable that resolves to such.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "workspace/inlineValue/refresh", + "result": { + "kind": "base", + "name": "null" + }, + "messageDirection": "serverToClient", + "documentation": "@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "textDocument/inlayHint", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "InlayHint" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "InlayHintParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "InlayHint" + } + }, + "registrationOptions": { + "kind": "reference", + "name": "InlayHintRegistrationOptions" + }, + "documentation": "A request to provide inlay hints in a document. The request's parameter is of\ntype {@link InlayHintsParams}, the response is of type\n{@link InlayHint InlayHint[]} or a Thenable that resolves to such.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "inlayHint/resolve", + "result": { + "kind": "reference", + "name": "InlayHint" + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "InlayHint" + }, + "documentation": "A request to resolve additional properties for an inlay hint.\nThe request's parameter is of type {@link InlayHint}, the response is\nof type {@link InlayHint} or a Thenable that resolves to such.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "workspace/inlayHint/refresh", + "result": { + "kind": "base", + "name": "null" + }, + "messageDirection": "serverToClient", + "documentation": "@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "textDocument/diagnostic", + "result": { + "kind": "reference", + "name": "DocumentDiagnosticReport" + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DocumentDiagnosticParams" + }, + "partialResult": { + "kind": "reference", + "name": "DocumentDiagnosticReportPartialResult" + }, + "errorData": { + "kind": "reference", + "name": "DiagnosticServerCancellationData" + }, + "registrationOptions": { + "kind": "reference", + "name": "DiagnosticRegistrationOptions" + }, + "documentation": "The document diagnostic request definition.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "workspace/diagnostic", + "result": { + "kind": "reference", + "name": "WorkspaceDiagnosticReport" + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "WorkspaceDiagnosticParams" + }, + "partialResult": { + "kind": "reference", + "name": "WorkspaceDiagnosticReportPartialResult" + }, + "errorData": { + "kind": "reference", + "name": "DiagnosticServerCancellationData" + }, + "documentation": "The workspace diagnostic request definition.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "workspace/diagnostic/refresh", + "result": { + "kind": "base", + "name": "null" + }, + "messageDirection": "serverToClient", + "documentation": "The diagnostic refresh request definition.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "textDocument/inlineCompletion", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "InlineCompletionList" + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "InlineCompletionItem" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "InlineCompletionParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "InlineCompletionItem" + } + }, + "registrationOptions": { + "kind": "reference", + "name": "InlineCompletionRegistrationOptions" + }, + "documentation": "A request to provide inline completions in a document. The request's parameter is of\ntype {@link InlineCompletionParams}, the response is of type\n{@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "method": "client/registerCapability", + "result": { + "kind": "base", + "name": "null" + }, + "messageDirection": "serverToClient", + "params": { + "kind": "reference", + "name": "RegistrationParams" + }, + "documentation": "The `client/registerCapability` request is sent from the server to the client to register a new capability\nhandler on the client side." + }, + { + "method": "client/unregisterCapability", + "result": { + "kind": "base", + "name": "null" + }, + "messageDirection": "serverToClient", + "params": { + "kind": "reference", + "name": "UnregistrationParams" + }, + "documentation": "The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability\nhandler on the client side." + }, + { + "method": "initialize", + "result": { + "kind": "reference", + "name": "InitializeResult" + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "InitializeParams" + }, + "errorData": { + "kind": "reference", + "name": "InitializeError" + }, + "documentation": "The initialize request is sent from the client to the server.\nIt is sent once as the request after starting up the server.\nThe requests parameter is of type {@link InitializeParams}\nthe response if of type {@link InitializeResult} of a Thenable that\nresolves to such." + }, + { + "method": "shutdown", + "result": { + "kind": "base", + "name": "null" + }, + "messageDirection": "clientToServer", + "documentation": "A shutdown request is sent from the client to the server.\nIt is sent once when the client decides to shutdown the\nserver. The only notification that is sent after a shutdown request\nis the exit event." + }, + { + "method": "window/showMessageRequest", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "MessageActionItem" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "serverToClient", + "params": { + "kind": "reference", + "name": "ShowMessageRequestParams" + }, + "documentation": "The show message request is sent from the server to the client to show a message\nand a set of options actions to the user." + }, + { + "method": "textDocument/willSaveWaitUntil", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextEdit" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "WillSaveTextDocumentParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + "documentation": "A document will save request is sent from the client to the server before\nthe document is actually saved. The request can return an array of TextEdits\nwhich will be applied to the text document before it is saved. Please note that\nclients might drop results if computing the text edits took too long or if a\nserver constantly fails on this request. This is done to keep the save fast and\nreliable." + }, + { + "method": "textDocument/completion", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "CompletionItem" + } + }, + { + "kind": "reference", + "name": "CompletionList" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "CompletionParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CompletionItem" + } + }, + "registrationOptions": { + "kind": "reference", + "name": "CompletionRegistrationOptions" + }, + "documentation": "Request to request completion at a given text document position. The request's\nparameter is of type {@link TextDocumentPosition} the response\nis of type {@link CompletionItem CompletionItem[]} or {@link CompletionList}\nor a Thenable that resolves to such.\n\nThe request can delay the computation of the {@link CompletionItem.detail `detail`}\nand {@link CompletionItem.documentation `documentation`} properties to the `completionItem/resolve`\nrequest. However, properties that are needed for the initial sorting and filtering, like `sortText`,\n`filterText`, `insertText`, and `textEdit`, must not be changed during resolve." + }, + { + "method": "completionItem/resolve", + "result": { + "kind": "reference", + "name": "CompletionItem" + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "CompletionItem" + }, + "documentation": "Request to resolve additional information for a given completion item.The request's\nparameter is of type {@link CompletionItem} the response\nis of type {@link CompletionItem} or a Thenable that resolves to such." + }, + { + "method": "textDocument/hover", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Hover" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "HoverParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "HoverRegistrationOptions" + }, + "documentation": "Request to request hover information at a given text document position. The request's\nparameter is of type {@link TextDocumentPosition} the response is of\ntype {@link Hover} or a Thenable that resolves to such." + }, + { + "method": "textDocument/signatureHelp", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "SignatureHelp" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "SignatureHelpParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "SignatureHelpRegistrationOptions" + } + }, + { + "method": "textDocument/definition", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Definition" + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "DefinitionLink" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DefinitionParams" + }, + "partialResult": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "Location" + } + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "DefinitionLink" + } + } + ] + }, + "registrationOptions": { + "kind": "reference", + "name": "DefinitionRegistrationOptions" + }, + "documentation": "A request to resolve the definition location of a symbol at a given text\ndocument position. The request's parameter is of type {@link TextDocumentPosition}\nthe response is of either type {@link Definition} or a typed array of\n{@link DefinitionLink} or a Thenable that resolves to such." + }, + { + "method": "textDocument/references", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "Location" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "ReferenceParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Location" + } + }, + "registrationOptions": { + "kind": "reference", + "name": "ReferenceRegistrationOptions" + }, + "documentation": "A request to resolve project-wide references for the symbol denoted\nby the given text document position. The request's parameter is of\ntype {@link ReferenceParams} the response is of type\n{@link Location Location[]} or a Thenable that resolves to such." + }, + { + "method": "textDocument/documentHighlight", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "DocumentHighlight" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DocumentHighlightParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "DocumentHighlight" + } + }, + "registrationOptions": { + "kind": "reference", + "name": "DocumentHighlightRegistrationOptions" + }, + "documentation": "Request to resolve a {@link DocumentHighlight} for a given\ntext document position. The request's parameter is of type {@link TextDocumentPosition}\nthe request response is an array of type {@link DocumentHighlight}\nor a Thenable that resolves to such." + }, + { + "method": "textDocument/documentSymbol", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "SymbolInformation" + } + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "DocumentSymbol" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DocumentSymbolParams" + }, + "partialResult": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "SymbolInformation" + } + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "DocumentSymbol" + } + } + ] + }, + "registrationOptions": { + "kind": "reference", + "name": "DocumentSymbolRegistrationOptions" + }, + "documentation": "A request to list all symbols found in a given text document. The request's\nparameter is of type {@link TextDocumentIdentifier} the\nresponse is of type {@link SymbolInformation SymbolInformation[]} or a Thenable\nthat resolves to such." + }, + { + "method": "textDocument/codeAction", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Command" + }, + { + "kind": "reference", + "name": "CodeAction" + } + ] + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "CodeActionParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Command" + }, + { + "kind": "reference", + "name": "CodeAction" + } + ] + } + }, + "registrationOptions": { + "kind": "reference", + "name": "CodeActionRegistrationOptions" + }, + "documentation": "A request to provide commands for the given text document and range." + }, + { + "method": "codeAction/resolve", + "result": { + "kind": "reference", + "name": "CodeAction" + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "CodeAction" + }, + "documentation": "Request to resolve additional information for a given code action.The request's\nparameter is of type {@link CodeAction} the response\nis of type {@link CodeAction} or a Thenable that resolves to such." + }, + { + "method": "workspace/symbol", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "SymbolInformation" + } + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "WorkspaceSymbol" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "WorkspaceSymbolParams" + }, + "partialResult": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "SymbolInformation" + } + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "WorkspaceSymbol" + } + } + ] + }, + "registrationOptions": { + "kind": "reference", + "name": "WorkspaceSymbolRegistrationOptions" + }, + "documentation": "A request to list project-wide symbols matching the query string given\nby the {@link WorkspaceSymbolParams}. The response is\nof type {@link SymbolInformation SymbolInformation[]} or a Thenable that\nresolves to such.\n\n@since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients\n need to advertise support for WorkspaceSymbols via the client capability\n `workspace.symbol.resolveSupport`.\n", + "since": "3.17.0 - support for WorkspaceSymbol in the returned data. Clients\nneed to advertise support for WorkspaceSymbols via the client capability\n`workspace.symbol.resolveSupport`." + }, + { + "method": "workspaceSymbol/resolve", + "result": { + "kind": "reference", + "name": "WorkspaceSymbol" + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "WorkspaceSymbol" + }, + "documentation": "A request to resolve the range inside the workspace\nsymbol's location.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "textDocument/codeLens", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "CodeLens" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "CodeLensParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CodeLens" + } + }, + "registrationOptions": { + "kind": "reference", + "name": "CodeLensRegistrationOptions" + }, + "documentation": "A request to provide code lens for the given text document." + }, + { + "method": "codeLens/resolve", + "result": { + "kind": "reference", + "name": "CodeLens" + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "CodeLens" + }, + "documentation": "A request to resolve a command for a given code lens." + }, + { + "method": "workspace/codeLens/refresh", + "result": { + "kind": "base", + "name": "null" + }, + "messageDirection": "serverToClient", + "documentation": "A request to refresh all code actions\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "textDocument/documentLink", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "DocumentLink" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DocumentLinkParams" + }, + "partialResult": { + "kind": "array", + "element": { + "kind": "reference", + "name": "DocumentLink" + } + }, + "registrationOptions": { + "kind": "reference", + "name": "DocumentLinkRegistrationOptions" + }, + "documentation": "A request to provide document links" + }, + { + "method": "documentLink/resolve", + "result": { + "kind": "reference", + "name": "DocumentLink" + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DocumentLink" + }, + "documentation": "Request to resolve additional information for a given document link. The request's\nparameter is of type {@link DocumentLink} the response\nis of type {@link DocumentLink} or a Thenable that resolves to such." + }, + { + "method": "textDocument/formatting", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextEdit" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DocumentFormattingParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "DocumentFormattingRegistrationOptions" + }, + "documentation": "A request to format a whole document." + }, + { + "method": "textDocument/rangeFormatting", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextEdit" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DocumentRangeFormattingParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "DocumentRangeFormattingRegistrationOptions" + }, + "documentation": "A request to format a range in a document." + }, + { + "method": "textDocument/rangesFormatting", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextEdit" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DocumentRangesFormattingParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "DocumentRangeFormattingRegistrationOptions" + }, + "documentation": "A request to format ranges in a document.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "method": "textDocument/onTypeFormatting", + "result": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextEdit" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DocumentOnTypeFormattingParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "DocumentOnTypeFormattingRegistrationOptions" + }, + "documentation": "A request to format a document on type." + }, + { + "method": "textDocument/rename", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "WorkspaceEdit" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "RenameParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "RenameRegistrationOptions" + }, + "documentation": "A request to rename a symbol." + }, + { + "method": "textDocument/prepareRename", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "PrepareRenameResult" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "PrepareRenameParams" + }, + "documentation": "A request to test and perform the setup necessary for a rename.\n\n@since 3.16 - support for default behavior", + "since": "3.16 - support for default behavior" + }, + { + "method": "workspace/executeCommand", + "result": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "LSPAny" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "ExecuteCommandParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "ExecuteCommandRegistrationOptions" + }, + "documentation": "A request send from the client to the server to execute a command. The request might return\na workspace edit which the client will apply to the workspace." + }, + { + "method": "workspace/applyEdit", + "result": { + "kind": "reference", + "name": "ApplyWorkspaceEditResult" + }, + "messageDirection": "serverToClient", + "params": { + "kind": "reference", + "name": "ApplyWorkspaceEditParams" + }, + "documentation": "A request sent from the server to the client to modified certain resources." + } + ], + "notifications": [ + { + "method": "workspace/didChangeWorkspaceFolders", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DidChangeWorkspaceFoldersParams" + }, + "documentation": "The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace\nfolder configuration changes." + }, + { + "method": "window/workDoneProgress/cancel", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "WorkDoneProgressCancelParams" + }, + "documentation": "The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress\ninitiated on the server side." + }, + { + "method": "workspace/didCreateFiles", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "CreateFilesParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "FileOperationRegistrationOptions" + }, + "documentation": "The did create files notification is sent from the client to the server when\nfiles were created from within the client.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "workspace/didRenameFiles", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "RenameFilesParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "FileOperationRegistrationOptions" + }, + "documentation": "The did rename files notification is sent from the client to the server when\nfiles were renamed from within the client.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "workspace/didDeleteFiles", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DeleteFilesParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "FileOperationRegistrationOptions" + }, + "documentation": "The will delete files request is sent from the client to the server before files are actually\ndeleted as long as the deletion is triggered from within the client.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "method": "notebookDocument/didOpen", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DidOpenNotebookDocumentParams" + }, + "registrationMethod": "notebookDocument/sync", + "documentation": "A notification sent when a notebook opens.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "notebookDocument/didChange", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DidChangeNotebookDocumentParams" + }, + "registrationMethod": "notebookDocument/sync" + }, + { + "method": "notebookDocument/didSave", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DidSaveNotebookDocumentParams" + }, + "registrationMethod": "notebookDocument/sync", + "documentation": "A notification sent when a notebook document is saved.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "notebookDocument/didClose", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DidCloseNotebookDocumentParams" + }, + "registrationMethod": "notebookDocument/sync", + "documentation": "A notification sent when a notebook closes.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "method": "initialized", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "InitializedParams" + }, + "documentation": "The initialized notification is sent from the client to the\nserver after the client is fully initialized and the server\nis allowed to send requests from the server to the client." + }, + { + "method": "exit", + "messageDirection": "clientToServer", + "documentation": "The exit event is sent from the client to the server to\nask the server to exit its process." + }, + { + "method": "workspace/didChangeConfiguration", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DidChangeConfigurationParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "DidChangeConfigurationRegistrationOptions" + }, + "documentation": "The configuration change notification is sent from the client to the server\nwhen the client's configuration has changed. The notification contains\nthe changed configuration as defined by the language client." + }, + { + "method": "window/showMessage", + "messageDirection": "serverToClient", + "params": { + "kind": "reference", + "name": "ShowMessageParams" + }, + "documentation": "The show message notification is sent from a server to a client to ask\nthe client to display a particular message in the user interface." + }, + { + "method": "window/logMessage", + "messageDirection": "serverToClient", + "params": { + "kind": "reference", + "name": "LogMessageParams" + }, + "documentation": "The log message notification is sent from the server to the client to ask\nthe client to log a particular message." + }, + { + "method": "telemetry/event", + "messageDirection": "serverToClient", + "params": { + "kind": "reference", + "name": "LSPAny" + }, + "documentation": "The telemetry event notification is sent from the server to the client to ask\nthe client to log telemetry data." + }, + { + "method": "textDocument/didOpen", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DidOpenTextDocumentParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + "documentation": "The document open notification is sent from the client to the server to signal\nnewly opened text documents. The document's truth is now managed by the client\nand the server must not try to read the document's truth using the document's\nuri. Open in this sense means it is managed by the client. It doesn't necessarily\nmean that its content is presented in an editor. An open notification must not\nbe sent more than once without a corresponding close notification send before.\nThis means open and close notification must be balanced and the max open count\nis one." + }, + { + "method": "textDocument/didChange", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DidChangeTextDocumentParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "TextDocumentChangeRegistrationOptions" + }, + "documentation": "The document change notification is sent from the client to the server to signal\nchanges to a text document." + }, + { + "method": "textDocument/didClose", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DidCloseTextDocumentParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + "documentation": "The document close notification is sent from the client to the server when\nthe document got closed in the client. The document's truth now exists where\nthe document's uri points to (e.g. if the document's uri is a file uri the\ntruth now exists on disk). As with the open notification the close notification\nis about managing the document's content. Receiving a close notification\ndoesn't mean that the document was open in an editor before. A close\nnotification requires a previous open notification to be sent." + }, + { + "method": "textDocument/didSave", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DidSaveTextDocumentParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "TextDocumentSaveRegistrationOptions" + }, + "documentation": "The document save notification is sent from the client to the server when\nthe document got saved in the client." + }, + { + "method": "textDocument/willSave", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "WillSaveTextDocumentParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + "documentation": "A document will save notification is sent from the client to the server before\nthe document is actually saved." + }, + { + "method": "workspace/didChangeWatchedFiles", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "DidChangeWatchedFilesParams" + }, + "registrationOptions": { + "kind": "reference", + "name": "DidChangeWatchedFilesRegistrationOptions" + }, + "documentation": "The watched files notification is sent from the client to the server when\nthe client detects changes to file watched by the language client." + }, + { + "method": "textDocument/publishDiagnostics", + "messageDirection": "serverToClient", + "params": { + "kind": "reference", + "name": "PublishDiagnosticsParams" + }, + "documentation": "Diagnostics notification are sent from the server to the client to signal\nresults of validation runs." + }, + { + "method": "$/setTrace", + "messageDirection": "clientToServer", + "params": { + "kind": "reference", + "name": "SetTraceParams" + } + }, + { + "method": "$/logTrace", + "messageDirection": "serverToClient", + "params": { + "kind": "reference", + "name": "LogTraceParams" + } + }, + { + "method": "$/cancelRequest", + "messageDirection": "both", + "params": { + "kind": "reference", + "name": "CancelParams" + } + }, + { + "method": "$/progress", + "messageDirection": "both", + "params": { + "kind": "reference", + "name": "ProgressParams" + } + } + ], + "structures": [ + { + "name": "ImplementationParams", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ] + }, + { + "name": "Location", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + } + }, + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + } + } + ], + "documentation": "Represents a location inside a resource, such as a line\ninside a text file." + }, + { + "name": "ImplementationRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "ImplementationOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ] + }, + { + "name": "TypeDefinitionParams", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ] + }, + { + "name": "TypeDefinitionRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "TypeDefinitionOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ] + }, + { + "name": "WorkspaceFolder", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "URI" + }, + "documentation": "The associated URI for this workspace folder." + }, + { + "name": "name", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The name of the workspace folder. Used to refer to this\nworkspace folder in the user interface." + } + ], + "documentation": "A workspace folder inside a client." + }, + { + "name": "DidChangeWorkspaceFoldersParams", + "properties": [ + { + "name": "event", + "type": { + "kind": "reference", + "name": "WorkspaceFoldersChangeEvent" + }, + "documentation": "The actual workspace folder change event." + } + ], + "documentation": "The parameters of a `workspace/didChangeWorkspaceFolders` notification." + }, + { + "name": "ConfigurationParams", + "properties": [ + { + "name": "items", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "ConfigurationItem" + } + } + } + ], + "documentation": "The parameters of a configuration request." + }, + { + "name": "DocumentColorParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The text document." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "Parameters for a {@link DocumentColorRequest}." + }, + { + "name": "ColorInformation", + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range in the document where this color appears." + }, + { + "name": "color", + "type": { + "kind": "reference", + "name": "Color" + }, + "documentation": "The actual color value for this color range." + } + ], + "documentation": "Represents a color range from a document." + }, + { + "name": "DocumentColorRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "DocumentColorOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ] + }, + { + "name": "ColorPresentationParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The text document." + }, + { + "name": "color", + "type": { + "kind": "reference", + "name": "Color" + }, + "documentation": "The color to request presentations for." + }, + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range where the color would be inserted. Serves as a context." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "Parameters for a {@link ColorPresentationRequest}." + }, + { + "name": "ColorPresentation", + "properties": [ + { + "name": "label", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The label of this color presentation. It will be shown on the color\npicker header. By default this is also the text that is inserted when selecting\nthis color presentation." + }, + { + "name": "textEdit", + "type": { + "kind": "reference", + "name": "TextEdit" + }, + "optional": true, + "documentation": "An {@link TextEdit edit} which is applied to a document when selecting\nthis presentation for the color. When `falsy` the {@link ColorPresentation.label label}\nis used." + }, + { + "name": "additionalTextEdits", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextEdit" + } + }, + "optional": true, + "documentation": "An optional array of additional {@link TextEdit text edits} that are applied when\nselecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves." + } + ] + }, + { + "name": "WorkDoneProgressOptions", + "properties": [ + { + "name": "workDoneProgress", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true + } + ] + }, + { + "name": "TextDocumentRegistrationOptions", + "properties": [ + { + "name": "documentSelector", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "DocumentSelector" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "documentation": "A document selector to identify the scope of the registration. If set to null\nthe document selector provided on the client side will be used." + } + ], + "documentation": "General text document registration options." + }, + { + "name": "FoldingRangeParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The text document." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "Parameters for a {@link FoldingRangeRequest}." + }, + { + "name": "FoldingRange", + "properties": [ + { + "name": "startLine", + "type": { + "kind": "base", + "name": "uinteger" + }, + "documentation": "The zero-based start line of the range to fold. The folded area starts after the line's last character.\nTo be valid, the end must be zero or larger and smaller than the number of lines in the document." + }, + { + "name": "startCharacter", + "type": { + "kind": "base", + "name": "uinteger" + }, + "optional": true, + "documentation": "The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line." + }, + { + "name": "endLine", + "type": { + "kind": "base", + "name": "uinteger" + }, + "documentation": "The zero-based end line of the range to fold. The folded area ends with the line's last character.\nTo be valid, the end must be zero or larger and smaller than the number of lines in the document." + }, + { + "name": "endCharacter", + "type": { + "kind": "base", + "name": "uinteger" + }, + "optional": true, + "documentation": "The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line." + }, + { + "name": "kind", + "type": { + "kind": "reference", + "name": "FoldingRangeKind" + }, + "optional": true, + "documentation": "Describes the kind of the folding range such as `comment' or 'region'. The kind\nis used to categorize folding ranges and used by commands like 'Fold all comments'.\nSee {@link FoldingRangeKind} for an enumeration of standardized kinds." + }, + { + "name": "collapsedText", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The text that the client should show when the specified range is\ncollapsed. If not defined or not supported by the client, a default\nwill be chosen by the client.\n\n@since 3.17.0", + "since": "3.17.0" + } + ], + "documentation": "Represents a folding range. To be valid, start and end line must be bigger than zero and smaller\nthan the number of lines in the document. Clients are free to ignore invalid ranges." + }, + { + "name": "FoldingRangeRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "FoldingRangeOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ] + }, + { + "name": "DeclarationParams", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ] + }, + { + "name": "DeclarationRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "DeclarationOptions" + }, + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ] + }, + { + "name": "SelectionRangeParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The text document." + }, + { + "name": "positions", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Position" + } + }, + "documentation": "The positions inside the text document." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "A parameter literal used in selection range requests." + }, + { + "name": "SelectionRange", + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The {@link Range range} of this selection range." + }, + { + "name": "parent", + "type": { + "kind": "reference", + "name": "SelectionRange" + }, + "optional": true, + "documentation": "The parent selection range containing this range. Therefore `parent.range` must contain `this.range`." + } + ], + "documentation": "A selection range represents a part of a selection hierarchy. A selection range\nmay have a parent selection range that contains it." + }, + { + "name": "SelectionRangeRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "SelectionRangeOptions" + }, + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ] + }, + { + "name": "WorkDoneProgressCreateParams", + "properties": [ + { + "name": "token", + "type": { + "kind": "reference", + "name": "ProgressToken" + }, + "documentation": "The token to be used to report progress." + } + ] + }, + { + "name": "WorkDoneProgressCancelParams", + "properties": [ + { + "name": "token", + "type": { + "kind": "reference", + "name": "ProgressToken" + }, + "documentation": "The token to be used to report progress." + } + ] + }, + { + "name": "CallHierarchyPrepareParams", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "The parameter of a `textDocument/prepareCallHierarchy` request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "CallHierarchyItem", + "properties": [ + { + "name": "name", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The name of this item." + }, + { + "name": "kind", + "type": { + "kind": "reference", + "name": "SymbolKind" + }, + "documentation": "The kind of this item." + }, + { + "name": "tags", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "SymbolTag" + } + }, + "optional": true, + "documentation": "Tags for this item." + }, + { + "name": "detail", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "More detail for this item, e.g. the signature of a function." + }, + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The resource identifier of this item." + }, + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code." + }, + { + "name": "selectionRange", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.\nMust be contained by the {@link CallHierarchyItem.range `range`}." + }, + { + "name": "data", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "A data entry field that is preserved between a call hierarchy prepare and\nincoming calls or outgoing calls requests." + } + ], + "documentation": "Represents programming constructs like functions or constructors in the context\nof call hierarchy.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "CallHierarchyRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "CallHierarchyOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ], + "documentation": "Call hierarchy options used during static or dynamic registration.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "CallHierarchyIncomingCallsParams", + "properties": [ + { + "name": "item", + "type": { + "kind": "reference", + "name": "CallHierarchyItem" + } + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "The parameter of a `callHierarchy/incomingCalls` request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "CallHierarchyIncomingCall", + "properties": [ + { + "name": "from", + "type": { + "kind": "reference", + "name": "CallHierarchyItem" + }, + "documentation": "The item that makes the call." + }, + { + "name": "fromRanges", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Range" + } + }, + "documentation": "The ranges at which the calls appear. This is relative to the caller\ndenoted by {@link CallHierarchyIncomingCall.from `this.from`}." + } + ], + "documentation": "Represents an incoming call, e.g. a caller of a method or constructor.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "CallHierarchyOutgoingCallsParams", + "properties": [ + { + "name": "item", + "type": { + "kind": "reference", + "name": "CallHierarchyItem" + } + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "The parameter of a `callHierarchy/outgoingCalls` request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "CallHierarchyOutgoingCall", + "properties": [ + { + "name": "to", + "type": { + "kind": "reference", + "name": "CallHierarchyItem" + }, + "documentation": "The item that is called." + }, + { + "name": "fromRanges", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Range" + } + }, + "documentation": "The range at which this item is called. This is the range relative to the caller, e.g the item\npassed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls `provideCallHierarchyOutgoingCalls`}\nand not {@link CallHierarchyOutgoingCall.to `this.to`}." + } + ], + "documentation": "Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "SemanticTokensParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The text document." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "SemanticTokens", + "properties": [ + { + "name": "resultId", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "An optional result id. If provided and clients support delta updating\nthe client will include the result id in the next semantic token request.\nA server can then instead of computing all semantic tokens again simply\nsend a delta." + }, + { + "name": "data", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "uinteger" + } + }, + "documentation": "The actual tokens." + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "SemanticTokensPartialResult", + "properties": [ + { + "name": "data", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "uinteger" + } + } + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "SemanticTokensRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "SemanticTokensOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "SemanticTokensDeltaParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The text document." + }, + { + "name": "previousResultId", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The result id of a previous response. The result Id can either point to a full response\nor a delta response depending on what was received last." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "SemanticTokensDelta", + "properties": [ + { + "name": "resultId", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true + }, + { + "name": "edits", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "SemanticTokensEdit" + } + }, + "documentation": "The semantic token edits to transform a previous result into a new result." + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "SemanticTokensDeltaPartialResult", + "properties": [ + { + "name": "edits", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "SemanticTokensEdit" + } + } + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "SemanticTokensRangeParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The text document." + }, + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range the semantic tokens are requested for." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "ShowDocumentParams", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "URI" + }, + "documentation": "The uri to show." + }, + { + "name": "external", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Indicates to show the resource in an external program.\nTo show, for example, `https://code.visualstudio.com/`\nin the default WEB browser set `external` to `true`." + }, + { + "name": "takeFocus", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "An optional property to indicate whether the editor\nshowing the document should take focus or not.\nClients might ignore this property if an external\nprogram is started." + }, + { + "name": "selection", + "type": { + "kind": "reference", + "name": "Range" + }, + "optional": true, + "documentation": "An optional selection range if the document is a text\ndocument. Clients might ignore the property if an\nexternal program is started or the file is not a text\nfile." + } + ], + "documentation": "Params to show a resource in the UI.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "ShowDocumentResult", + "properties": [ + { + "name": "success", + "type": { + "kind": "base", + "name": "boolean" + }, + "documentation": "A boolean indicating if the show was successful." + } + ], + "documentation": "The result of a showDocument request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "LinkedEditingRangeParams", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ] + }, + { + "name": "LinkedEditingRanges", + "properties": [ + { + "name": "ranges", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Range" + } + }, + "documentation": "A list of ranges that can be edited together. The ranges must have\nidentical length and contain identical text content. The ranges cannot overlap." + }, + { + "name": "wordPattern", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "An optional word pattern (regular expression) that describes valid contents for\nthe given ranges. If no pattern is provided, the client configuration's word\npattern will be used." + } + ], + "documentation": "The result of a linked editing range request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "LinkedEditingRangeRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "LinkedEditingRangeOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ] + }, + { + "name": "CreateFilesParams", + "properties": [ + { + "name": "files", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "FileCreate" + } + }, + "documentation": "An array of all files/folders created in this operation." + } + ], + "documentation": "The parameters sent in notifications/requests for user-initiated creation of\nfiles.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "WorkspaceEdit", + "properties": [ + { + "name": "changes", + "type": { + "kind": "map", + "key": { + "kind": "base", + "name": "DocumentUri" + }, + "value": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextEdit" + } + } + }, + "optional": true, + "documentation": "Holds changes to existing resources." + }, + { + "name": "documentChanges", + "type": { + "kind": "array", + "element": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "TextDocumentEdit" + }, + { + "kind": "reference", + "name": "CreateFile" + }, + { + "kind": "reference", + "name": "RenameFile" + }, + { + "kind": "reference", + "name": "DeleteFile" + } + ] + } + }, + "optional": true, + "documentation": "Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes\nare either an array of `TextDocumentEdit`s to express changes to n different text documents\nwhere each text document edit addresses a specific version of a text document. Or it can contain\nabove `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.\n\nWhether a client supports versioned document edits is expressed via\n`workspace.workspaceEdit.documentChanges` client capability.\n\nIf a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then\nonly plain `TextEdit`s using the `changes` property are supported." + }, + { + "name": "changeAnnotations", + "type": { + "kind": "map", + "key": { + "kind": "reference", + "name": "ChangeAnnotationIdentifier" + }, + "value": { + "kind": "reference", + "name": "ChangeAnnotation" + } + }, + "optional": true, + "documentation": "A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and\ndelete file / folder operations.\n\nWhether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`.\n\n@since 3.16.0", + "since": "3.16.0" + } + ], + "documentation": "A workspace edit represents changes to many resources managed in the workspace. The edit\nshould either provide `changes` or `documentChanges`. If documentChanges are present\nthey are preferred over `changes` if the client can handle versioned document edits.\n\nSince version 3.13.0 a workspace edit can contain resource operations as well. If resource\noperations are present clients need to execute the operations in the order in which they\nare provided. So a workspace edit for example can consist of the following two changes:\n(1) a create file a.txt and (2) a text document edit which insert text into file a.txt.\n\nAn invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will\ncause failure of the operation. How the client recovers from the failure is described by\nthe client capability: `workspace.workspaceEdit.failureHandling`" + }, + { + "name": "FileOperationRegistrationOptions", + "properties": [ + { + "name": "filters", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "FileOperationFilter" + } + }, + "documentation": "The actual filters." + } + ], + "documentation": "The options to register for file operations.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "RenameFilesParams", + "properties": [ + { + "name": "files", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "FileRename" + } + }, + "documentation": "An array of all files/folders renamed in this operation. When a folder is renamed, only\nthe folder will be included, and not its children." + } + ], + "documentation": "The parameters sent in notifications/requests for user-initiated renames of\nfiles.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "DeleteFilesParams", + "properties": [ + { + "name": "files", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "FileDelete" + } + }, + "documentation": "An array of all files/folders deleted in this operation." + } + ], + "documentation": "The parameters sent in notifications/requests for user-initiated deletes of\nfiles.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "MonikerParams", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ] + }, + { + "name": "Moniker", + "properties": [ + { + "name": "scheme", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The scheme of the moniker. For example tsc or .Net" + }, + { + "name": "identifier", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The identifier of the moniker. The value is opaque in LSIF however\nschema owners are allowed to define the structure if they want." + }, + { + "name": "unique", + "type": { + "kind": "reference", + "name": "UniquenessLevel" + }, + "documentation": "The scope in which the moniker is unique" + }, + { + "name": "kind", + "type": { + "kind": "reference", + "name": "MonikerKind" + }, + "optional": true, + "documentation": "The moniker kind if known." + } + ], + "documentation": "Moniker definition to match LSIF 0.5 moniker definition.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "MonikerRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "MonikerOptions" + } + ] + }, + { + "name": "TypeHierarchyPrepareParams", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "The parameter of a `textDocument/prepareTypeHierarchy` request.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "TypeHierarchyItem", + "properties": [ + { + "name": "name", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The name of this item." + }, + { + "name": "kind", + "type": { + "kind": "reference", + "name": "SymbolKind" + }, + "documentation": "The kind of this item." + }, + { + "name": "tags", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "SymbolTag" + } + }, + "optional": true, + "documentation": "Tags for this item." + }, + { + "name": "detail", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "More detail for this item, e.g. the signature of a function." + }, + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The resource identifier of this item." + }, + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range enclosing this symbol not including leading/trailing whitespace\nbut everything else, e.g. comments and code." + }, + { + "name": "selectionRange", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range that should be selected and revealed when this symbol is being\npicked, e.g. the name of a function. Must be contained by the\n{@link TypeHierarchyItem.range `range`}." + }, + { + "name": "data", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "A data entry field that is preserved between a type hierarchy prepare and\nsupertypes or subtypes requests. It could also be used to identify the\ntype hierarchy in the server, helping improve the performance on\nresolving supertypes and subtypes." + } + ], + "documentation": "@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "TypeHierarchyRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "TypeHierarchyOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ], + "documentation": "Type hierarchy options used during static or dynamic registration.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "TypeHierarchySupertypesParams", + "properties": [ + { + "name": "item", + "type": { + "kind": "reference", + "name": "TypeHierarchyItem" + } + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "The parameter of a `typeHierarchy/supertypes` request.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "TypeHierarchySubtypesParams", + "properties": [ + { + "name": "item", + "type": { + "kind": "reference", + "name": "TypeHierarchyItem" + } + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "The parameter of a `typeHierarchy/subtypes` request.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlineValueParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The text document." + }, + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The document range for which inline values should be computed." + }, + { + "name": "context", + "type": { + "kind": "reference", + "name": "InlineValueContext" + }, + "documentation": "Additional information about the context in which inline values were\nrequested." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "A parameter literal used in inline value requests.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlineValueRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "InlineValueOptions" + }, + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ], + "documentation": "Inline value options used during static or dynamic registration.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlayHintParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The text document." + }, + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The document range for which inlay hints should be computed." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "A parameter literal used in inlay hint requests.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlayHint", + "properties": [ + { + "name": "position", + "type": { + "kind": "reference", + "name": "Position" + }, + "documentation": "The position of this hint." + }, + { + "name": "label", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "InlayHintLabelPart" + } + } + ] + }, + "documentation": "The label of this hint. A human readable string or an array of\nInlayHintLabelPart label parts.\n\n*Note* that neither the string nor the label part can be empty." + }, + { + "name": "kind", + "type": { + "kind": "reference", + "name": "InlayHintKind" + }, + "optional": true, + "documentation": "The kind of this hint. Can be omitted in which case the client\nshould fall back to a reasonable default." + }, + { + "name": "textEdits", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextEdit" + } + }, + "optional": true, + "documentation": "Optional text edits that are performed when accepting this inlay hint.\n\n*Note* that edits are expected to change the document so that the inlay\nhint (or its nearest variant) is now part of the document and the inlay\nhint itself is now obsolete." + }, + { + "name": "tooltip", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "reference", + "name": "MarkupContent" + } + ] + }, + "optional": true, + "documentation": "The tooltip text when you hover over this item." + }, + { + "name": "paddingLeft", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Render padding before the hint.\n\nNote: Padding should use the editor's background color, not the\nbackground color of the hint itself. That means padding can be used\nto visually align/separate an inlay hint." + }, + { + "name": "paddingRight", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Render padding after the hint.\n\nNote: Padding should use the editor's background color, not the\nbackground color of the hint itself. That means padding can be used\nto visually align/separate an inlay hint." + }, + { + "name": "data", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "A data entry field that is preserved on an inlay hint between\na `textDocument/inlayHint` and a `inlayHint/resolve` request." + } + ], + "documentation": "Inlay hint information.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlayHintRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "InlayHintOptions" + }, + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ], + "documentation": "Inlay hint options used during static or dynamic registration.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "DocumentDiagnosticParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The text document." + }, + { + "name": "identifier", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The additional identifier provided during registration." + }, + { + "name": "previousResultId", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The result id of a previous response if provided." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "Parameters of the document diagnostic request.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "DocumentDiagnosticReportPartialResult", + "properties": [ + { + "name": "relatedDocuments", + "type": { + "kind": "map", + "key": { + "kind": "base", + "name": "DocumentUri" + }, + "value": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "FullDocumentDiagnosticReport" + }, + { + "kind": "reference", + "name": "UnchangedDocumentDiagnosticReport" + } + ] + } + } + } + ], + "documentation": "A partial result for a document diagnostic report.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "DiagnosticServerCancellationData", + "properties": [ + { + "name": "retriggerRequest", + "type": { + "kind": "base", + "name": "boolean" + } + } + ], + "documentation": "Cancellation data returned from a diagnostic request.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "DiagnosticRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "DiagnosticOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ], + "documentation": "Diagnostic registration options.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "WorkspaceDiagnosticParams", + "properties": [ + { + "name": "identifier", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The additional identifier provided during registration." + }, + { + "name": "previousResultIds", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "PreviousResultId" + } + }, + "documentation": "The currently known diagnostic reports with their\nprevious result ids." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "Parameters of the workspace diagnostic request.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "WorkspaceDiagnosticReport", + "properties": [ + { + "name": "items", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "WorkspaceDocumentDiagnosticReport" + } + } + } + ], + "documentation": "A workspace diagnostic report.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "WorkspaceDiagnosticReportPartialResult", + "properties": [ + { + "name": "items", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "WorkspaceDocumentDiagnosticReport" + } + } + } + ], + "documentation": "A partial result for a workspace diagnostic report.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "DidOpenNotebookDocumentParams", + "properties": [ + { + "name": "notebookDocument", + "type": { + "kind": "reference", + "name": "NotebookDocument" + }, + "documentation": "The notebook document that got opened." + }, + { + "name": "cellTextDocuments", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextDocumentItem" + } + }, + "documentation": "The text documents that represent the content\nof a notebook cell." + } + ], + "documentation": "The params sent in an open notebook document notification.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "DidChangeNotebookDocumentParams", + "properties": [ + { + "name": "notebookDocument", + "type": { + "kind": "reference", + "name": "VersionedNotebookDocumentIdentifier" + }, + "documentation": "The notebook document that did change. The version number points\nto the version after all provided changes have been applied. If\nonly the text document content of a cell changes the notebook version\ndoesn't necessarily have to change." + }, + { + "name": "change", + "type": { + "kind": "reference", + "name": "NotebookDocumentChangeEvent" + }, + "documentation": "The actual changes to the notebook document.\n\nThe changes describe single state changes to the notebook document.\nSo if there are two changes c1 (at array index 0) and c2 (at array\nindex 1) for a notebook in state S then c1 moves the notebook from\nS to S' and c2 from S' to S''. So c1 is computed on the state S and\nc2 is computed on the state S'.\n\nTo mirror the content of a notebook using change events use the following approach:\n- start with the same initial content\n- apply the 'notebookDocument/didChange' notifications in the order you receive them.\n- apply the `NotebookChangeEvent`s in a single notification in the order\n you receive them." + } + ], + "documentation": "The params sent in a change notebook document notification.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "DidSaveNotebookDocumentParams", + "properties": [ + { + "name": "notebookDocument", + "type": { + "kind": "reference", + "name": "NotebookDocumentIdentifier" + }, + "documentation": "The notebook document that got saved." + } + ], + "documentation": "The params sent in a save notebook document notification.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "DidCloseNotebookDocumentParams", + "properties": [ + { + "name": "notebookDocument", + "type": { + "kind": "reference", + "name": "NotebookDocumentIdentifier" + }, + "documentation": "The notebook document that got closed." + }, + { + "name": "cellTextDocuments", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextDocumentIdentifier" + } + }, + "documentation": "The text documents that represent the content\nof a notebook cell that got closed." + } + ], + "documentation": "The params sent in a close notebook document notification.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlineCompletionParams", + "properties": [ + { + "name": "context", + "type": { + "kind": "reference", + "name": "InlineCompletionContext" + }, + "documentation": "Additional information about the context in which inline completions were\nrequested." + } + ], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "A parameter literal used in inline completion requests.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "InlineCompletionList", + "properties": [ + { + "name": "items", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "InlineCompletionItem" + } + }, + "documentation": "The inline completion items" + } + ], + "documentation": "Represents a collection of {@link InlineCompletionItem inline completion items} to be presented in the editor.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "InlineCompletionItem", + "properties": [ + { + "name": "insertText", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "reference", + "name": "StringValue" + } + ] + }, + "documentation": "The text to replace the range with. Must be set." + }, + { + "name": "filterText", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A text that is used to decide if this inline completion should be shown. When `falsy` the {@link InlineCompletionItem.insertText} is used." + }, + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "optional": true, + "documentation": "The range to replace. Must begin and end on the same line." + }, + { + "name": "command", + "type": { + "kind": "reference", + "name": "Command" + }, + "optional": true, + "documentation": "An optional {@link Command} that is executed *after* inserting this completion." + } + ], + "documentation": "An inline completion item represents a text snippet that is proposed inline to complete text that is being typed.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "InlineCompletionRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "InlineCompletionOptions" + }, + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ], + "documentation": "Inline completion options used during static or dynamic registration.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "RegistrationParams", + "properties": [ + { + "name": "registrations", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Registration" + } + } + } + ] + }, + { + "name": "UnregistrationParams", + "properties": [ + { + "name": "unregisterations", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Unregistration" + } + } + } + ] + }, + { + "name": "InitializeParams", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "_InitializeParams" + }, + { + "kind": "reference", + "name": "WorkspaceFoldersInitializeParams" + } + ] + }, + { + "name": "InitializeResult", + "properties": [ + { + "name": "capabilities", + "type": { + "kind": "reference", + "name": "ServerCapabilities" + }, + "documentation": "The capabilities the language server provides." + }, + { + "name": "serverInfo", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "name", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The name of the server as defined by the server." + }, + { + "name": "version", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The server's version as defined by the server." + } + ] + } + }, + "optional": true, + "documentation": "Information about the server.\n\n@since 3.15.0", + "since": "3.15.0" + } + ], + "documentation": "The result returned from an initialize request." + }, + { + "name": "InitializeError", + "properties": [ + { + "name": "retry", + "type": { + "kind": "base", + "name": "boolean" + }, + "documentation": "Indicates whether the client execute the following retry logic:\n(1) show the message provided by the ResponseError to the user\n(2) user selects retry or cancel\n(3) if user selected retry the initialize method is sent again." + } + ], + "documentation": "The data type of the ResponseError if the\ninitialize request fails." + }, + { + "name": "InitializedParams", + "properties": [] + }, + { + "name": "DidChangeConfigurationParams", + "properties": [ + { + "name": "settings", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "documentation": "The actual changed settings" + } + ], + "documentation": "The parameters of a change configuration notification." + }, + { + "name": "DidChangeConfigurationRegistrationOptions", + "properties": [ + { + "name": "section", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + } + ] + }, + "optional": true + } + ] + }, + { + "name": "ShowMessageParams", + "properties": [ + { + "name": "type", + "type": { + "kind": "reference", + "name": "MessageType" + }, + "documentation": "The message type. See {@link MessageType}" + }, + { + "name": "message", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The actual message." + } + ], + "documentation": "The parameters of a notification message." + }, + { + "name": "ShowMessageRequestParams", + "properties": [ + { + "name": "type", + "type": { + "kind": "reference", + "name": "MessageType" + }, + "documentation": "The message type. See {@link MessageType}" + }, + { + "name": "message", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The actual message." + }, + { + "name": "actions", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "MessageActionItem" + } + }, + "optional": true, + "documentation": "The message action items to present." + } + ] + }, + { + "name": "MessageActionItem", + "properties": [ + { + "name": "title", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A short title like 'Retry', 'Open Log' etc." + } + ] + }, + { + "name": "LogMessageParams", + "properties": [ + { + "name": "type", + "type": { + "kind": "reference", + "name": "MessageType" + }, + "documentation": "The message type. See {@link MessageType}" + }, + { + "name": "message", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The actual message." + } + ], + "documentation": "The log message parameters." + }, + { + "name": "DidOpenTextDocumentParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentItem" + }, + "documentation": "The document that was opened." + } + ], + "documentation": "The parameters sent in an open text document notification" + }, + { + "name": "DidChangeTextDocumentParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "VersionedTextDocumentIdentifier" + }, + "documentation": "The document that did change. The version number points\nto the version after all provided content changes have\nbeen applied." + }, + { + "name": "contentChanges", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextDocumentContentChangeEvent" + } + }, + "documentation": "The actual content changes. The content changes describe single state changes\nto the document. So if there are two content changes c1 (at array index 0) and\nc2 (at array index 1) for a document in state S then c1 moves the document from\nS to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed\non the state S'.\n\nTo mirror the content of a document using change events use the following approach:\n- start with the same initial content\n- apply the 'textDocument/didChange' notifications in the order you receive them.\n- apply the `TextDocumentContentChangeEvent`s in a single notification in the order\n you receive them." + } + ], + "documentation": "The change text document notification's parameters." + }, + { + "name": "TextDocumentChangeRegistrationOptions", + "properties": [ + { + "name": "syncKind", + "type": { + "kind": "reference", + "name": "TextDocumentSyncKind" + }, + "documentation": "How documents are synced to the server." + } + ], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + } + ], + "documentation": "Describe options to be used when registered for text document change events." + }, + { + "name": "DidCloseTextDocumentParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The document that was closed." + } + ], + "documentation": "The parameters sent in a close text document notification" + }, + { + "name": "DidSaveTextDocumentParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The document that was saved." + }, + { + "name": "text", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "Optional the content when saved. Depends on the includeText value\nwhen the save notification was requested." + } + ], + "documentation": "The parameters sent in a save text document notification" + }, + { + "name": "TextDocumentSaveRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "SaveOptions" + } + ], + "documentation": "Save registration options." + }, + { + "name": "WillSaveTextDocumentParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The document that will be saved." + }, + { + "name": "reason", + "type": { + "kind": "reference", + "name": "TextDocumentSaveReason" + }, + "documentation": "The 'TextDocumentSaveReason'." + } + ], + "documentation": "The parameters sent in a will save text document notification." + }, + { + "name": "TextEdit", + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range of the text document to be manipulated. To insert\ntext into a document create a range where start === end." + }, + { + "name": "newText", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The string to be inserted. For delete operations use an\nempty string." + } + ], + "documentation": "A text edit applicable to a text document." + }, + { + "name": "DidChangeWatchedFilesParams", + "properties": [ + { + "name": "changes", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "FileEvent" + } + }, + "documentation": "The actual file events." + } + ], + "documentation": "The watched files change notification's parameters." + }, + { + "name": "DidChangeWatchedFilesRegistrationOptions", + "properties": [ + { + "name": "watchers", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "FileSystemWatcher" + } + }, + "documentation": "The watchers to register." + } + ], + "documentation": "Describe options to be used when registered for text document change events." + }, + { + "name": "PublishDiagnosticsParams", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The URI for which diagnostic information is reported." + }, + { + "name": "version", + "type": { + "kind": "base", + "name": "integer" + }, + "optional": true, + "documentation": "Optional the version number of the document the diagnostics are published for.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "diagnostics", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Diagnostic" + } + }, + "documentation": "An array of diagnostic information items." + } + ], + "documentation": "The publish diagnostic notification's parameters." + }, + { + "name": "CompletionParams", + "properties": [ + { + "name": "context", + "type": { + "kind": "reference", + "name": "CompletionContext" + }, + "optional": true, + "documentation": "The completion context. This is only available it the client specifies\nto send this using the client capability `textDocument.completion.contextSupport === true`" + } + ], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "Completion parameters" + }, + { + "name": "CompletionItem", + "properties": [ + { + "name": "label", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The label of this completion item.\n\nThe label property is also by default the text that\nis inserted when selecting this completion.\n\nIf label details are provided the label itself should\nbe an unqualified name of the completion item." + }, + { + "name": "labelDetails", + "type": { + "kind": "reference", + "name": "CompletionItemLabelDetails" + }, + "optional": true, + "documentation": "Additional details for the label\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "kind", + "type": { + "kind": "reference", + "name": "CompletionItemKind" + }, + "optional": true, + "documentation": "The kind of this completion item. Based of the kind\nan icon is chosen by the editor." + }, + { + "name": "tags", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CompletionItemTag" + } + }, + "optional": true, + "documentation": "Tags for this completion item.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "detail", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A human-readable string with additional information\nabout this item, like type or symbol information." + }, + { + "name": "documentation", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "reference", + "name": "MarkupContent" + } + ] + }, + "optional": true, + "documentation": "A human-readable string that represents a doc-comment." + }, + { + "name": "deprecated", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Indicates if this item is deprecated.\n@deprecated Use `tags` instead.", + "deprecated": "Use `tags` instead." + }, + { + "name": "preselect", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Select this item when showing.\n\n*Note* that only one completion item can be selected and that the\ntool / client decides which item that is. The rule is that the *first*\nitem of those that match best is selected." + }, + { + "name": "sortText", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A string that should be used when comparing this item\nwith other items. When `falsy` the {@link CompletionItem.label label}\nis used." + }, + { + "name": "filterText", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A string that should be used when filtering a set of\ncompletion items. When `falsy` the {@link CompletionItem.label label}\nis used." + }, + { + "name": "insertText", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A string that should be inserted into a document when selecting\nthis completion. When `falsy` the {@link CompletionItem.label label}\nis used.\n\nThe `insertText` is subject to interpretation by the client side.\nSome tools might not take the string literally. For example\nVS Code when code complete is requested in this example\n`con<cursor position>` and a completion item with an `insertText` of\n`console` is provided it will only insert `sole`. Therefore it is\nrecommended to use `textEdit` instead since it avoids additional client\nside interpretation." + }, + { + "name": "insertTextFormat", + "type": { + "kind": "reference", + "name": "InsertTextFormat" + }, + "optional": true, + "documentation": "The format of the insert text. The format applies to both the\n`insertText` property and the `newText` property of a provided\n`textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.\n\nPlease note that the insertTextFormat doesn't apply to\n`additionalTextEdits`." + }, + { + "name": "insertTextMode", + "type": { + "kind": "reference", + "name": "InsertTextMode" + }, + "optional": true, + "documentation": "How whitespace and indentation is handled during completion\nitem insertion. If not provided the clients default value depends on\nthe `textDocument.completion.insertTextMode` client capability.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "textEdit", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "TextEdit" + }, + { + "kind": "reference", + "name": "InsertReplaceEdit" + } + ] + }, + "optional": true, + "documentation": "An {@link TextEdit edit} which is applied to a document when selecting\nthis completion. When an edit is provided the value of\n{@link CompletionItem.insertText insertText} is ignored.\n\nMost editors support two different operations when accepting a completion\nitem. One is to insert a completion text and the other is to replace an\nexisting text with a completion text. Since this can usually not be\npredetermined by a server it can report both ranges. Clients need to\nsignal support for `InsertReplaceEdits` via the\n`textDocument.completion.insertReplaceSupport` client capability\nproperty.\n\n*Note 1:* The text edit's range as well as both ranges from an insert\nreplace edit must be a [single line] and they must contain the position\nat which completion has been requested.\n*Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range\nmust be a prefix of the edit's replace range, that means it must be\ncontained and starting at the same position.\n\n@since 3.16.0 additional type `InsertReplaceEdit`", + "since": "3.16.0 additional type `InsertReplaceEdit`" + }, + { + "name": "textEditText", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The edit text used if the completion item is part of a CompletionList and\nCompletionList defines an item default for the text edit range.\n\nClients will only honor this property if they opt into completion list\nitem defaults using the capability `completionList.itemDefaults`.\n\nIf not provided and a list's default range is provided the label\nproperty is used as a text.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "additionalTextEdits", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextEdit" + } + }, + "optional": true, + "documentation": "An optional array of additional {@link TextEdit text edits} that are applied when\nselecting this completion. Edits must not overlap (including the same insert position)\nwith the main {@link CompletionItem.textEdit edit} nor with themselves.\n\nAdditional text edits should be used to change text unrelated to the current cursor position\n(for example adding an import statement at the top of the file if the completion item will\ninsert an unqualified type)." + }, + { + "name": "commitCharacters", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "optional": true, + "documentation": "An optional set of characters that when pressed while this completion is active will accept it first and\nthen type that character. *Note* that all commit characters should have `length=1` and that superfluous\ncharacters will be ignored." + }, + { + "name": "command", + "type": { + "kind": "reference", + "name": "Command" + }, + "optional": true, + "documentation": "An optional {@link Command command} that is executed *after* inserting this completion. *Note* that\nadditional modifications to the current document should be described with the\n{@link CompletionItem.additionalTextEdits additionalTextEdits}-property." + }, + { + "name": "data", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "A data entry field that is preserved on a completion item between a\n{@link CompletionRequest} and a {@link CompletionResolveRequest}." + } + ], + "documentation": "A completion item represents a text snippet that is\nproposed to complete text that is being typed." + }, + { + "name": "CompletionList", + "properties": [ + { + "name": "isIncomplete", + "type": { + "kind": "base", + "name": "boolean" + }, + "documentation": "This list it not complete. Further typing results in recomputing this list.\n\nRecomputed lists have all their items replaced (not appended) in the\nincomplete completion sessions." + }, + { + "name": "itemDefaults", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "commitCharacters", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "optional": true, + "documentation": "A default commit character set.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "editRange", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Range" + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "insert", + "type": { + "kind": "reference", + "name": "Range" + } + }, + { + "name": "replace", + "type": { + "kind": "reference", + "name": "Range" + } + } + ] + } + } + ] + }, + "optional": true, + "documentation": "A default edit range.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "insertTextFormat", + "type": { + "kind": "reference", + "name": "InsertTextFormat" + }, + "optional": true, + "documentation": "A default insert text format.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "insertTextMode", + "type": { + "kind": "reference", + "name": "InsertTextMode" + }, + "optional": true, + "documentation": "A default insert text mode.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "data", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "A default data value.\n\n@since 3.17.0", + "since": "3.17.0" + } + ] + } + }, + "optional": true, + "documentation": "In many cases the items of an actual completion result share the same\nvalue for properties like `commitCharacters` or the range of a text\nedit. A completion list can therefore define item defaults which will\nbe used if a completion item itself doesn't specify the value.\n\nIf a completion list specifies a default value and a completion item\nalso specifies a corresponding value the one from the item is used.\n\nServers are only allowed to return default values if the client\nsignals support for this via the `completionList.itemDefaults`\ncapability.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "items", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CompletionItem" + } + }, + "documentation": "The completion items." + } + ], + "documentation": "Represents a collection of {@link CompletionItem completion items} to be presented\nin the editor." + }, + { + "name": "CompletionRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "CompletionOptions" + } + ], + "documentation": "Registration options for a {@link CompletionRequest}." + }, + { + "name": "HoverParams", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "Parameters for a {@link HoverRequest}." + }, + { + "name": "Hover", + "properties": [ + { + "name": "contents", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "MarkupContent" + }, + { + "kind": "reference", + "name": "MarkedString" + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "MarkedString" + } + } + ] + }, + "documentation": "The hover's content" + }, + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "optional": true, + "documentation": "An optional range inside the text document that is used to\nvisualize the hover, e.g. by changing the background color." + } + ], + "documentation": "The result of a hover request." + }, + { + "name": "HoverRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "HoverOptions" + } + ], + "documentation": "Registration options for a {@link HoverRequest}." + }, + { + "name": "SignatureHelpParams", + "properties": [ + { + "name": "context", + "type": { + "kind": "reference", + "name": "SignatureHelpContext" + }, + "optional": true, + "documentation": "The signature help context. This is only available if the client specifies\nto send this using the client capability `textDocument.signatureHelp.contextSupport === true`\n\n@since 3.15.0", + "since": "3.15.0" + } + ], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "Parameters for a {@link SignatureHelpRequest}." + }, + { + "name": "SignatureHelp", + "properties": [ + { + "name": "signatures", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "SignatureInformation" + } + }, + "documentation": "One or more signatures." + }, + { + "name": "activeSignature", + "type": { + "kind": "base", + "name": "uinteger" + }, + "optional": true, + "documentation": "The active signature. If omitted or the value lies outside the\nrange of `signatures` the value defaults to zero or is ignored if\nthe `SignatureHelp` has no signatures.\n\nWhenever possible implementors should make an active decision about\nthe active signature and shouldn't rely on a default value.\n\nIn future version of the protocol this property might become\nmandatory to better express this." + }, + { + "name": "activeParameter", + "type": { + "kind": "base", + "name": "uinteger" + }, + "optional": true, + "documentation": "The active parameter of the active signature. If omitted or the value\nlies outside the range of `signatures[activeSignature].parameters`\ndefaults to 0 if the active signature has parameters. If\nthe active signature has no parameters it is ignored.\nIn future version of the protocol this property might become\nmandatory to better express the active parameter if the\nactive signature does have any." + } + ], + "documentation": "Signature help represents the signature of something\ncallable. There can be multiple signature but only one\nactive and only one active parameter." + }, + { + "name": "SignatureHelpRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "SignatureHelpOptions" + } + ], + "documentation": "Registration options for a {@link SignatureHelpRequest}." + }, + { + "name": "DefinitionParams", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "Parameters for a {@link DefinitionRequest}." + }, + { + "name": "DefinitionRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "DefinitionOptions" + } + ], + "documentation": "Registration options for a {@link DefinitionRequest}." + }, + { + "name": "ReferenceParams", + "properties": [ + { + "name": "context", + "type": { + "kind": "reference", + "name": "ReferenceContext" + } + } + ], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "Parameters for a {@link ReferencesRequest}." + }, + { + "name": "ReferenceRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "ReferenceOptions" + } + ], + "documentation": "Registration options for a {@link ReferencesRequest}." + }, + { + "name": "DocumentHighlightParams", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "Parameters for a {@link DocumentHighlightRequest}." + }, + { + "name": "DocumentHighlight", + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range this highlight applies to." + }, + { + "name": "kind", + "type": { + "kind": "reference", + "name": "DocumentHighlightKind" + }, + "optional": true, + "documentation": "The highlight kind, default is {@link DocumentHighlightKind.Text text}." + } + ], + "documentation": "A document highlight is a range inside a text document which deserves\nspecial attention. Usually a document highlight is visualized by changing\nthe background color of its range." + }, + { + "name": "DocumentHighlightRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "DocumentHighlightOptions" + } + ], + "documentation": "Registration options for a {@link DocumentHighlightRequest}." + }, + { + "name": "DocumentSymbolParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The text document." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "Parameters for a {@link DocumentSymbolRequest}." + }, + { + "name": "SymbolInformation", + "properties": [ + { + "name": "deprecated", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Indicates if this symbol is deprecated.\n\n@deprecated Use tags instead", + "deprecated": "Use tags instead" + }, + { + "name": "location", + "type": { + "kind": "reference", + "name": "Location" + }, + "documentation": "The location of this symbol. The location's range is used by a tool\nto reveal the location in the editor. If the symbol is selected in the\ntool the range's start information is used to position the cursor. So\nthe range usually spans more than the actual symbol's name and does\nnormally include things like visibility modifiers.\n\nThe range doesn't have to denote a node range in the sense of an abstract\nsyntax tree. It can therefore not be used to re-construct a hierarchy of\nthe symbols." + } + ], + "extends": [ + { + "kind": "reference", + "name": "BaseSymbolInformation" + } + ], + "documentation": "Represents information about programming constructs like variables, classes,\ninterfaces etc." + }, + { + "name": "DocumentSymbol", + "properties": [ + { + "name": "name", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The name of this symbol. Will be displayed in the user interface and therefore must not be\nan empty string or a string only consisting of white spaces." + }, + { + "name": "detail", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "More detail for this symbol, e.g the signature of a function." + }, + { + "name": "kind", + "type": { + "kind": "reference", + "name": "SymbolKind" + }, + "documentation": "The kind of this symbol." + }, + { + "name": "tags", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "SymbolTag" + } + }, + "optional": true, + "documentation": "Tags for this document symbol.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "deprecated", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Indicates if this symbol is deprecated.\n\n@deprecated Use tags instead", + "deprecated": "Use tags instead" + }, + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range enclosing this symbol not including leading/trailing whitespace but everything else\nlike comments. This information is typically used to determine if the clients cursor is\ninside the symbol to reveal in the symbol in the UI." + }, + { + "name": "selectionRange", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.\nMust be contained by the `range`." + }, + { + "name": "children", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "DocumentSymbol" + } + }, + "optional": true, + "documentation": "Children of this symbol, e.g. properties of a class." + } + ], + "documentation": "Represents programming constructs like variables, classes, interfaces etc.\nthat appear in a document. Document symbols can be hierarchical and they\nhave two ranges: one that encloses its definition and one that points to\nits most interesting range, e.g. the range of an identifier." + }, + { + "name": "DocumentSymbolRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "DocumentSymbolOptions" + } + ], + "documentation": "Registration options for a {@link DocumentSymbolRequest}." + }, + { + "name": "CodeActionParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The document in which the command was invoked." + }, + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range for which the command was invoked." + }, + { + "name": "context", + "type": { + "kind": "reference", + "name": "CodeActionContext" + }, + "documentation": "Context carrying additional information." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "The parameters of a {@link CodeActionRequest}." + }, + { + "name": "Command", + "properties": [ + { + "name": "title", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "Title of the command, like `save`." + }, + { + "name": "command", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The identifier of the actual command handler." + }, + { + "name": "arguments", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "LSPAny" + } + }, + "optional": true, + "documentation": "Arguments that the command handler should be\ninvoked with." + } + ], + "documentation": "Represents a reference to a command. Provides a title which\nwill be used to represent a command in the UI and, optionally,\nan array of arguments which will be passed to the command handler\nfunction when invoked." + }, + { + "name": "CodeAction", + "properties": [ + { + "name": "title", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A short, human-readable, title for this code action." + }, + { + "name": "kind", + "type": { + "kind": "reference", + "name": "CodeActionKind" + }, + "optional": true, + "documentation": "The kind of the code action.\n\nUsed to filter code actions." + }, + { + "name": "diagnostics", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Diagnostic" + } + }, + "optional": true, + "documentation": "The diagnostics that this code action resolves." + }, + { + "name": "isPreferred", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted\nby keybindings.\n\nA quick fix should be marked preferred if it properly addresses the underlying error.\nA refactoring should be marked preferred if it is the most reasonable choice of actions to take.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "disabled", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "reason", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "Human readable description of why the code action is currently disabled.\n\nThis is displayed in the code actions UI." + } + ] + } + }, + "optional": true, + "documentation": "Marks that the code action cannot currently be applied.\n\nClients should follow the following guidelines regarding disabled code actions:\n\n - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action)\n code action menus.\n\n - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type\n of code action, such as refactorings.\n\n - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions)\n that auto applies a code action and only disabled code actions are returned, the client should show the user an\n error message with `reason` in the editor.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "edit", + "type": { + "kind": "reference", + "name": "WorkspaceEdit" + }, + "optional": true, + "documentation": "The workspace edit this code action performs." + }, + { + "name": "command", + "type": { + "kind": "reference", + "name": "Command" + }, + "optional": true, + "documentation": "A command this code action executes. If a code action\nprovides an edit and a command, first the edit is\nexecuted and then the command." + }, + { + "name": "data", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "A data entry field that is preserved on a code action between\na `textDocument/codeAction` and a `codeAction/resolve` request.\n\n@since 3.16.0", + "since": "3.16.0" + } + ], + "documentation": "A code action represents a change that can be performed in code, e.g. to fix a problem or\nto refactor code.\n\nA CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed." + }, + { + "name": "CodeActionRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "CodeActionOptions" + } + ], + "documentation": "Registration options for a {@link CodeActionRequest}." + }, + { + "name": "WorkspaceSymbolParams", + "properties": [ + { + "name": "query", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A query string to filter symbols by. Clients may send an empty\nstring here to request all symbols." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "The parameters of a {@link WorkspaceSymbolRequest}." + }, + { + "name": "WorkspaceSymbol", + "properties": [ + { + "name": "location", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Location" + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + } + } + ] + } + } + ] + }, + "documentation": "The location of the symbol. Whether a server is allowed to\nreturn a location without a range depends on the client\ncapability `workspace.symbol.resolveSupport`.\n\nSee SymbolInformation#location for more details." + }, + { + "name": "data", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "A data entry field that is preserved on a workspace symbol between a\nworkspace symbol request and a workspace symbol resolve request." + } + ], + "extends": [ + { + "kind": "reference", + "name": "BaseSymbolInformation" + } + ], + "documentation": "A special workspace symbol that supports locations without a range.\n\nSee also SymbolInformation.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "WorkspaceSymbolRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "WorkspaceSymbolOptions" + } + ], + "documentation": "Registration options for a {@link WorkspaceSymbolRequest}." + }, + { + "name": "CodeLensParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The document to request code lens for." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "The parameters of a {@link CodeLensRequest}." + }, + { + "name": "CodeLens", + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range in which this code lens is valid. Should only span a single line." + }, + { + "name": "command", + "type": { + "kind": "reference", + "name": "Command" + }, + "optional": true, + "documentation": "The command this code lens represents." + }, + { + "name": "data", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "A data entry field that is preserved on a code lens item between\na {@link CodeLensRequest} and a {@link CodeLensResolveRequest}" + } + ], + "documentation": "A code lens represents a {@link Command command} that should be shown along with\nsource text, like the number of references, a way to run tests, etc.\n\nA code lens is _unresolved_ when no command is associated to it. For performance\nreasons the creation of a code lens and resolving should be done in two stages." + }, + { + "name": "CodeLensRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "CodeLensOptions" + } + ], + "documentation": "Registration options for a {@link CodeLensRequest}." + }, + { + "name": "DocumentLinkParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The document to provide document links for." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + }, + { + "kind": "reference", + "name": "PartialResultParams" + } + ], + "documentation": "The parameters of a {@link DocumentLinkRequest}." + }, + { + "name": "DocumentLink", + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range this link applies to." + }, + { + "name": "target", + "type": { + "kind": "base", + "name": "URI" + }, + "optional": true, + "documentation": "The uri this link points to. If missing a resolve request is sent later." + }, + { + "name": "tooltip", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The tooltip text when you hover over this link.\n\nIf a tooltip is provided, is will be displayed in a string that includes instructions on how to\ntrigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,\nuser settings, and localization.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "data", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "A data entry field that is preserved on a document link between a\nDocumentLinkRequest and a DocumentLinkResolveRequest." + } + ], + "documentation": "A document link is a range in a text document that links to an internal or external resource, like another\ntext document or a web site." + }, + { + "name": "DocumentLinkRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "DocumentLinkOptions" + } + ], + "documentation": "Registration options for a {@link DocumentLinkRequest}." + }, + { + "name": "DocumentFormattingParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The document to format." + }, + { + "name": "options", + "type": { + "kind": "reference", + "name": "FormattingOptions" + }, + "documentation": "The format options." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "The parameters of a {@link DocumentFormattingRequest}." + }, + { + "name": "DocumentFormattingRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "DocumentFormattingOptions" + } + ], + "documentation": "Registration options for a {@link DocumentFormattingRequest}." + }, + { + "name": "DocumentRangeFormattingParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The document to format." + }, + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range to format" + }, + { + "name": "options", + "type": { + "kind": "reference", + "name": "FormattingOptions" + }, + "documentation": "The format options" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "The parameters of a {@link DocumentRangeFormattingRequest}." + }, + { + "name": "DocumentRangeFormattingRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "DocumentRangeFormattingOptions" + } + ], + "documentation": "Registration options for a {@link DocumentRangeFormattingRequest}." + }, + { + "name": "DocumentRangesFormattingParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The document to format." + }, + { + "name": "ranges", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Range" + } + }, + "documentation": "The ranges to format" + }, + { + "name": "options", + "type": { + "kind": "reference", + "name": "FormattingOptions" + }, + "documentation": "The format options" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "The parameters of a {@link DocumentRangesFormattingRequest}.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "DocumentOnTypeFormattingParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The document to format." + }, + { + "name": "position", + "type": { + "kind": "reference", + "name": "Position" + }, + "documentation": "The position around which the on type formatting should happen.\nThis is not necessarily the exact position where the character denoted\nby the property `ch` got typed." + }, + { + "name": "ch", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The character that has been typed that triggered the formatting\non type request. That is not necessarily the last character that\ngot inserted into the document since the client could auto insert\ncharacters as well (e.g. like automatic brace completion)." + }, + { + "name": "options", + "type": { + "kind": "reference", + "name": "FormattingOptions" + }, + "documentation": "The formatting options." + } + ], + "documentation": "The parameters of a {@link DocumentOnTypeFormattingRequest}." + }, + { + "name": "DocumentOnTypeFormattingRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "DocumentOnTypeFormattingOptions" + } + ], + "documentation": "Registration options for a {@link DocumentOnTypeFormattingRequest}." + }, + { + "name": "RenameParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The document to rename." + }, + { + "name": "position", + "type": { + "kind": "reference", + "name": "Position" + }, + "documentation": "The position at which this request was sent." + }, + { + "name": "newName", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The new name of the symbol. If the given name is not valid the\nrequest must return a {@link ResponseError} with an\nappropriate message set." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "The parameters of a {@link RenameRequest}." + }, + { + "name": "RenameRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentRegistrationOptions" + }, + { + "kind": "reference", + "name": "RenameOptions" + } + ], + "documentation": "Registration options for a {@link RenameRequest}." + }, + { + "name": "PrepareRenameParams", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentPositionParams" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ] + }, + { + "name": "ExecuteCommandParams", + "properties": [ + { + "name": "command", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The identifier of the actual command handler." + }, + { + "name": "arguments", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "LSPAny" + } + }, + "optional": true, + "documentation": "Arguments that the command should be invoked with." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "The parameters of a {@link ExecuteCommandRequest}." + }, + { + "name": "ExecuteCommandRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "ExecuteCommandOptions" + } + ], + "documentation": "Registration options for a {@link ExecuteCommandRequest}." + }, + { + "name": "ApplyWorkspaceEditParams", + "properties": [ + { + "name": "label", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "An optional label of the workspace edit. This label is\npresented in the user interface for example on an undo\nstack to undo the workspace edit." + }, + { + "name": "edit", + "type": { + "kind": "reference", + "name": "WorkspaceEdit" + }, + "documentation": "The edits to apply." + } + ], + "documentation": "The parameters passed via an apply workspace edit request." + }, + { + "name": "ApplyWorkspaceEditResult", + "properties": [ + { + "name": "applied", + "type": { + "kind": "base", + "name": "boolean" + }, + "documentation": "Indicates whether the edit was applied or not." + }, + { + "name": "failureReason", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "An optional textual description for why the edit was not applied.\nThis may be used by the server for diagnostic logging or to provide\na suitable error for a request that triggered the edit." + }, + { + "name": "failedChange", + "type": { + "kind": "base", + "name": "uinteger" + }, + "optional": true, + "documentation": "Depending on the client's failure handling strategy `failedChange` might\ncontain the index of the change that failed. This property is only available\nif the client signals a `failureHandlingStrategy` in its client capabilities." + } + ], + "documentation": "The result returned from the apply workspace edit request.\n\n@since 3.17 renamed from ApplyWorkspaceEditResponse", + "since": "3.17 renamed from ApplyWorkspaceEditResponse" + }, + { + "name": "WorkDoneProgressBegin", + "properties": [ + { + "name": "kind", + "type": { + "kind": "stringLiteral", + "value": "begin" + } + }, + { + "name": "title", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "Mandatory title of the progress operation. Used to briefly inform about\nthe kind of operation being performed.\n\nExamples: \"Indexing\" or \"Linking dependencies\"." + }, + { + "name": "cancellable", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Controls if a cancel button should show to allow the user to cancel the\nlong running operation. Clients that don't support cancellation are allowed\nto ignore the setting." + }, + { + "name": "message", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "Optional, more detailed associated progress message. Contains\ncomplementary information to the `title`.\n\nExamples: \"3/25 files\", \"project/src/module2\", \"node_modules/some_dep\".\nIf unset, the previous progress message (if any) is still valid." + }, + { + "name": "percentage", + "type": { + "kind": "base", + "name": "uinteger" + }, + "optional": true, + "documentation": "Optional progress percentage to display (value 100 is considered 100%).\nIf not provided infinite progress is assumed and clients are allowed\nto ignore the `percentage` value in subsequent in report notifications.\n\nThe value should be steadily rising. Clients are free to ignore values\nthat are not following this rule. The value range is [0, 100]." + } + ] + }, + { + "name": "WorkDoneProgressReport", + "properties": [ + { + "name": "kind", + "type": { + "kind": "stringLiteral", + "value": "report" + } + }, + { + "name": "cancellable", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Controls enablement state of a cancel button.\n\nClients that don't support cancellation or don't support controlling the button's\nenablement state are allowed to ignore the property." + }, + { + "name": "message", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "Optional, more detailed associated progress message. Contains\ncomplementary information to the `title`.\n\nExamples: \"3/25 files\", \"project/src/module2\", \"node_modules/some_dep\".\nIf unset, the previous progress message (if any) is still valid." + }, + { + "name": "percentage", + "type": { + "kind": "base", + "name": "uinteger" + }, + "optional": true, + "documentation": "Optional progress percentage to display (value 100 is considered 100%).\nIf not provided infinite progress is assumed and clients are allowed\nto ignore the `percentage` value in subsequent in report notifications.\n\nThe value should be steadily rising. Clients are free to ignore values\nthat are not following this rule. The value range is [0, 100]" + } + ] + }, + { + "name": "WorkDoneProgressEnd", + "properties": [ + { + "name": "kind", + "type": { + "kind": "stringLiteral", + "value": "end" + } + }, + { + "name": "message", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "Optional, a final message indicating to for example indicate the outcome\nof the operation." + } + ] + }, + { + "name": "SetTraceParams", + "properties": [ + { + "name": "value", + "type": { + "kind": "reference", + "name": "TraceValues" + } + } + ] + }, + { + "name": "LogTraceParams", + "properties": [ + { + "name": "message", + "type": { + "kind": "base", + "name": "string" + } + }, + { + "name": "verbose", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true + } + ] + }, + { + "name": "CancelParams", + "properties": [ + { + "name": "id", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "integer" + }, + { + "kind": "base", + "name": "string" + } + ] + }, + "documentation": "The request id to cancel." + } + ] + }, + { + "name": "ProgressParams", + "properties": [ + { + "name": "token", + "type": { + "kind": "reference", + "name": "ProgressToken" + }, + "documentation": "The progress token provided by the client or server." + }, + { + "name": "value", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "documentation": "The progress data." + } + ] + }, + { + "name": "TextDocumentPositionParams", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentIdentifier" + }, + "documentation": "The text document." + }, + { + "name": "position", + "type": { + "kind": "reference", + "name": "Position" + }, + "documentation": "The position inside the text document." + } + ], + "documentation": "A parameter literal used in requests to pass a text document and a position inside that\ndocument." + }, + { + "name": "WorkDoneProgressParams", + "properties": [ + { + "name": "workDoneToken", + "type": { + "kind": "reference", + "name": "ProgressToken" + }, + "optional": true, + "documentation": "An optional token that a server can use to report work done progress." + } + ] + }, + { + "name": "PartialResultParams", + "properties": [ + { + "name": "partialResultToken", + "type": { + "kind": "reference", + "name": "ProgressToken" + }, + "optional": true, + "documentation": "An optional token that a server can use to report partial results (e.g. streaming) to\nthe client." + } + ] + }, + { + "name": "LocationLink", + "properties": [ + { + "name": "originSelectionRange", + "type": { + "kind": "reference", + "name": "Range" + }, + "optional": true, + "documentation": "Span of the origin of this link.\n\nUsed as the underlined span for mouse interaction. Defaults to the word range at\nthe definition position." + }, + { + "name": "targetUri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The target resource identifier of this link." + }, + { + "name": "targetRange", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The full target range of this link. If the target for example is a symbol then target range is the\nrange enclosing this symbol not including leading/trailing whitespace but everything else\nlike comments. This information is typically used to highlight the range in the editor." + }, + { + "name": "targetSelectionRange", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range that should be selected and revealed when this link is being followed, e.g the name of a function.\nMust be contained by the `targetRange`. See also `DocumentSymbol#range`" + } + ], + "documentation": "Represents the connection of two locations. Provides additional metadata over normal {@link Location locations},\nincluding an origin range." + }, + { + "name": "Range", + "properties": [ + { + "name": "start", + "type": { + "kind": "reference", + "name": "Position" + }, + "documentation": "The range's start position." + }, + { + "name": "end", + "type": { + "kind": "reference", + "name": "Position" + }, + "documentation": "The range's end position." + } + ], + "documentation": "A range in a text document expressed as (zero-based) start and end positions.\n\nIf you want to specify a range that contains a line including the line ending\ncharacter(s) then use an end position denoting the start of the next line.\nFor example:\n```ts\n{\n start: { line: 5, character: 23 }\n end : { line 6, character : 0 }\n}\n```" + }, + { + "name": "ImplementationOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ] + }, + { + "name": "StaticRegistrationOptions", + "properties": [ + { + "name": "id", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The id used to register the request. The id can be used to deregister\nthe request again. See also Registration#id." + } + ], + "documentation": "Static registration options to be returned in the initialize\nrequest." + }, + { + "name": "TypeDefinitionOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ] + }, + { + "name": "WorkspaceFoldersChangeEvent", + "properties": [ + { + "name": "added", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "WorkspaceFolder" + } + }, + "documentation": "The array of added workspace folders" + }, + { + "name": "removed", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "WorkspaceFolder" + } + }, + "documentation": "The array of the removed workspace folders" + } + ], + "documentation": "The workspace folder change event." + }, + { + "name": "ConfigurationItem", + "properties": [ + { + "name": "scopeUri", + "type": { + "kind": "base", + "name": "URI" + }, + "optional": true, + "documentation": "The scope to get the configuration section for." + }, + { + "name": "section", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The configuration section asked for." + } + ] + }, + { + "name": "TextDocumentIdentifier", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The text document's uri." + } + ], + "documentation": "A literal to identify a text document in the client." + }, + { + "name": "Color", + "properties": [ + { + "name": "red", + "type": { + "kind": "base", + "name": "decimal" + }, + "documentation": "The red component of this color in the range [0-1]." + }, + { + "name": "green", + "type": { + "kind": "base", + "name": "decimal" + }, + "documentation": "The green component of this color in the range [0-1]." + }, + { + "name": "blue", + "type": { + "kind": "base", + "name": "decimal" + }, + "documentation": "The blue component of this color in the range [0-1]." + }, + { + "name": "alpha", + "type": { + "kind": "base", + "name": "decimal" + }, + "documentation": "The alpha component of this color in the range [0-1]." + } + ], + "documentation": "Represents a color in RGBA space." + }, + { + "name": "DocumentColorOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ] + }, + { + "name": "FoldingRangeOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ] + }, + { + "name": "DeclarationOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ] + }, + { + "name": "Position", + "properties": [ + { + "name": "line", + "type": { + "kind": "base", + "name": "uinteger" + }, + "documentation": "Line position in a document (zero-based).\n\nIf a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document.\nIf a line number is negative, it defaults to 0." + }, + { + "name": "character", + "type": { + "kind": "base", + "name": "uinteger" + }, + "documentation": "Character offset on a line in a document (zero-based).\n\nThe meaning of this offset is determined by the negotiated\n`PositionEncodingKind`.\n\nIf the character value is greater than the line length it defaults back to the\nline length." + } + ], + "documentation": "Position in a text document expressed as zero-based line and character\noffset. Prior to 3.17 the offsets were always based on a UTF-16 string\nrepresentation. So a string of the form `a𐐀b` the character offset of the\ncharacter `a` is 0, the character offset of `𐐀` is 1 and the character\noffset of b is 3 since `𐐀` is represented using two code units in UTF-16.\nSince 3.17 clients and servers can agree on a different string encoding\nrepresentation (e.g. UTF-8). The client announces it's supported encoding\nvia the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities).\nThe value is an array of position encodings the client supports, with\ndecreasing preference (e.g. the encoding at index `0` is the most preferred\none). To stay backwards compatible the only mandatory encoding is UTF-16\nrepresented via the string `utf-16`. The server can pick one of the\nencodings offered by the client and signals that encoding back to the\nclient via the initialize result's property\n[`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value\n`utf-16` is missing from the client's capability `general.positionEncodings`\nservers can safely assume that the client supports UTF-16. If the server\nomits the position encoding in its initialize result the encoding defaults\nto the string value `utf-16`. Implementation considerations: since the\nconversion from one encoding into another requires the content of the\nfile / line the conversion is best done where the file is read which is\nusually on the server side.\n\nPositions are line end character agnostic. So you can not specify a position\nthat denotes `\\r|\\n` or `\\n|` where `|` represents the character offset.\n\n@since 3.17.0 - support for negotiated position encoding.", + "since": "3.17.0 - support for negotiated position encoding." + }, + { + "name": "SelectionRangeOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ] + }, + { + "name": "CallHierarchyOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Call hierarchy options used during static registration.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "SemanticTokensOptions", + "properties": [ + { + "name": "legend", + "type": { + "kind": "reference", + "name": "SemanticTokensLegend" + }, + "documentation": "The legend used by the server" + }, + { + "name": "range", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "literal", + "value": { + "properties": [] + } + } + ] + }, + "optional": true, + "documentation": "Server supports providing semantic tokens for a specific range\nof a document." + }, + { + "name": "full", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "delta", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The server supports deltas for full documents." + } + ] + } + } + ] + }, + "optional": true, + "documentation": "Server supports providing semantic tokens for a full document." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "SemanticTokensEdit", + "properties": [ + { + "name": "start", + "type": { + "kind": "base", + "name": "uinteger" + }, + "documentation": "The start offset of the edit." + }, + { + "name": "deleteCount", + "type": { + "kind": "base", + "name": "uinteger" + }, + "documentation": "The count of elements to remove." + }, + { + "name": "data", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "uinteger" + } + }, + "optional": true, + "documentation": "The elements to insert." + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "LinkedEditingRangeOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ] + }, + { + "name": "FileCreate", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A file:// URI for the location of the file/folder being created." + } + ], + "documentation": "Represents information on a file/folder create.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "TextDocumentEdit", + "properties": [ + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "OptionalVersionedTextDocumentIdentifier" + }, + "documentation": "The text document to change." + }, + { + "name": "edits", + "type": { + "kind": "array", + "element": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "TextEdit" + }, + { + "kind": "reference", + "name": "AnnotatedTextEdit" + } + ] + } + }, + "documentation": "The edits to be applied.\n\n@since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a\nclient capability.", + "since": "3.16.0 - support for AnnotatedTextEdit. This is guarded using a\nclient capability." + } + ], + "documentation": "Describes textual changes on a text document. A TextDocumentEdit describes all changes\non a document version Si and after they are applied move the document to version Si+1.\nSo the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any\nkind of ordering. However the edits must be non overlapping." + }, + { + "name": "CreateFile", + "properties": [ + { + "name": "kind", + "type": { + "kind": "stringLiteral", + "value": "create" + }, + "documentation": "A create" + }, + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The resource to create." + }, + { + "name": "options", + "type": { + "kind": "reference", + "name": "CreateFileOptions" + }, + "optional": true, + "documentation": "Additional options" + } + ], + "extends": [ + { + "kind": "reference", + "name": "ResourceOperation" + } + ], + "documentation": "Create file operation." + }, + { + "name": "RenameFile", + "properties": [ + { + "name": "kind", + "type": { + "kind": "stringLiteral", + "value": "rename" + }, + "documentation": "A rename" + }, + { + "name": "oldUri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The old (existing) location." + }, + { + "name": "newUri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The new location." + }, + { + "name": "options", + "type": { + "kind": "reference", + "name": "RenameFileOptions" + }, + "optional": true, + "documentation": "Rename options." + } + ], + "extends": [ + { + "kind": "reference", + "name": "ResourceOperation" + } + ], + "documentation": "Rename file operation" + }, + { + "name": "DeleteFile", + "properties": [ + { + "name": "kind", + "type": { + "kind": "stringLiteral", + "value": "delete" + }, + "documentation": "A delete" + }, + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The file to delete." + }, + { + "name": "options", + "type": { + "kind": "reference", + "name": "DeleteFileOptions" + }, + "optional": true, + "documentation": "Delete options." + } + ], + "extends": [ + { + "kind": "reference", + "name": "ResourceOperation" + } + ], + "documentation": "Delete file operation" + }, + { + "name": "ChangeAnnotation", + "properties": [ + { + "name": "label", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A human-readable string describing the actual change. The string\nis rendered prominent in the user interface." + }, + { + "name": "needsConfirmation", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "A flag which indicates that user confirmation is needed\nbefore applying the change." + }, + { + "name": "description", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A human-readable string which is rendered less prominent in\nthe user interface." + } + ], + "documentation": "Additional information that describes document changes.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "FileOperationFilter", + "properties": [ + { + "name": "scheme", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A Uri scheme like `file` or `untitled`." + }, + { + "name": "pattern", + "type": { + "kind": "reference", + "name": "FileOperationPattern" + }, + "documentation": "The actual file operation pattern." + } + ], + "documentation": "A filter to describe in which file operation requests or notifications\nthe server is interested in receiving.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "FileRename", + "properties": [ + { + "name": "oldUri", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A file:// URI for the original location of the file/folder being renamed." + }, + { + "name": "newUri", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A file:// URI for the new location of the file/folder being renamed." + } + ], + "documentation": "Represents information on a file/folder rename.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "FileDelete", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A file:// URI for the location of the file/folder being deleted." + } + ], + "documentation": "Represents information on a file/folder delete.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "MonikerOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ] + }, + { + "name": "TypeHierarchyOptions", + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "properties": [], + "documentation": "Type hierarchy options used during static registration.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlineValueContext", + "properties": [ + { + "name": "frameId", + "type": { + "kind": "base", + "name": "integer" + }, + "documentation": "The stack frame (as a DAP Id) where the execution has stopped." + }, + { + "name": "stoppedLocation", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The document range where execution has stopped.\nTypically the end position of the range denotes the line where the inline values are shown." + } + ], + "documentation": "@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlineValueText", + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The document range for which the inline value applies." + }, + { + "name": "text", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The text of the inline value." + } + ], + "documentation": "Provide inline value as text.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlineValueVariableLookup", + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The document range for which the inline value applies.\nThe range is used to extract the variable name from the underlying document." + }, + { + "name": "variableName", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "If specified the name of the variable to look up." + }, + { + "name": "caseSensitiveLookup", + "type": { + "kind": "base", + "name": "boolean" + }, + "documentation": "How to perform the lookup." + } + ], + "documentation": "Provide inline value through a variable lookup.\nIf only a range is specified, the variable name will be extracted from the underlying document.\nAn optional variable name can be used to override the extracted name.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlineValueEvaluatableExpression", + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The document range for which the inline value applies.\nThe range is used to extract the evaluatable expression from the underlying document." + }, + { + "name": "expression", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "If specified the expression overrides the extracted expression." + } + ], + "documentation": "Provide an inline value through an expression evaluation.\nIf only a range is specified, the expression will be extracted from the underlying document.\nAn optional expression can be used to override the extracted expression.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlineValueOptions", + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "properties": [], + "documentation": "Inline value options used during static registration.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlayHintLabelPart", + "properties": [ + { + "name": "value", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The value of this label part." + }, + { + "name": "tooltip", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "reference", + "name": "MarkupContent" + } + ] + }, + "optional": true, + "documentation": "The tooltip text when you hover over this label part. Depending on\nthe client capability `inlayHint.resolveSupport` clients might resolve\nthis property late using the resolve request." + }, + { + "name": "location", + "type": { + "kind": "reference", + "name": "Location" + }, + "optional": true, + "documentation": "An optional source code location that represents this\nlabel part.\n\nThe editor will use this location for the hover and for code navigation\nfeatures: This part will become a clickable link that resolves to the\ndefinition of the symbol at the given location (not necessarily the\nlocation itself), it shows the hover that shows at the given location,\nand it shows a context menu with further code navigation commands.\n\nDepending on the client capability `inlayHint.resolveSupport` clients\nmight resolve this property late using the resolve request." + }, + { + "name": "command", + "type": { + "kind": "reference", + "name": "Command" + }, + "optional": true, + "documentation": "An optional command for this label part.\n\nDepending on the client capability `inlayHint.resolveSupport` clients\nmight resolve this property late using the resolve request." + } + ], + "documentation": "An inlay hint label part allows for interactive and composite labels\nof inlay hints.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "MarkupContent", + "properties": [ + { + "name": "kind", + "type": { + "kind": "reference", + "name": "MarkupKind" + }, + "documentation": "The type of the Markup" + }, + { + "name": "value", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The content itself" + } + ], + "documentation": "A `MarkupContent` literal represents a string value which content is interpreted base on its\nkind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.\n\nIf the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.\nSee https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting\n\nHere is an example how such a string can be constructed using JavaScript / TypeScript:\n```ts\nlet markdown: MarkdownContent = {\n kind: MarkupKind.Markdown,\n value: [\n '# Header',\n 'Some text',\n '```typescript',\n 'someCode();',\n '```'\n ].join('\\n')\n};\n```\n\n*Please Note* that clients might sanitize the return markdown. A client could decide to\nremove HTML from the markdown to avoid script execution." + }, + { + "name": "InlayHintOptions", + "properties": [ + { + "name": "resolveProvider", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The server provides support to resolve additional\ninformation for an inlay hint item." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Inlay hint options used during static registration.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "RelatedFullDocumentDiagnosticReport", + "properties": [ + { + "name": "relatedDocuments", + "type": { + "kind": "map", + "key": { + "kind": "base", + "name": "DocumentUri" + }, + "value": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "FullDocumentDiagnosticReport" + }, + { + "kind": "reference", + "name": "UnchangedDocumentDiagnosticReport" + } + ] + } + }, + "optional": true, + "documentation": "Diagnostics of related documents. This information is useful\nin programming languages where code in a file A can generate\ndiagnostics in a file B which A depends on. An example of\nsuch a language is C/C++ where marco definitions in a file\na.cpp and result in errors in a header file b.hpp.\n\n@since 3.17.0", + "since": "3.17.0" + } + ], + "extends": [ + { + "kind": "reference", + "name": "FullDocumentDiagnosticReport" + } + ], + "documentation": "A full diagnostic report with a set of related documents.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "RelatedUnchangedDocumentDiagnosticReport", + "properties": [ + { + "name": "relatedDocuments", + "type": { + "kind": "map", + "key": { + "kind": "base", + "name": "DocumentUri" + }, + "value": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "FullDocumentDiagnosticReport" + }, + { + "kind": "reference", + "name": "UnchangedDocumentDiagnosticReport" + } + ] + } + }, + "optional": true, + "documentation": "Diagnostics of related documents. This information is useful\nin programming languages where code in a file A can generate\ndiagnostics in a file B which A depends on. An example of\nsuch a language is C/C++ where marco definitions in a file\na.cpp and result in errors in a header file b.hpp.\n\n@since 3.17.0", + "since": "3.17.0" + } + ], + "extends": [ + { + "kind": "reference", + "name": "UnchangedDocumentDiagnosticReport" + } + ], + "documentation": "An unchanged diagnostic report with a set of related documents.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "FullDocumentDiagnosticReport", + "properties": [ + { + "name": "kind", + "type": { + "kind": "stringLiteral", + "value": "full" + }, + "documentation": "A full document diagnostic report." + }, + { + "name": "resultId", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "An optional result id. If provided it will\nbe sent on the next diagnostic request for the\nsame document." + }, + { + "name": "items", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Diagnostic" + } + }, + "documentation": "The actual items." + } + ], + "documentation": "A diagnostic report with a full set of problems.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "UnchangedDocumentDiagnosticReport", + "properties": [ + { + "name": "kind", + "type": { + "kind": "stringLiteral", + "value": "unchanged" + }, + "documentation": "A document diagnostic report indicating\nno changes to the last result. A server can\nonly return `unchanged` if result ids are\nprovided." + }, + { + "name": "resultId", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A result id which will be sent on the next\ndiagnostic request for the same document." + } + ], + "documentation": "A diagnostic report indicating that the last returned\nreport is still accurate.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "DiagnosticOptions", + "properties": [ + { + "name": "identifier", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "An optional identifier under which the diagnostics are\nmanaged by the client." + }, + { + "name": "interFileDependencies", + "type": { + "kind": "base", + "name": "boolean" + }, + "documentation": "Whether the language has inter file dependencies meaning that\nediting code in one file can result in a different diagnostic\nset in another file. Inter file dependencies are common for\nmost programming languages and typically uncommon for linters." + }, + { + "name": "workspaceDiagnostics", + "type": { + "kind": "base", + "name": "boolean" + }, + "documentation": "The server provides support for workspace diagnostics as well." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Diagnostic options.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "PreviousResultId", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The URI for which the client knowns a\nresult id." + }, + { + "name": "value", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The value of the previous result id." + } + ], + "documentation": "A previous result id in a workspace pull request.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "NotebookDocument", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "URI" + }, + "documentation": "The notebook document's uri." + }, + { + "name": "notebookType", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The type of the notebook." + }, + { + "name": "version", + "type": { + "kind": "base", + "name": "integer" + }, + "documentation": "The version number of this document (it will increase after each\nchange, including undo/redo)." + }, + { + "name": "metadata", + "type": { + "kind": "reference", + "name": "LSPObject" + }, + "optional": true, + "documentation": "Additional metadata stored with the notebook\ndocument.\n\nNote: should always be an object literal (e.g. LSPObject)" + }, + { + "name": "cells", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "NotebookCell" + } + }, + "documentation": "The cells of a notebook." + } + ], + "documentation": "A notebook document.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "TextDocumentItem", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The text document's uri." + }, + { + "name": "languageId", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The text document's language identifier." + }, + { + "name": "version", + "type": { + "kind": "base", + "name": "integer" + }, + "documentation": "The version number of this document (it will increase after each\nchange, including undo/redo)." + }, + { + "name": "text", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The content of the opened text document." + } + ], + "documentation": "An item to transfer a text document from the client to the\nserver." + }, + { + "name": "VersionedNotebookDocumentIdentifier", + "properties": [ + { + "name": "version", + "type": { + "kind": "base", + "name": "integer" + }, + "documentation": "The version number of this notebook document." + }, + { + "name": "uri", + "type": { + "kind": "base", + "name": "URI" + }, + "documentation": "The notebook document's uri." + } + ], + "documentation": "A versioned notebook document identifier.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "NotebookDocumentChangeEvent", + "properties": [ + { + "name": "metadata", + "type": { + "kind": "reference", + "name": "LSPObject" + }, + "optional": true, + "documentation": "The changed meta data if any.\n\nNote: should always be an object literal (e.g. LSPObject)" + }, + { + "name": "cells", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "structure", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "array", + "type": { + "kind": "reference", + "name": "NotebookCellArrayChange" + }, + "documentation": "The change to the cell array." + }, + { + "name": "didOpen", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextDocumentItem" + } + }, + "optional": true, + "documentation": "Additional opened cell text documents." + }, + { + "name": "didClose", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextDocumentIdentifier" + } + }, + "optional": true, + "documentation": "Additional closed cell text documents." + } + ] + } + }, + "optional": true, + "documentation": "Changes to the cell structure to add or\nremove cells." + }, + { + "name": "data", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "NotebookCell" + } + }, + "optional": true, + "documentation": "Changes to notebook cells properties like its\nkind, execution summary or metadata." + }, + { + "name": "textContent", + "type": { + "kind": "array", + "element": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "document", + "type": { + "kind": "reference", + "name": "VersionedTextDocumentIdentifier" + } + }, + { + "name": "changes", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TextDocumentContentChangeEvent" + } + } + } + ] + } + } + }, + "optional": true, + "documentation": "Changes to the text content of notebook cells." + } + ] + } + }, + "optional": true, + "documentation": "Changes to cells" + } + ], + "documentation": "A change event for a notebook document.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "NotebookDocumentIdentifier", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "URI" + }, + "documentation": "The notebook document's uri." + } + ], + "documentation": "A literal to identify a notebook document in the client.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlineCompletionContext", + "properties": [ + { + "name": "triggerKind", + "type": { + "kind": "reference", + "name": "InlineCompletionTriggerKind" + }, + "documentation": "Describes how the inline completion was triggered." + }, + { + "name": "selectedCompletionInfo", + "type": { + "kind": "reference", + "name": "SelectedCompletionInfo" + }, + "optional": true, + "documentation": "Provides information about the currently selected item in the autocomplete widget if it is visible." + } + ], + "documentation": "Provides information about the context in which an inline completion was requested.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "StringValue", + "properties": [ + { + "name": "kind", + "type": { + "kind": "stringLiteral", + "value": "snippet" + }, + "documentation": "The kind of string value." + }, + { + "name": "value", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The snippet string." + } + ], + "documentation": "A string value used as a snippet is a template which allows to insert text\nand to control the editor cursor when insertion happens.\n\nA snippet can define tab stops and placeholders with `$1`, `$2`\nand `${3:foo}`. `$0` defines the final tab stop, it defaults to\nthe end of the snippet. Variables are defined with `$name` and\n`${name:default value}`.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "InlineCompletionOptions", + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "properties": [], + "documentation": "Inline completion options used during static registration.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "Registration", + "properties": [ + { + "name": "id", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The id used to register the request. The id can be used to deregister\nthe request again." + }, + { + "name": "method", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The method / capability to register for." + }, + { + "name": "registerOptions", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "Options necessary for the registration." + } + ], + "documentation": "General parameters to register for a notification or to register a provider." + }, + { + "name": "Unregistration", + "properties": [ + { + "name": "id", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The id used to unregister the request or notification. Usually an id\nprovided during the register request." + }, + { + "name": "method", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The method to unregister for." + } + ], + "documentation": "General parameters to unregister a request or notification." + }, + { + "name": "_InitializeParams", + "properties": [ + { + "name": "processId", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "integer" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "documentation": "The process Id of the parent process that started\nthe server.\n\nIs `null` if the process has not been started by another process.\nIf the parent process is not alive then the server should exit." + }, + { + "name": "clientInfo", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "name", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The name of the client as defined by the client." + }, + { + "name": "version", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The client's version as defined by the client." + } + ] + } + }, + "optional": true, + "documentation": "Information about the client\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "locale", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The locale the client is currently showing the user interface\nin. This must not necessarily be the locale of the operating\nsystem.\n\nUses IETF language tags as the value's syntax\n(See https://en.wikipedia.org/wiki/IETF_language_tag)\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "rootPath", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "optional": true, + "documentation": "The rootPath of the workspace. Is null\nif no folder is open.\n\n@deprecated in favour of rootUri.", + "deprecated": "in favour of rootUri." + }, + { + "name": "rootUri", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "DocumentUri" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "documentation": "The rootUri of the workspace. Is null if no\nfolder is open. If both `rootPath` and `rootUri` are set\n`rootUri` wins.\n\n@deprecated in favour of workspaceFolders.", + "deprecated": "in favour of workspaceFolders." + }, + { + "name": "capabilities", + "type": { + "kind": "reference", + "name": "ClientCapabilities" + }, + "documentation": "The capabilities provided by the client (editor or tool)" + }, + { + "name": "initializationOptions", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "User provided initialization options." + }, + { + "name": "trace", + "type": { + "kind": "reference", + "name": "TraceValues" + }, + "optional": true, + "documentation": "The initial trace setting. If omitted trace is disabled ('off')." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressParams" + } + ], + "documentation": "The initialize parameters" + }, + { + "name": "WorkspaceFoldersInitializeParams", + "properties": [ + { + "name": "workspaceFolders", + "type": { + "kind": "or", + "items": [ + { + "kind": "array", + "element": { + "kind": "reference", + "name": "WorkspaceFolder" + } + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "optional": true, + "documentation": "The workspace folders configured in the client when the server starts.\n\nThis property is only available if the client supports workspace folders.\nIt can be `null` if the client supports workspace folders but none are\nconfigured.\n\n@since 3.6.0", + "since": "3.6.0" + } + ] + }, + { + "name": "ServerCapabilities", + "properties": [ + { + "name": "positionEncoding", + "type": { + "kind": "reference", + "name": "PositionEncodingKind" + }, + "optional": true, + "documentation": "The position encoding the server picked from the encodings offered\nby the client via the client capability `general.positionEncodings`.\n\nIf the client didn't provide any position encodings the only valid\nvalue that a server can return is 'utf-16'.\n\nIf omitted it defaults to 'utf-16'.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "textDocumentSync", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "TextDocumentSyncOptions" + }, + { + "kind": "reference", + "name": "TextDocumentSyncKind" + } + ] + }, + "optional": true, + "documentation": "Defines how text documents are synced. Is either a detailed structure\ndefining each notification or for backwards compatibility the\nTextDocumentSyncKind number." + }, + { + "name": "notebookDocumentSync", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "NotebookDocumentSyncOptions" + }, + { + "kind": "reference", + "name": "NotebookDocumentSyncRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "Defines how notebook documents are synced.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "completionProvider", + "type": { + "kind": "reference", + "name": "CompletionOptions" + }, + "optional": true, + "documentation": "The server provides completion support." + }, + { + "name": "hoverProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "HoverOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides hover support." + }, + { + "name": "signatureHelpProvider", + "type": { + "kind": "reference", + "name": "SignatureHelpOptions" + }, + "optional": true, + "documentation": "The server provides signature help support." + }, + { + "name": "declarationProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "DeclarationOptions" + }, + { + "kind": "reference", + "name": "DeclarationRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides Goto Declaration support." + }, + { + "name": "definitionProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "DefinitionOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides goto definition support." + }, + { + "name": "typeDefinitionProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "TypeDefinitionOptions" + }, + { + "kind": "reference", + "name": "TypeDefinitionRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides Goto Type Definition support." + }, + { + "name": "implementationProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "ImplementationOptions" + }, + { + "kind": "reference", + "name": "ImplementationRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides Goto Implementation support." + }, + { + "name": "referencesProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "ReferenceOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides find references support." + }, + { + "name": "documentHighlightProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "DocumentHighlightOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides document highlight support." + }, + { + "name": "documentSymbolProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "DocumentSymbolOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides document symbol support." + }, + { + "name": "codeActionProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "CodeActionOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides code actions. CodeActionOptions may only be\nspecified if the client states that it supports\n`codeActionLiteralSupport` in its initial `initialize` request." + }, + { + "name": "codeLensProvider", + "type": { + "kind": "reference", + "name": "CodeLensOptions" + }, + "optional": true, + "documentation": "The server provides code lens." + }, + { + "name": "documentLinkProvider", + "type": { + "kind": "reference", + "name": "DocumentLinkOptions" + }, + "optional": true, + "documentation": "The server provides document link support." + }, + { + "name": "colorProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "DocumentColorOptions" + }, + { + "kind": "reference", + "name": "DocumentColorRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides color provider support." + }, + { + "name": "workspaceSymbolProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "WorkspaceSymbolOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides workspace symbol support." + }, + { + "name": "documentFormattingProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "DocumentFormattingOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides document formatting." + }, + { + "name": "documentRangeFormattingProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "DocumentRangeFormattingOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides document range formatting." + }, + { + "name": "documentOnTypeFormattingProvider", + "type": { + "kind": "reference", + "name": "DocumentOnTypeFormattingOptions" + }, + "optional": true, + "documentation": "The server provides document formatting on typing." + }, + { + "name": "renameProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "RenameOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides rename support. RenameOptions may only be\nspecified if the client states that it supports\n`prepareSupport` in its initial `initialize` request." + }, + { + "name": "foldingRangeProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "FoldingRangeOptions" + }, + { + "kind": "reference", + "name": "FoldingRangeRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides folding provider support." + }, + { + "name": "selectionRangeProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "SelectionRangeOptions" + }, + { + "kind": "reference", + "name": "SelectionRangeRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides selection range support." + }, + { + "name": "executeCommandProvider", + "type": { + "kind": "reference", + "name": "ExecuteCommandOptions" + }, + "optional": true, + "documentation": "The server provides execute command support." + }, + { + "name": "callHierarchyProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "CallHierarchyOptions" + }, + { + "kind": "reference", + "name": "CallHierarchyRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides call hierarchy support.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "linkedEditingRangeProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "LinkedEditingRangeOptions" + }, + { + "kind": "reference", + "name": "LinkedEditingRangeRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides linked editing range support.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "semanticTokensProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "SemanticTokensOptions" + }, + { + "kind": "reference", + "name": "SemanticTokensRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides semantic tokens support.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "monikerProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "MonikerOptions" + }, + { + "kind": "reference", + "name": "MonikerRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides moniker support.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "typeHierarchyProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "TypeHierarchyOptions" + }, + { + "kind": "reference", + "name": "TypeHierarchyRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides type hierarchy support.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "inlineValueProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "InlineValueOptions" + }, + { + "kind": "reference", + "name": "InlineValueRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides inline values.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "inlayHintProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "InlayHintOptions" + }, + { + "kind": "reference", + "name": "InlayHintRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server provides inlay hints.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "diagnosticProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "DiagnosticOptions" + }, + { + "kind": "reference", + "name": "DiagnosticRegistrationOptions" + } + ] + }, + "optional": true, + "documentation": "The server has support for pull model diagnostics.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "inlineCompletionProvider", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "InlineCompletionOptions" + } + ] + }, + "optional": true, + "documentation": "Inline completion options used during static registration.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "workspace", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "workspaceFolders", + "type": { + "kind": "reference", + "name": "WorkspaceFoldersServerCapabilities" + }, + "optional": true, + "documentation": "The server supports workspace folder.\n\n@since 3.6.0", + "since": "3.6.0" + }, + { + "name": "fileOperations", + "type": { + "kind": "reference", + "name": "FileOperationOptions" + }, + "optional": true, + "documentation": "The server is interested in notifications/requests for operations on files.\n\n@since 3.16.0", + "since": "3.16.0" + } + ] + } + }, + "optional": true, + "documentation": "Workspace specific server capabilities." + }, + { + "name": "experimental", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "Experimental server capabilities." + } + ], + "documentation": "Defines the capabilities provided by a language\nserver." + }, + { + "name": "VersionedTextDocumentIdentifier", + "properties": [ + { + "name": "version", + "type": { + "kind": "base", + "name": "integer" + }, + "documentation": "The version number of this document." + } + ], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentIdentifier" + } + ], + "documentation": "A text document identifier to denote a specific version of a text document." + }, + { + "name": "SaveOptions", + "properties": [ + { + "name": "includeText", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client is supposed to include the content on save." + } + ], + "documentation": "Save options." + }, + { + "name": "FileEvent", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The file's uri." + }, + { + "name": "type", + "type": { + "kind": "reference", + "name": "FileChangeType" + }, + "documentation": "The change type." + } + ], + "documentation": "An event describing a file change." + }, + { + "name": "FileSystemWatcher", + "properties": [ + { + "name": "globPattern", + "type": { + "kind": "reference", + "name": "GlobPattern" + }, + "documentation": "The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail.\n\n@since 3.17.0 support for relative patterns.", + "since": "3.17.0 support for relative patterns." + }, + { + "name": "kind", + "type": { + "kind": "reference", + "name": "WatchKind" + }, + "optional": true, + "documentation": "The kind of events of interest. If omitted it defaults\nto WatchKind.Create | WatchKind.Change | WatchKind.Delete\nwhich is 7." + } + ] + }, + { + "name": "Diagnostic", + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range at which the message applies" + }, + { + "name": "severity", + "type": { + "kind": "reference", + "name": "DiagnosticSeverity" + }, + "optional": true, + "documentation": "The diagnostic's severity. Can be omitted. If omitted it is up to the\nclient to interpret diagnostics as error, warning, info or hint." + }, + { + "name": "code", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "integer" + }, + { + "kind": "base", + "name": "string" + } + ] + }, + "optional": true, + "documentation": "The diagnostic's code, which usually appear in the user interface." + }, + { + "name": "codeDescription", + "type": { + "kind": "reference", + "name": "CodeDescription" + }, + "optional": true, + "documentation": "An optional property to describe the error code.\nRequires the code field (above) to be present/not null.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "source", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A human-readable string describing the source of this\ndiagnostic, e.g. 'typescript' or 'super lint'. It usually\nappears in the user interface." + }, + { + "name": "message", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The diagnostic's message. It usually appears in the user interface" + }, + { + "name": "tags", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "DiagnosticTag" + } + }, + "optional": true, + "documentation": "Additional metadata about the diagnostic.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "relatedInformation", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "DiagnosticRelatedInformation" + } + }, + "optional": true, + "documentation": "An array of related diagnostic information, e.g. when symbol-names within\na scope collide all definitions can be marked via this property." + }, + { + "name": "data", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "A data entry field that is preserved between a `textDocument/publishDiagnostics`\nnotification and `textDocument/codeAction` request.\n\n@since 3.16.0", + "since": "3.16.0" + } + ], + "documentation": "Represents a diagnostic, such as a compiler error or warning. Diagnostic objects\nare only valid in the scope of a resource." + }, + { + "name": "CompletionContext", + "properties": [ + { + "name": "triggerKind", + "type": { + "kind": "reference", + "name": "CompletionTriggerKind" + }, + "documentation": "How the completion was triggered." + }, + { + "name": "triggerCharacter", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The trigger character (a single character) that has trigger code complete.\nIs undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`" + } + ], + "documentation": "Contains additional information about the context in which a completion request is triggered." + }, + { + "name": "CompletionItemLabelDetails", + "properties": [ + { + "name": "detail", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "An optional string which is rendered less prominently directly after {@link CompletionItem.label label},\nwithout any spacing. Should be used for function signatures and type annotations." + }, + { + "name": "description", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used\nfor fully qualified names and file paths." + } + ], + "documentation": "Additional details for a completion item label.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InsertReplaceEdit", + "properties": [ + { + "name": "newText", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The string to be inserted." + }, + { + "name": "insert", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range if the insert is requested" + }, + { + "name": "replace", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range if the replace is requested." + } + ], + "documentation": "A special text edit to provide an insert and a replace operation.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "CompletionOptions", + "properties": [ + { + "name": "triggerCharacters", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "optional": true, + "documentation": "Most tools trigger completion request automatically without explicitly requesting\nit using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user\nstarts to type an identifier. For example if the user types `c` in a JavaScript file\ncode complete will automatically pop up present `console` besides others as a\ncompletion item. Characters that make up identifiers don't need to be listed here.\n\nIf code complete should automatically be trigger on characters not being valid inside\nan identifier (for example `.` in JavaScript) list them in `triggerCharacters`." + }, + { + "name": "allCommitCharacters", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "optional": true, + "documentation": "The list of all possible characters that commit a completion. This field can be used\nif clients don't support individual commit characters per completion item. See\n`ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`\n\nIf a server provides both `allCommitCharacters` and commit characters on an individual\ncompletion item the ones on the completion item win.\n\n@since 3.2.0", + "since": "3.2.0" + }, + { + "name": "resolveProvider", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The server provides support to resolve additional\ninformation for a completion item." + }, + { + "name": "completionItem", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "labelDetailsSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The server has support for completion item label\ndetails (see also `CompletionItemLabelDetails`) when\nreceiving a completion item in a resolve call.\n\n@since 3.17.0", + "since": "3.17.0" + } + ] + } + }, + "optional": true, + "documentation": "The server supports the following `CompletionItem` specific\ncapabilities.\n\n@since 3.17.0", + "since": "3.17.0" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Completion options." + }, + { + "name": "HoverOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Hover options." + }, + { + "name": "SignatureHelpContext", + "properties": [ + { + "name": "triggerKind", + "type": { + "kind": "reference", + "name": "SignatureHelpTriggerKind" + }, + "documentation": "Action that caused signature help to be triggered." + }, + { + "name": "triggerCharacter", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "Character that caused signature help to be triggered.\n\nThis is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter`" + }, + { + "name": "isRetrigger", + "type": { + "kind": "base", + "name": "boolean" + }, + "documentation": "`true` if signature help was already showing when it was triggered.\n\nRetriggers occurs when the signature help is already active and can be caused by actions such as\ntyping a trigger character, a cursor move, or document content changes." + }, + { + "name": "activeSignatureHelp", + "type": { + "kind": "reference", + "name": "SignatureHelp" + }, + "optional": true, + "documentation": "The currently active `SignatureHelp`.\n\nThe `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on\nthe user navigating through available signatures." + } + ], + "documentation": "Additional information about the context in which a signature help request was triggered.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "SignatureInformation", + "properties": [ + { + "name": "label", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The label of this signature. Will be shown in\nthe UI." + }, + { + "name": "documentation", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "reference", + "name": "MarkupContent" + } + ] + }, + "optional": true, + "documentation": "The human-readable doc-comment of this signature. Will be shown\nin the UI but can be omitted." + }, + { + "name": "parameters", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "ParameterInformation" + } + }, + "optional": true, + "documentation": "The parameters of this signature." + }, + { + "name": "activeParameter", + "type": { + "kind": "base", + "name": "uinteger" + }, + "optional": true, + "documentation": "The index of the active parameter.\n\nIf provided, this is used in place of `SignatureHelp.activeParameter`.\n\n@since 3.16.0", + "since": "3.16.0" + } + ], + "documentation": "Represents the signature of something callable. A signature\ncan have a label, like a function-name, a doc-comment, and\na set of parameters." + }, + { + "name": "SignatureHelpOptions", + "properties": [ + { + "name": "triggerCharacters", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "optional": true, + "documentation": "List of characters that trigger signature help automatically." + }, + { + "name": "retriggerCharacters", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "optional": true, + "documentation": "List of characters that re-trigger signature help.\n\nThese trigger characters are only active when signature help is already showing. All trigger characters\nare also counted as re-trigger characters.\n\n@since 3.15.0", + "since": "3.15.0" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Server Capabilities for a {@link SignatureHelpRequest}." + }, + { + "name": "DefinitionOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Server Capabilities for a {@link DefinitionRequest}." + }, + { + "name": "ReferenceContext", + "properties": [ + { + "name": "includeDeclaration", + "type": { + "kind": "base", + "name": "boolean" + }, + "documentation": "Include the declaration of the current symbol." + } + ], + "documentation": "Value-object that contains additional information when\nrequesting references." + }, + { + "name": "ReferenceOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Reference options." + }, + { + "name": "DocumentHighlightOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Provider options for a {@link DocumentHighlightRequest}." + }, + { + "name": "BaseSymbolInformation", + "properties": [ + { + "name": "name", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The name of this symbol." + }, + { + "name": "kind", + "type": { + "kind": "reference", + "name": "SymbolKind" + }, + "documentation": "The kind of this symbol." + }, + { + "name": "tags", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "SymbolTag" + } + }, + "optional": true, + "documentation": "Tags for this symbol.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "containerName", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The name of the symbol containing this symbol. This information is for\nuser interface purposes (e.g. to render a qualifier in the user interface\nif necessary). It can't be used to re-infer a hierarchy for the document\nsymbols." + } + ], + "documentation": "A base for all symbol information." + }, + { + "name": "DocumentSymbolOptions", + "properties": [ + { + "name": "label", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A human-readable string that is shown when multiple outlines trees\nare shown for the same document.\n\n@since 3.16.0", + "since": "3.16.0" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Provider options for a {@link DocumentSymbolRequest}." + }, + { + "name": "CodeActionContext", + "properties": [ + { + "name": "diagnostics", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "Diagnostic" + } + }, + "documentation": "An array of diagnostics known on the client side overlapping the range provided to the\n`textDocument/codeAction` request. They are provided so that the server knows which\nerrors are currently presented to the user for the given range. There is no guarantee\nthat these accurately reflect the error state of the resource. The primary parameter\nto compute code actions is the provided range." + }, + { + "name": "only", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CodeActionKind" + } + }, + "optional": true, + "documentation": "Requested kind of actions to return.\n\nActions not of this kind are filtered out by the client before being shown. So servers\ncan omit computing them." + }, + { + "name": "triggerKind", + "type": { + "kind": "reference", + "name": "CodeActionTriggerKind" + }, + "optional": true, + "documentation": "The reason why code actions were requested.\n\n@since 3.17.0", + "since": "3.17.0" + } + ], + "documentation": "Contains additional diagnostic information about the context in which\na {@link CodeActionProvider.provideCodeActions code action} is run." + }, + { + "name": "CodeActionOptions", + "properties": [ + { + "name": "codeActionKinds", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CodeActionKind" + } + }, + "optional": true, + "documentation": "CodeActionKinds that this server may return.\n\nThe list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server\nmay list out every specific kind they provide." + }, + { + "name": "resolveProvider", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The server provides support to resolve additional\ninformation for a code action.\n\n@since 3.16.0", + "since": "3.16.0" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Provider options for a {@link CodeActionRequest}." + }, + { + "name": "WorkspaceSymbolOptions", + "properties": [ + { + "name": "resolveProvider", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The server provides support to resolve additional\ninformation for a workspace symbol.\n\n@since 3.17.0", + "since": "3.17.0" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Server capabilities for a {@link WorkspaceSymbolRequest}." + }, + { + "name": "CodeLensOptions", + "properties": [ + { + "name": "resolveProvider", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Code lens has a resolve provider as well." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Code Lens provider options of a {@link CodeLensRequest}." + }, + { + "name": "DocumentLinkOptions", + "properties": [ + { + "name": "resolveProvider", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Document links have a resolve provider as well." + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Provider options for a {@link DocumentLinkRequest}." + }, + { + "name": "FormattingOptions", + "properties": [ + { + "name": "tabSize", + "type": { + "kind": "base", + "name": "uinteger" + }, + "documentation": "Size of a tab in spaces." + }, + { + "name": "insertSpaces", + "type": { + "kind": "base", + "name": "boolean" + }, + "documentation": "Prefer spaces over tabs." + }, + { + "name": "trimTrailingWhitespace", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Trim trailing whitespace on a line.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "insertFinalNewline", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Insert a newline character at the end of the file if one does not exist.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "trimFinalNewlines", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Trim all newlines after the final newline at the end of the file.\n\n@since 3.15.0", + "since": "3.15.0" + } + ], + "documentation": "Value-object describing what options formatting should use." + }, + { + "name": "DocumentFormattingOptions", + "properties": [], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Provider options for a {@link DocumentFormattingRequest}." + }, + { + "name": "DocumentRangeFormattingOptions", + "properties": [ + { + "name": "rangesSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the server supports formatting multiple ranges at once.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Provider options for a {@link DocumentRangeFormattingRequest}." + }, + { + "name": "DocumentOnTypeFormattingOptions", + "properties": [ + { + "name": "firstTriggerCharacter", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A character on which formatting should be triggered, like `{`." + }, + { + "name": "moreTriggerCharacter", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "optional": true, + "documentation": "More trigger characters." + } + ], + "documentation": "Provider options for a {@link DocumentOnTypeFormattingRequest}." + }, + { + "name": "RenameOptions", + "properties": [ + { + "name": "prepareProvider", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Renames should be checked and tested before being executed.\n\n@since version 3.12.0", + "since": "version 3.12.0" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "Provider options for a {@link RenameRequest}." + }, + { + "name": "ExecuteCommandOptions", + "properties": [ + { + "name": "commands", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "documentation": "The commands to be executed on the server" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "WorkDoneProgressOptions" + } + ], + "documentation": "The server capabilities of a {@link ExecuteCommandRequest}." + }, + { + "name": "SemanticTokensLegend", + "properties": [ + { + "name": "tokenTypes", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "documentation": "The token types a server uses." + }, + { + "name": "tokenModifiers", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "documentation": "The token modifiers a server uses." + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "OptionalVersionedTextDocumentIdentifier", + "properties": [ + { + "name": "version", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "integer" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "documentation": "The version number of this document. If a versioned text document identifier\nis sent from the server to the client and the file is not open in the editor\n(the server has not received an open notification before) the server can send\n`null` to indicate that the version is unknown and the content on disk is the\ntruth (as specified with document content ownership)." + } + ], + "extends": [ + { + "kind": "reference", + "name": "TextDocumentIdentifier" + } + ], + "documentation": "A text document identifier to optionally denote a specific version of a text document." + }, + { + "name": "AnnotatedTextEdit", + "properties": [ + { + "name": "annotationId", + "type": { + "kind": "reference", + "name": "ChangeAnnotationIdentifier" + }, + "documentation": "The actual identifier of the change annotation" + } + ], + "extends": [ + { + "kind": "reference", + "name": "TextEdit" + } + ], + "documentation": "A special text edit with an additional change annotation.\n\n@since 3.16.0.", + "since": "3.16.0." + }, + { + "name": "ResourceOperation", + "properties": [ + { + "name": "kind", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The resource operation kind." + }, + { + "name": "annotationId", + "type": { + "kind": "reference", + "name": "ChangeAnnotationIdentifier" + }, + "optional": true, + "documentation": "An optional annotation identifier describing the operation.\n\n@since 3.16.0", + "since": "3.16.0" + } + ], + "documentation": "A generic resource operation." + }, + { + "name": "CreateFileOptions", + "properties": [ + { + "name": "overwrite", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Overwrite existing file. Overwrite wins over `ignoreIfExists`" + }, + { + "name": "ignoreIfExists", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Ignore if exists." + } + ], + "documentation": "Options to create a file." + }, + { + "name": "RenameFileOptions", + "properties": [ + { + "name": "overwrite", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Overwrite target if existing. Overwrite wins over `ignoreIfExists`" + }, + { + "name": "ignoreIfExists", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Ignores if target exists." + } + ], + "documentation": "Rename file options" + }, + { + "name": "DeleteFileOptions", + "properties": [ + { + "name": "recursive", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Delete the content recursively if a folder is denoted." + }, + { + "name": "ignoreIfNotExists", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Ignore the operation if the file doesn't exist." + } + ], + "documentation": "Delete file options" + }, + { + "name": "FileOperationPattern", + "properties": [ + { + "name": "glob", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The glob pattern to match. Glob patterns can have the following syntax:\n- `*` to match one or more characters in a path segment\n- `?` to match on one character in a path segment\n- `**` to match any number of path segments, including none\n- `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)\n- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)\n- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)" + }, + { + "name": "matches", + "type": { + "kind": "reference", + "name": "FileOperationPatternKind" + }, + "optional": true, + "documentation": "Whether to match files or folders with this pattern.\n\nMatches both if undefined." + }, + { + "name": "options", + "type": { + "kind": "reference", + "name": "FileOperationPatternOptions" + }, + "optional": true, + "documentation": "Additional options used during matching." + } + ], + "documentation": "A pattern to describe in which file operation requests or notifications\nthe server is interested in receiving.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "WorkspaceFullDocumentDiagnosticReport", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The URI for which diagnostic information is reported." + }, + { + "name": "version", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "integer" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "documentation": "The version number for which the diagnostics are reported.\nIf the document is not marked as open `null` can be provided." + } + ], + "extends": [ + { + "kind": "reference", + "name": "FullDocumentDiagnosticReport" + } + ], + "documentation": "A full document diagnostic report for a workspace diagnostic result.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "WorkspaceUnchangedDocumentDiagnosticReport", + "properties": [ + { + "name": "uri", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The URI for which diagnostic information is reported." + }, + { + "name": "version", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "integer" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "documentation": "The version number for which the diagnostics are reported.\nIf the document is not marked as open `null` can be provided." + } + ], + "extends": [ + { + "kind": "reference", + "name": "UnchangedDocumentDiagnosticReport" + } + ], + "documentation": "An unchanged document diagnostic report for a workspace diagnostic result.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "NotebookCell", + "properties": [ + { + "name": "kind", + "type": { + "kind": "reference", + "name": "NotebookCellKind" + }, + "documentation": "The cell's kind" + }, + { + "name": "document", + "type": { + "kind": "base", + "name": "DocumentUri" + }, + "documentation": "The URI of the cell's text document\ncontent." + }, + { + "name": "metadata", + "type": { + "kind": "reference", + "name": "LSPObject" + }, + "optional": true, + "documentation": "Additional metadata stored with the cell.\n\nNote: should always be an object literal (e.g. LSPObject)" + }, + { + "name": "executionSummary", + "type": { + "kind": "reference", + "name": "ExecutionSummary" + }, + "optional": true, + "documentation": "Additional execution summary information\nif supported by the client." + } + ], + "documentation": "A notebook cell.\n\nA cell's document URI must be unique across ALL notebook\ncells and can therefore be used to uniquely identify a\nnotebook cell or the cell's text document.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "NotebookCellArrayChange", + "properties": [ + { + "name": "start", + "type": { + "kind": "base", + "name": "uinteger" + }, + "documentation": "The start oftest of the cell that changed." + }, + { + "name": "deleteCount", + "type": { + "kind": "base", + "name": "uinteger" + }, + "documentation": "The deleted cells" + }, + { + "name": "cells", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "NotebookCell" + } + }, + "optional": true, + "documentation": "The new cells, if any" + } + ], + "documentation": "A change describing how to move a `NotebookCell`\narray from state S to S'.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "SelectedCompletionInfo", + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range that will be replaced if this completion item is accepted." + }, + { + "name": "text", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The text the range will be replaced with if this completion is accepted." + } + ], + "documentation": "Describes the currently selected completion item.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "ClientCapabilities", + "properties": [ + { + "name": "workspace", + "type": { + "kind": "reference", + "name": "WorkspaceClientCapabilities" + }, + "optional": true, + "documentation": "Workspace specific client capabilities." + }, + { + "name": "textDocument", + "type": { + "kind": "reference", + "name": "TextDocumentClientCapabilities" + }, + "optional": true, + "documentation": "Text document specific client capabilities." + }, + { + "name": "notebookDocument", + "type": { + "kind": "reference", + "name": "NotebookDocumentClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the notebook document support.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "window", + "type": { + "kind": "reference", + "name": "WindowClientCapabilities" + }, + "optional": true, + "documentation": "Window specific client capabilities." + }, + { + "name": "general", + "type": { + "kind": "reference", + "name": "GeneralClientCapabilities" + }, + "optional": true, + "documentation": "General client capabilities.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "experimental", + "type": { + "kind": "reference", + "name": "LSPAny" + }, + "optional": true, + "documentation": "Experimental client capabilities." + } + ], + "documentation": "Defines the capabilities provided by the client." + }, + { + "name": "TextDocumentSyncOptions", + "properties": [ + { + "name": "openClose", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Open and close notifications are sent to the server. If omitted open close notification should not\nbe sent." + }, + { + "name": "change", + "type": { + "kind": "reference", + "name": "TextDocumentSyncKind" + }, + "optional": true, + "documentation": "Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full\nand TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None." + }, + { + "name": "willSave", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "If present will save notifications are sent to the server. If omitted the notification should not be\nsent." + }, + { + "name": "willSaveWaitUntil", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "If present will save wait until requests are sent to the server. If omitted the request should not be\nsent." + }, + { + "name": "save", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "reference", + "name": "SaveOptions" + } + ] + }, + "optional": true, + "documentation": "If present save notifications are sent to the server. If omitted the notification should not be\nsent." + } + ] + }, + { + "name": "NotebookDocumentSyncOptions", + "properties": [ + { + "name": "notebookSelector", + "type": { + "kind": "array", + "element": { + "kind": "or", + "items": [ + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "notebook", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "reference", + "name": "NotebookDocumentFilter" + } + ] + }, + "documentation": "The notebook to be synced If a string\nvalue is provided it matches against the\nnotebook type. '*' matches every notebook." + }, + { + "name": "cells", + "type": { + "kind": "array", + "element": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "language", + "type": { + "kind": "base", + "name": "string" + } + } + ] + } + } + }, + "optional": true, + "documentation": "The cells of the matching notebook to be synced." + } + ] + } + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "notebook", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "reference", + "name": "NotebookDocumentFilter" + } + ] + }, + "optional": true, + "documentation": "The notebook to be synced If a string\nvalue is provided it matches against the\nnotebook type. '*' matches every notebook." + }, + { + "name": "cells", + "type": { + "kind": "array", + "element": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "language", + "type": { + "kind": "base", + "name": "string" + } + } + ] + } + } + }, + "documentation": "The cells of the matching notebook to be synced." + } + ] + } + } + ] + } + }, + "documentation": "The notebooks to be synced" + }, + { + "name": "save", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether save notification should be forwarded to\nthe server. Will only be honored if mode === `notebook`." + } + ], + "documentation": "Options specific to a notebook plus its cells\nto be synced to the server.\n\nIf a selector provides a notebook document\nfilter but no cell selector all cells of a\nmatching notebook document will be synced.\n\nIf a selector provides no notebook document\nfilter but only a cell selector all notebook\ndocument that contain at least one matching\ncell will be synced.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "NotebookDocumentSyncRegistrationOptions", + "properties": [], + "extends": [ + { + "kind": "reference", + "name": "NotebookDocumentSyncOptions" + } + ], + "mixins": [ + { + "kind": "reference", + "name": "StaticRegistrationOptions" + } + ], + "documentation": "Registration options specific to a notebook.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "WorkspaceFoldersServerCapabilities", + "properties": [ + { + "name": "supported", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The server has support for workspace folders" + }, + { + "name": "changeNotifications", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "base", + "name": "boolean" + } + ] + }, + "optional": true, + "documentation": "Whether the server wants to receive workspace folder\nchange notifications.\n\nIf a string is provided the string is treated as an ID\nunder which the notification is registered on the client\nside. The ID can be used to unregister for these events\nusing the `client/unregisterCapability` request." + } + ] + }, + { + "name": "FileOperationOptions", + "properties": [ + { + "name": "didCreate", + "type": { + "kind": "reference", + "name": "FileOperationRegistrationOptions" + }, + "optional": true, + "documentation": "The server is interested in receiving didCreateFiles notifications." + }, + { + "name": "willCreate", + "type": { + "kind": "reference", + "name": "FileOperationRegistrationOptions" + }, + "optional": true, + "documentation": "The server is interested in receiving willCreateFiles requests." + }, + { + "name": "didRename", + "type": { + "kind": "reference", + "name": "FileOperationRegistrationOptions" + }, + "optional": true, + "documentation": "The server is interested in receiving didRenameFiles notifications." + }, + { + "name": "willRename", + "type": { + "kind": "reference", + "name": "FileOperationRegistrationOptions" + }, + "optional": true, + "documentation": "The server is interested in receiving willRenameFiles requests." + }, + { + "name": "didDelete", + "type": { + "kind": "reference", + "name": "FileOperationRegistrationOptions" + }, + "optional": true, + "documentation": "The server is interested in receiving didDeleteFiles file notifications." + }, + { + "name": "willDelete", + "type": { + "kind": "reference", + "name": "FileOperationRegistrationOptions" + }, + "optional": true, + "documentation": "The server is interested in receiving willDeleteFiles file requests." + } + ], + "documentation": "Options for notifications/requests for user operations on files.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "CodeDescription", + "properties": [ + { + "name": "href", + "type": { + "kind": "base", + "name": "URI" + }, + "documentation": "An URI to open with more information about the diagnostic error." + } + ], + "documentation": "Structure to capture a description for an error code.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "DiagnosticRelatedInformation", + "properties": [ + { + "name": "location", + "type": { + "kind": "reference", + "name": "Location" + }, + "documentation": "The location of this related diagnostic information." + }, + { + "name": "message", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The message of this related diagnostic information." + } + ], + "documentation": "Represents a related message and source code location for a diagnostic. This should be\nused to point to code locations that cause or related to a diagnostics, e.g when duplicating\na symbol in a scope." + }, + { + "name": "ParameterInformation", + "properties": [ + { + "name": "label", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "tuple", + "items": [ + { + "kind": "base", + "name": "uinteger" + }, + { + "kind": "base", + "name": "uinteger" + } + ] + } + ] + }, + "documentation": "The label of this parameter information.\n\nEither a string or an inclusive start and exclusive end offsets within its containing\nsignature label. (see SignatureInformation.label). The offsets are based on a UTF-16\nstring representation as `Position` and `Range` does.\n\n*Note*: a label of type string should be a substring of its containing signature label.\nIts intended use case is to highlight the parameter label part in the `SignatureInformation.label`." + }, + { + "name": "documentation", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "reference", + "name": "MarkupContent" + } + ] + }, + "optional": true, + "documentation": "The human-readable doc-comment of this parameter. Will be shown\nin the UI but can be omitted." + } + ], + "documentation": "Represents a parameter of a callable-signature. A parameter can\nhave a label and a doc-comment." + }, + { + "name": "NotebookCellTextDocumentFilter", + "properties": [ + { + "name": "notebook", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "reference", + "name": "NotebookDocumentFilter" + } + ] + }, + "documentation": "A filter that matches against the notebook\ncontaining the notebook cell. If a string\nvalue is provided it matches against the\nnotebook type. '*' matches every notebook." + }, + { + "name": "language", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A language id like `python`.\n\nWill be matched against the language id of the\nnotebook cell document. '*' matches every language." + } + ], + "documentation": "A notebook cell text document filter denotes a cell text\ndocument by different properties.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "FileOperationPatternOptions", + "properties": [ + { + "name": "ignoreCase", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The pattern should be matched ignoring casing." + } + ], + "documentation": "Matching options for the file operation pattern.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "ExecutionSummary", + "properties": [ + { + "name": "executionOrder", + "type": { + "kind": "base", + "name": "uinteger" + }, + "documentation": "A strict monotonically increasing value\nindicating the execution order of a cell\ninside a notebook." + }, + { + "name": "success", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the execution was successful or\nnot if known by the client." + } + ] + }, + { + "name": "WorkspaceClientCapabilities", + "properties": [ + { + "name": "applyEdit", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports applying batch edits\nto the workspace by supporting the request\n'workspace/applyEdit'" + }, + { + "name": "workspaceEdit", + "type": { + "kind": "reference", + "name": "WorkspaceEditClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to `WorkspaceEdit`s." + }, + { + "name": "didChangeConfiguration", + "type": { + "kind": "reference", + "name": "DidChangeConfigurationClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `workspace/didChangeConfiguration` notification." + }, + { + "name": "didChangeWatchedFiles", + "type": { + "kind": "reference", + "name": "DidChangeWatchedFilesClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `workspace/didChangeWatchedFiles` notification." + }, + { + "name": "symbol", + "type": { + "kind": "reference", + "name": "WorkspaceSymbolClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `workspace/symbol` request." + }, + { + "name": "executeCommand", + "type": { + "kind": "reference", + "name": "ExecuteCommandClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `workspace/executeCommand` request." + }, + { + "name": "workspaceFolders", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client has support for workspace folders.\n\n@since 3.6.0", + "since": "3.6.0" + }, + { + "name": "configuration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports `workspace/configuration` requests.\n\n@since 3.6.0", + "since": "3.6.0" + }, + { + "name": "semanticTokens", + "type": { + "kind": "reference", + "name": "SemanticTokensWorkspaceClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the semantic token requests scoped to the\nworkspace.\n\n@since 3.16.0.", + "since": "3.16.0." + }, + { + "name": "codeLens", + "type": { + "kind": "reference", + "name": "CodeLensWorkspaceClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the code lens requests scoped to the\nworkspace.\n\n@since 3.16.0.", + "since": "3.16.0." + }, + { + "name": "fileOperations", + "type": { + "kind": "reference", + "name": "FileOperationClientCapabilities" + }, + "optional": true, + "documentation": "The client has support for file notifications/requests for user operations on files.\n\nSince 3.16.0" + }, + { + "name": "inlineValue", + "type": { + "kind": "reference", + "name": "InlineValueWorkspaceClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the inline values requests scoped to the\nworkspace.\n\n@since 3.17.0.", + "since": "3.17.0." + }, + { + "name": "inlayHint", + "type": { + "kind": "reference", + "name": "InlayHintWorkspaceClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the inlay hint requests scoped to the\nworkspace.\n\n@since 3.17.0.", + "since": "3.17.0." + }, + { + "name": "diagnostics", + "type": { + "kind": "reference", + "name": "DiagnosticWorkspaceClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the diagnostic requests scoped to the\nworkspace.\n\n@since 3.17.0.", + "since": "3.17.0." + }, + { + "name": "foldingRange", + "type": { + "kind": "reference", + "name": "FoldingRangeWorkspaceClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the folding range requests scoped to the workspace.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + } + ], + "documentation": "Workspace specific client capabilities." + }, + { + "name": "TextDocumentClientCapabilities", + "properties": [ + { + "name": "synchronization", + "type": { + "kind": "reference", + "name": "TextDocumentSyncClientCapabilities" + }, + "optional": true, + "documentation": "Defines which synchronization capabilities the client supports." + }, + { + "name": "completion", + "type": { + "kind": "reference", + "name": "CompletionClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/completion` request." + }, + { + "name": "hover", + "type": { + "kind": "reference", + "name": "HoverClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/hover` request." + }, + { + "name": "signatureHelp", + "type": { + "kind": "reference", + "name": "SignatureHelpClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/signatureHelp` request." + }, + { + "name": "declaration", + "type": { + "kind": "reference", + "name": "DeclarationClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/declaration` request.\n\n@since 3.14.0", + "since": "3.14.0" + }, + { + "name": "definition", + "type": { + "kind": "reference", + "name": "DefinitionClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/definition` request." + }, + { + "name": "typeDefinition", + "type": { + "kind": "reference", + "name": "TypeDefinitionClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/typeDefinition` request.\n\n@since 3.6.0", + "since": "3.6.0" + }, + { + "name": "implementation", + "type": { + "kind": "reference", + "name": "ImplementationClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/implementation` request.\n\n@since 3.6.0", + "since": "3.6.0" + }, + { + "name": "references", + "type": { + "kind": "reference", + "name": "ReferenceClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/references` request." + }, + { + "name": "documentHighlight", + "type": { + "kind": "reference", + "name": "DocumentHighlightClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/documentHighlight` request." + }, + { + "name": "documentSymbol", + "type": { + "kind": "reference", + "name": "DocumentSymbolClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/documentSymbol` request." + }, + { + "name": "codeAction", + "type": { + "kind": "reference", + "name": "CodeActionClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/codeAction` request." + }, + { + "name": "codeLens", + "type": { + "kind": "reference", + "name": "CodeLensClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/codeLens` request." + }, + { + "name": "documentLink", + "type": { + "kind": "reference", + "name": "DocumentLinkClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/documentLink` request." + }, + { + "name": "colorProvider", + "type": { + "kind": "reference", + "name": "DocumentColorClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/documentColor` and the\n`textDocument/colorPresentation` request.\n\n@since 3.6.0", + "since": "3.6.0" + }, + { + "name": "formatting", + "type": { + "kind": "reference", + "name": "DocumentFormattingClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/formatting` request." + }, + { + "name": "rangeFormatting", + "type": { + "kind": "reference", + "name": "DocumentRangeFormattingClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/rangeFormatting` request." + }, + { + "name": "onTypeFormatting", + "type": { + "kind": "reference", + "name": "DocumentOnTypeFormattingClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/onTypeFormatting` request." + }, + { + "name": "rename", + "type": { + "kind": "reference", + "name": "RenameClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/rename` request." + }, + { + "name": "foldingRange", + "type": { + "kind": "reference", + "name": "FoldingRangeClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/foldingRange` request.\n\n@since 3.10.0", + "since": "3.10.0" + }, + { + "name": "selectionRange", + "type": { + "kind": "reference", + "name": "SelectionRangeClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/selectionRange` request.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "publishDiagnostics", + "type": { + "kind": "reference", + "name": "PublishDiagnosticsClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/publishDiagnostics` notification." + }, + { + "name": "callHierarchy", + "type": { + "kind": "reference", + "name": "CallHierarchyClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the various call hierarchy requests.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "semanticTokens", + "type": { + "kind": "reference", + "name": "SemanticTokensClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the various semantic token request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "linkedEditingRange", + "type": { + "kind": "reference", + "name": "LinkedEditingRangeClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/linkedEditingRange` request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "moniker", + "type": { + "kind": "reference", + "name": "MonikerClientCapabilities" + }, + "optional": true, + "documentation": "Client capabilities specific to the `textDocument/moniker` request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "typeHierarchy", + "type": { + "kind": "reference", + "name": "TypeHierarchyClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the various type hierarchy requests.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "inlineValue", + "type": { + "kind": "reference", + "name": "InlineValueClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/inlineValue` request.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "inlayHint", + "type": { + "kind": "reference", + "name": "InlayHintClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the `textDocument/inlayHint` request.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "diagnostic", + "type": { + "kind": "reference", + "name": "DiagnosticClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the diagnostic pull model.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "inlineCompletion", + "type": { + "kind": "reference", + "name": "InlineCompletionClientCapabilities" + }, + "optional": true, + "documentation": "Client capabilities specific to inline completions.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + } + ], + "documentation": "Text document specific client capabilities." + }, + { + "name": "NotebookDocumentClientCapabilities", + "properties": [ + { + "name": "synchronization", + "type": { + "kind": "reference", + "name": "NotebookDocumentSyncClientCapabilities" + }, + "documentation": "Capabilities specific to notebook document synchronization\n\n@since 3.17.0", + "since": "3.17.0" + } + ], + "documentation": "Capabilities specific to the notebook document support.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "WindowClientCapabilities", + "properties": [ + { + "name": "workDoneProgress", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "It indicates whether the client supports server initiated\nprogress using the `window/workDoneProgress/create` request.\n\nThe capability also controls Whether client supports handling\nof progress notifications. If set servers are allowed to report a\n`workDoneProgress` property in the request specific server\ncapabilities.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "showMessage", + "type": { + "kind": "reference", + "name": "ShowMessageRequestClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the showMessage request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "showDocument", + "type": { + "kind": "reference", + "name": "ShowDocumentClientCapabilities" + }, + "optional": true, + "documentation": "Capabilities specific to the showDocument request.\n\n@since 3.16.0", + "since": "3.16.0" + } + ] + }, + { + "name": "GeneralClientCapabilities", + "properties": [ + { + "name": "staleRequestSupport", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "cancel", + "type": { + "kind": "base", + "name": "boolean" + }, + "documentation": "The client will actively cancel the request." + }, + { + "name": "retryOnContentModified", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "documentation": "The list of requests for which the client\nwill retry the request if it receives a\nresponse with error code `ContentModified`" + } + ] + } + }, + "optional": true, + "documentation": "Client capability that signals how the client\nhandles stale requests (e.g. a request\nfor which the client will not process the response\nanymore since the information is outdated).\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "regularExpressions", + "type": { + "kind": "reference", + "name": "RegularExpressionsClientCapabilities" + }, + "optional": true, + "documentation": "Client capabilities specific to regular expressions.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "markdown", + "type": { + "kind": "reference", + "name": "MarkdownClientCapabilities" + }, + "optional": true, + "documentation": "Client capabilities specific to the client's markdown parser.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "positionEncodings", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "PositionEncodingKind" + } + }, + "optional": true, + "documentation": "The position encodings supported by the client. Client and server\nhave to agree on the same position encoding to ensure that offsets\n(e.g. character position in a line) are interpreted the same on both\nsides.\n\nTo keep the protocol backwards compatible the following applies: if\nthe value 'utf-16' is missing from the array of position encodings\nservers can assume that the client supports UTF-16. UTF-16 is\ntherefore a mandatory encoding.\n\nIf omitted it defaults to ['utf-16'].\n\nImplementation considerations: since the conversion from one encoding\ninto another requires the content of the file / line the conversion\nis best done where the file is read which is usually on the server\nside.\n\n@since 3.17.0", + "since": "3.17.0" + } + ], + "documentation": "General client capabilities.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "RelativePattern", + "properties": [ + { + "name": "baseUri", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "WorkspaceFolder" + }, + { + "kind": "base", + "name": "URI" + } + ] + }, + "documentation": "A workspace folder or a base URI to which this pattern will be matched\nagainst relatively." + }, + { + "name": "pattern", + "type": { + "kind": "reference", + "name": "Pattern" + }, + "documentation": "The actual glob pattern;" + } + ], + "documentation": "A relative pattern is a helper to construct glob patterns that are matched\nrelatively to a base URI. The common value for a `baseUri` is a workspace\nfolder root, but it can be another absolute URI as well.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "WorkspaceEditClientCapabilities", + "properties": [ + { + "name": "documentChanges", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports versioned document changes in `WorkspaceEdit`s" + }, + { + "name": "resourceOperations", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "ResourceOperationKind" + } + }, + "optional": true, + "documentation": "The resource operations the client supports. Clients should at least\nsupport 'create', 'rename' and 'delete' files and folders.\n\n@since 3.13.0", + "since": "3.13.0" + }, + { + "name": "failureHandling", + "type": { + "kind": "reference", + "name": "FailureHandlingKind" + }, + "optional": true, + "documentation": "The failure handling strategy of a client if applying the workspace edit\nfails.\n\n@since 3.13.0", + "since": "3.13.0" + }, + { + "name": "normalizesLineEndings", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client normalizes line endings to the client specific\nsetting.\nIf set to `true` the client will normalize line ending characters\nin a workspace edit to the client-specified new line\ncharacter.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "changeAnnotationSupport", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "groupsOnLabel", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client groups edits with equal labels into tree nodes,\nfor instance all edits labelled with \"Changes in Strings\" would\nbe a tree node." + } + ] + } + }, + "optional": true, + "documentation": "Whether the client in general supports change annotations on text edits,\ncreate file, rename file and delete file changes.\n\n@since 3.16.0", + "since": "3.16.0" + } + ] + }, + { + "name": "DidChangeConfigurationClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Did change configuration notification supports dynamic registration." + } + ] + }, + { + "name": "DidChangeWatchedFilesClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Did change watched files notification supports dynamic registration. Please note\nthat the current protocol doesn't support static configuration for file changes\nfrom the server side." + }, + { + "name": "relativePatternSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client has support for {@link RelativePattern relative pattern}\nor not.\n\n@since 3.17.0", + "since": "3.17.0" + } + ] + }, + { + "name": "WorkspaceSymbolClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Symbol request supports dynamic registration." + }, + { + "name": "symbolKind", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "valueSet", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "SymbolKind" + } + }, + "optional": true, + "documentation": "The symbol kind values the client supports. When this\nproperty exists the client also guarantees that it will\nhandle values outside its set gracefully and falls back\nto a default value when unknown.\n\nIf this property is not present the client only supports\nthe symbol kinds from `File` to `Array` as defined in\nthe initial version of the protocol." + } + ] + } + }, + "optional": true, + "documentation": "Specific capabilities for the `SymbolKind` in the `workspace/symbol` request." + }, + { + "name": "tagSupport", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "valueSet", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "SymbolTag" + } + }, + "documentation": "The tags supported by the client." + } + ] + } + }, + "optional": true, + "documentation": "The client supports tags on `SymbolInformation`.\nClients supporting tags have to handle unknown tags gracefully.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "resolveSupport", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "properties", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "documentation": "The properties that a client can resolve lazily. Usually\n`location.range`" + } + ] + } + }, + "optional": true, + "documentation": "The client support partial workspace symbols. The client will send the\nrequest `workspaceSymbol/resolve` to the server to resolve additional\nproperties.\n\n@since 3.17.0", + "since": "3.17.0" + } + ], + "documentation": "Client capabilities for a {@link WorkspaceSymbolRequest}." + }, + { + "name": "ExecuteCommandClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Execute command supports dynamic registration." + } + ], + "documentation": "The client capabilities of a {@link ExecuteCommandRequest}." + }, + { + "name": "SemanticTokensWorkspaceClientCapabilities", + "properties": [ + { + "name": "refreshSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client implementation supports a refresh request sent from\nthe server to the client.\n\nNote that this event is global and will force the client to refresh all\nsemantic tokens currently shown. It should be used with absolute care\nand is useful for situation where a server for example detects a project\nwide change that requires such a calculation." + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "CodeLensWorkspaceClientCapabilities", + "properties": [ + { + "name": "refreshSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client implementation supports a refresh request sent from the\nserver to the client.\n\nNote that this event is global and will force the client to refresh all\ncode lenses currently shown. It should be used with absolute care and is\nuseful for situation where a server for example detect a project wide\nchange that requires such a calculation." + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "FileOperationClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client supports dynamic registration for file requests/notifications." + }, + { + "name": "didCreate", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client has support for sending didCreateFiles notifications." + }, + { + "name": "willCreate", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client has support for sending willCreateFiles requests." + }, + { + "name": "didRename", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client has support for sending didRenameFiles notifications." + }, + { + "name": "willRename", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client has support for sending willRenameFiles requests." + }, + { + "name": "didDelete", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client has support for sending didDeleteFiles notifications." + }, + { + "name": "willDelete", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client has support for sending willDeleteFiles requests." + } + ], + "documentation": "Capabilities relating to events from file operations by the user in the client.\n\nThese events do not come from the file system, they come from user operations\nlike renaming a file in the UI.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "InlineValueWorkspaceClientCapabilities", + "properties": [ + { + "name": "refreshSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client implementation supports a refresh request sent from the\nserver to the client.\n\nNote that this event is global and will force the client to refresh all\ninline values currently shown. It should be used with absolute care and is\nuseful for situation where a server for example detects a project wide\nchange that requires such a calculation." + } + ], + "documentation": "Client workspace capabilities specific to inline values.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlayHintWorkspaceClientCapabilities", + "properties": [ + { + "name": "refreshSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client implementation supports a refresh request sent from\nthe server to the client.\n\nNote that this event is global and will force the client to refresh all\ninlay hints currently shown. It should be used with absolute care and\nis useful for situation where a server for example detects a project wide\nchange that requires such a calculation." + } + ], + "documentation": "Client workspace capabilities specific to inlay hints.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "DiagnosticWorkspaceClientCapabilities", + "properties": [ + { + "name": "refreshSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client implementation supports a refresh request sent from\nthe server to the client.\n\nNote that this event is global and will force the client to refresh all\npulled diagnostics currently shown. It should be used with absolute care and\nis useful for situation where a server for example detects a project wide\nchange that requires such a calculation." + } + ], + "documentation": "Workspace client capabilities specific to diagnostic pull requests.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "FoldingRangeWorkspaceClientCapabilities", + "properties": [ + { + "name": "refreshSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client implementation supports a refresh request sent from the\nserver to the client.\n\nNote that this event is global and will force the client to refresh all\nfolding ranges currently shown. It should be used with absolute care and is\nuseful for situation where a server for example detects a project wide\nchange that requires such a calculation.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + } + ], + "documentation": "Client workspace capabilities specific to folding ranges\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "TextDocumentSyncClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether text document synchronization supports dynamic registration." + }, + { + "name": "willSave", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports sending will save notifications." + }, + { + "name": "willSaveWaitUntil", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports sending a will save request and\nwaits for a response providing text edits which will\nbe applied to the document before it is saved." + }, + { + "name": "didSave", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports did save notifications." + } + ] + }, + { + "name": "CompletionClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether completion supports dynamic registration." + }, + { + "name": "completionItem", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "snippetSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Client supports snippets as insert text.\n\nA snippet can define tab stops and placeholders with `$1`, `$2`\nand `${3:foo}`. `$0` defines the final tab stop, it defaults to\nthe end of the snippet. Placeholders with equal identifiers are linked,\nthat is typing in one will update others too." + }, + { + "name": "commitCharactersSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Client supports commit characters on a completion item." + }, + { + "name": "documentationFormat", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "MarkupKind" + } + }, + "optional": true, + "documentation": "Client supports the following content formats for the documentation\nproperty. The order describes the preferred format of the client." + }, + { + "name": "deprecatedSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Client supports the deprecated property on a completion item." + }, + { + "name": "preselectSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Client supports the preselect property on a completion item." + }, + { + "name": "tagSupport", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "valueSet", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CompletionItemTag" + } + }, + "documentation": "The tags supported by the client." + } + ] + } + }, + "optional": true, + "documentation": "Client supports the tag property on a completion item. Clients supporting\ntags have to handle unknown tags gracefully. Clients especially need to\npreserve unknown tags when sending a completion item back to the server in\na resolve call.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "insertReplaceSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Client support insert replace edit to control different behavior if a\ncompletion item is inserted in the text or should replace text.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "resolveSupport", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "properties", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "documentation": "The properties that a client can resolve lazily." + } + ] + } + }, + "optional": true, + "documentation": "Indicates which properties a client can resolve lazily on a completion\nitem. Before version 3.16.0 only the predefined properties `documentation`\nand `details` could be resolved lazily.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "insertTextModeSupport", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "valueSet", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "InsertTextMode" + } + } + } + ] + } + }, + "optional": true, + "documentation": "The client supports the `insertTextMode` property on\na completion item to override the whitespace handling mode\nas defined by the client (see `insertTextMode`).\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "labelDetailsSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client has support for completion item label\ndetails (see also `CompletionItemLabelDetails`).\n\n@since 3.17.0", + "since": "3.17.0" + } + ] + } + }, + "optional": true, + "documentation": "The client supports the following `CompletionItem` specific\ncapabilities." + }, + { + "name": "completionItemKind", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "valueSet", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CompletionItemKind" + } + }, + "optional": true, + "documentation": "The completion item kind values the client supports. When this\nproperty exists the client also guarantees that it will\nhandle values outside its set gracefully and falls back\nto a default value when unknown.\n\nIf this property is not present the client only supports\nthe completion items kinds from `Text` to `Reference` as defined in\nthe initial version of the protocol." + } + ] + } + }, + "optional": true + }, + { + "name": "insertTextMode", + "type": { + "kind": "reference", + "name": "InsertTextMode" + }, + "optional": true, + "documentation": "Defines how the client handles whitespace and indentation\nwhen accepting a completion item that uses multi line\ntext in either `insertText` or `textEdit`.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "contextSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports to send additional context information for a\n`textDocument/completion` request." + }, + { + "name": "completionList", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "itemDefaults", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "optional": true, + "documentation": "The client supports the following itemDefaults on\na completion list.\n\nThe value lists the supported property names of the\n`CompletionList.itemDefaults` object. If omitted\nno properties are supported.\n\n@since 3.17.0", + "since": "3.17.0" + } + ] + } + }, + "optional": true, + "documentation": "The client supports the following `CompletionList` specific\ncapabilities.\n\n@since 3.17.0", + "since": "3.17.0" + } + ], + "documentation": "Completion client capabilities" + }, + { + "name": "HoverClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether hover supports dynamic registration." + }, + { + "name": "contentFormat", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "MarkupKind" + } + }, + "optional": true, + "documentation": "Client supports the following content formats for the content\nproperty. The order describes the preferred format of the client." + } + ] + }, + { + "name": "SignatureHelpClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether signature help supports dynamic registration." + }, + { + "name": "signatureInformation", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "documentationFormat", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "MarkupKind" + } + }, + "optional": true, + "documentation": "Client supports the following content formats for the documentation\nproperty. The order describes the preferred format of the client." + }, + { + "name": "parameterInformation", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "labelOffsetSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports processing label offsets instead of a\nsimple label string.\n\n@since 3.14.0", + "since": "3.14.0" + } + ] + } + }, + "optional": true, + "documentation": "Client capabilities specific to parameter information." + }, + { + "name": "activeParameterSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports the `activeParameter` property on `SignatureInformation`\nliteral.\n\n@since 3.16.0", + "since": "3.16.0" + } + ] + } + }, + "optional": true, + "documentation": "The client supports the following `SignatureInformation`\nspecific properties." + }, + { + "name": "contextSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports to send additional context information for a\n`textDocument/signatureHelp` request. A client that opts into\ncontextSupport will also support the `retriggerCharacters` on\n`SignatureHelpOptions`.\n\n@since 3.15.0", + "since": "3.15.0" + } + ], + "documentation": "Client Capabilities for a {@link SignatureHelpRequest}." + }, + { + "name": "DeclarationClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether declaration supports dynamic registration. If this is set to `true`\nthe client supports the new `DeclarationRegistrationOptions` return value\nfor the corresponding server capability as well." + }, + { + "name": "linkSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports additional metadata in the form of declaration links." + } + ], + "documentation": "@since 3.14.0", + "since": "3.14.0" + }, + { + "name": "DefinitionClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether definition supports dynamic registration." + }, + { + "name": "linkSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports additional metadata in the form of definition links.\n\n@since 3.14.0", + "since": "3.14.0" + } + ], + "documentation": "Client Capabilities for a {@link DefinitionRequest}." + }, + { + "name": "TypeDefinitionClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `TypeDefinitionRegistrationOptions` return value\nfor the corresponding server capability as well." + }, + { + "name": "linkSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports additional metadata in the form of definition links.\n\nSince 3.14.0" + } + ], + "documentation": "Since 3.6.0" + }, + { + "name": "ImplementationClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `ImplementationRegistrationOptions` return value\nfor the corresponding server capability as well." + }, + { + "name": "linkSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports additional metadata in the form of definition links.\n\n@since 3.14.0", + "since": "3.14.0" + } + ], + "documentation": "@since 3.6.0", + "since": "3.6.0" + }, + { + "name": "ReferenceClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether references supports dynamic registration." + } + ], + "documentation": "Client Capabilities for a {@link ReferencesRequest}." + }, + { + "name": "DocumentHighlightClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether document highlight supports dynamic registration." + } + ], + "documentation": "Client Capabilities for a {@link DocumentHighlightRequest}." + }, + { + "name": "DocumentSymbolClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether document symbol supports dynamic registration." + }, + { + "name": "symbolKind", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "valueSet", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "SymbolKind" + } + }, + "optional": true, + "documentation": "The symbol kind values the client supports. When this\nproperty exists the client also guarantees that it will\nhandle values outside its set gracefully and falls back\nto a default value when unknown.\n\nIf this property is not present the client only supports\nthe symbol kinds from `File` to `Array` as defined in\nthe initial version of the protocol." + } + ] + } + }, + "optional": true, + "documentation": "Specific capabilities for the `SymbolKind` in the\n`textDocument/documentSymbol` request." + }, + { + "name": "hierarchicalDocumentSymbolSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports hierarchical document symbols." + }, + { + "name": "tagSupport", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "valueSet", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "SymbolTag" + } + }, + "documentation": "The tags supported by the client." + } + ] + } + }, + "optional": true, + "documentation": "The client supports tags on `SymbolInformation`. Tags are supported on\n`DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true.\nClients supporting tags have to handle unknown tags gracefully.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "labelSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports an additional label presented in the UI when\nregistering a document symbol provider.\n\n@since 3.16.0", + "since": "3.16.0" + } + ], + "documentation": "Client Capabilities for a {@link DocumentSymbolRequest}." + }, + { + "name": "CodeActionClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether code action supports dynamic registration." + }, + { + "name": "codeActionLiteralSupport", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "codeActionKind", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "valueSet", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CodeActionKind" + } + }, + "documentation": "The code action kind values the client supports. When this\nproperty exists the client also guarantees that it will\nhandle values outside its set gracefully and falls back\nto a default value when unknown." + } + ] + } + }, + "documentation": "The code action kind is support with the following value\nset." + } + ] + } + }, + "optional": true, + "documentation": "The client support code action literals of type `CodeAction` as a valid\nresponse of the `textDocument/codeAction` request. If the property is not\nset the request can only return `Command` literals.\n\n@since 3.8.0", + "since": "3.8.0" + }, + { + "name": "isPreferredSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether code action supports the `isPreferred` property.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "disabledSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether code action supports the `disabled` property.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "dataSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether code action supports the `data` property which is\npreserved between a `textDocument/codeAction` and a\n`codeAction/resolve` request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "resolveSupport", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "properties", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "documentation": "The properties that a client can resolve lazily." + } + ] + } + }, + "optional": true, + "documentation": "Whether the client supports resolving additional code action\nproperties via a separate `codeAction/resolve` request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "honorsChangeAnnotations", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client honors the change annotations in\ntext edits and resource operations returned via the\n`CodeAction#edit` property by for example presenting\nthe workspace edit in the user interface and asking\nfor confirmation.\n\n@since 3.16.0", + "since": "3.16.0" + } + ], + "documentation": "The Client Capabilities of a {@link CodeActionRequest}." + }, + { + "name": "CodeLensClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether code lens supports dynamic registration." + } + ], + "documentation": "The client capabilities of a {@link CodeLensRequest}." + }, + { + "name": "DocumentLinkClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether document link supports dynamic registration." + }, + { + "name": "tooltipSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client supports the `tooltip` property on `DocumentLink`.\n\n@since 3.15.0", + "since": "3.15.0" + } + ], + "documentation": "The client capabilities of a {@link DocumentLinkRequest}." + }, + { + "name": "DocumentColorClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `DocumentColorRegistrationOptions` return value\nfor the corresponding server capability as well." + } + ] + }, + { + "name": "DocumentFormattingClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether formatting supports dynamic registration." + } + ], + "documentation": "Client capabilities of a {@link DocumentFormattingRequest}." + }, + { + "name": "DocumentRangeFormattingClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether range formatting supports dynamic registration." + }, + { + "name": "rangesSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client supports formatting multiple ranges at once.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + } + ], + "documentation": "Client capabilities of a {@link DocumentRangeFormattingRequest}." + }, + { + "name": "DocumentOnTypeFormattingClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether on type formatting supports dynamic registration." + } + ], + "documentation": "Client capabilities of a {@link DocumentOnTypeFormattingRequest}." + }, + { + "name": "RenameClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether rename supports dynamic registration." + }, + { + "name": "prepareSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Client supports testing for validity of rename operations\nbefore execution.\n\n@since 3.12.0", + "since": "3.12.0" + }, + { + "name": "prepareSupportDefaultBehavior", + "type": { + "kind": "reference", + "name": "PrepareSupportDefaultBehavior" + }, + "optional": true, + "documentation": "Client supports the default behavior result.\n\nThe value indicates the default behavior used by the\nclient.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "honorsChangeAnnotations", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client honors the change annotations in\ntext edits and resource operations returned via the\nrename request's workspace edit by for example presenting\nthe workspace edit in the user interface and asking\nfor confirmation.\n\n@since 3.16.0", + "since": "3.16.0" + } + ] + }, + { + "name": "FoldingRangeClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration for folding range\nproviders. If this is set to `true` the client supports the new\n`FoldingRangeRegistrationOptions` return value for the corresponding\nserver capability as well." + }, + { + "name": "rangeLimit", + "type": { + "kind": "base", + "name": "uinteger" + }, + "optional": true, + "documentation": "The maximum number of folding ranges that the client prefers to receive\nper document. The value serves as a hint, servers are free to follow the\nlimit." + }, + { + "name": "lineFoldingOnly", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "If set, the client signals that it only supports folding complete lines.\nIf set, client will ignore specified `startCharacter` and `endCharacter`\nproperties in a FoldingRange." + }, + { + "name": "foldingRangeKind", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "valueSet", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "FoldingRangeKind" + } + }, + "optional": true, + "documentation": "The folding range kind values the client supports. When this\nproperty exists the client also guarantees that it will\nhandle values outside its set gracefully and falls back\nto a default value when unknown." + } + ] + } + }, + "optional": true, + "documentation": "Specific options for the folding range kind.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "foldingRange", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "collapsedText", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "If set, the client signals that it supports setting collapsedText on\nfolding ranges to display custom labels instead of the default text.\n\n@since 3.17.0", + "since": "3.17.0" + } + ] + } + }, + "optional": true, + "documentation": "Specific options for the folding range.\n\n@since 3.17.0", + "since": "3.17.0" + } + ] + }, + { + "name": "SelectionRangeClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration for selection range providers. If this is set to `true`\nthe client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server\ncapability as well." + } + ] + }, + { + "name": "PublishDiagnosticsClientCapabilities", + "properties": [ + { + "name": "relatedInformation", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the clients accepts diagnostics with related information." + }, + { + "name": "tagSupport", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "valueSet", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "DiagnosticTag" + } + }, + "documentation": "The tags supported by the client." + } + ] + } + }, + "optional": true, + "documentation": "Client supports the tag property to provide meta data about a diagnostic.\nClients supporting tags have to handle unknown tags gracefully.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "versionSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client interprets the version property of the\n`textDocument/publishDiagnostics` notification's parameter.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "codeDescriptionSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Client supports a codeDescription property\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "dataSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether code action supports the `data` property which is\npreserved between a `textDocument/publishDiagnostics` and\n`textDocument/codeAction` request.\n\n@since 3.16.0", + "since": "3.16.0" + } + ], + "documentation": "The publish diagnostic client capabilities." + }, + { + "name": "CallHierarchyClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`\nreturn value for the corresponding server capability as well." + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "SemanticTokensClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`\nreturn value for the corresponding server capability as well." + }, + { + "name": "requests", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "range", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "literal", + "value": { + "properties": [] + } + } + ] + }, + "optional": true, + "documentation": "The client will send the `textDocument/semanticTokens/range` request if\nthe server provides a corresponding handler." + }, + { + "name": "full", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "delta", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client will send the `textDocument/semanticTokens/full/delta` request if\nthe server provides a corresponding handler." + } + ] + } + } + ] + }, + "optional": true, + "documentation": "The client will send the `textDocument/semanticTokens/full` request if\nthe server provides a corresponding handler." + } + ] + } + }, + "documentation": "Which requests the client supports and might send to the server\ndepending on the server's capability. Please note that clients might not\nshow semantic tokens or degrade some of the user experience if a range\nor full request is advertised by the client but not provided by the\nserver. If for example the client capability `requests.full` and\n`request.range` are both set to true but the server only provides a\nrange provider the client might not render a minimap correctly or might\neven decide to not show any semantic tokens at all." + }, + { + "name": "tokenTypes", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "documentation": "The token types that the client supports." + }, + { + "name": "tokenModifiers", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "documentation": "The token modifiers that the client supports." + }, + { + "name": "formats", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "TokenFormat" + } + }, + "documentation": "The token formats the clients supports." + }, + { + "name": "overlappingTokenSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client supports tokens that can overlap each other." + }, + { + "name": "multilineTokenSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client supports tokens that can span multiple lines." + }, + { + "name": "serverCancelSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client allows the server to actively cancel a\nsemantic token request, e.g. supports returning\nLSPErrorCodes.ServerCancelled. If a server does the client\nneeds to retrigger the request.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "augmentsSyntaxTokens", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client uses semantic tokens to augment existing\nsyntax tokens. If set to `true` client side created syntax\ntokens and semantic tokens are both used for colorization. If\nset to `false` the client only uses the returned semantic tokens\nfor colorization.\n\nIf the value is `undefined` then the client behavior is not\nspecified.\n\n@since 3.17.0", + "since": "3.17.0" + } + ], + "documentation": "@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "LinkedEditingRangeClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`\nreturn value for the corresponding server capability as well." + } + ], + "documentation": "Client capabilities for the linked editing range request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "MonikerClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether moniker supports dynamic registration. If this is set to `true`\nthe client supports the new `MonikerRegistrationOptions` return value\nfor the corresponding server capability as well." + } + ], + "documentation": "Client capabilities specific to the moniker request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "TypeHierarchyClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`\nreturn value for the corresponding server capability as well." + } + ], + "documentation": "@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlineValueClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration for inline value providers." + } + ], + "documentation": "Client capabilities specific to inline values.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlayHintClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether inlay hints support dynamic registration." + }, + { + "name": "resolveSupport", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "properties", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "documentation": "The properties that a client can resolve lazily." + } + ] + } + }, + "optional": true, + "documentation": "Indicates which properties a client can resolve lazily on an inlay\nhint." + } + ], + "documentation": "Inlay hint client capabilities.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "DiagnosticClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`\nreturn value for the corresponding server capability as well." + }, + { + "name": "relatedDocumentSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the clients supports related documents for document diagnostic pulls." + } + ], + "documentation": "Client capabilities specific to diagnostic pull requests.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "InlineCompletionClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration for inline completion providers." + } + ], + "documentation": "Client capabilities specific to inline completions.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "NotebookDocumentSyncClientCapabilities", + "properties": [ + { + "name": "dynamicRegistration", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether implementation supports dynamic registration. If this is\nset to `true` the client supports the new\n`(TextDocumentRegistrationOptions & StaticRegistrationOptions)`\nreturn value for the corresponding server capability as well." + }, + { + "name": "executionSummarySupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "The client supports sending execution summary data per cell." + } + ], + "documentation": "Notebook specific client capabilities.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "ShowMessageRequestClientCapabilities", + "properties": [ + { + "name": "messageActionItem", + "type": { + "kind": "literal", + "value": { + "properties": [ + { + "name": "additionalPropertiesSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Whether the client supports additional attributes which\nare preserved and send back to the server in the\nrequest's response." + } + ] + } + }, + "optional": true, + "documentation": "Capabilities specific to the `MessageActionItem` type." + } + ], + "documentation": "Show message request client capabilities" + }, + { + "name": "ShowDocumentClientCapabilities", + "properties": [ + { + "name": "support", + "type": { + "kind": "base", + "name": "boolean" + }, + "documentation": "The client has support for the showDocument\nrequest." + } + ], + "documentation": "Client capabilities for the showDocument request.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "RegularExpressionsClientCapabilities", + "properties": [ + { + "name": "engine", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The engine's name." + }, + { + "name": "version", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The engine's version." + } + ], + "documentation": "Client capabilities specific to regular expressions.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "MarkdownClientCapabilities", + "properties": [ + { + "name": "parser", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The name of the parser." + }, + { + "name": "version", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The version of the parser." + }, + { + "name": "allowedTags", + "type": { + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } + }, + "optional": true, + "documentation": "A list of HTML tags that the client allows / supports in\nMarkdown.\n\n@since 3.17.0", + "since": "3.17.0" + } + ], + "documentation": "Client capabilities specific to the used markdown parser.\n\n@since 3.16.0", + "since": "3.16.0" + } + ], + "enumerations": [ + { + "name": "SemanticTokenTypes", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "namespace", + "value": "namespace" + }, + { + "name": "type", + "value": "type", + "documentation": "Represents a generic type. Acts as a fallback for types which can't be mapped to\na specific type like class or enum." + }, + { + "name": "class", + "value": "class" + }, + { + "name": "enum", + "value": "enum" + }, + { + "name": "interface", + "value": "interface" + }, + { + "name": "struct", + "value": "struct" + }, + { + "name": "typeParameter", + "value": "typeParameter" + }, + { + "name": "parameter", + "value": "parameter" + }, + { + "name": "variable", + "value": "variable" + }, + { + "name": "property", + "value": "property" + }, + { + "name": "enumMember", + "value": "enumMember" + }, + { + "name": "event", + "value": "event" + }, + { + "name": "function", + "value": "function" + }, + { + "name": "method", + "value": "method" + }, + { + "name": "macro", + "value": "macro" + }, + { + "name": "keyword", + "value": "keyword" + }, + { + "name": "modifier", + "value": "modifier" + }, + { + "name": "comment", + "value": "comment" + }, + { + "name": "string", + "value": "string" + }, + { + "name": "number", + "value": "number" + }, + { + "name": "regexp", + "value": "regexp" + }, + { + "name": "operator", + "value": "operator" + }, + { + "name": "decorator", + "value": "decorator", + "documentation": "@since 3.17.0", + "since": "3.17.0" + } + ], + "supportsCustomValues": true, + "documentation": "A set of predefined token types. This set is not fixed\nan clients can specify additional token types via the\ncorresponding client capabilities.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "SemanticTokenModifiers", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "declaration", + "value": "declaration" + }, + { + "name": "definition", + "value": "definition" + }, + { + "name": "readonly", + "value": "readonly" + }, + { + "name": "static", + "value": "static" + }, + { + "name": "deprecated", + "value": "deprecated" + }, + { + "name": "abstract", + "value": "abstract" + }, + { + "name": "async", + "value": "async" + }, + { + "name": "modification", + "value": "modification" + }, + { + "name": "documentation", + "value": "documentation" + }, + { + "name": "defaultLibrary", + "value": "defaultLibrary" + } + ], + "supportsCustomValues": true, + "documentation": "A set of predefined token modifiers. This set is not fixed\nan clients can specify additional token types via the\ncorresponding client capabilities.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "DocumentDiagnosticReportKind", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "Full", + "value": "full", + "documentation": "A diagnostic report with a full\nset of problems." + }, + { + "name": "Unchanged", + "value": "unchanged", + "documentation": "A report indicating that the last\nreturned report is still accurate." + } + ], + "documentation": "The document diagnostic report kinds.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "ErrorCodes", + "type": { + "kind": "base", + "name": "integer" + }, + "values": [ + { + "name": "ParseError", + "value": -32700 + }, + { + "name": "InvalidRequest", + "value": -32600 + }, + { + "name": "MethodNotFound", + "value": -32601 + }, + { + "name": "InvalidParams", + "value": -32602 + }, + { + "name": "InternalError", + "value": -32603 + }, + { + "name": "ServerNotInitialized", + "value": -32002, + "documentation": "Error code indicating that a server received a notification or\nrequest before the server has received the `initialize` request." + }, + { + "name": "UnknownErrorCode", + "value": -32001 + } + ], + "supportsCustomValues": true, + "documentation": "Predefined error codes." + }, + { + "name": "LSPErrorCodes", + "type": { + "kind": "base", + "name": "integer" + }, + "values": [ + { + "name": "RequestFailed", + "value": -32803, + "documentation": "A request failed but it was syntactically correct, e.g the\nmethod name was known and the parameters were valid. The error\nmessage should contain human readable information about why\nthe request failed.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "ServerCancelled", + "value": -32802, + "documentation": "The server cancelled the request. This error code should\nonly be used for requests that explicitly support being\nserver cancellable.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "ContentModified", + "value": -32801, + "documentation": "The server detected that the content of a document got\nmodified outside normal conditions. A server should\nNOT send this error code if it detects a content change\nin it unprocessed messages. The result even computed\non an older state might still be useful for the client.\n\nIf a client decides that a result is not of any use anymore\nthe client should cancel the request." + }, + { + "name": "RequestCancelled", + "value": -32800, + "documentation": "The client has canceled a request and a server as detected\nthe cancel." + } + ], + "supportsCustomValues": true + }, + { + "name": "FoldingRangeKind", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "Comment", + "value": "comment", + "documentation": "Folding range for a comment" + }, + { + "name": "Imports", + "value": "imports", + "documentation": "Folding range for an import or include" + }, + { + "name": "Region", + "value": "region", + "documentation": "Folding range for a region (e.g. `#region`)" + } + ], + "supportsCustomValues": true, + "documentation": "A set of predefined range kinds." + }, + { + "name": "SymbolKind", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "File", + "value": 1 + }, + { + "name": "Module", + "value": 2 + }, + { + "name": "Namespace", + "value": 3 + }, + { + "name": "Package", + "value": 4 + }, + { + "name": "Class", + "value": 5 + }, + { + "name": "Method", + "value": 6 + }, + { + "name": "Property", + "value": 7 + }, + { + "name": "Field", + "value": 8 + }, + { + "name": "Constructor", + "value": 9 + }, + { + "name": "Enum", + "value": 10 + }, + { + "name": "Interface", + "value": 11 + }, + { + "name": "Function", + "value": 12 + }, + { + "name": "Variable", + "value": 13 + }, + { + "name": "Constant", + "value": 14 + }, + { + "name": "String", + "value": 15 + }, + { + "name": "Number", + "value": 16 + }, + { + "name": "Boolean", + "value": 17 + }, + { + "name": "Array", + "value": 18 + }, + { + "name": "Object", + "value": 19 + }, + { + "name": "Key", + "value": 20 + }, + { + "name": "Null", + "value": 21 + }, + { + "name": "EnumMember", + "value": 22 + }, + { + "name": "Struct", + "value": 23 + }, + { + "name": "Event", + "value": 24 + }, + { + "name": "Operator", + "value": 25 + }, + { + "name": "TypeParameter", + "value": 26 + } + ], + "documentation": "A symbol kind." + }, + { + "name": "SymbolTag", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Deprecated", + "value": 1, + "documentation": "Render a symbol as obsolete, usually using a strike-out." + } + ], + "documentation": "Symbol tags are extra annotations that tweak the rendering of a symbol.\n\n@since 3.16", + "since": "3.16" + }, + { + "name": "UniquenessLevel", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "document", + "value": "document", + "documentation": "The moniker is only unique inside a document" + }, + { + "name": "project", + "value": "project", + "documentation": "The moniker is unique inside a project for which a dump got created" + }, + { + "name": "group", + "value": "group", + "documentation": "The moniker is unique inside the group to which a project belongs" + }, + { + "name": "scheme", + "value": "scheme", + "documentation": "The moniker is unique inside the moniker scheme." + }, + { + "name": "global", + "value": "global", + "documentation": "The moniker is globally unique" + } + ], + "documentation": "Moniker uniqueness level to define scope of the moniker.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "MonikerKind", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "import", + "value": "import", + "documentation": "The moniker represent a symbol that is imported into a project" + }, + { + "name": "export", + "value": "export", + "documentation": "The moniker represents a symbol that is exported from a project" + }, + { + "name": "local", + "value": "local", + "documentation": "The moniker represents a symbol that is local to a project (e.g. a local\nvariable of a function, a class not visible outside the project, ...)" + } + ], + "documentation": "The moniker kind.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "InlayHintKind", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Type", + "value": 1, + "documentation": "An inlay hint that for a type annotation." + }, + { + "name": "Parameter", + "value": 2, + "documentation": "An inlay hint that is for a parameter." + } + ], + "documentation": "Inlay hint kinds.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "MessageType", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Error", + "value": 1, + "documentation": "An error message." + }, + { + "name": "Warning", + "value": 2, + "documentation": "A warning message." + }, + { + "name": "Info", + "value": 3, + "documentation": "An information message." + }, + { + "name": "Log", + "value": 4, + "documentation": "A log message." + }, + { + "name": "Debug", + "value": 5, + "documentation": "A debug message.\n\n@since 3.18.0", + "since": "3.18.0" + } + ], + "documentation": "The message type" + }, + { + "name": "TextDocumentSyncKind", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "None", + "value": 0, + "documentation": "Documents should not be synced at all." + }, + { + "name": "Full", + "value": 1, + "documentation": "Documents are synced by always sending the full content\nof the document." + }, + { + "name": "Incremental", + "value": 2, + "documentation": "Documents are synced by sending the full content on open.\nAfter that only incremental updates to the document are\nsend." + } + ], + "documentation": "Defines how the host (editor) should sync\ndocument changes to the language server." + }, + { + "name": "TextDocumentSaveReason", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Manual", + "value": 1, + "documentation": "Manually triggered, e.g. by the user pressing save, by starting debugging,\nor by an API call." + }, + { + "name": "AfterDelay", + "value": 2, + "documentation": "Automatic after a delay." + }, + { + "name": "FocusOut", + "value": 3, + "documentation": "When the editor lost focus." + } + ], + "documentation": "Represents reasons why a text document is saved." + }, + { + "name": "CompletionItemKind", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Text", + "value": 1 + }, + { + "name": "Method", + "value": 2 + }, + { + "name": "Function", + "value": 3 + }, + { + "name": "Constructor", + "value": 4 + }, + { + "name": "Field", + "value": 5 + }, + { + "name": "Variable", + "value": 6 + }, + { + "name": "Class", + "value": 7 + }, + { + "name": "Interface", + "value": 8 + }, + { + "name": "Module", + "value": 9 + }, + { + "name": "Property", + "value": 10 + }, + { + "name": "Unit", + "value": 11 + }, + { + "name": "Value", + "value": 12 + }, + { + "name": "Enum", + "value": 13 + }, + { + "name": "Keyword", + "value": 14 + }, + { + "name": "Snippet", + "value": 15 + }, + { + "name": "Color", + "value": 16 + }, + { + "name": "File", + "value": 17 + }, + { + "name": "Reference", + "value": 18 + }, + { + "name": "Folder", + "value": 19 + }, + { + "name": "EnumMember", + "value": 20 + }, + { + "name": "Constant", + "value": 21 + }, + { + "name": "Struct", + "value": 22 + }, + { + "name": "Event", + "value": 23 + }, + { + "name": "Operator", + "value": 24 + }, + { + "name": "TypeParameter", + "value": 25 + } + ], + "documentation": "The kind of a completion entry." + }, + { + "name": "CompletionItemTag", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Deprecated", + "value": 1, + "documentation": "Render a completion as obsolete, usually using a strike-out." + } + ], + "documentation": "Completion item tags are extra annotations that tweak the rendering of a completion\nitem.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "InsertTextFormat", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "PlainText", + "value": 1, + "documentation": "The primary text to be inserted is treated as a plain string." + }, + { + "name": "Snippet", + "value": 2, + "documentation": "The primary text to be inserted is treated as a snippet.\n\nA snippet can define tab stops and placeholders with `$1`, `$2`\nand `${3:foo}`. `$0` defines the final tab stop, it defaults to\nthe end of the snippet. Placeholders with equal identifiers are linked,\nthat is typing in one will update others too.\n\nSee also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax" + } + ], + "documentation": "Defines whether the insert text in a completion item should be interpreted as\nplain text or a snippet." + }, + { + "name": "InsertTextMode", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "asIs", + "value": 1, + "documentation": "The insertion or replace strings is taken as it is. If the\nvalue is multi line the lines below the cursor will be\ninserted using the indentation defined in the string value.\nThe client will not apply any kind of adjustments to the\nstring." + }, + { + "name": "adjustIndentation", + "value": 2, + "documentation": "The editor adjusts leading whitespace of new lines so that\nthey match the indentation up to the cursor of the line for\nwhich the item is accepted.\n\nConsider a line like this: <2tabs><cursor><3tabs>foo. Accepting a\nmulti line completion item is indented using 2 tabs and all\nfollowing lines inserted will be indented using 2 tabs as well." + } + ], + "documentation": "How whitespace and indentation is handled during completion\nitem insertion.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "DocumentHighlightKind", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Text", + "value": 1, + "documentation": "A textual occurrence." + }, + { + "name": "Read", + "value": 2, + "documentation": "Read-access of a symbol, like reading a variable." + }, + { + "name": "Write", + "value": 3, + "documentation": "Write-access of a symbol, like writing to a variable." + } + ], + "documentation": "A document highlight kind." + }, + { + "name": "CodeActionKind", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "Empty", + "value": "", + "documentation": "Empty kind." + }, + { + "name": "QuickFix", + "value": "quickfix", + "documentation": "Base kind for quickfix actions: 'quickfix'" + }, + { + "name": "Refactor", + "value": "refactor", + "documentation": "Base kind for refactoring actions: 'refactor'" + }, + { + "name": "RefactorExtract", + "value": "refactor.extract", + "documentation": "Base kind for refactoring extraction actions: 'refactor.extract'\n\nExample extract actions:\n\n- Extract method\n- Extract function\n- Extract variable\n- Extract interface from class\n- ..." + }, + { + "name": "RefactorInline", + "value": "refactor.inline", + "documentation": "Base kind for refactoring inline actions: 'refactor.inline'\n\nExample inline actions:\n\n- Inline function\n- Inline variable\n- Inline constant\n- ..." + }, + { + "name": "RefactorRewrite", + "value": "refactor.rewrite", + "documentation": "Base kind for refactoring rewrite actions: 'refactor.rewrite'\n\nExample rewrite actions:\n\n- Convert JavaScript function to class\n- Add or remove parameter\n- Encapsulate field\n- Make method static\n- Move method to base class\n- ..." + }, + { + "name": "Source", + "value": "source", + "documentation": "Base kind for source actions: `source`\n\nSource code actions apply to the entire file." + }, + { + "name": "SourceOrganizeImports", + "value": "source.organizeImports", + "documentation": "Base kind for an organize imports source action: `source.organizeImports`" + }, + { + "name": "SourceFixAll", + "value": "source.fixAll", + "documentation": "Base kind for auto-fix source actions: `source.fixAll`.\n\nFix all actions automatically fix errors that have a clear fix that do not require user input.\nThey should not suppress errors or perform unsafe fixes such as generating new types or classes.\n\n@since 3.15.0", + "since": "3.15.0" + } + ], + "supportsCustomValues": true, + "documentation": "A set of predefined code action kinds" + }, + { + "name": "TraceValues", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "Off", + "value": "off", + "documentation": "Turn tracing off." + }, + { + "name": "Messages", + "value": "messages", + "documentation": "Trace messages only." + }, + { + "name": "Verbose", + "value": "verbose", + "documentation": "Verbose message tracing." + } + ] + }, + { + "name": "MarkupKind", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "PlainText", + "value": "plaintext", + "documentation": "Plain text is supported as a content format" + }, + { + "name": "Markdown", + "value": "markdown", + "documentation": "Markdown is supported as a content format" + } + ], + "documentation": "Describes the content type that a client supports in various\nresult literals like `Hover`, `ParameterInfo` or `CompletionItem`.\n\nPlease note that `MarkupKinds` must not start with a `$`. This kinds\nare reserved for internal usage." + }, + { + "name": "InlineCompletionTriggerKind", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Invoked", + "value": 0, + "documentation": "Completion was triggered explicitly by a user gesture." + }, + { + "name": "Automatic", + "value": 1, + "documentation": "Completion was triggered automatically while editing." + } + ], + "documentation": "Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, + { + "name": "PositionEncodingKind", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "UTF8", + "value": "utf-8", + "documentation": "Character offsets count UTF-8 code units (e.g. bytes)." + }, + { + "name": "UTF16", + "value": "utf-16", + "documentation": "Character offsets count UTF-16 code units.\n\nThis is the default and must always be supported\nby servers" + }, + { + "name": "UTF32", + "value": "utf-32", + "documentation": "Character offsets count UTF-32 code units.\n\nImplementation note: these are the same as Unicode codepoints,\nso this `PositionEncodingKind` may also be used for an\nencoding-agnostic representation of character offsets." + } + ], + "supportsCustomValues": true, + "documentation": "A set of predefined position encoding kinds.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "FileChangeType", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Created", + "value": 1, + "documentation": "The file got created." + }, + { + "name": "Changed", + "value": 2, + "documentation": "The file got changed." + }, + { + "name": "Deleted", + "value": 3, + "documentation": "The file got deleted." + } + ], + "documentation": "The file event type" + }, + { + "name": "WatchKind", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Create", + "value": 1, + "documentation": "Interested in create events." + }, + { + "name": "Change", + "value": 2, + "documentation": "Interested in change events" + }, + { + "name": "Delete", + "value": 4, + "documentation": "Interested in delete events" + } + ], + "supportsCustomValues": true + }, + { + "name": "DiagnosticSeverity", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Error", + "value": 1, + "documentation": "Reports an error." + }, + { + "name": "Warning", + "value": 2, + "documentation": "Reports a warning." + }, + { + "name": "Information", + "value": 3, + "documentation": "Reports an information." + }, + { + "name": "Hint", + "value": 4, + "documentation": "Reports a hint." + } + ], + "documentation": "The diagnostic's severity." + }, + { + "name": "DiagnosticTag", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Unnecessary", + "value": 1, + "documentation": "Unused or unnecessary code.\n\nClients are allowed to render diagnostics with this tag faded out instead of having\nan error squiggle." + }, + { + "name": "Deprecated", + "value": 2, + "documentation": "Deprecated or obsolete code.\n\nClients are allowed to rendered diagnostics with this tag strike through." + } + ], + "documentation": "The diagnostic tags.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "CompletionTriggerKind", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Invoked", + "value": 1, + "documentation": "Completion was triggered by typing an identifier (24x7 code\ncomplete), manual invocation (e.g Ctrl+Space) or via API." + }, + { + "name": "TriggerCharacter", + "value": 2, + "documentation": "Completion was triggered by a trigger character specified by\nthe `triggerCharacters` properties of the `CompletionRegistrationOptions`." + }, + { + "name": "TriggerForIncompleteCompletions", + "value": 3, + "documentation": "Completion was re-triggered as current completion list is incomplete" + } + ], + "documentation": "How a completion was triggered" + }, + { + "name": "SignatureHelpTriggerKind", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Invoked", + "value": 1, + "documentation": "Signature help was invoked manually by the user or by a command." + }, + { + "name": "TriggerCharacter", + "value": 2, + "documentation": "Signature help was triggered by a trigger character." + }, + { + "name": "ContentChange", + "value": 3, + "documentation": "Signature help was triggered by the cursor moving or by the document content changing." + } + ], + "documentation": "How a signature help was triggered.\n\n@since 3.15.0", + "since": "3.15.0" + }, + { + "name": "CodeActionTriggerKind", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Invoked", + "value": 1, + "documentation": "Code actions were explicitly requested by the user or by an extension." + }, + { + "name": "Automatic", + "value": 2, + "documentation": "Code actions were requested automatically.\n\nThis typically happens when current selection in a file changes, but can\nalso be triggered when file content changes." + } + ], + "documentation": "The reason why code actions were requested.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "FileOperationPatternKind", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "file", + "value": "file", + "documentation": "The pattern matches a file only." + }, + { + "name": "folder", + "value": "folder", + "documentation": "The pattern matches a folder only." + } + ], + "documentation": "A pattern kind describing if a glob pattern matches a file a folder or\nboth.\n\n@since 3.16.0", + "since": "3.16.0" + }, + { + "name": "NotebookCellKind", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Markup", + "value": 1, + "documentation": "A markup-cell is formatted source that is used for display." + }, + { + "name": "Code", + "value": 2, + "documentation": "A code-cell is source code." + } + ], + "documentation": "A notebook cell kind.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "ResourceOperationKind", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "Create", + "value": "create", + "documentation": "Supports creating new files and folders." + }, + { + "name": "Rename", + "value": "rename", + "documentation": "Supports renaming existing files and folders." + }, + { + "name": "Delete", + "value": "delete", + "documentation": "Supports deleting existing files and folders." + } + ] + }, + { + "name": "FailureHandlingKind", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "Abort", + "value": "abort", + "documentation": "Applying the workspace change is simply aborted if one of the changes provided\nfails. All operations executed before the failing operation stay executed." + }, + { + "name": "Transactional", + "value": "transactional", + "documentation": "All operations are executed transactional. That means they either all\nsucceed or no changes at all are applied to the workspace." + }, + { + "name": "TextOnlyTransactional", + "value": "textOnlyTransactional", + "documentation": "If the workspace edit contains only textual file changes they are executed transactional.\nIf resource changes (create, rename or delete file) are part of the change the failure\nhandling strategy is abort." + }, + { + "name": "Undo", + "value": "undo", + "documentation": "The client tries to undo the operations already executed. But there is no\nguarantee that this is succeeding." + } + ] + }, + { + "name": "PrepareSupportDefaultBehavior", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "Identifier", + "value": 1, + "documentation": "The client's default behavior is to select the identifier\naccording the to language's syntax rule." + } + ] + }, + { + "name": "TokenFormat", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "Relative", + "value": "relative" + } + ] + } + ], + "typeAliases": [ + { + "name": "Definition", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Location" + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "Location" + } + } + ] + }, + "documentation": "The definition of a symbol represented as one or many {@link Location locations}.\nFor most programming languages there is only one location at which a symbol is\ndefined.\n\nServers should prefer returning `DefinitionLink` over `Definition` if supported\nby the client." + }, + { + "name": "DefinitionLink", + "type": { + "kind": "reference", + "name": "LocationLink" + }, + "documentation": "Information about where a symbol is defined.\n\nProvides additional metadata over normal {@link Location location} definitions, including the range of\nthe defining symbol" + }, + { + "name": "LSPArray", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "LSPAny" + } + }, + "documentation": "LSP arrays.\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "LSPAny", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "LSPObject" + }, + { + "kind": "reference", + "name": "LSPArray" + }, + { + "kind": "base", + "name": "string" + }, + { + "kind": "base", + "name": "integer" + }, + { + "kind": "base", + "name": "uinteger" + }, + { + "kind": "base", + "name": "decimal" + }, + { + "kind": "base", + "name": "boolean" + }, + { + "kind": "base", + "name": "null" + } + ] + }, + "documentation": "The LSP any type.\nPlease note that strictly speaking a property with the value `undefined`\ncan't be converted into JSON preserving the property name. However for\nconvenience it is allowed and assumed that all these properties are\noptional as well.\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "Declaration", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Location" + }, + { + "kind": "array", + "element": { + "kind": "reference", + "name": "Location" + } + } + ] + }, + "documentation": "The declaration of a symbol representation as one or many {@link Location locations}." + }, + { + "name": "DeclarationLink", + "type": { + "kind": "reference", + "name": "LocationLink" + }, + "documentation": "Information about where a symbol is declared.\n\nProvides additional metadata over normal {@link Location location} declarations, including the range of\nthe declaring symbol.\n\nServers should prefer returning `DeclarationLink` over `Declaration` if supported\nby the client." + }, + { + "name": "InlineValue", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "InlineValueText" + }, + { + "kind": "reference", + "name": "InlineValueVariableLookup" + }, + { + "kind": "reference", + "name": "InlineValueEvaluatableExpression" + } + ] + }, + "documentation": "Inline value information can be provided by different means:\n- directly as a text value (class InlineValueText).\n- as a name to use for a variable lookup (class InlineValueVariableLookup)\n- as an evaluatable expression (class InlineValueEvaluatableExpression)\nThe InlineValue types combines all inline value types into one type.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "DocumentDiagnosticReport", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "RelatedFullDocumentDiagnosticReport" + }, + { + "kind": "reference", + "name": "RelatedUnchangedDocumentDiagnosticReport" + } + ] + }, + "documentation": "The result of a document diagnostic pull request. A report can\neither be a full report containing all diagnostics for the\nrequested document or an unchanged report indicating that nothing\nhas changed in terms of diagnostics in comparison to the last\npull request.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "PrepareRenameResult", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Range" + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + } + }, + { + "name": "placeholder", + "type": { + "kind": "base", + "name": "string" + } + } + ] + } + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "defaultBehavior", + "type": { + "kind": "base", + "name": "boolean" + } + } + ] + } + } + ] + } + }, + { + "name": "DocumentSelector", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "DocumentFilter" + } + }, + "documentation": "A document selector is the combination of one or many document filters.\n\n@sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`;\n\nThe use of a string as a document filter is deprecated @since 3.16.0.", + "since": "3.16.0." + }, + { + "name": "ProgressToken", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "integer" + }, + { + "kind": "base", + "name": "string" + } + ] + } + }, + { + "name": "ChangeAnnotationIdentifier", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "An identifier to refer to a change annotation stored with a workspace edit." + }, + { + "name": "WorkspaceDocumentDiagnosticReport", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "WorkspaceFullDocumentDiagnosticReport" + }, + { + "kind": "reference", + "name": "WorkspaceUnchangedDocumentDiagnosticReport" + } + ] + }, + "documentation": "A workspace diagnostic document report.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "TextDocumentContentChangeEvent", + "type": { + "kind": "or", + "items": [ + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "range", + "type": { + "kind": "reference", + "name": "Range" + }, + "documentation": "The range of the document that changed." + }, + { + "name": "rangeLength", + "type": { + "kind": "base", + "name": "uinteger" + }, + "optional": true, + "documentation": "The optional length of the range that got replaced.\n\n@deprecated use range instead." + }, + { + "name": "text", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The new text for the provided range." + } + ] + } + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "text", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The new text of the whole document." + } + ] + } + } + ] + }, + "documentation": "An event describing a change to a text document. If only a text is provided\nit is considered to be the full content of the document." + }, + { + "name": "MarkedString", + "type": { + "kind": "or", + "items": [ + { + "kind": "base", + "name": "string" + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "language", + "type": { + "kind": "base", + "name": "string" + } + }, + { + "name": "value", + "type": { + "kind": "base", + "name": "string" + } + } + ] + } + } + ] + }, + "documentation": "MarkedString can be used to render human readable text. It is either a markdown string\nor a code-block that provides a language and a code snippet. The language identifier\nis semantically equal to the optional language identifier in fenced code blocks in GitHub\nissues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting\n\nThe pair of a language and a value is an equivalent to markdown:\n```${language}\n${value}\n```\n\nNote that markdown strings will be sanitized - that means html will be escaped.\n@deprecated use MarkupContent instead.", + "deprecated": "use MarkupContent instead." + }, + { + "name": "DocumentFilter", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "TextDocumentFilter" + }, + { + "kind": "reference", + "name": "NotebookCellTextDocumentFilter" + } + ] + }, + "documentation": "A document filter describes a top level text document or\na notebook cell document.\n\n@since 3.17.0 - proposed support for NotebookCellTextDocumentFilter.", + "since": "3.17.0 - proposed support for NotebookCellTextDocumentFilter." + }, + { + "name": "LSPObject", + "type": { + "kind": "map", + "key": { + "kind": "base", + "name": "string" + }, + "value": { + "kind": "reference", + "name": "LSPAny" + } + }, + "documentation": "LSP object definition.\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "GlobPattern", + "type": { + "kind": "or", + "items": [ + { + "kind": "reference", + "name": "Pattern" + }, + { + "kind": "reference", + "name": "RelativePattern" + } + ] + }, + "documentation": "The glob pattern. Either a string pattern or a relative pattern.\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "TextDocumentFilter", + "type": { + "kind": "or", + "items": [ + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "language", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A language id, like `typescript`." + }, + { + "name": "scheme", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A Uri {@link Uri.scheme scheme}, like `file` or `untitled`." + }, + { + "name": "pattern", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples." + } + ] + } + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "language", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A language id, like `typescript`." + }, + { + "name": "scheme", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A Uri {@link Uri.scheme scheme}, like `file` or `untitled`." + }, + { + "name": "pattern", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples." + } + ] + } + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "language", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A language id, like `typescript`." + }, + { + "name": "scheme", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A Uri {@link Uri.scheme scheme}, like `file` or `untitled`." + }, + { + "name": "pattern", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples." + } + ] + } + } + ] + }, + "documentation": "A document filter denotes a document by different properties like\nthe {@link TextDocument.languageId language}, the {@link Uri.scheme scheme} of\nits resource, or a glob-pattern that is applied to the {@link TextDocument.fileName path}.\n\nGlob patterns can have the following syntax:\n- `*` to match one or more characters in a path segment\n- `?` to match on one character in a path segment\n- `**` to match any number of path segments, including none\n- `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)\n- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)\n- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)\n\n@sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`\n@sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "NotebookDocumentFilter", + "type": { + "kind": "or", + "items": [ + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "notebookType", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The type of the enclosing notebook." + }, + { + "name": "scheme", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A Uri {@link Uri.scheme scheme}, like `file` or `untitled`." + }, + { + "name": "pattern", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A glob pattern." + } + ] + } + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "notebookType", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The type of the enclosing notebook." + }, + { + "name": "scheme", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A Uri {@link Uri.scheme scheme}, like `file` or `untitled`." + }, + { + "name": "pattern", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A glob pattern." + } + ] + } + }, + { + "kind": "literal", + "value": { + "properties": [ + { + "name": "notebookType", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "The type of the enclosing notebook." + }, + { + "name": "scheme", + "type": { + "kind": "base", + "name": "string" + }, + "optional": true, + "documentation": "A Uri {@link Uri.scheme scheme}, like `file` or `untitled`." + }, + { + "name": "pattern", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "A glob pattern." + } + ] + } + } + ] + }, + "documentation": "A notebook document filter denotes a notebook document by\ndifferent properties. The properties will be match\nagainst the notebook's URI (same as with documents)\n\n@since 3.17.0", + "since": "3.17.0" + }, + { + "name": "Pattern", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The glob pattern to watch relative to the base path. Glob patterns can have the following syntax:\n- `*` to match one or more characters in a path segment\n- `?` to match on one character in a path segment\n- `**` to match any number of path segments, including none\n- `{}` to group conditions (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)\n- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)\n- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)\n\n@since 3.17.0", + "since": "3.17.0" + } + ] +} diff --git a/generator/lsp.schema.json b/generator/lsp.schema.json new file mode 100644 index 0000000..e40764b --- /dev/null +++ b/generator/lsp.schema.json @@ -0,0 +1,783 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "AndType": { + "additionalProperties": false, + "description": "Represents an `and`type (e.g. TextDocumentParams & WorkDoneProgressParams`).", + "properties": { + "items": { + "items": { + "$ref": "#/definitions/Type" + }, + "type": "array" + }, + "kind": { + "const": "and", + "type": "string" + } + }, + "required": [ + "kind", + "items" + ], + "type": "object" + }, + "ArrayType": { + "additionalProperties": false, + "description": "Represents an array type (e.g. `TextDocument[]`).", + "properties": { + "element": { + "$ref": "#/definitions/Type" + }, + "kind": { + "const": "array", + "type": "string" + } + }, + "required": [ + "kind", + "element" + ], + "type": "object" + }, + "BaseType": { + "additionalProperties": false, + "description": "Represents a base type like `string` or `DocumentUri`.", + "properties": { + "kind": { + "const": "base", + "type": "string" + }, + "name": { + "$ref": "#/definitions/BaseTypes" + } + }, + "required": [ + "kind", + "name" + ], + "type": "object" + }, + "BaseTypes": { + "enum": [ + "URI", + "DocumentUri", + "integer", + "uinteger", + "decimal", + "RegExp", + "string", + "boolean", + "null" + ], + "type": "string" + }, + "BooleanLiteralType": { + "additionalProperties": false, + "description": "Represents a boolean literal type (e.g. `kind: true`).", + "properties": { + "kind": { + "const": "booleanLiteral", + "type": "string" + }, + "value": { + "type": "boolean" + } + }, + "required": [ + "kind", + "value" + ], + "type": "object" + }, + "Enumeration": { + "additionalProperties": false, + "description": "Defines an enumeration.", + "properties": { + "deprecated": { + "description": "Whether the enumeration is deprecated or not. If deprecated the property contains the deprecation message.", + "type": "string" + }, + "documentation": { + "description": "An optional documentation.", + "type": "string" + }, + "name": { + "description": "The name of the enumeration.", + "type": "string" + }, + "proposed": { + "description": "Whether this is a proposed enumeration. If omitted, the enumeration is final.", + "type": "boolean" + }, + "since": { + "description": "Since when (release number) this enumeration is available. Is undefined if not known.", + "type": "string" + }, + "supportsCustomValues": { + "description": "Whether the enumeration supports custom values (e.g. values which are not part of the set defined in `values`). If omitted no custom values are supported.", + "type": "boolean" + }, + "type": { + "$ref": "#/definitions/EnumerationType", + "description": "The type of the elements." + }, + "values": { + "description": "The enum values.", + "items": { + "$ref": "#/definitions/EnumerationEntry" + }, + "type": "array" + } + }, + "required": [ + "name", + "type", + "values" + ], + "type": "object" + }, + "EnumerationEntry": { + "additionalProperties": false, + "description": "Defines an enumeration entry.", + "properties": { + "deprecated": { + "description": "Whether the enum entry is deprecated or not. If deprecated the property contains the deprecation message.", + "type": "string" + }, + "documentation": { + "description": "An optional documentation.", + "type": "string" + }, + "name": { + "description": "The name of the enum item.", + "type": "string" + }, + "proposed": { + "description": "Whether this is a proposed enumeration entry. If omitted, the enumeration entry is final.", + "type": "boolean" + }, + "since": { + "description": "Since when (release number) this enumeration entry is available. Is undefined if not known.", + "type": "string" + }, + "value": { + "description": "The value.", + "type": [ + "string", + "number" + ] + } + }, + "required": [ + "name", + "value" + ], + "type": "object" + }, + "EnumerationType": { + "additionalProperties": false, + "properties": { + "kind": { + "const": "base", + "type": "string" + }, + "name": { + "enum": [ + "string", + "integer", + "uinteger" + ], + "type": "string" + } + }, + "required": [ + "kind", + "name" + ], + "type": "object" + }, + "IntegerLiteralType": { + "additionalProperties": false, + "properties": { + "kind": { + "const": "integerLiteral", + "description": "Represents an integer literal type (e.g. `kind: 1`).", + "type": "string" + }, + "value": { + "type": "number" + } + }, + "required": [ + "kind", + "value" + ], + "type": "object" + }, + "MapKeyType": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "kind": { + "const": "base", + "type": "string" + }, + "name": { + "enum": [ + "URI", + "DocumentUri", + "string", + "integer" + ], + "type": "string" + } + }, + "required": [ + "kind", + "name" + ], + "type": "object" + }, + { + "$ref": "#/definitions/ReferenceType" + } + ], + "description": "Represents a type that can be used as a key in a map type. If a reference type is used then the type must either resolve to a `string` or `integer` type. (e.g. `type ChangeAnnotationIdentifier === string`)." + }, + "MapType": { + "additionalProperties": false, + "description": "Represents a JSON object map (e.g. `interface Map<K extends string | integer, V> { [key: K] => V; }`).", + "properties": { + "key": { + "$ref": "#/definitions/MapKeyType" + }, + "kind": { + "const": "map", + "type": "string" + }, + "value": { + "$ref": "#/definitions/Type" + } + }, + "required": [ + "kind", + "key", + "value" + ], + "type": "object" + }, + "MessageDirection": { + "description": "Indicates in which direction a message is sent in the protocol.", + "enum": [ + "clientToServer", + "serverToClient", + "both" + ], + "type": "string" + }, + "MetaData": { + "additionalProperties": false, + "properties": { + "version": { + "description": "The protocol version.", + "type": "string" + } + }, + "required": [ + "version" + ], + "type": "object" + }, + "MetaModel": { + "additionalProperties": false, + "description": "The actual meta model.", + "properties": { + "enumerations": { + "description": "The enumerations.", + "items": { + "$ref": "#/definitions/Enumeration" + }, + "type": "array" + }, + "metaData": { + "$ref": "#/definitions/MetaData", + "description": "Additional meta data." + }, + "notifications": { + "description": "The notifications.", + "items": { + "$ref": "#/definitions/Notification" + }, + "type": "array" + }, + "requests": { + "description": "The requests.", + "items": { + "$ref": "#/definitions/Request" + }, + "type": "array" + }, + "structures": { + "description": "The structures.", + "items": { + "$ref": "#/definitions/Structure" + }, + "type": "array" + }, + "typeAliases": { + "description": "The type aliases.", + "items": { + "$ref": "#/definitions/TypeAlias" + }, + "type": "array" + } + }, + "required": [ + "metaData", + "requests", + "notifications", + "structures", + "enumerations", + "typeAliases" + ], + "type": "object" + }, + "Notification": { + "additionalProperties": false, + "description": "Represents a LSP notification", + "properties": { + "deprecated": { + "description": "Whether the notification is deprecated or not. If deprecated the property contains the deprecation message.", + "type": "string" + }, + "documentation": { + "description": "An optional documentation;", + "type": "string" + }, + "messageDirection": { + "$ref": "#/definitions/MessageDirection", + "description": "The direction in which this notification is sent in the protocol." + }, + "method": { + "description": "The request's method name.", + "type": "string" + }, + "params": { + "anyOf": [ + { + "$ref": "#/definitions/Type" + }, + { + "items": { + "$ref": "#/definitions/Type" + }, + "type": "array" + } + ], + "description": "The parameter type(s) if any." + }, + "proposed": { + "description": "Whether this is a proposed notification. If omitted the notification is final.", + "type": "boolean" + }, + "registrationMethod": { + "description": "Optional a dynamic registration method if it different from the request's method.", + "type": "string" + }, + "registrationOptions": { + "$ref": "#/definitions/Type", + "description": "Optional registration options if the notification supports dynamic registration." + }, + "since": { + "description": "Since when (release number) this notification is available. Is undefined if not known.", + "type": "string" + } + }, + "required": [ + "method", + "messageDirection" + ], + "type": "object" + }, + "OrType": { + "additionalProperties": false, + "description": "Represents an `or` type (e.g. `Location | LocationLink`).", + "properties": { + "items": { + "items": { + "$ref": "#/definitions/Type" + }, + "type": "array" + }, + "kind": { + "const": "or", + "type": "string" + } + }, + "required": [ + "kind", + "items" + ], + "type": "object" + }, + "Property": { + "additionalProperties": false, + "description": "Represents an object property.", + "properties": { + "deprecated": { + "description": "Whether the property is deprecated or not. If deprecated the property contains the deprecation message.", + "type": "string" + }, + "documentation": { + "description": "An optional documentation.", + "type": "string" + }, + "name": { + "description": "The property name;", + "type": "string" + }, + "optional": { + "description": "Whether the property is optional. If omitted, the property is mandatory.", + "type": "boolean" + }, + "proposed": { + "description": "Whether this is a proposed property. If omitted, the structure is final.", + "type": "boolean" + }, + "since": { + "description": "Since when (release number) this property is available. Is undefined if not known.", + "type": "string" + }, + "type": { + "$ref": "#/definitions/Type", + "description": "The type of the property" + } + }, + "required": [ + "name", + "type" + ], + "type": "object" + }, + "ReferenceType": { + "additionalProperties": false, + "description": "Represents a reference to another type (e.g. `TextDocument`). This is either a `Structure`, a `Enumeration` or a `TypeAlias` in the same meta model.", + "properties": { + "kind": { + "const": "reference", + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "kind", + "name" + ], + "type": "object" + }, + "Request": { + "additionalProperties": false, + "description": "Represents a LSP request", + "properties": { + "deprecated": { + "description": "Whether the request is deprecated or not. If deprecated the property contains the deprecation message.", + "type": "string" + }, + "documentation": { + "description": "An optional documentation;", + "type": "string" + }, + "errorData": { + "$ref": "#/definitions/Type", + "description": "An optional error data type." + }, + "messageDirection": { + "$ref": "#/definitions/MessageDirection", + "description": "The direction in which this request is sent in the protocol." + }, + "method": { + "description": "The request's method name.", + "type": "string" + }, + "params": { + "anyOf": [ + { + "$ref": "#/definitions/Type" + }, + { + "items": { + "$ref": "#/definitions/Type" + }, + "type": "array" + } + ], + "description": "The parameter type(s) if any." + }, + "partialResult": { + "$ref": "#/definitions/Type", + "description": "Optional partial result type if the request supports partial result reporting." + }, + "proposed": { + "description": "Whether this is a proposed feature. If omitted the feature is final.", + "type": "boolean" + }, + "registrationMethod": { + "description": "Optional a dynamic registration method if it different from the request's method.", + "type": "string" + }, + "registrationOptions": { + "$ref": "#/definitions/Type", + "description": "Optional registration options if the request supports dynamic registration." + }, + "result": { + "$ref": "#/definitions/Type", + "description": "The result type." + }, + "since": { + "description": "Since when (release number) this request is available. Is undefined if not known.", + "type": "string" + } + }, + "required": [ + "method", + "result", + "messageDirection" + ], + "type": "object" + }, + "StringLiteralType": { + "additionalProperties": false, + "description": "Represents a string literal type (e.g. `kind: 'rename'`).", + "properties": { + "kind": { + "const": "stringLiteral", + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "kind", + "value" + ], + "type": "object" + }, + "Structure": { + "additionalProperties": false, + "description": "Defines the structure of an object literal.", + "properties": { + "deprecated": { + "description": "Whether the structure is deprecated or not. If deprecated the property contains the deprecation message.", + "type": "string" + }, + "documentation": { + "description": "An optional documentation;", + "type": "string" + }, + "extends": { + "description": "Structures extended from. This structures form a polymorphic type hierarchy.", + "items": { + "$ref": "#/definitions/Type" + }, + "type": "array" + }, + "mixins": { + "description": "Structures to mix in. The properties of these structures are `copied` into this structure. Mixins don't form a polymorphic type hierarchy in LSP.", + "items": { + "$ref": "#/definitions/Type" + }, + "type": "array" + }, + "name": { + "description": "The name of the structure.", + "type": "string" + }, + "properties": { + "description": "The properties.", + "items": { + "$ref": "#/definitions/Property" + }, + "type": "array" + }, + "proposed": { + "description": "Whether this is a proposed structure. If omitted, the structure is final.", + "type": "boolean" + }, + "since": { + "description": "Since when (release number) this structure is available. Is undefined if not known.", + "type": "string" + } + }, + "required": [ + "name", + "properties" + ], + "type": "object" + }, + "StructureLiteral": { + "additionalProperties": false, + "description": "Defines an unnamed structure of an object literal.", + "properties": { + "deprecated": { + "description": "Whether the literal is deprecated or not. If deprecated the property contains the deprecation message.", + "type": "string" + }, + "documentation": { + "description": "An optional documentation.", + "type": "string" + }, + "properties": { + "description": "The properties.", + "items": { + "$ref": "#/definitions/Property" + }, + "type": "array" + }, + "proposed": { + "description": "Whether this is a proposed structure. If omitted, the structure is final.", + "type": "boolean" + }, + "since": { + "description": "Since when (release number) this structure is available. Is undefined if not known.", + "type": "string" + } + }, + "required": [ + "properties" + ], + "type": "object" + }, + "StructureLiteralType": { + "additionalProperties": false, + "description": "Represents a literal structure (e.g. `property: { start: uinteger; end: uinteger; }`).", + "properties": { + "kind": { + "const": "literal", + "type": "string" + }, + "value": { + "$ref": "#/definitions/StructureLiteral" + } + }, + "required": [ + "kind", + "value" + ], + "type": "object" + }, + "TupleType": { + "additionalProperties": false, + "description": "Represents a `tuple` type (e.g. `[integer, integer]`).", + "properties": { + "items": { + "items": { + "$ref": "#/definitions/Type" + }, + "type": "array" + }, + "kind": { + "const": "tuple", + "type": "string" + } + }, + "required": [ + "kind", + "items" + ], + "type": "object" + }, + "Type": { + "anyOf": [ + { + "$ref": "#/definitions/BaseType" + }, + { + "$ref": "#/definitions/ReferenceType" + }, + { + "$ref": "#/definitions/ArrayType" + }, + { + "$ref": "#/definitions/MapType" + }, + { + "$ref": "#/definitions/AndType" + }, + { + "$ref": "#/definitions/OrType" + }, + { + "$ref": "#/definitions/TupleType" + }, + { + "$ref": "#/definitions/StructureLiteralType" + }, + { + "$ref": "#/definitions/StringLiteralType" + }, + { + "$ref": "#/definitions/IntegerLiteralType" + }, + { + "$ref": "#/definitions/BooleanLiteralType" + } + ] + }, + "TypeAlias": { + "additionalProperties": false, + "description": "Defines a type alias. (e.g. `type Definition = Location | LocationLink`)", + "properties": { + "deprecated": { + "description": "Whether the type alias is deprecated or not. If deprecated the property contains the deprecation message.", + "type": "string" + }, + "documentation": { + "description": "An optional documentation.", + "type": "string" + }, + "name": { + "description": "The name of the type alias.", + "type": "string" + }, + "proposed": { + "description": "Whether this is a proposed type alias. If omitted, the type alias is final.", + "type": "boolean" + }, + "since": { + "description": "Since when (release number) this structure is available. Is undefined if not known.", + "type": "string" + }, + "type": { + "$ref": "#/definitions/Type", + "description": "The aliased type." + } + }, + "required": [ + "name", + "type" + ], + "type": "object" + }, + "TypeKind": { + "enum": [ + "base", + "reference", + "array", + "map", + "and", + "or", + "tuple", + "literal", + "stringLiteral", + "integerLiteral", + "booleanLiteral" + ], + "type": "string" + } + } +} diff --git a/generator/model.py b/generator/model.py new file mode 100644 index 0000000..abac69d --- /dev/null +++ b/generator/model.py @@ -0,0 +1,897 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from __future__ import annotations + +import uuid +from typing import Any, Dict, Iterable, List, Optional, Type, TypeVar, Union + +import attrs + +LSP_TYPE_SPEC = Union[ + "BaseType", + "ReferenceType", + "OrType", + "AndType", + "ArrayType", + "LiteralType", + "StringLiteralType", + "MapType", + "TupleType", +] + + +def partial_apply(callable): + def apply(x): + if isinstance(x, dict): + return callable(**x) + else: + return x + + return apply + + +def list_converter(callable): + def apply(x): + if isinstance(x, dict): + return callable(**x) + else: + return x + + def converter(x: List[Any]) -> List[Any]: + return list(map(apply, x)) + + return converter + + +def enum_validator(instance: Enum, attribute: Any, value: Any) -> None: + test_type = str if instance.type.name == "string" else int + for e in value: + if not isinstance(e.value, test_type): + raise ValueError( + f"Value of {instance.name}.{e.name} is not of type {test_type}: {e.value}." + ) + + +def convert_to_lsp_type(**type_info) -> Optional[LSP_TYPE_SPEC]: + if type_info is None: + return None + lut: Dict[str, LSP_TYPE_SPEC] = { + "base": BaseType, + "reference": ReferenceType, + "array": ArrayType, + "or": OrType, + "and": AndType, + "literal": LiteralType, + "map": MapType, + "stringLiteral": StringLiteralType, + "tuple": TupleType, + } + callable = lut.get(type_info["kind"]) + if callable: + return callable(**type_info) + + raise ValueError(f"Unknown LSP type: {type_info}") + + +def type_validator(instance: Any, attribute: str, value: Any) -> bool: + return isinstance( + value, + ( + BaseType, + ReferenceType, + ArrayType, + OrType, + LiteralType, + AndType, + MapType, + StringLiteralType, + TupleType, + ), + ) + + +@attrs.define +class EnumItem: + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + value: Union[str, int] = attrs.field( + validator=attrs.validators.instance_of((str, int)) + ) + proposed: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + documentation: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + since: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + deprecated: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: Any) -> bool: + if isinstance(other, EnumItem): + return self.name == other.name and self.value == other.value + return False + + def get_inner_types(self) -> List[Type]: + return [] + + +@attrs.define +class EnumValueType: + kind: str = attrs.field(validator=attrs.validators.in_(["base"])) + name: str = attrs.field( + validator=attrs.validators.in_(["string", "integer", "uinteger"]) + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, EnumValueType): + return self.name == other.name and self.kind == other.kind + return False + + def get_inner_types(self) -> List[Type]: + return [] + + +@attrs.define +class Enum: + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + type: EnumValueType = attrs.field(converter=partial_apply(EnumValueType)) + values: Iterable[EnumItem] = attrs.field( + validator=enum_validator, + converter=list_converter(EnumItem), + ) + proposed: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + documentation: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + since: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + supportsCustomValues: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + deprecated: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, Enum): + return ( + self.name == other.name + and self.type == other.type + and self.values == other.values + ) + return False + + def get_inner_types(self) -> List[Type]: + types = [self.type] + for value in self.values: + types.append(value) + types.extend(value.get_inner_types()) + return types + + +@attrs.define +class BaseType: + kind: str = attrs.field(validator=attrs.validators.in_(["base"])) + name: str = attrs.field( + validator=attrs.validators.in_( + [ + "URI", + "DocumentUri", + "integer", + "uinteger", + "decimal", + "RegExp", + "string", + "boolean", + "null", + ] + ) + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, BaseType): + return self.name == other.name and self.kind == other.kind + return False + + def get_inner_types(self) -> List[Type]: + return [] + + +@attrs.define +class ReferenceType: + kind: str = attrs.field(validator=attrs.validators.in_(["reference"])) + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, ReferenceType): + return self.name == other.name and self.kind == other.kind + return False + + def get_inner_types(self) -> List[Type]: + return [] + + +@attrs.define +class StringLiteralType: + kind: str = attrs.field(validator=attrs.validators.in_(["stringLiteral"])) + value: str = attrs.field(validator=attrs.validators.instance_of(str)) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, StringLiteralType): + return self.value == other.value and self.kind == other.kind + return False + + def get_inner_types(self) -> List[Type]: + return [] + + +@attrs.define +class OrType: + kind: str = attrs.field(validator=attrs.validators.in_(["or"])) + items: Iterable[LSP_TYPE_SPEC] = attrs.field( + converter=list_converter(convert_to_lsp_type) + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, OrType): + return self.items == other.items and self.kind == other.kind + return False + + def get_inner_types(self) -> List[Type]: + types = [] + for item in self.items: + types.append(item) + types.extend(item.get_inner_types()) + return types + + +@attrs.define +class AndType: + kind: str = attrs.field(validator=attrs.validators.in_(["and"])) + items: Iterable[LSP_TYPE_SPEC] = attrs.field( + converter=list_converter(convert_to_lsp_type), + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, AndType): + return self.items == other.items and self.kind == other.kind + return False + + def get_inner_types(self) -> List[Type]: + types = [] + for item in self.items: + types.append(item) + types.extend(item.get_inner_types()) + return types + + +@attrs.define +class ArrayType: + kind: str = attrs.field(validator=attrs.validators.in_(["array"])) + element: LSP_TYPE_SPEC = attrs.field( + validator=type_validator, converter=partial_apply(convert_to_lsp_type) + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, ArrayType): + return self.element == other.element and self.kind == other.kind + return False + + def get_inner_types(self) -> List[Type]: + return [self.element] + self.element.get_inner_types() + + +@attrs.define +class TupleType: + kind: str = attrs.field(validator=attrs.validators.in_(["tuple"])) + items: Iterable[LSP_TYPE_SPEC] = attrs.field( + converter=list_converter(convert_to_lsp_type) + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, TupleType): + return self.items == other.items and self.kind == other.kind + return False + + def get_inner_types(self) -> List[Type]: + types = [] + for item in self.items: + types.append(item) + types.extend(item.get_inner_types()) + return types + + +@attrs.define +class BaseMapKeyType: + kind: str = attrs.field(validator=attrs.validators.in_(["base"])) + name: str = attrs.field( + validator=attrs.validators.in_( + [ + "URI", + "DocumentUri", + "integer", + "string", + ] + ) + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, BaseMapKeyType): + return self.name == other.name and self.kind == other.kind + return False + + def get_inner_types(self) -> List[Type]: + return [] + + +@attrs.define +class ReferenceMapKeyType: + kind: str = attrs.field(validator=attrs.validators.in_(["reference"])) + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, ReferenceMapKeyType): + return self.name == other.name and self.kind == other.kind + return False + + def get_inner_types(self) -> List[Type]: + return [] + + +def convert_map_key( + key_info: Dict[str, Any] +) -> Union[BaseMapKeyType, ReferenceMapKeyType]: + if key_info["kind"] == "base": + return BaseMapKeyType(**key_info) + return ReferenceMapKeyType(**key_info) + + +@attrs.define +class MapType: + kind: str = attrs.field(validator=attrs.validators.in_(["map"])) + key: Union[BaseMapKeyType, ReferenceMapKeyType] = attrs.field( + converter=convert_map_key + ) + value: LSP_TYPE_SPEC = attrs.field( + validator=type_validator, converter=partial_apply(convert_to_lsp_type) + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, MapType): + return ( + self.key == other.key + and self.value == other.value + and self.kind == other.kind + ) + return False + + def get_inner_types(self) -> List[Type]: + return ( + [self.value, self.key] + + self.value.get_inner_types() + + self.key.get_inner_types() + ) + + +@attrs.define +class MetaData: + version: str = attrs.field(validator=attrs.validators.instance_of(str)) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, MetaData): + return self.version == other.version + return False + + def get_inner_types(self) -> List[Type]: + return [] + + +@attrs.define +class Property: + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + type: LSP_TYPE_SPEC = attrs.field( + validator=type_validator, + converter=partial_apply(convert_to_lsp_type), + ) + optional: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + proposed: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + documentation: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + since: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + deprecated: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, Property): + return ( + self.name == other.name + and self.type == other.type + and self.optional == other.optional + ) + return False + + def get_inner_types(self) -> List[Type]: + return [self.type] + self.type.get_inner_types() + + +@attrs.define +class LiteralValue: + properties: Iterable[Property] = attrs.field( + converter=list_converter(Property), + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, LiteralValue): + return self.properties == other.properties + return False + + def get_inner_types(self) -> List[Type]: + types = [] + for prop in self.properties: + types.append(prop) + types.extend(prop.get_inner_types()) + return types + + +@attrs.define +class LiteralType: + kind: str = attrs.field(validator=attrs.validators.in_(["literal"])) + value: LiteralValue = attrs.field( + validator=attrs.validators.instance_of(LiteralValue), + converter=partial_apply(LiteralValue), + ) + name: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + proposed: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + documentation: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + since: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + deprecated: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, LiteralType): + return ( + self.value == other.value + and self.kind == other.kind + and self.name == other.name + ) + return False + + def get_inner_types(self) -> List[Type]: + return [self.value] + self.value.get_inner_types() + + +@attrs.define +class TypeAlias: + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + type: LSP_TYPE_SPEC = attrs.field( + validator=type_validator, + converter=partial_apply(convert_to_lsp_type), + ) + proposed: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + documentation: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + since: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + deprecated: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, TypeAlias): + return ( + self.name == other.name + and self.type == other.type + and self.kind == other.kind + ) + return False + + def get_inner_types(self) -> List[Type]: + return [self.type] + self.type.get_inner_types() + + +@attrs.define +class Structure: + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + properties: Iterable[Property] = attrs.field( + converter=list_converter(Property), + ) + extends: Optional[Iterable[LSP_TYPE_SPEC]] = attrs.field( + converter=list_converter(convert_to_lsp_type), default=[] + ) + mixins: Optional[Iterable[LSP_TYPE_SPEC]] = attrs.field( + converter=list_converter(convert_to_lsp_type), default=[] + ) + proposed: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + documentation: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + since: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + deprecated: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, Structure): + return ( + self.name == other.name + and self.properties == other.properties + and self.extends == other.extends + and self.mixins == other.mixins + ) + return False + + def get_inner_types(self) -> List[Type]: + types = [] + for prop in self.properties: + types.append(prop.type) + types.extend(prop.type.get_inner_types()) + for ext in self.extends: + types.append(ext) + types.extend(ext.get_inner_types()) + for mixin in self.mixins: + types.append(mixin) + types.extend(mixin.get_inner_types()) + return types + + +@attrs.define +class Notification: + method: str = attrs.field(validator=attrs.validators.instance_of(str)) + messageDirection: str = attrs.field( + validator=attrs.validators.in_(["clientToServer", "serverToClient", "both"]) + ) + params: Optional[LSP_TYPE_SPEC] = attrs.field( + validator=type_validator, + converter=partial_apply(convert_to_lsp_type), + default=None, + ) + registrationOptions: Optional[LSP_TYPE_SPEC] = attrs.field( + validator=type_validator, + converter=partial_apply(convert_to_lsp_type), + default=None, + ) + proposed: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + documentation: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + since: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + registrationMethod: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + deprecated: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, Notification): + return ( + self.method == other.method + and self.messageDirection == other.messageDirection + and self.params == other.params + and self.registrationOptions == other.registrationOptions + and self.registrationMethod == other.registrationMethod + ) + return False + + def get_inner_types(self) -> List[Type]: + types = [] + if self.params: + types.append(self.params) + types.extend(self.params.get_inner_types()) + if self.registrationOptions: + types.append(self.registrationOptions) + types.extend(self.registrationOptions.get_inner_types()) + return types + + +@attrs.define +class Request: + method: str = attrs.field(validator=attrs.validators.instance_of(str)) + messageDirection: str = attrs.field( + validator=attrs.validators.in_(["clientToServer", "serverToClient", "both"]) + ) + params: Optional[LSP_TYPE_SPEC] = attrs.field( + validator=type_validator, + converter=partial_apply(convert_to_lsp_type), + default=None, + ) + result: Optional[LSP_TYPE_SPEC] = attrs.field( + validator=type_validator, + converter=partial_apply(convert_to_lsp_type), + default=None, + ) + partialResult: Optional[LSP_TYPE_SPEC] = attrs.field( + validator=type_validator, + converter=partial_apply(convert_to_lsp_type), + default=None, + ) + errorData: Optional[LSP_TYPE_SPEC] = attrs.field( + validator=type_validator, + converter=partial_apply(convert_to_lsp_type), + default=None, + ) + registrationOptions: Optional[LSP_TYPE_SPEC] = attrs.field( + validator=type_validator, + converter=partial_apply(convert_to_lsp_type), + default=None, + ) + proposed: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + documentation: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + since: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + registrationMethod: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + deprecated: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + id_: Optional[str] = attrs.field( + converter=lambda x: str(uuid.uuid4()), + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, Request): + return ( + self.method == other.method + and self.messageDirection == other.messageDirection + and self.params == other.params + and self.result == other.result + and self.partialResult == other.partialResult + and self.errorData == other.errorData + and self.registrationOptions == other.registrationOptions + and self.registrationMethod == other.registrationMethod + ) + return False + + def get_inner_types(self) -> List[Type]: + types = [] + if self.params: + types.append(self.params) + types.extend(self.params.get_inner_types()) + if self.result: + types.append(self.result) + types.extend(self.result.get_inner_types()) + if self.partialResult: + types.append(self.partialResult) + types.extend(self.partialResult.get_inner_types()) + if self.errorData: + types.append(self.errorData) + types.extend(self.errorData.get_inner_types()) + if self.registrationOptions: + types.append(self.registrationOptions) + types.extend(self.registrationOptions.get_inner_types()) + return types + + +@attrs.define +class LSPModel: + requests: Iterable[Request] = attrs.field(converter=list_converter(Request)) + notifications: Iterable[Notification] = attrs.field( + converter=list_converter(Notification) + ) + structures: Iterable[Structure] = attrs.field(converter=list_converter(Structure)) + enumerations: Iterable[Enum] = attrs.field(converter=list_converter(Enum)) + typeAliases: Iterable[TypeAlias] = attrs.field(converter=list_converter(TypeAlias)) + metaData: MetaData = attrs.field(converter=lambda x: MetaData(**x)) + + def __eq__(self, other: object) -> bool: + if isinstance(other, LSPModel): + return ( + self.requests == other.requests + and self.notifications == other.notifications + and self.structures == other.structures + and self.enumerations == other.enumerations + and self.typeAliases == other.typeAliases + and self.metaData == other.metaData + ) + return False + + def get_inner_types(self) -> List[Type]: + types = self.metaData.get_inner_types() + for r in self.requests: + types.extend(r.get_inner_types()) + for n in self.notifications: + types.extend(n.get_inner_types()) + for s in self.structures: + types.extend(s.get_inner_types()) + for e in self.enumerations: + types.extend(e.get_inner_types()) + for t in self.typeAliases: + types.extend(t.get_inner_types()) + return types + + +def create_lsp_model(models: List[Dict[str, Any]]) -> LSPModel: + if len(models) >= 1: + spec = LSPModel(**models[0]) + + if len(models) >= 2: + for model in models[1:]: + addition = LSPModel(**model) + spec.requests.extend(addition.requests) + spec.notifications.extend(addition.notifications) + spec.structures.extend(addition.structures) + spec.enumerations.extend(addition.enumerations) + spec.typeAliases.extend(addition.typeAliases) + + return spec diff --git a/generator/plugins/__init__.py b/generator/plugins/__init__.py new file mode 100644 index 0000000..5b7f7a9 --- /dev/null +++ b/generator/plugins/__init__.py @@ -0,0 +1,2 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. diff --git a/generator/plugins/dotnet/__init__.py b/generator/plugins/dotnet/__init__.py new file mode 100644 index 0000000..8c6065b --- /dev/null +++ b/generator/plugins/dotnet/__init__.py @@ -0,0 +1,4 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from .dotnet_utils import generate_from_spec as generate diff --git a/generator/plugins/dotnet/custom/CustomArrayConverter.cs b/generator/plugins/dotnet/custom/CustomArrayConverter.cs new file mode 100644 index 0000000..d34eb62 --- /dev/null +++ b/generator/plugins/dotnet/custom/CustomArrayConverter.cs @@ -0,0 +1,42 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System.Collections.Immutable; + +public class CustomArrayConverter<T> : JsonConverter<ImmutableArray<T>> +{ + public override ImmutableArray<T> ReadJson(JsonReader reader, Type objectType, ImmutableArray<T> existingValue, bool hasExistingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + { + return default(ImmutableArray<T>); + } + + JArray array = JArray.Load(reader); + ImmutableArray<T>.Builder builder = ImmutableArray.CreateBuilder<T>(); + + for (int i = 0; i < array.Count; i++) + { + builder.Add((T)array[i].ToObject(typeof(T))!); + } + + return builder.ToImmutable(); + + } + + public override void WriteJson(JsonWriter writer, ImmutableArray<T> value, JsonSerializer serializer) + { + if (value.IsDefault) + { + writer.WriteNull(); + } + else + { + writer.WriteStartArray(); + foreach (var item in value) + { + serializer.Serialize(writer, item); + } + writer.WriteEndArray(); + } + } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/CustomObjectConverter.cs b/generator/plugins/dotnet/custom/CustomObjectConverter.cs new file mode 100644 index 0000000..e03b588 --- /dev/null +++ b/generator/plugins/dotnet/custom/CustomObjectConverter.cs @@ -0,0 +1,40 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; + + +class CustomObjectConverter<T> : JsonConverter<T> where T : Dictionary<string, object?> +{ + public override T ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + { + return default(T)!; + } + + Dictionary<string, object?>? o = serializer.Deserialize<Dictionary<string, object?>>(reader); + if (o == null) + { + return default(T)!; + } + return (T)Activator.CreateInstance(typeof(T), o)! ?? default(T)!; + } + + public override void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer) + { + if (value is null) + { + writer.WriteNull(); + } + else + { + writer.WriteStartObject(); + foreach (var kvp in value) + { + writer.WritePropertyName(kvp.Key); + serializer.Serialize(writer, kvp.Value); + } + writer.WriteEndObject(); + } + } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/CustomStringConverter.cs b/generator/plugins/dotnet/custom/CustomStringConverter.cs new file mode 100644 index 0000000..33a04df --- /dev/null +++ b/generator/plugins/dotnet/custom/CustomStringConverter.cs @@ -0,0 +1,40 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; + +public class CustomStringConverter<T> : JsonConverter<T> where T : class +{ + public override T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.String && reader.Value is string str) + { + return Activator.CreateInstance(typeof(T), str) as T; + } + else if (reader.TokenType == JsonToken.Null) + { + return null; + } + + throw new JsonSerializationException($"Unexpected token type '{reader.TokenType}' while deserializing '{objectType.Name}'."); + } + + public override void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer) + { + if (value is null) + { + writer.WriteNull(); + } + else if (value is Uri u) + { + writer.WriteValue(u.AbsoluteUri); + } + else if (value is T t) + { + writer.WriteValue(t.ToString()); + } + else + { + throw new ArgumentException($"{nameof(value)} must be of type {nameof(T)}."); + } + } +} diff --git a/generator/plugins/dotnet/custom/Direction.cs b/generator/plugins/dotnet/custom/Direction.cs new file mode 100644 index 0000000..757acd3 --- /dev/null +++ b/generator/plugins/dotnet/custom/Direction.cs @@ -0,0 +1,12 @@ +using System; + +[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Enum)] +public class DirectionAttribute : Attribute +{ + public DirectionAttribute(MessageDirection direction) + { + Direction = direction; + } + + public MessageDirection Direction { get; } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/DocumentSelectorConverter.cs b/generator/plugins/dotnet/custom/DocumentSelectorConverter.cs new file mode 100644 index 0000000..3124416 --- /dev/null +++ b/generator/plugins/dotnet/custom/DocumentSelectorConverter.cs @@ -0,0 +1,34 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; + +public class DocumentSelectorConverter : JsonConverter<DocumentSelector> +{ + public override void WriteJson(JsonWriter writer, DocumentSelector? value, JsonSerializer serializer) + { + if (value is null) + { + writer.WriteNull(); + } + else + { + serializer.Serialize(writer, (DocumentFilter[])value); + } + } + + public override DocumentSelector ReadJson(JsonReader reader, Type objectType, DocumentSelector? existingValue, bool hasExistingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + { + return null!; + } + var token = JToken.Load(reader); + if (token.Type == JTokenType.Array) + { + var filters = token.ToObject<DocumentFilter[]>(serializer); + return new DocumentSelector(filters ?? Array.Empty<DocumentFilter>()); + } + + throw new JsonSerializationException("Invalid JSON for DocumentSelector"); + } +} diff --git a/generator/plugins/dotnet/custom/IMessage.cs b/generator/plugins/dotnet/custom/IMessage.cs new file mode 100644 index 0000000..175c258 --- /dev/null +++ b/generator/plugins/dotnet/custom/IMessage.cs @@ -0,0 +1,4 @@ +public interface IMessage +{ + string JsonRPC { get; } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/INotification.cs b/generator/plugins/dotnet/custom/INotification.cs new file mode 100644 index 0000000..b287767 --- /dev/null +++ b/generator/plugins/dotnet/custom/INotification.cs @@ -0,0 +1,6 @@ +public interface INotification<TParams> : IMessage +{ + string Method { get; } + + TParams? Params { get; } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/IOrType.cs b/generator/plugins/dotnet/custom/IOrType.cs new file mode 100644 index 0000000..217b64a --- /dev/null +++ b/generator/plugins/dotnet/custom/IOrType.cs @@ -0,0 +1,4 @@ +public interface IOrType +{ + public object? Value { get; } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/IPartialResultParams.cs b/generator/plugins/dotnet/custom/IPartialResultParams.cs new file mode 100644 index 0000000..ef90c3b --- /dev/null +++ b/generator/plugins/dotnet/custom/IPartialResultParams.cs @@ -0,0 +1,15 @@ +using System; + +/// <summary> +/// Interface to describe parameters for requests that support streaming results. +/// +/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#partialResultParams">Language Server Protocol specification</see> for additional information. +/// </summary> +/// <typeparam name="T">The type to be reported by <see cref="PartialResultToken"/>.</typeparam> +public interface IPartialResultParams +{ + /// <summary> + /// An optional token that a server can use to report partial results (e.g. streaming) to the client. + /// </summary> + public ProgressToken? PartialResultToken { get; set; } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/IRequest.cs b/generator/plugins/dotnet/custom/IRequest.cs new file mode 100644 index 0000000..55fcbd8 --- /dev/null +++ b/generator/plugins/dotnet/custom/IRequest.cs @@ -0,0 +1,9 @@ +public interface IRequest<TParams> : IMessage +{ + + OrType<string, int> Id { get; } + + string Method { get; } + + TParams Params { get; } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/IResponse.cs b/generator/plugins/dotnet/custom/IResponse.cs new file mode 100644 index 0000000..01ecf3e --- /dev/null +++ b/generator/plugins/dotnet/custom/IResponse.cs @@ -0,0 +1,9 @@ +public interface IResponse<TResponse> : IMessage +{ + + OrType<string, int> Id { get; } + + TResponse? Result { get; } + + ResponseError? Error { get; } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/LSPAnyConverter.cs b/generator/plugins/dotnet/custom/LSPAnyConverter.cs new file mode 100644 index 0000000..28781cb --- /dev/null +++ b/generator/plugins/dotnet/custom/LSPAnyConverter.cs @@ -0,0 +1,61 @@ +using Newtonsoft.Json; + +public class LSPAnyConverter : JsonConverter +{ + public override bool CanConvert(Type objectType) + { + return objectType == typeof(LSPAny); + } + + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + reader = reader ?? throw new ArgumentNullException(nameof(reader)); + switch (reader.TokenType) + { + case JsonToken.Null: + return null; + + case JsonToken.Integer: + return new LSPAny(serializer.Deserialize<long>(reader)); + + case JsonToken.Float: + return new LSPAny(serializer.Deserialize<float>(reader)); + + case JsonToken.Boolean: + return new LSPAny(serializer.Deserialize<bool>(reader)); + + case JsonToken.String: + return new LSPAny(serializer.Deserialize<string>(reader)); + + case JsonToken.StartArray: + List<object>? l = serializer.Deserialize<List<object>>(reader); + if (l == null) + { + return null; + } + return new LSPAny(new LSPArray(l)); + + case JsonToken.StartObject: + Dictionary<string, object?>? o = serializer.Deserialize<Dictionary<string, object?>>(reader); + if (o == null) + { + return null; + } + return new LSPAny(new LSPObject(o)); + } + + throw new JsonSerializationException($"Unexpected token type '{reader.TokenType}' while deserializing '{objectType.Name}'."); + } + + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + if (value is null) + { + writer.WriteNull(); + } + else + { + serializer.Serialize(writer, ((LSPAny)value).Value); + } + } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/LSPRequest.cs b/generator/plugins/dotnet/custom/LSPRequest.cs new file mode 100644 index 0000000..69e3f0d --- /dev/null +++ b/generator/plugins/dotnet/custom/LSPRequest.cs @@ -0,0 +1,22 @@ +using System; + +[AttributeUsage(AttributeTargets.Class)] +public class LSPRequestAttribute : Attribute +{ + public LSPRequestAttribute(string method, Type response) + { + Method = method; + Response = response; + } + + public LSPRequestAttribute(string method, Type response, Type partialResponse) + { + Method = method; + Response = response; + PartialResponse = partialResponse; + } + + public string Method { get; } + public Type Response { get; } + public Type? PartialResponse { get; } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/LSPResponse.cs b/generator/plugins/dotnet/custom/LSPResponse.cs new file mode 100644 index 0000000..4d2ca46 --- /dev/null +++ b/generator/plugins/dotnet/custom/LSPResponse.cs @@ -0,0 +1,13 @@ +using System; + +[AttributeUsage(AttributeTargets.Class)] +public class LSPResponseAttribute : Attribute +{ + public LSPResponseAttribute(Type request) + { + Request = request; + } + + + public Type Request { get; } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/MessageDirection.cs b/generator/plugins/dotnet/custom/MessageDirection.cs new file mode 100644 index 0000000..a2792ff --- /dev/null +++ b/generator/plugins/dotnet/custom/MessageDirection.cs @@ -0,0 +1,8 @@ +using System.Runtime.Serialization; + +public enum MessageDirection +{ + [EnumMember(Value = "serverToClient")] ServerToClient, + [EnumMember(Value = "clientToServer")] ClientToServer, + [EnumMember(Value = "both")] Both, +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/OrType.cs b/generator/plugins/dotnet/custom/OrType.cs new file mode 100644 index 0000000..2ddf320 --- /dev/null +++ b/generator/plugins/dotnet/custom/OrType.cs @@ -0,0 +1,138 @@ +using System; + +public record OrType<T, U> : IOrType +{ + public object? Value { get; } + public OrType(T t) + { + Value = t ?? throw new ArgumentNullException(nameof(t)); + } + + public OrType(U u) + { + Value = u ?? throw new ArgumentNullException(nameof(u)); + } + + public static explicit operator U?(OrType<T, U> obj) + { + return obj.Value is U x ? x : default; + } + + public static explicit operator T?(OrType<T, U> obj) + { + return obj.Value is T x ? x : default; + } + + public static explicit operator OrType<T, U>(U obj) => obj is null ? null! : new OrType<T, U>(obj); + public static explicit operator OrType<T, U>(T obj) => obj is null ? null! : new OrType<T, U>(obj); + + public override string ToString() + { + return Value?.ToString()!; + } +} + +public record OrType<T, U, V> : IOrType +{ + public object? Value { get; } + + public OrType(T t) + { + Value = t ?? throw new ArgumentNullException(nameof(t)); + } + + public OrType(U u) + { + Value = u ?? throw new ArgumentNullException(nameof(u)); + } + + public OrType(V v) + { + Value = v ?? throw new ArgumentNullException(nameof(v)); + } + + public static explicit operator U?(OrType<T, U, V> obj) + { + return obj.Value is U x ? x : default; + } + + public static explicit operator T?(OrType<T, U, V> obj) + { + return obj.Value is T x ? x : default; + } + + public static explicit operator V?(OrType<T, U, V> obj) + { + return obj.Value is V x ? x : default; + } + + public static explicit operator OrType<T, U, V>(U obj) => obj is null ? null! : new OrType<T, U, V>(obj); + + public static explicit operator OrType<T, U, V>(T obj) => obj is null ? null! : new OrType<T, U, V>(obj); + + public static explicit operator OrType<T, U, V>(V obj) => obj is null ? null! : new OrType<T, U, V>(obj); + + public override string ToString() + { + return Value?.ToString()!; + } +} + + +public record OrType<T, U, V, W> : IOrType +{ + public object? Value { get; } + + public OrType(T t) + { + Value = t ?? throw new ArgumentNullException(nameof(t)); + } + + public OrType(U u) + { + Value = u ?? throw new ArgumentNullException(nameof(u)); + } + + public OrType(V v) + { + Value = v ?? throw new ArgumentNullException(nameof(v)); + } + + public OrType(W w) + { + Value = w ?? throw new ArgumentNullException(nameof(w)); + } + + public static explicit operator U?(OrType<T, U, V, W> obj) + { + return obj.Value is U x ? x : default; + } + + public static explicit operator T?(OrType<T, U, V, W> obj) + { + return obj.Value is T x ? x : default; + } + + public static explicit operator V?(OrType<T, U, V, W> obj) + { + return obj.Value is V x ? x : default; + } + + public static explicit operator W?(OrType<T, U, V, W> obj) + { + return obj.Value is W x ? x : default; + } + + public static explicit operator OrType<T, U, V, W>(U obj) => obj is null ? null! : new OrType<T, U, V, W>(obj); + + public static explicit operator OrType<T, U, V, W>(T obj) => obj is null ? null! : new OrType<T, U, V, W>(obj); + + public static explicit operator OrType<T, U, V, W>(V obj) => obj is null ? null! : new OrType<T, U, V, W>(obj); + + public static explicit operator OrType<T, U, V, W>(W obj) => obj is null ? null! : new OrType<T, U, V, W>(obj); + + public override string ToString() + { + return Value?.ToString()!; + } +} diff --git a/generator/plugins/dotnet/custom/OrTypeArrayConverter.cs b/generator/plugins/dotnet/custom/OrTypeArrayConverter.cs new file mode 100644 index 0000000..f2dbf23 --- /dev/null +++ b/generator/plugins/dotnet/custom/OrTypeArrayConverter.cs @@ -0,0 +1,145 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Immutable; + +public class OrTypeArrayConverter<T, U> : JsonConverter<ImmutableArray<OrType<T, U>>> +{ + private OrTypeConverter<T, U> _converter; + + public OrTypeArrayConverter() + { + _converter = new OrTypeConverter<T, U>(); + } + + public override ImmutableArray<OrType<T, U>> ReadJson(JsonReader reader, Type objectType, ImmutableArray<OrType<T, U>> existingValue, bool hasExistingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + { + return default(ImmutableArray<OrType<T, U>>); + } + + JArray array = JArray.Load(reader); + ImmutableArray<OrType<T, U>>.Builder builder = ImmutableArray.CreateBuilder<OrType<T, U>>(); + + for (int i = 0; i < array.Count; i++) + { + builder.Add((OrType<T, U>)_converter.ReadJson(array[i].CreateReader(), typeof(OrType<T, U>), null, serializer)!); + } + + return builder.ToImmutable(); + } + + public override void WriteJson(JsonWriter writer, ImmutableArray<OrType<T, U>> value, JsonSerializer serializer) + { + if (value.IsDefault) + { + writer.WriteNull(); + } + else + { + writer.WriteStartArray(); + + foreach (var item in value) + { + _converter.WriteJson(writer, item, serializer); + } + + writer.WriteEndArray(); + } + } +} +public class OrTypeArrayConverter<T, U, V> : JsonConverter<ImmutableArray<OrType<T, U, V>>> +{ + private OrTypeConverter<T, U, V> _converter; + + public OrTypeArrayConverter() + { + _converter = new OrTypeConverter<T, U, V>(); + } + + public override ImmutableArray<OrType<T, U, V>> ReadJson(JsonReader reader, Type objectType, ImmutableArray<OrType<T, U, V>> existingValue, bool hasExistingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + { + return default(ImmutableArray<OrType<T, U, V>>); + } + + JArray array = JArray.Load(reader); + ImmutableArray<OrType<T, U, V>>.Builder builder = ImmutableArray.CreateBuilder<OrType<T, U, V>>(); + + for (int i = 0; i < array.Count; i++) + { + builder.Add((OrType<T, U, V>)_converter.ReadJson(array[i].CreateReader(), typeof(OrType<T, U, V>), null, serializer)!); + } + + return builder.ToImmutable(); + } + + public override void WriteJson(JsonWriter writer, ImmutableArray<OrType<T, U, V>> value, JsonSerializer serializer) + { + if (value.IsDefault) + { + writer.WriteNull(); + } + else + { + writer.WriteStartArray(); + + foreach (var item in value) + { + _converter.WriteJson(writer, item, serializer); + } + + writer.WriteEndArray(); + } + } +} + + +public class OrTypeArrayConverter<T, U, V, W> : JsonConverter<ImmutableArray<OrType<T, U, V, W>>> +{ + private OrTypeConverter<T, U, V, W> _converter; + + public OrTypeArrayConverter() + { + _converter = new OrTypeConverter<T, U, V, W>(); + } + + public override ImmutableArray<OrType<T, U, V, W>> ReadJson(JsonReader reader, Type objectType, ImmutableArray<OrType<T, U, V, W>> existingValue, bool hasExistingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + { + return default(ImmutableArray<OrType<T, U, V, W>>); + } + + JArray array = JArray.Load(reader); + ImmutableArray<OrType<T, U, V, W>>.Builder builder = ImmutableArray.CreateBuilder<OrType<T, U, V, W>>(); + + for (int i = 0; i < array.Count; i++) + { + builder.Add((OrType<T, U, V, W>)_converter.ReadJson(array[i].CreateReader(), typeof(OrType<T, U, V, W>), null, serializer)!); + } + + return builder.ToImmutable(); + } + + public override void WriteJson(JsonWriter writer, ImmutableArray<OrType<T, U, V, W>> value, JsonSerializer serializer) + { + if (value.IsDefault) + { + writer.WriteNull(); + } + else + { + writer.WriteStartArray(); + + foreach (var item in value) + { + _converter.WriteJson(writer, item, serializer); + } + + writer.WriteEndArray(); + } + } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/OrTypeConverter.cs b/generator/plugins/dotnet/custom/OrTypeConverter.cs new file mode 100644 index 0000000..f2aadbf --- /dev/null +++ b/generator/plugins/dotnet/custom/OrTypeConverter.cs @@ -0,0 +1,595 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; + +internal class OrTypeConverterHelpers +{ + public static Type[] SortTypesByHeuristic(Type[] types, JToken jToken) + { + var typePropertyScores = new Dictionary<Type, int>(); + + string[] jTokenPropertyNames = jToken.Children<JProperty>().Select(p => p.Name.ToUpper()).ToArray(); + + foreach (Type type in types) + { + string[] typePropertyNames = type.GetProperties().Select(p => p.Name.ToUpper()).ToArray(); + + int score = jTokenPropertyNames.Count(propertyName => typePropertyNames.Contains(propertyName)); + typePropertyScores[type] = score; + } + + return types.OrderByDescending(type => typePropertyScores[type]).ToArray(); + } +} + +public class OrTypeConverter<T, U> : JsonConverter<OrType<T, U>> +{ + public override OrType<T, U>? ReadJson(JsonReader reader, Type objectType, OrType<T, U>? existingValue, bool hasExistingValue, JsonSerializer serializer) + { + reader = reader ?? throw new ArgumentNullException(nameof(reader)); + + if (reader.TokenType == JsonToken.Null) + { + return null; + } + + Type[] types = new Type[] { typeof(T), typeof(U) }; + + if (reader.TokenType == JsonToken.Integer && (Validators.HasType(types, typeof(uint)) || Validators.HasType(types, typeof(int)))) + { + return ReadIntegerToken(reader, serializer, types); + } + if (reader.TokenType == JsonToken.Float && Validators.HasType(types, typeof(float))) + { + return ReadFloatToken(reader, serializer, types); + } + if (reader.TokenType == JsonToken.Boolean && Validators.HasType(types, typeof(bool))) + { + return ReadBooleanToken(reader, serializer, types); + } + if (reader.TokenType == JsonToken.String && Validators.HasType(types, typeof(string))) + { + return ReadStringToken(reader, serializer, types); + } + + var token = JToken.Load(reader); + return OrTypeConverter<T, U>.ReadObjectToken(token, serializer, OrTypeConverterHelpers.SortTypesByHeuristic(types, token)); + } + + private static OrType<T, U> ReadIntegerToken(JsonReader reader, JsonSerializer serializer, Type[] types) + { + long integer = serializer.Deserialize<long>(reader); + if (Validators.InUIntegerRange(integer) && Validators.HasType(types, typeof(uint))) + { + if (typeof(T) == typeof(uint)) + { + return new OrType<T, U>((T)(object)(uint)integer); + } + if (typeof(U) == typeof(uint)) + { + return new OrType<T, U>((U)(object)(uint)integer); + } + } + if (Validators.InIntegerRange(integer) && Validators.HasType(types, typeof(int))) + { + if (typeof(T) == typeof(int)) + { + return new OrType<T, U>((T)(object)(int)integer); + } + if (typeof(U) == typeof(int)) + { + return new OrType<T, U>((U)(object)(int)integer); + } + } + throw new ArgumentOutOfRangeException($"Integer out-of-range of LSP Signed Integer[{int.MinValue}:{int.MaxValue}] and out-of-range of LSP Unsigned Integer [{uint.MinValue}:{uint.MaxValue}] => {integer}"); + } + + private static OrType<T, U> ReadFloatToken(JsonReader reader, JsonSerializer serializer, Type[] types) + { + float real = serializer.Deserialize<float>(reader); + if (typeof(T) == typeof(float)) + { + return new OrType<T, U>((T)(object)real); + } + if (typeof(U) == typeof(float)) + { + return new OrType<T, U>((U)(object)real); + } + throw new InvalidOperationException("Invalid token type for float"); + } + + private static OrType<T, U> ReadBooleanToken(JsonReader reader, JsonSerializer serializer, Type[] types) + { + bool boolean = serializer.Deserialize<bool>(reader); + if (typeof(T) == typeof(bool)) + { + return new OrType<T, U>((T)(object)boolean); + } + if (typeof(U) == typeof(bool)) + { + return new OrType<T, U>((U)(object)boolean); + } + throw new InvalidOperationException("Invalid token type for boolean"); + } + + private static OrType<T, U> ReadStringToken(JsonReader reader, JsonSerializer serializer, Type[] types) + { + string str = serializer.Deserialize<string>(reader)!; + if (typeof(T) == typeof(string)) + { + return new OrType<T, U>((T)(object)str); + } + if (typeof(U) == typeof(string)) + { + return new OrType<T, U>((U)(object)str); + } + throw new InvalidOperationException("Invalid token type for string"); + } + + private static OrType<T, U> ReadObjectToken(JToken token, JsonSerializer serializer, Type[] types) + { + var exceptions = new List<Exception>(); + foreach (Type type in types) + { + try + { + object? value = null; + if (token.Type == JTokenType.Array && type == typeof((uint, uint))) + { + uint[]? o = token.ToObject<uint[]>(serializer); + if (o != null) + { + value = (o[0], o[1]); + } + } + else + { + value = token.ToObject(type, serializer); + } + + if (value != null) + { + if (value is T t) + { + return new OrType<T, U>(t); + } + if (value is U u) + { + return new OrType<T, U>(u); + } + } + } + catch (Exception ex) + { + exceptions.Add(ex); + continue; + } + } + + throw new JsonSerializationException("Unable to deserialize object", new AggregateException(exceptions)); + } + + + + public override void WriteJson(JsonWriter writer, OrType<T, U>? value, JsonSerializer serializer) + { + if (value is null) + { + writer.WriteNull(); + } + else if (value?.Value?.GetType() == typeof((uint, uint))) + { + ValueTuple<uint, uint> o = (ValueTuple<uint, uint>)(value.Value); + serializer.Serialize(writer, new uint[] { o.Item1, o.Item2 }); + } + else + { + serializer.Serialize(writer, value?.Value); + } + } +} + +public class OrTypeConverter<T, U, V> : JsonConverter<OrType<T, U, V>> +{ + public override OrType<T, U, V>? ReadJson(JsonReader reader, Type objectType, OrType<T, U, V>? existingValue, bool hasExistingValue, JsonSerializer serializer) + { + reader = reader ?? throw new ArgumentNullException(nameof(reader)); + + if (reader.TokenType == JsonToken.Null) + { + return null; + } + + Type[] types = new Type[] { typeof(T), typeof(U), typeof(V) }; + + if (reader.TokenType == JsonToken.Integer && (Validators.HasType(types, typeof(uint)) || Validators.HasType(types, typeof(int)))) + { + return ReadIntegerToken(reader, serializer, types); + } + if (reader.TokenType == JsonToken.Float && Validators.HasType(types, typeof(float))) + { + return ReadFloatToken(reader, serializer, types); + } + if (reader.TokenType == JsonToken.Boolean && Validators.HasType(types, typeof(bool))) + { + return ReadBooleanToken(reader, serializer, types); + } + if (reader.TokenType == JsonToken.String && Validators.HasType(types, typeof(string))) + { + return ReadStringToken(reader, serializer, types); + } + + var token = JToken.Load(reader); + return OrTypeConverter<T, U, V>.ReadObjectToken(token, serializer, OrTypeConverterHelpers.SortTypesByHeuristic(types, token)); + } + + private static OrType<T, U, V> ReadIntegerToken(JsonReader reader, JsonSerializer serializer, Type[] types) + { + long integer = serializer.Deserialize<long>(reader); + if (Validators.InUIntegerRange(integer) && Validators.HasType(types, typeof(uint))) + { + if (typeof(T) == typeof(uint)) + { + return new OrType<T, U, V>((T)(object)(uint)integer); + } + if (typeof(U) == typeof(uint)) + { + return new OrType<T, U, V>((U)(object)(uint)integer); + } + if (typeof(V) == typeof(uint)) + { + return new OrType<T, U, V>((V)(object)(uint)integer); + } + } + if (Validators.InIntegerRange(integer) && Validators.HasType(types, typeof(int))) + { + if (typeof(T) == typeof(int)) + { + return new OrType<T, U, V>((T)(object)(int)integer); + } + if (typeof(U) == typeof(int)) + { + return new OrType<T, U, V>((U)(object)(int)integer); + } + if (typeof(V) == typeof(int)) + { + return new OrType<T, U, V>((V)(object)(int)integer); + } + } + throw new ArgumentOutOfRangeException($"Integer out-of-range of LSP Signed Integer[{int.MinValue}:{int.MaxValue}] and out-of-range of LSP Unsigned Integer [{uint.MinValue}:{uint.MaxValue}] => {integer}"); + } + + private static OrType<T, U, V> ReadFloatToken(JsonReader reader, JsonSerializer serializer, Type[] types) + { + float real = serializer.Deserialize<float>(reader); + if (typeof(T) == typeof(float)) + { + return new OrType<T, U, V>((T)(object)real); + } + if (typeof(U) == typeof(float)) + { + return new OrType<T, U, V>((U)(object)real); + } + if (typeof(V) == typeof(float)) + { + return new OrType<T, U, V>((V)(object)real); + } + throw new InvalidOperationException("Invalid token type for float"); + } + + private static OrType<T, U, V> ReadBooleanToken(JsonReader reader, JsonSerializer serializer, Type[] types) + { + bool boolean = serializer.Deserialize<bool>(reader); + if (typeof(T) == typeof(bool)) + { + return new OrType<T, U, V>((T)(object)boolean); + } + if (typeof(U) == typeof(bool)) + { + return new OrType<T, U, V>((U)(object)boolean); + } + if (typeof(V) == typeof(bool)) + { + return new OrType<T, U, V>((V)(object)boolean); + } + throw new InvalidOperationException("Invalid token type for boolean"); + } + + private static OrType<T, U, V> ReadStringToken(JsonReader reader, JsonSerializer serializer, Type[] types) + { + string str = serializer.Deserialize<string>(reader)!; + if (typeof(T) == typeof(string)) + { + return new OrType<T, U, V>((T)(object)str); + } + if (typeof(U) == typeof(string)) + { + return new OrType<T, U, V>((U)(object)str); + } + if (typeof(V) == typeof(string)) + { + return new OrType<T, U, V>((V)(object)str); + } + throw new InvalidOperationException("Invalid token type for string"); + } + + private static OrType<T, U, V> ReadObjectToken(JToken token, JsonSerializer serializer, Type[] types) + { + var exceptions = new List<Exception>(); + foreach (Type type in types) + { + try + { + object? value = null; + if (token.Type == JTokenType.Array && type == typeof((uint, uint))) + { + uint[]? o = token.ToObject<uint[]>(serializer); + if (o != null) + { + value = (o[0], o[1]); + } + } + else + { + value = token.ToObject(type, serializer); + } + + if (value != null) + { + if (value is T t) + { + return new OrType<T, U, V>(t); + } + if (value is U u) + { + return new OrType<T, U, V>(u); + } + if (value is V v) + { + return new OrType<T, U, V>(v); + } + } + } + catch (Exception ex) + { + exceptions.Add(ex); + continue; + } + } + + throw new JsonSerializationException("Unable to deserialize object", new AggregateException(exceptions)); + } + + public override void WriteJson(JsonWriter writer, OrType<T, U, V>? value, JsonSerializer serializer) + { + if (value is null) + { + writer.WriteNull(); + } + else if (value?.Value?.GetType() == typeof((uint, uint))) + { + ValueTuple<uint, uint> o = (ValueTuple<uint, uint>)(value.Value); + serializer.Serialize(writer, new uint[] { o.Item1, o.Item2 }); + } + else + { + serializer.Serialize(writer, value?.Value); + } + } +} + +public class OrTypeConverter<T, U, V, W> : JsonConverter<OrType<T, U, V, W>> +{ + public override OrType<T, U, V, W>? ReadJson(JsonReader reader, Type objectType, OrType<T, U, V, W>? existingValue, bool hasExistingValue, JsonSerializer serializer) + { + reader = reader ?? throw new ArgumentNullException(nameof(reader)); + + if (reader.TokenType == JsonToken.Null) + { + return null; + } + + Type[] types = new Type[] { typeof(T), typeof(U), typeof(V), typeof(W) }; + + if (reader.TokenType == JsonToken.Integer && (Validators.HasType(types, typeof(uint)) || Validators.HasType(types, typeof(int)))) + { + return ReadIntegerToken(reader, serializer, types); + } + if (reader.TokenType == JsonToken.Float && Validators.HasType(types, typeof(float))) + { + return ReadFloatToken(reader, serializer, types); + } + if (reader.TokenType == JsonToken.Boolean && Validators.HasType(types, typeof(bool))) + { + return ReadBooleanToken(reader, serializer, types); + } + if (reader.TokenType == JsonToken.String && Validators.HasType(types, typeof(string))) + { + return ReadStringToken(reader, serializer, types); + } + + var token = JToken.Load(reader); + return OrTypeConverter<T, U, V, W>.ReadObjectToken(token, serializer, OrTypeConverterHelpers.SortTypesByHeuristic(types, token)); + } + + private static OrType<T, U, V, W> ReadIntegerToken(JsonReader reader, JsonSerializer serializer, Type[] types) + { + long integer = serializer.Deserialize<long>(reader); + if (Validators.InUIntegerRange(integer) && Validators.HasType(types, typeof(uint))) + { + if (typeof(T) == typeof(uint)) + { + return new OrType<T, U, V, W>((T)(object)(uint)integer); + } + if (typeof(U) == typeof(uint)) + { + return new OrType<T, U, V, W>((U)(object)(uint)integer); + } + if (typeof(V) == typeof(uint)) + { + return new OrType<T, U, V, W>((V)(object)(uint)integer); + } + if (typeof(W) == typeof(uint)) + { + return new OrType<T, U, V, W>((W)(object)(uint)integer); + } + } + if (Validators.InIntegerRange(integer) && Validators.HasType(types, typeof(int))) + { + if (typeof(T) == typeof(int)) + { + return new OrType<T, U, V, W>((T)(object)(int)integer); + } + if (typeof(U) == typeof(int)) + { + return new OrType<T, U, V, W>((U)(object)(int)integer); + } + if (typeof(V) == typeof(int)) + { + return new OrType<T, U, V, W>((V)(object)(int)integer); + } + if (typeof(W) == typeof(int)) + { + return new OrType<T, U, V, W>((W)(object)(int)integer); + } + } + throw new ArgumentOutOfRangeException($"Integer out-of-range of LSP Signed Integer[{int.MinValue}:{int.MaxValue}] and out-of-range of LSP Unsigned Integer [{uint.MinValue}:{uint.MaxValue}] => {integer}"); + } + + private static OrType<T, U, V, W> ReadFloatToken(JsonReader reader, JsonSerializer serializer, Type[] types) + { + float real = serializer.Deserialize<float>(reader); + if (typeof(T) == typeof(float)) + { + return new OrType<T, U, V, W>((T)(object)real); + } + if (typeof(U) == typeof(float)) + { + return new OrType<T, U, V, W>((U)(object)real); + } + if (typeof(V) == typeof(float)) + { + return new OrType<T, U, V, W>((V)(object)real); + } + if (typeof(W) == typeof(float)) + { + return new OrType<T, U, V, W>((W)(object)real); + } + throw new InvalidOperationException("Invalid token type for float"); + } + + private static OrType<T, U, V, W> ReadBooleanToken(JsonReader reader, JsonSerializer serializer, Type[] types) + { + bool boolean = serializer.Deserialize<bool>(reader); + if (typeof(T) == typeof(bool)) + { + return new OrType<T, U, V, W>((T)(object)boolean); + } + if (typeof(U) == typeof(bool)) + { + return new OrType<T, U, V, W>((U)(object)boolean); + } + if (typeof(V) == typeof(bool)) + { + return new OrType<T, U, V, W>((V)(object)boolean); + } + if (typeof(W) == typeof(bool)) + { + return new OrType<T, U, V, W>((W)(object)boolean); + } + throw new InvalidOperationException("Invalid token type for boolean"); + } + + private static OrType<T, U, V, W> ReadStringToken(JsonReader reader, JsonSerializer serializer, Type[] types) + { + string str = serializer.Deserialize<string>(reader)!; + if (typeof(T) == typeof(string)) + { + return new OrType<T, U, V, W>((T)(object)str); + } + if (typeof(U) == typeof(string)) + { + return new OrType<T, U, V, W>((U)(object)str); + } + if (typeof(V) == typeof(string)) + { + return new OrType<T, U, V, W>((V)(object)str); + } + if (typeof(W) == typeof(string)) + { + return new OrType<T, U, V, W>((W)(object)str); + } + throw new InvalidOperationException("Invalid token type for string"); + } + + private static OrType<T, U, V, W> ReadObjectToken(JToken token, JsonSerializer serializer, Type[] types) + { + var exceptions = new List<Exception>(); + foreach (Type type in types) + { + try + { + object? value = null; + if (token.Type == JTokenType.Array && type == typeof((uint, uint))) + { + uint[]? o = token.ToObject<uint[]>(serializer); + if (o != null) + { + value = (o[0], o[1]); + } + } + else + { + value = token.ToObject(type, serializer); + } + + if (value != null) + { + if (value is T t) + { + return new OrType<T, U, V, W>(t); + } + if (value is U u) + { + return new OrType<T, U, V, W>(u); + } + if (value is V v) + { + return new OrType<T, U, V, W>(v); + } + if (value is W w) + { + return new OrType<T, U, V, W>(w); + } + } + + } + catch (Exception ex) + { + exceptions.Add(ex); + continue; + } + } + + throw new JsonSerializationException("Unable to deserialize object", new AggregateException(exceptions)); + } + + public override void WriteJson(JsonWriter writer, OrType<T, U, V, W>? value, JsonSerializer serializer) + { + if (value is null) + { + writer.WriteNull(); + } + else if (value?.Value?.GetType() == typeof((uint, uint))) + { + ValueTuple<uint, uint> o = (ValueTuple<uint, uint>)(value.Value); + serializer.Serialize(writer, new uint[] { o.Item1, o.Item2 }); + } + else + { + serializer.Serialize(writer, value?.Value); + } + } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/Proposed.cs b/generator/plugins/dotnet/custom/Proposed.cs new file mode 100644 index 0000000..eb0ed75 --- /dev/null +++ b/generator/plugins/dotnet/custom/Proposed.cs @@ -0,0 +1,17 @@ +using System; + +[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Enum)] +public class ProposedAttribute : Attribute +{ + public ProposedAttribute() + { + Version = null; + } + + public ProposedAttribute(string version) + { + Version = version; + } + + public string? Version { get; } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/ResponseError.cs b/generator/plugins/dotnet/custom/ResponseError.cs new file mode 100644 index 0000000..5151783 --- /dev/null +++ b/generator/plugins/dotnet/custom/ResponseError.cs @@ -0,0 +1,27 @@ +using Newtonsoft.Json; +using System.Runtime.Serialization; + +[DataContract] +public class ResponseError +{ + [JsonConstructor] + public ResponseError( + int code, + string message, + LSPObject? data = null + ) + { + Code = code; + Message = message; + Data = data; + } + + [DataMember(Name = "code")] + int Code { get; } + + [DataMember(Name = "message")] + string Message { get; } + + [DataMember(Name = "data")] + LSPObject? Data { get; } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/Since.cs b/generator/plugins/dotnet/custom/Since.cs new file mode 100644 index 0000000..b13da74 --- /dev/null +++ b/generator/plugins/dotnet/custom/Since.cs @@ -0,0 +1,17 @@ +using System; + +[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Enum | AttributeTargets.Interface)] +public class SinceAttribute : Attribute +{ + public SinceAttribute() + { + Version = null; + } + + public SinceAttribute(string version) + { + Version = version; + } + + public string? Version { get; } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/custom/Validators.cs b/generator/plugins/dotnet/custom/Validators.cs new file mode 100644 index 0000000..9edc18f --- /dev/null +++ b/generator/plugins/dotnet/custom/Validators.cs @@ -0,0 +1,20 @@ + +using System; + +public static class Validators +{ + public static bool HasType(Type[] types, Type type) + { + return types.Contains(type); + } + + public static bool InIntegerRange(long value) + { + return value >= int.MinValue && value <= int.MaxValue; + } + + public static bool InUIntegerRange(long value) + { + return value >= uint.MinValue && value <= uint.MaxValue; + } +}
\ No newline at end of file diff --git a/generator/plugins/dotnet/dotnet_classes.py b/generator/plugins/dotnet/dotnet_classes.py new file mode 100644 index 0000000..0a705cd --- /dev/null +++ b/generator/plugins/dotnet/dotnet_classes.py @@ -0,0 +1,1024 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import re +from typing import Any, Dict, List, Optional, Tuple, Union + +import cattrs + +from generator import model + +from .dotnet_commons import TypeData +from .dotnet_constants import NAMESPACE +from .dotnet_helpers import ( + class_wrapper, + generate_extras, + get_doc, + get_special_case_class_name, + get_special_case_property_name, + get_usings, + indent_lines, + lsp_method_to_name, + namespace_wrapper, + to_camel_case, + to_upper_camel_case, +) + +ORTYPE_CONVERTER_RE = re.compile(r"OrType<(?P<parts>.*)>") +IMMUTABLE_ARRAY_CONVERTER_RE = re.compile(r"ImmutableArray<(?P<elements>.*)>") + + +def _get_enum(name: str, spec: model.LSPModel) -> Optional[model.Enum]: + for enum in spec.enumerations: + if enum.name == name: + return enum + return None + + +def _get_struct(name: str, spec: model.LSPModel) -> Optional[model.Structure]: + for struct in spec.structures: + if struct.name == name: + return struct + return None + + +def _is_str_enum(enum_def: model.Enum) -> bool: + return all(isinstance(item.value, str) for item in enum_def.values) + + +def _is_int_enum(enum_def: model.Enum) -> bool: + return all(isinstance(item.value, int) for item in enum_def.values) + + +def lsp_to_base_types(lsp_type: model.BaseType): + if lsp_type.name in ["string", "RegExp"]: + return "string" + elif lsp_type.name in ["DocumentUri", "URI"]: + return "Uri" + elif lsp_type.name in ["decimal"]: + return "float" + elif lsp_type.name in ["integer"]: + return "int" + elif lsp_type.name in ["uinteger"]: + return "uint" + elif lsp_type.name in ["boolean"]: + return "bool" + elif lsp_type.name in ["null"]: + return "object" + + # null should be handled by the caller as an Option<> type + raise ValueError(f"Unknown base type: {lsp_type.name}") + + +def get_types_for_usings(code: List[str]) -> List[str]: + immutable = [] + for line in code: + if "ImmutableArray<" in line: + immutable.append("ImmutableArray") + if "ImmutableDictionary<" in line: + immutable.append("ImmutableDictionary") + return list(set(immutable)) + + +def has_null_base_type(items: List[model.LSP_TYPE_SPEC]) -> bool: + return any(item.kind == "base" and item.name == "null" for item in items) + + +def filter_null_base_type( + items: List[model.LSP_TYPE_SPEC], +) -> List[model.LSP_TYPE_SPEC]: + return [item for item in items if not (item.kind == "base" and item.name == "null")] + + +def get_type_name( + type_def: model.LSP_TYPE_SPEC, + types: TypeData, + spec: model.LSPModel, + name_context: Optional[str] = None, +) -> str: + name = None + if type_def.kind == "reference": + enum_def = _get_enum(type_def.name, spec) + if enum_def and enum_def.supportsCustomValues: + if _is_str_enum(enum_def): + name = f"string" + elif _is_int_enum(enum_def): + name = f"int" + else: + name = get_special_case_class_name(type_def.name) + elif type_def.kind == "array": + name = f"ImmutableArray<{get_type_name(type_def.element, types, spec, name_context)}>" + elif type_def.kind == "map": + name = generate_map_type(type_def, types, spec, name_context) + elif type_def.kind == "base": + name = lsp_to_base_types(type_def) + elif type_def.kind == "literal": + name = generate_literal_type(type_def, types, spec, name_context) + elif type_def.kind == "stringLiteral": + name = "string" + elif type_def.kind == "tuple": + subset = filter_null_base_type(type_def.items) + subset_types = [ + get_type_name(item, types, spec, name_context) for item in subset + ] + name = f"({', '.join(subset_types)})" + elif type_def.kind == "or": + subset = filter_null_base_type(type_def.items) + if len(subset) == 1: + name = get_type_name(subset[0], types, spec, name_context) + elif len(subset) >= 2: + if are_variant_literals(subset): + name = generate_class_from_variant_literals( + subset, spec, types, name_context + ) + else: + subset_types = [ + get_type_name(item, types, spec, name_context) for item in subset + ] + name = f"OrType<{', '.join(subset_types)}>" + else: + raise ValueError(f"Unknown type kind: {type_def.kind}") + else: + raise ValueError(f"Unknown type kind: {type_def.kind}") + return name + + +def generate_map_type( + type_def: model.LSP_TYPE_SPEC, + types: TypeData, + spec: model.LSPModel, + name_context: Optional[str] = None, +) -> str: + key_type = get_type_name(type_def.key, types, spec, name_context) + + if type_def.value.kind == "or": + subset = filter_null_base_type(type_def.value.items) + if len(subset) == 1: + value_type = get_type_name(type_def.value, types, spec, name_context) + else: + value_type = to_upper_camel_case(f"{name_context}Value") + type_alias = model.TypeAlias( + **{ + "name": value_type, + "type": type_def.value, + } + ) + generate_class_from_type_alias(type_alias, spec, types) + + else: + value_type = get_type_name(type_def.value, types, spec, name_context) + return f"ImmutableDictionary<{key_type}, {value_type}>" + + +def get_converter(type_def: model.LSP_TYPE_SPEC, type_name: str) -> Optional[str]: + if type_def.kind == "base" and type_def.name in ["DocumentUri", "URI"]: + return "[JsonConverter(typeof(CustomStringConverter<Uri>))]" + elif type_def.kind == "reference" and type_def.name in [ + "Pattern", + "ChangeAnnotationIdentifier", + ]: + return f"[JsonConverter(typeof(CustomStringConverter<{type_def.name}>))]" + elif type_def.kind == "reference" and type_def.name == "DocumentSelector": + return "[JsonConverter(typeof(DocumentSelectorConverter))]" + elif type_def.kind == "or": + subset = filter_null_base_type(type_def.items) + if len(subset) == 1: + return get_converter(subset[0], type_name) + elif len(subset) >= 2: + converter = type_name.replace("OrType<", "OrTypeConverter<") + return f"[JsonConverter(typeof({converter}))]" + elif type_def.kind == "array" and type_name.startswith("OrType<"): + matches = ORTYPE_CONVERTER_RE.match(type_name).groupdict() + if "parts" in matches: + converter = f"OrTypeArrayConverter<{matches['parts']}>" + return f"[JsonConverter(typeof({converter}))]" + elif type_def.kind == "array": + matches = IMMUTABLE_ARRAY_CONVERTER_RE.match(type_name).groupdict() + elements = matches["elements"] + if elements.startswith("OrType<"): + matches = ORTYPE_CONVERTER_RE.match(elements).groupdict() + converter = f"OrTypeArrayConverter<{matches['parts']}>" + return f"[JsonConverter(typeof({converter}))]" + else: + converter = f"CustomArrayConverter<{elements}>" + return f"[JsonConverter(typeof({converter}))]" + return None + + +def generate_property( + prop_def: model.Property, + spec: model.LSPModel, + types: TypeData, + usings: List[str], + class_name: str = "", +) -> Tuple[List[str], str]: + if prop_def.name == "jsonrpc": + name = "JsonRPC" + else: + name = to_upper_camel_case(prop_def.name) + type_name = get_type_name( + prop_def.type, types, spec, f"{class_name}_{prop_def.name}" + ) + converter = get_converter(prop_def.type, type_name) + special_optional = prop_def.type.kind == "or" and has_null_base_type( + prop_def.type.items + ) + optional = ( + "?" + if (prop_def.optional or special_optional) + and not ( + type_name.startswith("ImmutableArray<") + or type_name.startswith("ImmutableDictionary<") + ) + else "" + ) + lines = ( + get_doc(prop_def.documentation) + + generate_extras(prop_def) + + ([converter] if converter else []) + + ( + ["[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]"] + if optional and not special_optional + else [] + ) + + [ + f'[DataMember(Name = "{prop_def.name}")]', + ] + ) + + if prop_def.type.kind == "stringLiteral": + lines.append( + f'public {type_name}{optional} {name} {{ get; init; }} = "{prop_def.type.value}";' + ) + else: + lines.append(f"public {type_name}{optional} {name} {{ get; init; }}") + + usings.append("DataMember") + if converter: + usings.append("JsonConverter") + if optional and not special_optional: + usings.append("JsonProperty") + + return lines, type_name + + +def generate_name(name_context: str, types: TypeData) -> str: + # If name context has a '_' it is likely a property. + # Try name generation using just the property name + parts = [to_upper_camel_case(p) for p in name_context.split("_") if len(p) > 3] + + # Try the last part of the name context + name = parts[-1] + if not types.get_by_name(name) and "info" in name_context.lower(): + return name + + # Combine all parts and try again + name = "".join(parts) + if not types.get_by_name(name): + return name + + raise ValueError(f"Unable to generate name for {name_context}") + + +def generate_literal_type( + literal: model.LiteralType, + types: TypeData, + spec: model.LSPModel, + name_context: Optional[str] = None, +) -> str: + if len(literal.value.properties) == 0: + return "LSPObject" + + if types.get_by_name(literal.name) and not _get_struct(literal.name, spec): + return literal.name + + if name_context is None: + raise ValueError("name_context must be provided for literal types") + + if name_context.startswith("I") and name_context[1].isupper(): + # This is a interface name ISomething => Something + name_context = name_context[1:] + + if "_" not in name_context: + name_context = f"{name_context}_{get_context_from_literal(literal)}" + + literal.name = generate_name(name_context, types) + + usings = ["DataContract"] + inner = [] + for prop in literal.value.properties: + prop_code, _ = generate_property(prop, spec, types, usings, literal.name) + inner += prop_code + + lines = namespace_wrapper( + NAMESPACE, + get_usings(usings + get_types_for_usings(inner)), + class_wrapper(literal, inner), + ) + types.add_type_info(literal, literal.name, lines) + return literal.name + + +def generate_constructor( + struct: model.Structure, + types: TypeData, + properties: List[Tuple[model.Property, str]], +) -> List[str]: + class_name = get_special_case_class_name(struct.name) + constructor = [ + "[JsonConstructor]", + f"public {class_name}(", + ] + + arguments = [] + optional_args = [] + assignments = [] + ctor_data = [] + for prop, prop_type in properties: + name = get_special_case_property_name(to_camel_case(prop.name)) + special_optional = prop.type.kind == "or" and has_null_base_type( + prop.type.items + ) + if prop.optional or special_optional: + if prop_type.startswith("ImmutableArray<") or prop_type.startswith( + "ImmutableDictionary<" + ): + optional_args += [f"{prop_type} {name} = default!"] + else: + optional_args += [f"{prop_type}? {name} = null"] + ctor_data += [(prop_type, name, True)] + elif prop.name == "jsonrpc": + optional_args += [f'{prop_type} {name} = "2.0"'] + ctor_data += [(prop_type, name, True)] + else: + arguments += [f"{prop_type} {name}"] + ctor_data += [(prop_type, name, False)] + + if prop.name == "jsonrpc": + assignments += [f"JsonRPC = {name};"] + else: + assignments += [f"{to_upper_camel_case(prop.name)} = {name};"] + + # combine args with a '\n' to get comma with indent + all_args = (",\n".join(indent_lines(arguments + optional_args))).splitlines() + types.add_ctor(struct.name, ctor_data) + + # re-split args to get the right coma placement and indent + constructor += all_args + constructor += [")", "{"] + constructor += indent_lines(assignments) + constructor += ["}"] + return constructor + + +def generate_class_from_struct( + struct: model.Structure, + spec: model.LSPModel, + types: TypeData, + derived: Optional[str] = None, + attributes: Optional[List[str]] = None, +): + if types.get_by_name(struct.name) or struct.name.startswith("_"): + return + + if attributes is None: + attributes = [] + + inner = [] + usings = ["DataContract", "JsonConstructor"] + + properties = get_all_properties(struct, spec) + prop_types = [] + for prop in properties: + prop_code, prop_type = generate_property(prop, spec, types, usings, struct.name) + inner += prop_code + prop_types += [prop_type] + + ctor = generate_constructor(struct, types, zip(properties, prop_types)) + inner = ctor + inner + + lines = namespace_wrapper( + NAMESPACE, + get_usings(usings + get_types_for_usings(inner + attributes)), + class_wrapper(struct, inner, derived, attributes), + ) + types.add_type_info(struct, struct.name, lines) + + +def get_context_from_literal(literal: model.LiteralType) -> str: + if len(literal.value.properties) == 0: + return "LSPObject" + + skipped = 0 + skip = [ + "range", + "rangeLength", + "position", + "position", + "location", + "locationLink", + "text", + ] + for prop in literal.value.properties: + if prop.name in skip: + skipped += 1 + continue + return prop.name + + if skipped == len(literal.value.properties): + # pick property with longest name + names = sorted([p.name for p in literal.value.properties]) + return sorted(names, key=lambda n: len(n))[-1] + + return "" + + +def generate_type_alias_constructor( + type_def: model.TypeAlias, spec: model.LSPModel, types: TypeData +) -> List[str]: + constructor = [] + + if type_def.type.kind == "or": + subset = filter_null_base_type(type_def.type.items) + if len(subset) == 1: + raise ValueError("Unable to generate constructor for single item union") + elif len(subset) >= 2: + type_name = to_upper_camel_case(type_def.name) + for t in subset: + sub_type = get_type_name(t, types, spec, type_def.name) + arg = get_special_case_property_name(to_camel_case(sub_type)) + matches = re.match(r"ImmutableArray<(?P<arg>\w+)>", arg) + if matches: + arg = f"{matches['arg']}s" + + constructor += [ + f"public {type_name}({sub_type} {arg}): base({arg}) {{}}", + ] + else: + raise ValueError("Unable to generate constructor for empty union") + elif type_def.type.kind == "reference": + type_name = to_upper_camel_case(type_def.name) + ctor_data = types.get_ctor(type_def.type.name) + required = [ + (prop_type, prop_name) + for prop_type, prop_name, optional in ctor_data + if not optional + ] + optional = [ + (prop_type, prop_name) + for prop_type, prop_name, optional in ctor_data + if optional + ] + + ctor_args = [f"{prop_type} {prop_name}" for prop_type, prop_name in required] + ctor_args += [ + f"{prop_type}? {prop_name} = null" for prop_type, prop_name in optional + ] + + base_args = [f"{prop_name}" for _, prop_name in required + optional] + constructor += [ + f"public {type_name}({','.join(ctor_args)}): base({','.join(base_args)}) {{}}", + ] + + return constructor + + +def generate_type_alias_converter( + type_def: model.TypeAlias, spec: model.LSPModel, types: TypeData +) -> None: + assert type_def.type.kind == "or" + subset_types = [ + get_type_name(i, types, spec, type_def.name) + for i in filter_null_base_type(type_def.type.items) + ] + converter = f"{type_def.name}Converter" + or_type_converter = f"OrTypeConverter<{','.join(subset_types)}>" + or_type = f"OrType<{','.join(subset_types)}>" + code = [ + f"public class {converter} : JsonConverter<{type_def.name}>", + "{", + f"private {or_type_converter} _orType;", + f"public {converter}()", + "{", + f"_orType = new {or_type_converter}();", + "}", + f"public override {type_def.name}? ReadJson(JsonReader reader, Type objectType, {type_def.name}? existingValue, bool hasExistingValue, JsonSerializer serializer)", + "{", + "reader = reader ?? throw new ArgumentNullException(nameof(reader));", + "if (reader.TokenType == JsonToken.Null) { return null; }", + f"var o = _orType.ReadJson(reader, objectType, existingValue, serializer);", + f"if (o is {or_type} orType)", + "{", + ] + for t in subset_types: + code += [ + f"if (orType.Value?.GetType() == typeof({t}))", + "{", + f"return new {type_def.name}(({t})orType.Value);", + "}", + ] + code += [ + "}", + 'throw new JsonSerializationException($"Unexpected token type.");', + "}", + f"public override void WriteJson(JsonWriter writer, {type_def.name}? value, JsonSerializer serializer)", + "{", + "_orType.WriteJson(writer, value, serializer);", + "}", + "}", + ] + + code = namespace_wrapper( + NAMESPACE, get_usings(["JsonConverter"] + get_types_for_usings(code)), code + ) + + ref = model.Structure(**{"name": converter, "properties": []}) + types.add_type_info(ref, converter, code) + return converter + + +def generate_class_from_type_alias( + type_def: model.TypeAlias, spec: model.LSPModel, types: TypeData +) -> None: + if types.get_by_name(type_def.name): + return + + usings = ["DataContract"] + type_name = get_type_name(type_def.type, types, spec, type_def.name) + class_attributes = [] + if type_def.type.kind == "or": + converter = generate_type_alias_converter(type_def, spec, types) + class_attributes += [f"[JsonConverter(typeof({converter}))]"] + usings.append("JsonConverter") + + inner = generate_type_alias_constructor(type_def, spec, types) + lines = namespace_wrapper( + NAMESPACE, + get_usings(usings + get_types_for_usings(inner)), + class_wrapper(type_def, inner, type_name, class_attributes), + ) + types.add_type_info(type_def, type_def.name, lines) + + +def generate_class_from_variant_literals( + literals: List[model.LiteralType], + spec: model.LSPModel, + types: TypeData, + name_context: Optional[str] = None, +) -> str: + name = generate_name(name_context, types) + if types.get_by_name(name): + raise ValueError(f"Name {name} already exists") + + struct = model.Structure( + **{ + "name": name, + "properties": get_properties_from_literals(literals), + } + ) + + lines = generate_code_for_variant_struct(struct, spec, types) + types.add_type_info(struct, struct.name, lines) + return struct.name + + +def get_properties_from_literals(literals: List[model.LiteralType]) -> Dict[str, Any]: + properties = [] + for literal in literals: + assert literal.kind == "literal" + for prop in literal.value.properties: + if prop.name not in [p["name"] for p in properties]: + properties.append( + { + "name": prop.name, + "type": cattrs.unstructure(prop.type), + "optional": has_optional_variant(literals, prop.name), # + } + ) + return properties + + +def generate_code_for_variant_struct( + struct: model.Structure, + spec: model.LSPModel, + types: TypeData, +) -> None: + prop_types = [] + inner = [] + usings = ["DataContract", "JsonConstructor"] + for prop in struct.properties: + prop_code, prop_type = generate_property(prop, spec, types, usings, struct.name) + inner += prop_code + prop_types += [prop_type] + + ctor_data = [] + constructor_args = [] + conditions = [] + for prop, prop_type in zip(struct.properties, prop_types): + name = get_special_case_property_name(to_camel_case(prop.name)) + immutable = prop_type.startswith("ImmutableArray<") or prop_type.startswith( + "ImmutableDictionary<" + ) + constructor_args += [ + f"{prop_type} {name}" if immutable else f"{prop_type}? {name}" + ] + ctor_data = [(prop_type)] + if immutable: + conditions += [f"({name}.IsDefault)"] + else: + conditions += [f"({name} is null)"] + + sig = ", ".join(constructor_args) + types.add_ctor(struct.name, ctor_data) + ctor = [ + f"[JsonConstructor]", + f"public {struct.name}({sig})", + "{", + *indent_lines( + [ + f"if ({'&&'.join(conditions)})", + "{", + *indent_lines( + [ + f'throw new ArgumentException("At least one of the arguments must be non-null");' + ] + ), + "}", + ] + ), + *indent_lines( + [ + f"{to_upper_camel_case(prop.name)} = {get_special_case_property_name(to_camel_case(prop.name))};" + for prop in struct.properties + ] + ), + "}", + ] + + inner = ctor + inner + + return namespace_wrapper( + NAMESPACE, + get_usings(usings + get_types_for_usings(inner)), + class_wrapper(struct, inner, None), + ) + + +def generate_class_from_variant_type_alias( + type_def: model.TypeAlias, + spec: model.LSPModel, + types: TypeData, + name_context: Optional[str] = None, +) -> None: + struct = model.Structure( + **{ + "name": type_def.name, + "properties": get_properties_from_literals(type_def.type.items), + "documentation": type_def.documentation, + "since": type_def.since, + "deprecated": type_def.deprecated, + "proposed": type_def.proposed, + } + ) + + lines = generate_code_for_variant_struct(struct, spec, types) + types.add_type_info(type_def, type_def.name, lines) + + +def has_optional_variant(literals: List[model.LiteralType], property_name: str) -> bool: + count = 0 + optional = False + for literal in literals: + for prop in literal.value.properties: + if prop.name == property_name: + count += 1 + optional = optional or prop.optional + return optional and count == len(literals) + + +def are_variant_literals(literals: List[model.LiteralType]) -> bool: + if all(i.kind == "literal" for i in literals): + return all( + has_optional_variant(literals, prop.name) + for prop in literals[0].value.properties + ) + return False + + +def is_variant_type_alias(type_def: model.TypeAlias) -> bool: + if type_def.type.kind == "or" and all( + i.kind == "literal" for i in type_def.type.items + ): + literals = type_def.type.items + return all( + has_optional_variant(literals, prop.name) + for prop in literals[0].value.properties + ) + return False + + +def copy_struct(struct_def: model.Structure, new_name: str): + converter = cattrs.GenConverter() + obj = converter.unstructure(struct_def, model.Structure) + obj["name"] = new_name + return model.Structure(**obj) + + +def copy_property(prop_def: model.Property): + converter = cattrs.GenConverter() + obj = converter.unstructure(prop_def, model.Property) + return model.Property(**obj) + + +def get_all_extends(struct_def: model.Structure, spec) -> List[model.Structure]: + extends = [] + for extend in struct_def.extends: + extends.append(_get_struct(extend.name, spec)) + for struct in get_all_extends(_get_struct(extend.name, spec), spec): + if not any(struct.name == e.name for e in extends): + extends.append(struct) + return extends + + +def get_all_properties(struct: model.Structure, spec) -> List[model.Structure]: + properties = [] + for prop in struct.properties: + properties.append(copy_property(prop)) + + for extend in get_all_extends(struct, spec): + for prop in get_all_properties(extend, spec): + if not any(prop.name == p.name for p in properties): + properties.append(copy_property(prop)) + + if not all(mixin.kind == "reference" for mixin in struct.mixins): + raise ValueError(f"Struct {struct.name} has non-reference mixins") + for mixin in [_get_struct(mixin.name, spec) for mixin in struct.mixins]: + for prop in get_all_properties(mixin, spec): + if not any(prop.name == p.name for p in properties): + properties.append(copy_property(prop)) + + return properties + + +def generate_code_for_request(request: model.Request): + lines = get_doc(request.documentation) + generate_extras(request) + lines.append( + f'public static string {lsp_method_to_name(request.method)} {{ get; }} = "{request.method}";' + ) + return lines + + +def generate_code_for_notification(notify: model.Notification): + lines = get_doc(notify.documentation) + generate_extras(notify) + lines.append( + f'public static string {lsp_method_to_name(notify.method)} {{ get; }} = "{notify.method}";' + ) + return lines + + +def generate_request_notification_methods(spec: model.LSPModel, types: TypeData): + inner_lines = [] + for request in spec.requests: + inner_lines += generate_code_for_request(request) + + for notification in spec.notifications: + inner_lines += generate_code_for_notification(notification) + + lines = namespace_wrapper( + NAMESPACE, + get_usings(["System"] + get_types_for_usings(inner_lines)), + ["public static class LSPMethods", "{", *indent_lines(inner_lines), "}"], + ) + enum_type = model.Enum( + **{ + "name": "LSPMethods", + "type": {"kind": "base", "name": "string"}, + "values": [], + "documentation": "LSP methods as defined in the LSP spec", + } + ) + types.add_type_info(enum_type, "LSPMethods", lines) + + +def get_message_template( + obj: Union[model.Request, model.Notification], + is_request: bool, +) -> model.Structure: + text = "Request" if is_request else "Notification" + properties = [ + { + "name": "jsonrpc", + "type": {"kind": "stringLiteral", "value": "2.0"}, + "documentation": "The jsonrpc version.", + } + ] + if is_request: + properties += [ + { + "name": "id", + "type": { + "kind": "or", + "items": [ + {"kind": "base", "name": "string"}, + {"kind": "base", "name": "integer"}, + ], + }, + "documentation": f"The {text} id.", + } + ] + properties += [ + { + "name": "method", + "type": {"kind": "base", "name": "string"}, + "documentation": f"The {text} method.", + }, + ] + if obj.params: + properties.append( + { + "name": "params", + "type": cattrs.unstructure(obj.params), + "documentation": f"The {text} parameters.", + } + ) + else: + properties.append( + { + "name": "params", + "type": {"kind": "reference", "name": "LSPAny"}, + "documentation": f"The {text} parameters.", + "optional": True, + } + ) + + class_template = { + "name": f"{lsp_method_to_name(obj.method)}{text}", + "properties": properties, + "documentation": obj.documentation, + "since": obj.since, + "deprecated": obj.deprecated, + "proposed": obj.proposed, + } + return model.Structure(**class_template) + + +def get_response_template( + obj: model.Request, spec: model.LSPModel, types: TypeData +) -> model.Structure: + properties = [ + { + "name": "jsonrpc", + "type": {"kind": "stringLiteral", "value": "2.0"}, + "documentation": "The jsonrpc version.", + }, + { + "name": "id", + "type": { + "kind": "or", + "items": [ + {"kind": "base", "name": "string"}, + {"kind": "base", "name": "integer"}, + ], + }, + "documentation": f"The Request id.", + }, + ] + if obj.result: + properties.append( + { + "name": "result", + "type": cattrs.unstructure(obj.result), + "documentation": f"Results for the request.", + "optional": True, + } + ) + else: + properties.append( + { + "name": "result", + "type": {"kind": "base", "name": "null"}, + "documentation": f"Results for the request.", + "optional": True, + } + ) + properties.append( + { + "name": "error", + "type": {"kind": "reference", "name": "ResponseError"}, + "documentation": f"Error while handling the request.", + "optional": True, + } + ) + class_template = { + "name": f"{lsp_method_to_name(obj.method)}Response", + "properties": properties, + "documentation": obj.documentation, + "since": obj.since, + "deprecated": obj.deprecated, + "proposed": obj.proposed, + } + return model.Structure(**class_template) + + +def get_registration_options_template( + obj: Union[model.Request, model.Notification], + spec: model.LSPModel, + types: TypeData, +) -> model.Structure: + if obj.registrationOptions and obj.registrationOptions.kind != "reference": + if obj.registrationOptions.kind == "and": + structs = [_get_struct(s.name, spec) for s in obj.registrationOptions.items] + properties = [] + for struct in structs: + properties += get_all_properties(struct, spec) + + class_template = { + "name": f"{lsp_method_to_name(obj.method)}RegistrationOptions", + "properties": [ + cattrs.unstructure(p, model.Property) for p in properties + ], + } + return model.Structure(**class_template) + else: + raise ValueError( + f"Unexpected registrationOptions type: {obj.registrationOptions.type.kind}" + ) + return None + + +def generate_all_classes(spec: model.LSPModel, types: TypeData): + for struct in spec.structures: + generate_class_from_struct(struct, spec, types) + + for type_alias in spec.typeAliases: + if is_variant_type_alias(type_alias): + generate_class_from_variant_type_alias(type_alias, spec, types) + else: + generate_class_from_type_alias(type_alias, spec, types) + + generate_request_notification_methods(spec, types) + + for request in spec.requests: + partial_result_name = None + if request.partialResult: + partial_result_name = get_type_name(request.partialResult, types, spec) + + struct = get_message_template(request, is_request=True) + generate_class_from_struct( + struct, + spec, + types, + ( + f"IRequest<{get_type_name(request.params, types, spec)}>" + if request.params + else "IRequest<LSPAny?>" + ), + [ + f"[Direction(MessageDirection.{to_upper_camel_case(request.messageDirection)})]", + f'[LSPRequest("{request.method}", typeof({lsp_method_to_name(request.method)}Response), typeof({partial_result_name}))]' + if partial_result_name + else f'[LSPRequest("{request.method}", typeof({lsp_method_to_name(request.method)}Response))]', + ], + ) + response = get_response_template(request, spec, types) + generate_class_from_struct( + response, + spec, + types, + f"IResponse<{get_type_name(request.result, types, spec)}>", + [ + f"[LSPResponse(typeof({lsp_method_to_name(request.method)}Request))]", + ], + ) + registration_options = get_registration_options_template(request, spec, types) + if registration_options: + generate_class_from_struct( + registration_options, + spec, + types, + ) + + for notification in spec.notifications: + struct = get_message_template(notification, is_request=False) + generate_class_from_struct( + struct, + spec, + types, + ( + f"INotification<{get_type_name(notification.params, types, spec)}>" + if notification.params + else "INotification<LSPAny>" + ), + [ + f"[Direction(MessageDirection.{to_upper_camel_case(request.messageDirection)})]", + ], + ) + registration_options = get_registration_options_template( + notification, spec, types + ) + if registration_options: + generate_class_from_struct( + registration_options, + spec, + types, + ) diff --git a/generator/plugins/dotnet/dotnet_commons.py b/generator/plugins/dotnet/dotnet_commons.py new file mode 100644 index 0000000..9c21eca --- /dev/null +++ b/generator/plugins/dotnet/dotnet_commons.py @@ -0,0 +1,60 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from typing import Dict, List, Tuple, Union + +from generator import model + +TypesWithId = Union[ + model.Request, + model.TypeAlias, + model.Enum, + model.Structure, + model.Notification, + model.LiteralType, + model.ReferenceType, + model.ReferenceMapKeyType, + model.Property, + model.EnumItem, +] + + +class TypeData: + def __init__(self) -> None: + self._id_data: Dict[str, Tuple[str, TypesWithId, List[str]]] = {} + self._ctor_data: Dict[str, Tuple[str, str]] = {} + + def add_type_info( + self, + type_def: TypesWithId, + type_name: str, + impl: List[str], + ) -> None: + if type_def.id_ in self._id_data: + raise Exception(f"Duplicate id {type_def.id_} for type {type_name}") + self._id_data[type_def.id_] = (type_name, type_def, impl) + + def has_id( + self, + type_def: TypesWithId, + ) -> bool: + return type_def.id_ in self._id_data + + def has_name(self, type_name: str) -> bool: + return any(type_name == name for name, _, _ in self._id_data.values()) + + def get_by_name(self, type_name: str) -> List[TypesWithId]: + return [ + type_def + for name, type_def, _ in self._id_data.values() + if name == type_name + ] + + def get_all(self) -> List[Tuple[str, List[str]]]: + return [(name, lines) for name, _, lines in self._id_data.values()] + + def add_ctor(self, type_name: str, ctor: Tuple[str, str, bool]) -> None: + self._ctor_data[type_name] = ctor + + def get_ctor(self, type_name: str) -> Tuple[str, str, bool]: + return self._ctor_data[type_name] diff --git a/generator/plugins/dotnet/dotnet_constants.py b/generator/plugins/dotnet/dotnet_constants.py new file mode 100644 index 0000000..f66c96b --- /dev/null +++ b/generator/plugins/dotnet/dotnet_constants.py @@ -0,0 +1,5 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +NAMESPACE = "Microsoft.LanguageServer.Protocol" +PACKAGE_DIR_NAME = "lsprotocol" diff --git a/generator/plugins/dotnet/dotnet_enums.py b/generator/plugins/dotnet/dotnet_enums.py new file mode 100644 index 0000000..c5e7a6c --- /dev/null +++ b/generator/plugins/dotnet/dotnet_enums.py @@ -0,0 +1,51 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from typing import Dict, List, Union + +from generator import model + +from .dotnet_commons import TypeData +from .dotnet_constants import NAMESPACE +from .dotnet_helpers import ( + indent_lines, + lines_to_doc_comments, + namespace_wrapper, + to_upper_camel_case, +) + + +def generate_enums(spec: model.LSPModel, types: TypeData) -> None: + """Generate the code for the given spec.""" + for enum_def in spec.enumerations: + types.add_type_info(enum_def, enum_def.name, generate_enum(enum_def)) + + +def _get_enum_doc(enum: Union[model.Enum, model.EnumItem]) -> List[str]: + doc = enum.documentation.splitlines(keepends=False) if enum.documentation else [] + return lines_to_doc_comments(doc) + + +def generate_enum(enum: model.Enum) -> List[str]: + use_enum_member = all(isinstance(item.value, str) for item in enum.values) + imports = ["using System.Runtime.Serialization;"] + if use_enum_member: + imports += ["using Newtonsoft.Json;", "using Newtonsoft.Json.Converters;"] + + lines = _get_enum_doc(enum) + if use_enum_member: + lines += ["[JsonConverter(typeof(StringEnumConverter))]"] + lines += [f"public enum {enum.name}", "{"] + + for item in enum.values: + name = to_upper_camel_case(item.name) + inner = _get_enum_doc(item) + if use_enum_member: + inner += [f'[EnumMember(Value = "{item.value}")]{name},'] + else: + inner += [f"{name} = {item.value},"] + lines += indent_lines(inner) + [""] + + lines += ["}"] + + return namespace_wrapper(NAMESPACE, (imports if use_enum_member else []), lines) diff --git a/generator/plugins/dotnet/dotnet_helpers.py b/generator/plugins/dotnet/dotnet_helpers.py new file mode 100644 index 0000000..2eb357a --- /dev/null +++ b/generator/plugins/dotnet/dotnet_helpers.py @@ -0,0 +1,215 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import re +from typing import List, Optional, Union + +from generator import model + +BASIC_LINK_RE = re.compile(r"{@link +(\w+) ([\w ]+)}") +BASIC_LINK_RE2 = re.compile(r"{@link +(\w+)\.(\w+) ([\w \.`]+)}") +BASIC_LINK_RE3 = re.compile(r"{@link +(\w+)}") +BASIC_LINK_RE4 = re.compile(r"{@link +(\w+)\.(\w+)}") +PARTS_RE = re.compile(r"(([a-z0-9])([A-Z]))") + + +def _fix_links(line: str) -> str: + line = BASIC_LINK_RE.sub(r'<see cref="\1">\2</see>', line) + line = BASIC_LINK_RE2.sub(r'<see cref="\1.\2">\3</see>', line) + line = BASIC_LINK_RE3.sub(r'<see cref="\1" />', line) + line = BASIC_LINK_RE4.sub(r'<see cref="\1.\2" />', line) + return line + + +def lines_to_doc_comments(lines: List[str]) -> List[str]: + if not lines: + return [] + + return ( + ["/// <summary>"] + + [f"/// {_fix_links(line)}" for line in lines if not line.startswith("@")] + + ["/// </summary>"] + ) + + +def get_parts(name: str) -> List[str]: + name = name.replace("_", " ") + return PARTS_RE.sub(r"\2 \3", name).split() + + +def to_camel_case(name: str) -> str: + parts = get_parts(name) + return parts[0] + "".join([p.capitalize() for p in parts[1:]]) + + +def to_upper_camel_case(name: str) -> str: + return "".join([c.capitalize() for c in get_parts(name)]) + + +def lsp_method_to_name(method: str) -> str: + if method.startswith("$"): + method = method[1:] + method = method.replace("/", "_") + return to_upper_camel_case(method) + + +def file_header() -> List[str]: + return [ + "// Copyright (c) Microsoft Corporation. All rights reserved.", + "// Licensed under the MIT License.", + "// ", + "// THIS FILE IS AUTOGENERATED, DO NOT MODIFY IT", + "", + ] + + +def namespace_wrapper( + namespace: str, imports: List[str], lines: List[str] +) -> List[str]: + indent = " " * 4 + return ( + file_header() + + imports + + [""] + + ["namespace " + namespace + " {"] + + [(f"{indent}{line}" if line else line) for line in lines] + + ["}", ""] + ) + + +def get_doc(doc: Optional[str]) -> str: + if doc: + return lines_to_doc_comments(doc.splitlines(keepends=False)) + return [] + + +def get_special_case_class_name(name: str) -> str: + # This is because C# does not allow class name and property name to be the same. + # public class Command{ public string Command { get; set; }} is not valid. + if name == "Command": + return "CommandAction" + return name + + +def get_special_case_property_name(name: str) -> str: + if name == "string": + return "stringValue" + if name == "int": + return "intValue" + if name == "event": + return "eventArgs" + if name == "params": + return "paramsValue" + return name + + +def class_wrapper( + type_def: Union[model.Structure, model.Notification, model.Request], + inner: List[str], + derived: Optional[str] = None, + class_attributes: Optional[List[str]] = None, + is_record=True, +) -> List[str]: + if hasattr(type_def, "name"): + name = get_special_case_class_name(type_def.name) + else: + raise ValueError(f"Unknown type: {type_def}") + + rec_or_cls = "record" if is_record else "class" + lines = ( + get_doc(type_def.documentation) + + generate_extras(type_def) + + (class_attributes if class_attributes else []) + + [ + "[DataContract]", + f"public {rec_or_cls} {name}: {derived}" + if derived + else f"public {rec_or_cls} {name}", + "{", + ] + ) + lines += indent_lines(inner) + lines += ["}", ""] + return lines + + +def property_wrapper(prop_def: model.Property, content: List[str]) -> List[str]: + lines = (get_doc(prop_def.documentation) + generate_extras(prop_def) + content,) + lines += indent_lines(content) + return lines + + +def indent_lines(lines: List[str], indent: str = " " * 4) -> List[str]: + return [(f"{indent}{line}" if line else line) for line in lines] + + +def cleanup_str(text: str) -> str: + return text.replace("\r", "").replace("\n", "") + + +def get_deprecated(text: Optional[str]) -> Optional[str]: + if not text: + return None + + lines = text.splitlines(keepends=False) + for line in lines: + if line.startswith("@deprecated"): + return line.replace("@deprecated", "").strip() + return None + + +def generate_extras( + type_def: Union[ + model.Enum, + model.EnumItem, + model.Property, + model.TypeAlias, + model.Structure, + model.Request, + model.Notification, + ] +) -> List[str]: + deprecated = get_deprecated(type_def.documentation) + extras = [] + if type_def.deprecated: + extras += [f'[Obsolete("{cleanup_str(type_def.deprecated)}")]'] + elif deprecated: + extras += [f'[Obsolete("{cleanup_str(deprecated)}")]'] + if type_def.proposed: + extras += [f"[Proposed]"] + if type_def.since: + extras += [f'[Since("{cleanup_str(type_def.since)}")]'] + + if hasattr(type_def, "messageDirection"): + if type_def.since: + extras += [ + f"[Direction(MessageDirection.{to_upper_camel_case(type_def.messageDirection)})]" + ] + + return extras + + +def get_usings(types: List[str]) -> List[str]: + usings = [] + + for t in ["DataMember", "DataContract"]: + if t in types: + usings.append("using System.Runtime.Serialization;") + + for t in ["JsonConverter", "JsonConstructor", "JsonProperty", "NullValueHandling"]: + if t in types: + usings.append("using Newtonsoft.Json;") + + for t in ["JToken", "JObject", "JArray"]: + if t in types: + usings.append("using Newtonsoft.Json.Linq;") + + for t in ["List", "Dictionary"]: + if t in types: + usings.append("using System.Collections.Generic;") + + for t in ["ImmutableArray", "ImmutableDictionary"]: + if t in types: + usings.append("using System.Collections.Immutable;") + + return sorted(list(set(usings))) diff --git a/generator/plugins/dotnet/dotnet_special_classes.py b/generator/plugins/dotnet/dotnet_special_classes.py new file mode 100644 index 0000000..a656b6d --- /dev/null +++ b/generator/plugins/dotnet/dotnet_special_classes.py @@ -0,0 +1,158 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from typing import Dict, List, Union + +from generator import model + +from .dotnet_commons import TypeData +from .dotnet_constants import NAMESPACE +from .dotnet_helpers import class_wrapper, get_usings, namespace_wrapper + +SPECIAL_CLASSES = [ + "LSPObject", + "LSPAny", + "LSPArray", + "ChangeAnnotationIdentifier", + "Pattern", + "DocumentSelector", + "InitializedParams", +] + + +def generate_special_classes(spec: model.LSPModel, types: TypeData) -> None: + """Generate code for special classes in LSP.""" + for special_class in SPECIAL_CLASSES: + for class_def in spec.structures + spec.typeAliases: + if class_def.name == special_class: + generate_special_class(class_def, spec, types) + + +def generate_special_class( + type_def: Union[model.Structure, model.TypeAlias], + spec: model.LSPModel, + types: TypeData, +) -> Dict[str, str]: + """Generate code for a special class.""" + lines: List[str] = [] + + if type_def.name == "LSPObject": + lines = namespace_wrapper( + NAMESPACE, + get_usings(["Dictionary", "DataContract", "JsonConverter"]), + class_wrapper( + type_def, + ["public LSPObject(Dictionary<string, object?> value):base(value){}"], + "Dictionary<string, object?>", + ["[JsonConverter(typeof(CustomObjectConverter<LSPObject>))]"], + is_record=False, + ), + ) + if type_def.name == "InitializedParams": + lines = namespace_wrapper( + NAMESPACE, + get_usings(["Dictionary", "DataContract", "JsonConverter"]), + class_wrapper( + type_def, + [ + "public InitializedParams(Dictionary<string, object?> value):base(value){}" + ], + "Dictionary<string, object?>", + ["[JsonConverter(typeof(CustomObjectConverter<InitializedParams>))]"], + is_record=False, + ), + ) + if type_def.name == "LSPAny": + lines = namespace_wrapper( + NAMESPACE, + get_usings(["DataContract", "JsonConverter"]), + class_wrapper( + type_def, + [ + "public LSPAny(object? value){this.Value = value;}", + "public object? Value { get; set; }", + ], + "object", + ["[JsonConverter(typeof(LSPAnyConverter))]"], + ), + ) + if type_def.name == "LSPArray": + lines = namespace_wrapper( + NAMESPACE, + get_usings(["DataContract", "List"]), + class_wrapper( + type_def, + ["public LSPArray(List<object> value):base(value){}"], + "List<object>", + is_record=False, + ), + ) + + if type_def.name == "Pattern": + inner = [ + "private string pattern;", + "public Pattern(string value){pattern = value;}", + "public static implicit operator Pattern(string value) => new Pattern(value);", + "public static implicit operator string(Pattern pattern) => pattern.pattern;", + "public override string ToString() => pattern;", + ] + lines = namespace_wrapper( + NAMESPACE, + get_usings(["JsonConverter", "DataContract"]), + class_wrapper( + type_def, + inner, + None, + [f"[JsonConverter(typeof(CustomStringConverter<{type_def.name}>))]"], + ), + ) + + if type_def.name == "ChangeAnnotationIdentifier": + inner = [ + "private string identifier;", + "public ChangeAnnotationIdentifier(string value){identifier = value;}", + "public static implicit operator ChangeAnnotationIdentifier(string value) => new ChangeAnnotationIdentifier(value);", + "public static implicit operator string(ChangeAnnotationIdentifier identifier) => identifier.identifier;", + "public override string ToString() => identifier;", + ] + lines = namespace_wrapper( + NAMESPACE, + get_usings(["JsonConverter", "DataContract"]), + class_wrapper( + type_def, + inner, + None, + [f"[JsonConverter(typeof(CustomStringConverter<{type_def.name}>))]"], + ), + ) + + if type_def.name == "DocumentSelector": + inner = [ + "private DocumentFilter[] Filters { get; set; }", + "public DocumentSelector(params DocumentFilter[] filters)", + "{", + " Filters = filters ?? Array.Empty<DocumentFilter>();", + "}", + "public DocumentFilter this[int index]", + "{", + " get { return Filters[index]; }", + " set { Filters[index] = value; }", + "}", + "public int Length => Filters.Length;", + "public static implicit operator DocumentSelector(DocumentFilter[] filters) => new(filters);", + "public static implicit operator DocumentFilter[](DocumentSelector selector) => selector.Filters;", + "public IEnumerator<DocumentFilter> GetEnumerator() => ((IEnumerable<DocumentFilter>)Filters).GetEnumerator();", + "System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => Filters.GetEnumerator();", + ] + lines = namespace_wrapper( + NAMESPACE, + get_usings(["JsonConverter", "DataContract"]), + class_wrapper( + type_def, + inner, + "IEnumerable<DocumentFilter>", + [f"[JsonConverter(typeof(DocumentSelectorConverter))]"], + ), + ) + + types.add_type_info(type_def, type_def.name, lines) diff --git a/generator/plugins/dotnet/dotnet_utils.py b/generator/plugins/dotnet/dotnet_utils.py new file mode 100644 index 0000000..4510527 --- /dev/null +++ b/generator/plugins/dotnet/dotnet_utils.py @@ -0,0 +1,58 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import logging +import os +import pathlib +import subprocess +from typing import Dict, List + +import generator.model as model + +from .dotnet_classes import generate_all_classes +from .dotnet_commons import TypeData +from .dotnet_constants import NAMESPACE, PACKAGE_DIR_NAME +from .dotnet_enums import generate_enums +from .dotnet_helpers import namespace_wrapper +from .dotnet_special_classes import generate_special_classes + +LOGGER = logging.getLogger("dotnet") + + +def generate_from_spec(spec: model.LSPModel, output_dir: str) -> None: + """Generate the code for the given spec.""" + output_path = pathlib.Path(output_dir, PACKAGE_DIR_NAME) + if not output_path.exists(): + output_path.mkdir(parents=True, exist_ok=True) + + cleanup(output_path) + copy_custom_classes(output_path) + + LOGGER.info("Generating code in C#") + types = TypeData() + generate_package_code(spec, types) + + for name, lines in types.get_all(): + file_name = f"{name}.cs" + (output_path / file_name).write_text("\n".join(lines), encoding="utf-8") + + +def generate_package_code(spec: model.LSPModel, types: TypeData) -> Dict[str, str]: + generate_enums(spec, types) + generate_special_classes(spec, types) + generate_all_classes(spec, types) + + +def cleanup(output_path: pathlib.Path) -> None: + """Cleanup the generated C# files.""" + for file in output_path.glob("*.cs"): + file.unlink() + + +def copy_custom_classes(output_path: pathlib.Path) -> None: + """Copy the custom classes to the output directory.""" + custom = pathlib.Path(__file__).parent / "custom" + for file in custom.glob("*.cs"): + lines = file.read_text(encoding="utf-8").splitlines() + lines = namespace_wrapper(NAMESPACE, [], lines) + (output_path / file.name).write_text("\n".join(lines), encoding="utf-8") diff --git a/generator/plugins/python/__init__.py b/generator/plugins/python/__init__.py new file mode 100644 index 0000000..c5de3ef --- /dev/null +++ b/generator/plugins/python/__init__.py @@ -0,0 +1,4 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from .utils import generate_from_spec as generate diff --git a/generator/plugins/python/utils.py b/generator/plugins/python/utils.py new file mode 100644 index 0000000..1d5f08d --- /dev/null +++ b/generator/plugins/python/utils.py @@ -0,0 +1,1122 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import collections +import copy +import itertools +import keyword +import pathlib +import re +from typing import Dict, List, Optional, OrderedDict, Sequence, Tuple, Union + +import generator.model as model + +METHOD_NAME_RE_1 = re.compile(r"(.)([A-Z][a-z]+)") +METHOD_NAME_RE_2 = re.compile(r"([a-z0-9])([A-Z])") +PACKAGE_NAME = "lsprotocol" + +# These are special type aliases to preserve backward compatibility. +custom_request_params_aliases = ["WorkspaceConfigurationParams"] + + +def generate_from_spec(spec: model.LSPModel, output_dir: str) -> None: + code = TypesCodeGenerator(spec).get_code() + + output_path = pathlib.Path(output_dir, PACKAGE_NAME) + if not output_path.exists(): + output_path.mkdir(parents=True, exist_ok=True) + + for file_name in code: + (output_path / file_name).write_text(code[file_name], encoding="utf-8") + + +def _generate_field_validator( + type_def: model.LSP_TYPE_SPEC, optional: bool = False +) -> str: + """Generates attrs.field validator for a given field base of type.""" + + if type_def.kind == "base": + if type_def.name == "integer": + validator = "validators.integer_validator" + elif type_def.name == "uinteger": + validator = "validators.uinteger_validator" + elif type_def.name in ["string", "DocumentUri", "URI", "Uri"]: + validator = "attrs.validators.instance_of(str)" + elif type_def.name == "boolean": + validator = "attrs.validators.instance_of(bool)" + elif type_def.name == "decimal": + validator = "attrs.validators.instance_of(float)" + else: + validator = None + elif type_def.kind == "stringLiteral": + return f"attrs.field(validator=attrs.validators.in_(['{type_def.value}']), default='{type_def.value}')" + else: + validator = None + + if optional: + if validator: + return f"attrs.field(validator=attrs.validators.optional({validator}), default=None)" + else: + return "attrs.field(default=None)" + else: + if validator: + return f"attrs.field(validator={validator})" + else: + return "attrs.field()" + + +def _to_class_name(lsp_method_name: str) -> str: + """Convert from LSP method name (e.g., textDocument/didSave) to python class name + (e.g., TextDocumentDidSave)""" + name = lsp_method_name[2:] if lsp_method_name.startswith("$/") else lsp_method_name + name = name.replace("/", "_") + name = METHOD_NAME_RE_1.sub(r"\1_\2", name) + name = METHOD_NAME_RE_2.sub(r"\1_\2", name) + return "".join(part.title() for part in name.split("_")) + + +def lines_to_str(lines: Union[Sequence[str], List[str]]) -> str: + return "\n".join(lines) + + +def _sanitize_comment(text: str) -> str: + """LSP spec comments can contain newlines or characters that should not be used or + can cause issues with python code clean them up.""" + return text.replace("\r", "").replace("\n", "") + + +def _is_special_field(prop: model.Property) -> bool: + """Detect if the field requires special handling when serialising.""" + return prop.type.kind == "stringLiteral" or _has_null_base_type(prop) + + +def _has_null_base_type(prop: model.Property) -> bool: + """Detect if the type is indirectly optional.""" + if prop.type.kind == "or": + # If one of the types in the item list is a `null` then that means the + # field can be None. So we can treat that field as optional. + return any(t.kind == "base" and t.name == "null" for t in prop.type.items) + else: + return False + + +def _to_snake_case(name: str) -> str: + new_name = METHOD_NAME_RE_1.sub(r"\1_\2", name) + new_name = METHOD_NAME_RE_2.sub(r"\1_\2", new_name) + new_name = new_name.lower() + return f"{new_name}_" if keyword.iskeyword(new_name) else new_name + + +def _snake_case_item_name(original: str) -> str: + """Generate snake case names from LSP definition names. + + Example: + * PlainText -> PLAIN_TEXT + * $import -> IMPORT + """ + new_name = original + if new_name.startswith("$"): + new_name = new_name[1:] + if new_name.startswith("/"): + new_name = new_name[1:] + new_name = new_name.replace("/", "_") + new_name = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", new_name) + new_name = re.sub("([a-z0-9])([A-Z])", r"\1_\2", new_name) + return f"{new_name}_" if keyword.iskeyword(new_name) else new_name + + +def _capitalized_item_name(original: str) -> str: + """Generate capitalized names from LSP definition names. + + Example: + * someClass -> SomeClass + * some_class -> SomeClass + """ + parts = _snake_case_item_name(original).split("_") + new_name = "".join(x.title() for x in parts) + return f"{new_name}_" if keyword.iskeyword(new_name) else new_name + + +def _get_indented_documentation( + documentation: Optional[str], indent: str = "" +) -> Optional[str]: + """Clean up doc string from LSP model and word wrap with correct indent level.""" + doc = ( + indent.join(documentation.splitlines(keepends=True)) if documentation else None + ) + if doc: + doc = doc.replace("**/*", "**/*").replace("∕", "/") + doc = doc[:-2] if doc.endswith("*/") else doc + doc = doc.strip() + doc = re.sub(r"\[(?P<class>[A-Za-z]*)\]\(\#(?P=class)\)", r"\1", doc) + doc = re.sub(r"\[(?P<class>[\S]*)(\[\])\]\(\#(?P=class)\)", r"\1\2", doc) + doc = re.sub(r"\[([\w\ ]+)\]\(\#[\w\.]+\)", r"\1", doc) + return doc + + +class TypesCodeGenerator: + def __init__(self, lsp_model: model.LSPModel): + self._lsp_model = lsp_model + self._reset() + + def _reset(self): + self._types: OrderedDict[str, List[str]] = collections.OrderedDict() + self._imports: List[str] = [ + "import enum", + "import functools", + "from typing import Any, Dict, List, Optional, Tuple, Union", + "import attrs", + "from . import validators", + ] + self._keyword_classes: List[str] = [] + self._special_classes: List[str] = [] + self._special_properties: List[str] = [] + + def _add_keyword_class(self, class_name) -> None: + if class_name not in self._keyword_classes: + self._keyword_classes.append(class_name) + + def _get_imports(self) -> List[str]: + return self._imports + + def _get_header(self) -> List[str]: + return [ + "# Copyright (c) Microsoft Corporation. All rights reserved.", + "# Licensed under the MIT License.", + "", + "# ****** THIS IS A GENERATED FILE, DO NOT EDIT. ******", + "# Steps to generate:", + "# 1. Checkout https://github.com/microsoft/lsprotocol", + "# 2. Install nox: `python -m pip install nox`", + "# 3. Run command: `python -m nox --session build_lsp`", + "", + ] + + def get_code(self) -> Dict[str, str]: + self._reset() + self._generate_code(self._lsp_model) + + code_lines = ( + self._get_header() + + self._get_imports() + + self._get_meta_data(self._lsp_model) + + self._get_types_code() + + self._get_utility_code(self._lsp_model) + ) + return { + "types.py": lines_to_str(code_lines), + } + + def _get_custom_value_type(self, ref_name: str) -> Optional[str]: + """Returns the custom supported type.""" + try: + enum_def = [e for e in self._lsp_model.enumerations if e.name == ref_name][ + 0 + ] + except IndexError: + enum_def = None + if enum_def and enum_def.supportsCustomValues: + if enum_def.type.name == "string": + return "str" + if enum_def.type.name in ["integer", "uinteger"]: + return "int" + return None + + def _generate_type_name( + self, + type_def: model.LSP_TYPE_SPEC, + class_name: Optional[str] = None, + prefix: str = "", + ) -> str: + """Get typing wrapped type name based on LSP type definition.""" + + if type_def.kind == "stringLiteral": + # These are string constants used in some LSP types. + # TODO: Use this with python >= 3.8 + # return f"Literal['{type_def.value}']" + return "str" + + if type_def.kind == "literal": + # A general type 'Any' has no properties + if ( + isinstance(type_def.value, model.LiteralValue) + and len(type_def.value.properties) == 0 + ): + return "Any" + + # The literal kind is a dynamically generated type and the + # name for it is generated as needed. It is expected that when + # this function is called name is set. + if type_def.name: + return f"'{type_def.name}'" + + # If name is missing, and there are properties then it is a dynamic + # type. It should have already been generated. + raise ValueError(str(type_def)) + + if type_def.kind == "reference": + # The reference kind is a named type which is part of LSP. + if self._has_type(type_def.name): + ref_type = f"{prefix}{type_def.name}" + else: + # We don't have this type yet. Make it a forward reference. + ref_type = f"'{prefix}{type_def.name}'" + custom_value_type = self._get_custom_value_type(type_def.name) + if custom_value_type: + return f"Union[{ref_type}, {custom_value_type}]" + + return ref_type + + if type_def.kind == "array": + # This is a linear collection type, LSP does not specify if + # this needs to be ordered. Also, usingList here because + # cattrs does not work well withIterable for some reason. + return f"List[{self._generate_type_name(type_def.element, class_name, prefix)}]" + + if type_def.kind == "or": + # This type means that you can have either of the types under `items` + # as the value. So, from typing point of view this is a union. The `or` + # type means it is going to be one of the types, never both (see `and`) + # Example: + # id :Union[str, int] + # * This means that id can either be string or integer, cannot be both. + types = [] + for item in type_def.items: + types.append(self._generate_type_name(item, class_name, prefix)) + return f"Union[{','.join(types)}]" + + if type_def.kind == "and": + # This type means that the value has properties of all the types under + # `items`. This type is equivalent of `class C(A, B)`. Where A and B are + # defined in `items`. This type should be generated separately, here we + # return the optionally provided class for this. + if not class_name: + raise ValueError(str(type_def)) + return class_name + + if type_def.kind == "base": + # The `base` kind is used for primitive data types. + if type_def.name == "decimal": + return "float" + elif type_def.name == "boolean": + return "bool" + elif type_def.name in ["integer", "uinteger"]: + return "int" + elif type_def.name in ["string", "DocumentUri", "URI"]: + return "str" + elif type_def.name == "null": + return "None" + else: + # Unknown base kind. + raise ValueError(str(type_def)) + + if type_def.kind == "map": + # This kind defines a dictionary like object. + return f"Dict[{self._generate_type_name(type_def.key, class_name, prefix)}, {self._generate_type_name(type_def.value, class_name, prefix)}]" + + if type_def.kind == "tuple": + # This kind defined a tuple like object. + types = [] + for item in type_def.items: + types.append(self._generate_type_name(item, class_name, prefix)) + return f"Tuple[{','.join(types)}]" + + raise ValueError(str(type_def)) + + def _add_special(self, class_name: str, properties: List[str]) -> None: + if properties: + self._special_classes.append(class_name) + self._special_properties.extend([f"'{class_name}.{p}'" for p in properties]) + + def _get_types_code(self) -> List[str]: + code_lines = [] + for v in self._types.values(): + code_lines.extend(v) + # Add blank lines between types + code_lines.extend(["", ""]) + + return code_lines + + def _add_import(self, import_line: str) -> None: + if import_line not in self._imports: + self._imports.append(import_line) + + def _has_type(self, type_name: str) -> bool: + if type_name.startswith(('"', "'")): + type_name = type_name[1:-1] + return type_name in self._types + + def _get_additional_methods(self, class_name: str) -> List[str]: + indent = " " * 4 + if class_name == "Position": + return [ + "def __eq__(self, o: object) -> bool:", + f"{indent}if not isinstance(o, Position):", + f"{indent}{indent}return NotImplemented", + f"{indent}return (self.line, self.character) == (o.line, o.character)", + "def __gt__(self, o: 'Position') -> bool:", + f"{indent}if not isinstance(o, Position):", + f"{indent}{indent}return NotImplemented", + f"{indent}return (self.line, self.character) > (o.line, o.character)", + "def __repr__(self) -> str:", + f"{indent}" + "return f'{self.line}:{self.character}'", + ] + if class_name == "Range": + return [ + "def __eq__(self, o: object) -> bool:", + f"{indent}if not isinstance(o, Range):", + f"{indent}{indent}return NotImplemented", + f"{indent}return (self.start == o.start) and (self.end == o.end)", + "def __repr__(self) -> str:", + f"{indent}" + "return f'{self.start!r}-{self.end!r}'", + ] + if class_name == "Location": + return [ + "def __eq__(self, o: object) -> bool:", + f"{indent}if not isinstance(o, Location):", + f"{indent}{indent}return NotImplemented", + f"{indent}return (self.uri == o.uri) and (self.range == o.range)", + "def __repr__(self) -> str:", + f"{indent}" + "return f'{self.uri}:{self.range!r}'", + ] + return None + + def _add_type_code(self, type_name: str, code: List[str]) -> None: + if not self._has_type(type_name): + self._types[type_name] = code + self._types.move_to_end(type_name) + + def _add_enum(self, enum_def: model.Enum) -> None: + code_lines = [ + "" if "ErrorCodes" in enum_def.name else "@enum.unique", + ] + if enum_def.type.name == "string": + code_lines += [f"class {enum_def.name}(str, enum.Enum):"] + elif enum_def.type.name in ["integer", "uinteger"]: + code_lines += [f"class {enum_def.name}(int, enum.Enum):"] + else: + code_lines += [f"class {enum_def.name}(enum.Enum):"] + + indent = " " * 4 + doc = _get_indented_documentation(enum_def.documentation, indent) + code_lines += [ + f'{indent}"""{doc}"""' if enum_def.documentation else "", + f"{indent}# Since: {_sanitize_comment(enum_def.since)}" + if enum_def.since + else "", + f"{indent}# Proposed" if enum_def.proposed else "", + ] + + # Remove unnecessary empty lines + code_lines = [code for code in code_lines if len(code) > 0] + + for item in enum_def.values: + name = _capitalized_item_name(item.name) + value = ( + f'"{item.value}"' if enum_def.type.name == "string" else f"{item.value}" + ) + doc = _get_indented_documentation(item.documentation, indent) + item_lines = [ + f"{indent}{name} = {value}", + f'{indent}"""{doc}"""' if item.documentation else "", + f"{indent}# Since: {_sanitize_comment(item.since)}" + if item.since + else "", + f"{indent}# Proposed" if item.proposed else "", + ] + + # Remove unnecessary empty lines. + code_lines += [code for code in item_lines if len(code) > 0] + + self._add_type_code(enum_def.name, code_lines) + + def _add_enums(self, lsp_model: model.LSPModel) -> None: + for enum_def in lsp_model.enumerations: + self._add_enum(enum_def) + + def _process_literal_types( + self, class_name: str, type_def: model.LSP_TYPE_SPEC + ) -> None: + if type_def.kind == "literal" and len(type_def.value.properties) > 0: + type_def.name = type_def.name or _to_class_name(f"{class_name}_Type") + self._add_literal_type(type_def) + elif type_def.kind == "or": + count = itertools.count(1) + for sub_type in type_def.items or []: + try: + # Anonymous types have no name so generate a name. We append `_Type#` + # to generate the name, where `#` is a number. + sub_type.name = sub_type.name or _to_class_name( + f"{class_name}_Type{next(count)}" + ) + except AttributeError: + pass + self._process_literal_types(class_name, sub_type) + elif type_def.kind == "array": + try: + type_def.element.name = type_def.element.name or _to_class_name( + f"{class_name}_Type" + ) + except AttributeError: + pass + self._process_literal_types(class_name, type_def.element) + elif type_def.kind == "and": + raise ValueError(str(type_def)) + else: + pass + + def _generate_properties( + self, class_name: str, properties: List[model.Property], indent: str + ) -> List[str]: + code_lines = [] + + # Ensure that we mark any property as optional if it supports None type. + # We only need to do this for properties not explicitly marked as optional. + for p in properties: + if not p.optional: + p.optional = _has_null_base_type(p) + + # sort properties so that you have non-optional properties first then optional properties + properties = [ + p for p in properties if not (p.optional or p.type.kind == "stringLiteral") + ] + [p for p in properties if p.optional or p.type.kind == "stringLiteral"] + + for property_def in properties: + self._process_literal_types( + f"{class_name}/{property_def.name}", property_def.type + ) + + doc = _get_indented_documentation(property_def.documentation, indent) + type_validator = _generate_field_validator( + property_def.type, property_def.optional + ) + + type_name = self._generate_type_name(property_def.type) + if property_def.optional: + type_name = f"Optional[{type_name}]" + + # make sure that property name is not a python keyword and snake cased. + name = _to_snake_case(property_def.name) + + prop_lines = [f"{indent}{name}: {type_name} = {type_validator}"] + prop_lines += [ + f'{indent}"""{doc}"""' if property_def.documentation else "", + f"{indent}# Since: {_sanitize_comment(property_def.since)}" + if property_def.since + else "", + f"{indent}# Proposed" if property_def.proposed else "", + ] + # Remove unnecessary empty lines and add a single empty line + code_lines += [code for code in prop_lines if len(code) > 0] + [""] + + return code_lines + + def _add_literal_type(self, literal_def: model.LiteralType) -> None: + if self._has_type(literal_def.name): + return + + # indent level for use with fields, doc string, and comments. + indent = " " * 4 + + # clean up the docstring for the class itself. + doc = _get_indented_documentation(literal_def.documentation, indent) + + # Code here should include class, its doc string, and any comments. + code_lines = [ + "@attrs.define", + f"class {literal_def.name}:", + f'{indent}"""{doc}"""' if literal_def.documentation else "", + f"{indent}# Since: {literal_def.since}" if literal_def.since else "", + f"{indent}# Proposed" if literal_def.proposed else "", + ] + + # Remove unnecessary empty lines. This can happen if doc string or comments are missing. + code_lines = [code for code in code_lines if len(code) > 0] + + code_lines += self._generate_properties( + literal_def.name, literal_def.value.properties, indent + ) + + self._add_type_code(literal_def.name, code_lines) + + if any(keyword.iskeyword(p.name) for p in literal_def.value.properties): + self._add_keyword_class(literal_def.name) + + self._add_special( + literal_def.name, + [ + _to_snake_case(p.name) + for p in literal_def.value.properties + if _is_special_field(p) + ], + ) + + def _add_type_alias(self, type_alias: model.TypeAlias) -> None: + # TypeAlias definition can contain anonymous types as a part of its + # definition. We generate them here first before we get to defile the + # TypeAlias. + indent = " " * 4 + count = itertools.count(1) + if type_alias.type.kind == "or": + for sub_type in type_alias.type.items or []: + if sub_type.kind == "literal": + # Anonymous types have no name so generate a name. We append `_Type#` + # to generate the name, where `#` is a number. + sub_type.name = ( + sub_type.name or f"{type_alias.name}_Type{next(count)}" + ) + self._add_literal_type(sub_type) + + if type_alias.name == "LSPAny": + type_name = "Union[Any, None]" + elif type_alias.name == "LSPObject": + type_name = None + else: + type_name = self._generate_type_name(type_alias.type) + if type_alias.type.kind == "reference" and not self._has_type( + type_alias.type.name + ): + # TODO: remove workaround for lack of TypeAlias in 3.7 + type_name = f"Union[{type_name}, {type_name}]" + + if type_name: + # clean up the docstring for the class itself. + doc = _get_indented_documentation(type_alias.documentation) + code_lines = [ + f"{type_alias.name} = {type_name}", + f'"""{doc}"""' if type_alias.documentation else "", + f"# Since: {_sanitize_comment(type_alias.since)}" + if type_alias.since + else "", + f"# Proposed" if type_alias.proposed else "", + ] + else: + doc = _get_indented_documentation(type_alias.documentation, indent) + code_lines = [ + f"class {type_alias.name}:", + f'{indent}"""{doc}"""' if type_alias.documentation else "", + f"{indent}# Since: {_sanitize_comment(type_alias.since)}" + if type_alias.since + else "", + f"{indent}# Proposed" if type_alias.proposed else "", + f"{indent}pass", + ] + code_lines = [code for code in code_lines if len(code) > 0] + + self._add_type_code(type_alias.name, code_lines) + + def _add_type_aliases(self, lsp_model: model.LSPModel) -> None: + for type_def in lsp_model.typeAliases: + self._add_type_alias(type_def) + + def _get_dependent_types( + self, + struct_def: model.Structure, + lsp_model: model.LSPModel, + ) -> List[model.Structure]: + # `extends` and `mixins` both are used as classes from which the + # current class to derive from. + extends = struct_def.extends or [] + mixins = struct_def.mixins or [] + + definitions: List[model.Structure] = [] + for s in extends + mixins: + for t in lsp_model.structures: + if t.name == s.name and s.kind == "reference": + definitions.append(t) + definitions.extend(self._get_dependent_types(t, lsp_model)) + + result: List[model.Structure] = [] + for d in definitions: + if d.name in [r.name for r in result]: + pass + else: + result.append(d) + return result + + def _add_structure( + self, + struct_def: model.Structure, + lsp_model: model.LSPModel, + ) -> None: + if self._has_type(struct_def.name): + return + + definitions = self._get_dependent_types(struct_def, lsp_model) + for d in definitions: + self._add_structure(d, lsp_model) + + indent = "" if struct_def.name == "LSPObject" else " " * 4 + doc = _get_indented_documentation(struct_def.documentation, indent) + class_name = struct_def.name + + class_lines = [ + "" if class_name == "LSPObject" else "@attrs.define", + "@functools.total_ordering" if class_name == "Position" else "", + f"{class_name} = object" + if class_name == "LSPObject" + else f"class {class_name}:", + f'{indent}"""{doc}"""' if struct_def.documentation else "", + f"{indent}# Since: {_sanitize_comment(struct_def.since)}" + if struct_def.since + else "", + f"{indent}# Proposed" if struct_def.proposed else "", + ] + + # Remove unnecessary empty lines and add a single empty line + code_lines = [code for code in class_lines if len(code) > 0] + [""] + + # Inheriting from multiple classes can cause problems especially when using + # `attrs.define`. + properties = copy.deepcopy(struct_def.properties) + extra_properties = [] + for d in definitions: + extra_properties += copy.deepcopy(d.properties) + + for p in extra_properties: + prop_names = [prop.name for prop in properties] + if p.name not in prop_names: + properties += [copy.deepcopy(p)] + + code_lines += self._generate_properties(class_name, properties, indent) + methods = self._get_additional_methods(class_name) + + # If the class has no properties then add `pass` + if len(properties) == 0 and not methods and class_name != "LSPObject": + code_lines += [f"{indent}pass"] + + if methods: + code_lines += [f"{indent}{l}" for l in methods] + + # Detect if the class has properties that might be keywords. + self._add_type_code(class_name, code_lines) + + if any(keyword.iskeyword(p.name) for p in properties): + self._add_keyword_class(class_name) + + self._add_special( + class_name, + [_to_snake_case(p.name) for p in properties if _is_special_field(p)], + ) + + def _add_structures(self, lsp_model: model.LSPModel) -> None: + for struct_def in lsp_model.structures: + self._add_structure(struct_def, lsp_model) + + def _add_and_type( + self, + type_def: model.LSP_TYPE_SPEC, + class_name: str, + structures: List[model.Structure], + ) -> Tuple[List[str], List[str]]: + if type_def.kind != "and": + raise ValueError("Only `and` type code generation is supported.") + + indent = " " * 4 + code_lines = [ + "@attrs.define", + f"class {class_name}:", + ] + + properties = [] + for item in type_def.items: + if item.kind == "reference": + for structure in structures: + if structure.name == item.name: + properties += copy.deepcopy(structure.properties) + else: + raise ValueError( + "Only `reference` types are supported for `and` type generation." + ) + + code_lines += self._generate_properties(class_name, properties, indent) + + self._add_type_code(class_name, code_lines) + if any(keyword.iskeyword(p.name) for p in properties): + self._add_keyword_class(class_name) + + self._add_special( + class_name, + [_to_snake_case(p.name) for p in properties if _is_special_field(p)], + ) + + def _add_and_types(self, lsp_model: model.LSPModel) -> None: + # Collect all and types in the model from known locations + and_types = [] + for request in lsp_model.requests: + if request.params: + if request.params.kind == "and": + class_name = f"{_to_class_name(request.method)}Params" + and_types.append((f"{class_name}", request.params)) + + if request.registrationOptions: + if request.registrationOptions.kind == "and": + class_name = f"{_to_class_name(request.method)}Options" + and_types.append((f"{class_name}", request.registrationOptions)) + + for notification in lsp_model.notifications: + if notification.params: + if notification.params.kind == "and": + class_name = f"{_to_class_name(notification.method)}Params" + and_types.append((f"{class_name}", notification.params)) + + if notification.registrationOptions: + if notification.registrationOptions.kind == "and": + class_name = f"{_to_class_name(notification.method)}Options" + and_types.append( + (f"{class_name}", notification.registrationOptions) + ) + + for name, type_def in and_types: + self._add_and_type(type_def, name, lsp_model.structures) + + def _add_requests(self, lsp_mode: model.LSPModel) -> None: + indent = " " * 4 + + self._add_type_code( + "ResponseError", + [ + "@attrs.define", + f"class ResponseError:", + f"{indent}code: int = attrs.field(validator=validators.integer_validator)", + f'{indent}"""A number indicating the error type that occurred."""', + f"{indent}message: str = attrs.field(validator=attrs.validators.instance_of(str))", + f'{indent}"""A string providing a short description of the error."""', + f"{indent}data:Optional[LSPAny] = attrs.field(default=None)", + f'{indent}"""A primitive or structured value that contains additional information', + f'{indent}about the error. Can be omitted."""', + ], + ) + + self._add_type_code( + "ResponseErrorMessage", + [ + "@attrs.define", + "class ResponseErrorMessage:", + f"{indent}id:Optional[Union[int, str]] = attrs.field(default=None)", + f'{indent}"""The request id where the error occurred."""', + f"{indent}error:Optional[ResponseError] = attrs.field(default=None)", + f'{indent}"""The error object in case a request fails."""', + f'{indent}jsonrpc: str = attrs.field(default="2.0")', + ], + ) + + self._add_special("ResponseErrorMessage", ["error", "jsonrpc"]) + + for request in lsp_mode.requests: + class_name = _to_class_name(request.method) + doc = _get_indented_documentation(request.documentation, indent) + + if request.params: + if ( + request.params.kind == "reference" + and f"{class_name}Params" in custom_request_params_aliases + ): + params_type = f"{class_name}Params" + + self._add_type_alias( + model.TypeAlias( + name=params_type, + type={"kind": "reference", "name": request.params.name}, + ) + ) + else: + params_type = self._generate_type_name( + request.params, f"{class_name}Params" + ) + if not self._has_type(params_type): + raise ValueError(f"{class_name}Params type definition is missing.") + params_field = "attrs.field()" + else: + params_type = "Optional[None]" + params_field = "attrs.field(default=None)" + + result_type = None + if request.result: + result_type = self._generate_type_name(request.result) + result_field = "attrs.field(default=None)" + else: + result_type = "Optional[None]" + result_field = "attrs.field(default=None)" + + self._add_type_code( + f"{class_name}Request", + [ + "@attrs.define", + f"class {class_name}Request:", + f'{indent}"""{doc}"""' if request.documentation else "", + f"{indent}id:Union[int, str] = attrs.field()", + f'{indent}"""The request id."""', + f"{indent}params: {params_type} ={params_field}", + f'{indent}method: str = "{request.method}"', + f'{indent}"""The method to be invoked."""', + f'{indent}jsonrpc: str = attrs.field(default="2.0")', + ], + ) + self._add_special(f"{class_name}Request", ["method", "jsonrpc"]) + + self._add_type_code( + f"{class_name}Response", + [ + "@attrs.define", + f"class {class_name}Response:", + f"{indent}id:Optional[Union[int, str]] = attrs.field()", + f'{indent}"""The request id."""', + f"{indent}result: {result_type} = {result_field}", + f'{indent}jsonrpc: str = attrs.field(default="2.0")', + ], + ) + self._add_special(f"{class_name}Response", ["result", "jsonrpc"]) + + def _add_notifications(self, lsp_mode: model.LSPModel) -> None: + indent = " " * 4 + + for notification in lsp_mode.notifications: + class_name = _to_class_name(notification.method) + doc = _get_indented_documentation(notification.documentation, indent) + + if notification.params: + params_type = self._generate_type_name( + notification.params, f"{class_name}Params" + ) + if not self._has_type(params_type): + raise ValueError(f"{class_name}Params type definition is missing.") + params_field = "attrs.field()" + else: + params_type = "Optional[None]" + params_field = "attrs.field(default=None)" + + self._add_type_code( + f"{class_name}Notification", + [ + "@attrs.define", + f"class {class_name}Notification:", + f'{indent}"""{doc}"""' if notification.documentation else "", + f"{indent}params: {params_type} = {params_field}", + f"{indent}method:str = attrs.field(", + f'validator=attrs.validators.in_(["{notification.method}"]),', + f'default="{notification.method}",', + ")", + f'{indent}"""The method to be invoked."""', + f'{indent}jsonrpc: str = attrs.field(default="2.0")', + ], + ) + self._add_special(f"{class_name}Notification", ["method", "jsonrpc"]) + + def _add_lsp_method_type(self, lsp_model: model.LSPModel) -> None: + indent = " " * 4 + directions = set( + [x.messageDirection for x in (lsp_model.requests + lsp_model.notifications)] + ) + code_lines = [ + "@enum.unique", + "class MessageDirection(enum.Enum):", + ] + code_lines += sorted( + [f"{indent}{_capitalized_item_name(m)} = '{m}'" for m in directions] + ) + self._add_type_code("MessageDirection", code_lines) + + def _add_special_types(self, lsp_model: model.LSPModel) -> None: + # Ensure LSPObject gets added first. + # Try and find it in the type aliases + lsp_object = list( + filter( + lambda s: s.name == "LSPObject", + [*lsp_model.typeAliases, *lsp_model.structures], + ) + ) + + if len(lsp_object) == 0: + raise ValueError("LSPObject type definition is missing.") + elif len(lsp_object) > 1: + raise ValueError("LSPObject type definition is duplicated.") + else: + if isinstance(lsp_object[0], model.TypeAlias): + self._add_type_alias(lsp_object[0]) + elif isinstance(lsp_object[0], model.Structure): + self._add_structure(lsp_object[0], lsp_model) + else: + raise ValueError("LSPObject type definition is invalid.") + + def _generate_code(self, lsp_model: model.LSPModel) -> None: + self._add_enums(lsp_model) + self._add_special_types(lsp_model) + self._add_type_aliases(lsp_model) + self._add_structures(lsp_model) + self._add_and_types(lsp_model) + self._add_requests(lsp_model) + self._add_notifications(lsp_model) + self._add_lsp_method_type(lsp_model) + + def _get_utility_code(self, lsp_model: model.LSPModel) -> List[str]: + request_classes = [] + response_classes = [] + notification_classes = [] + + methods = set( + [x.method for x in (lsp_model.requests + lsp_model.notifications)] + ) + code_lines = ( + [""] + + sorted([f"{_snake_case_item_name(m).upper()} = '{m}'" for m in methods]) + + [""] + ) + + code_lines += ["METHOD_TO_TYPES = {", " # Requests"] + + request_types = [] + for request in lsp_model.requests: + class_name = _to_class_name(request.method) + request_class = f"{class_name}Request" + response_class = f"{class_name}Response" + + request_classes.append(request_class) + response_classes.append(response_class) + + params_type = None + if request.params: + params_type = self._generate_type_name( + request.params, f"{class_name}Params" + ).strip("\"'") + + registration_type = None + if request.registrationOptions: + registration_type = self._generate_type_name( + request.registrationOptions, f"{class_name}Options" + ).strip("\"'") + + key = f"{_snake_case_item_name(request.method).upper()}" + request_types += [ + f"{key}: ({request_class}, {response_class}, {params_type}, {registration_type})," + ] + + code_lines += sorted(request_types) + code_lines += [" # Notifications"] + + notify_types = [] + for notification in lsp_model.notifications: + class_name = _to_class_name(notification.method) + notification_class = f"{class_name}Notification" + notification_classes.append(notification_class) + + params_type = None + if notification.params: + params_type = self._generate_type_name( + notification.params, f"{class_name}Params" + ).strip("\"'") + + registration_type = None + if notification.registrationOptions: + registration_type = self._generate_type_name( + notification.registrationOptions, f"{class_name}Options" + ).strip("\"'") + + key = f"{_snake_case_item_name(notification.method).upper()}" + notify_types += [ + f"{key}: ({notification_class}, None, {params_type}, {registration_type})," + ] + + code_lines += sorted(notify_types) + code_lines += ["}"] + + code_lines += [ + f"REQUESTS = Union[{', '.join(sorted(request_classes))}]", + f"RESPONSES = Union[{', '.join(sorted(response_classes))}]", + f"NOTIFICATIONS = Union[{', '.join(sorted(notification_classes))}]", + "MESSAGE_TYPES = Union[REQUESTS, RESPONSES, NOTIFICATIONS, ResponseErrorMessage]", + "", + ] + + # These classes have properties that may be python keywords. + code_lines += [ + f"_KEYWORD_CLASSES = [{', '.join(sorted(set(self._keyword_classes)))}]" + ] + code_lines += [ + "def is_keyword_class(cls: type) -> bool:", + ' """Returns true if the class has a property that may be python keyword."""', + " return any(cls is c for c in _KEYWORD_CLASSES)", + "", + ] + + # These are classes that have properties that need special handling + # during serialization of the class based on LSP. + # See: https://github.com/microsoft/vscode-languageserver-node/issues/967 + code_lines += [ + f"_SPECIAL_CLASSES = [{', '.join(sorted(set(self._special_classes)))}]" + ] + code_lines += [ + "def is_special_class(cls: type) -> bool:", + ' """Returns true if the class or its properties require special handling."""', + " return any(cls is c for c in _SPECIAL_CLASSES)", + "", + ] + + # This is a collection of `class_name.property` as string. These properties + # need special handling as described by LSP> + # See: https://github.com/microsoft/vscode-languageserver-node/issues/967 + # + # Example: + # Consider RenameRegistrationOptions + # * document_selector property: + # When you set `document_selector` to None in python it has to be preserved when + # serializing it. Since the serialized JSON value `{"document_selector": null}` + # means use the Clients document selector. Omitting it might throw error. + # * prepare_provider property + # This property does NOT need special handling, since omitting it or using + # `{"prepare_provider": null}` has the same meaning. + code_lines += [ + f"_SPECIAL_PROPERTIES = [{', '.join(sorted(set(self._special_properties)))}]" + ] + code_lines += [ + "def is_special_property(cls: type, property_name:str) -> bool:", + ' """Returns true if the class or its properties require special handling.', + " Example:", + " Consider RenameRegistrationOptions", + " * document_selector property:", + " When you set `document_selector` to None in python it has to be preserved when", + ' serializing it. Since the serialized JSON value `{"document_selector": null}`', + " means use the Clients document selector. Omitting it might throw error. ", + " * prepare_provider property", + " This property does NOT need special handling, since omitting it or using", + ' `{"prepare_provider": null}` in JSON has the same meaning.', + ' """', + ' qualified_name = f"{cls.__name__}.{property_name}"', + " return qualified_name in _SPECIAL_PROPERTIES", + "", + ] + + code_lines += ["", "ALL_TYPES_MAP: Dict[str, Union[type, object]] = {"] + code_lines += sorted([f"'{name}': {name}," for name in set(self._types.keys())]) + code_lines += ["}", ""] + + code_lines += ["_MESSAGE_DIRECTION: Dict[str, str] = {"] + + code_lines += ["# Request methods"] + code_lines += sorted( + [ + f'{_snake_case_item_name(r.method).upper()}:"{r.messageDirection}",' + for r in lsp_model.requests + ] + ) + code_lines += ["# Notification methods"] + code_lines += sorted( + [ + f'{_snake_case_item_name(n.method).upper()}:"{n.messageDirection}",' + for n in lsp_model.notifications + ] + ) + + code_lines += ["}", ""] + + code_lines += [ + "def message_direction(method:str) -> str:", + ' """Returns message direction clientToServer, serverToClient or both."""', + " return _MESSAGE_DIRECTION[method]", + "", + ] + + return code_lines + + def _get_meta_data(self, lsp_model: model.LSPModel) -> List[str]: + return [f"__lsp_version__ = '{lsp_model.metaData.version}'"] diff --git a/generator/plugins/rust/__init__.py b/generator/plugins/rust/__init__.py new file mode 100644 index 0000000..cbc2c00 --- /dev/null +++ b/generator/plugins/rust/__init__.py @@ -0,0 +1,4 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from .rust_utils import generate_from_spec as generate diff --git a/generator/plugins/rust/rust_commons.py b/generator/plugins/rust/rust_commons.py new file mode 100644 index 0000000..4022e27 --- /dev/null +++ b/generator/plugins/rust/rust_commons.py @@ -0,0 +1,681 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from typing import Dict, List, Optional, Tuple, Union + +from generator import model + +from .rust_lang_utils import ( + get_parts, + indent_lines, + lines_to_doc_comments, + to_snake_case, + to_upper_camel_case, +) + +TypesWithId = Union[ + model.Request, + model.TypeAlias, + model.Enum, + model.Structure, + model.Notification, + model.LiteralType, + model.ReferenceType, + model.ReferenceMapKeyType, + model.Property, + model.EnumItem, +] + + +class TypeData: + def __init__(self) -> None: + self._id_data: Dict[ + str, + Tuple[ + str, + TypesWithId, + List[str], + ], + ] = {} + + def add_type_info( + self, + type_def: TypesWithId, + type_name: str, + impl: List[str], + ) -> None: + if type_def.id_ in self._id_data: + raise Exception(f"Duplicate id {type_def.id_} for type {type_name}") + self._id_data[type_def.id_] = (type_name, type_def, impl) + + def has_id( + self, + type_def: TypesWithId, + ) -> bool: + return type_def.id_ in self._id_data + + def has_name(self, type_name: str) -> bool: + return any(type_name == name for name, _, _ in self._id_data.values()) + + def get_by_name(self, type_name: str) -> List[TypesWithId]: + return [type_name == name for name, _, _ in self._id_data.values()] + + def get_lines(self): + lines = [] + for _, _, impl in self._id_data.values(): + lines += impl + ["", ""] + return lines + + +def generate_custom_enum(type_data: TypeData) -> None: + type_data.add_type_info( + model.ReferenceType(kind="reference", name="CustomStringEnum"), + "CustomStringEnum", + [ + "/// This type allows extending any string enum to support custom values.", + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + "#[serde(untagged)]", + "pub enum CustomStringEnum<T> {", + " /// The value is one of the known enum values.", + " Known(T),", + " /// The value is custom.", + " Custom(String),", + "}", + "", + ], + ) + type_data.add_type_info( + model.ReferenceType(kind="reference", name="CustomIntEnum"), + "CustomIntEnum", + [ + "/// This type allows extending any integer enum to support custom values.", + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + "#[serde(untagged)]", + "pub enum CustomIntEnum<T> {", + " /// The value is one of the known enum values.", + " Known(T),", + " /// The value is custom.", + " Custom(i32),", + "}", + "", + ], + ) + type_data.add_type_info( + model.ReferenceType(kind="reference", name="OR2"), + "OR2", + [ + "/// This allows a field to have two types.", + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + "#[serde(untagged)]", + "pub enum OR2<T, U> {", + " T(T),", + " U(U),", + "}", + "", + ], + ) + type_data.add_type_info( + model.ReferenceType(kind="reference", name="OR3"), + "OR3", + [ + "/// This allows a field to have three types.", + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + "#[serde(untagged)]", + "pub enum OR3<T, U, V> {", + " T(T),", + " U(U),", + " V(V),", + "}", + "", + ], + ) + type_data.add_type_info( + model.ReferenceType(kind="reference", name="OR4"), + "OR4", + [ + "/// This allows a field to have four types.", + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + "#[serde(untagged)]", + "pub enum OR4<T, U, V, W> {", + " T(T),", + " U(U),", + " V(V),", + " W(W),", + "}", + "", + ], + ) + type_data.add_type_info( + model.ReferenceType(kind="reference", name="OR5"), + "OR5", + [ + "/// This allows a field to have five types.", + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + "#[serde(untagged)]", + "pub enum OR5<T, U, V, W, X> {", + " T(T),", + " U(U),", + " V(V),", + " W(W),", + " X(X),", + "}", + "", + ], + ) + type_data.add_type_info( + model.ReferenceType(kind="reference", name="OR6"), + "OR6", + [ + "/// This allows a field to have six types.", + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + "#[serde(untagged)]", + "pub enum OR6<T, U, V, W, X, Y> {", + " T(T),", + " U(U),", + " V(V),", + " W(W),", + " X(X),", + " Y(Y),", + "}", + "", + ], + ) + type_data.add_type_info( + model.ReferenceType(kind="reference", name="OR7"), + "OR7", + [ + "/// This allows a field to have seven types.", + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + "#[serde(untagged)]", + "pub enum OR7<T, U, V, W, X, Y, Z> {", + " T(T),", + " U(U),", + " V(V),", + " W(W),", + " X(X),", + " Y(Y),", + " Z(Z),", + "}", + "", + ], + ) + type_data.add_type_info( + model.ReferenceType(kind="reference", name="LSPNull"), + "LSPNull", + [ + "/// This allows a field to always have null or empty value.", + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + "#[serde(untagged)]", + "pub enum LSPNull {", + " None,", + "}", + "", + ], + ) + + +def get_definition( + name: str, spec: model.LSPModel +) -> Optional[Union[model.TypeAlias, model.Structure]]: + for type_def in spec.typeAliases + spec.structures: + if type_def.name == name: + return type_def + return None + + +def generate_special_types(model: model.LSPModel, types: TypeData) -> None: + special_types = [ + get_definition("LSPAny", model), + get_definition("LSPObject", model), + get_definition("LSPArray", model), + get_definition("SelectionRange", model), + ] + + for type_def in special_types: + if type_def: + doc = ( + type_def.documentation.splitlines(keepends=False) + if type_def.documentation + else [] + ) + lines = lines_to_doc_comments(doc) + lines += generate_extras(type_def) + + if type_def.name == "LSPAny": + lines += [ + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + "#[serde(untagged)]", + "pub enum LSPAny {", + " String(String),", + " Integer(i32),", + " UInteger(u32),", + " Decimal(Decimal),", + " Boolean(bool),", + " Object(LSPObject),", + " Array(LSPArray),", + " Null,", + "}", + ] + elif type_def.name == "LSPObject": + lines += ["type LSPObject = serde_json::Value;"] + elif type_def.name == "LSPArray": + lines += ["type LSPArray = Vec<LSPAny>;"] + elif type_def.name == "SelectionRange": + lines += [ + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + "pub struct SelectionRange {", + ] + for property in type_def.properties: + doc = ( + property.documentation.splitlines(keepends=False) + if property.documentation + else [] + ) + lines += lines_to_doc_comments(doc) + lines += generate_extras(property) + prop_name = to_snake_case(property.name) + prop_type = get_type_name( + property.type, types, model, property.optional + ) + if "SelectionRange" in prop_type: + prop_type = prop_type.replace( + "SelectionRange", "Box<SelectionRange>" + ) + lines += [f"pub {prop_name}: {prop_type},"] + lines += [""] + lines += ["}"] + lines += [""] + types.add_type_info(type_def, type_def.name, lines) + + +def fix_lsp_method_name(name: str) -> str: + if name.startswith("$/"): + name = name[2:] + return to_upper_camel_case(name.replace("/", "_")) + + +def generate_special_enum(enum_name: str, items: List[str]) -> Dict[str, List[str]]: + lines = [ + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + f"pub enum {enum_name}" "{", + ] + for item in items: + lines += indent_lines( + [ + f'#[serde(rename = "{item}")]', + f"{fix_lsp_method_name(item)},", + ] + ) + lines += ["}"] + return lines + + +def generate_extra_types(spec: model.LSPModel, type_data: TypeData) -> None: + type_data.add_type_info( + model.ReferenceType(kind="reference", name="LSPRequestMethods"), + "LSPRequestMethods", + generate_special_enum("LSPRequestMethods", [m.method for m in spec.requests]), + ) + type_data.add_type_info( + model.ReferenceType(kind="reference", name="LSPNotificationMethods"), + "LSPNotificationMethods", + generate_special_enum( + "LSPNotificationMethods", [m.method for m in spec.notifications] + ), + ) + + direction = set([m.messageDirection for m in (spec.requests + spec.notifications)]) + type_data.add_type_info( + model.ReferenceType(kind="reference", name="MessageDirection"), + "MessageDirection", + generate_special_enum("MessageDirection", direction), + ) + + +def generate_commons( + model: model.LSPModel, type_data: TypeData +) -> Dict[str, List[str]]: + generate_custom_enum(type_data) + generate_special_types(model, type_data) + generate_extra_types(model, type_data) + + +def lsp_to_base_types(lsp_type: model.BaseType): + if lsp_type.name in ["string", "DocumentUri", "URI", "RegExp"]: + return "String" + elif lsp_type.name in ["decimal"]: + return "Decimal" + elif lsp_type.name in ["integer"]: + return "i32" + elif lsp_type.name in ["uinteger"]: + return "u32" + elif lsp_type.name in ["boolean"]: + return "bool" + + # null should be handled by the caller as an Option<> type + raise ValueError(f"Unknown base type: {lsp_type.name}") + + +def _get_enum(name: str, spec: model.LSPModel) -> Optional[model.Enum]: + for enum in spec.enumerations: + if enum.name == name: + return enum + return None + + +def get_from_name( + name: str, spec: model.LSPModel +) -> Optional[Union[model.Structure, model.Enum, model.TypeAlias]]: + for some in spec.enumerations + spec.structures + spec.typeAliases: + if some.name == name: + return some + return None + + +def get_extended_properties( + struct_def: model.Structure, spec: model.LSPModel +) -> List[model.Property]: + properties = [p for p in struct_def.properties] + for t in struct_def.extends + struct_def.mixins: + if t.kind == "reference": + s = get_from_name(t.name, spec) + if s: + properties += [p for p in s.properties] + elif t.kind == "literal": + properties += [p for p in t.value.properties] + else: + raise ValueError(f"Unhandled extension type or mixin type: {t.kind}") + unique_props = [] + for p in properties: + if not any((p.name == u.name) for u in unique_props): + unique_props.append(p) + return sorted(unique_props, key=lambda p: p.name) + + +def _is_str_enum(enum_def: model.Enum) -> bool: + return all(isinstance(item.value, str) for item in enum_def.values) + + +def _is_int_enum(enum_def: model.Enum) -> bool: + return all(isinstance(item.value, int) for item in enum_def.values) + + +def generate_or_type( + type_def: model.LSP_TYPE_SPEC, + types: TypeData, + spec: model.LSPModel, + optional: Optional[bool] = None, + name_context: Optional[str] = None, +) -> str: + pass + + +def generate_and_type( + type_def: model.LSP_TYPE_SPEC, + types: TypeData, + spec: model.LSPModel, + optional: Optional[bool] = None, + name_context: Optional[str] = None, +) -> str: + pass + + +def get_type_name( + type_def: model.LSP_TYPE_SPEC, + types: TypeData, + spec: model.LSPModel, + optional: Optional[bool] = None, + name_context: Optional[str] = None, +) -> str: + if type_def.kind == "reference": + enum_def = _get_enum(type_def.name, spec) + if enum_def and enum_def.supportsCustomValues: + if _is_str_enum(enum_def): + name = f"CustomStringEnum<{enum_def.name}>" + elif _is_int_enum(enum_def): + name = f"CustomIntEnum<{enum_def.name}>" + else: + name = type_def.name + elif type_def.kind == "array": + name = f"Vec<{get_type_name(type_def.element, types, spec)}>" + elif type_def.kind == "map": + key_type = get_type_name(type_def.key, types, spec) + value_type = get_type_name(type_def.value, types, spec) + name = f"HashMap<{key_type}, {value_type}>" + elif type_def.kind == "base": + name = lsp_to_base_types(type_def) + elif type_def.kind == "or": + sub_set_items = [ + sub_spec + for sub_spec in type_def.items + if not (sub_spec.kind == "base" and sub_spec.name == "null") + ] + sub_types = [get_type_name(sub_spec, types, spec) for sub_spec in sub_set_items] + sub_types_str = ", ".join(sub_types) + if len(sub_types) >= 2: + name = f"OR{len(sub_types)}<{sub_types_str}>" + elif len(sub_types) == 1: + name = sub_types[0] + else: + raise ValueError( + f"OR type with more than out of range count of subtypes: {type_def}" + ) + optional = optional or is_special(type_def) + print(f"Option<{name}>" if optional else name) + elif type_def.kind == "literal": + name = generate_literal_struct_type(type_def, types, spec, name_context) + elif type_def.kind == "stringLiteral": + name = "String" + # This type in rust requires a custom deserializer that fails if the value is not + # one of the allowed values. This should be handled by the caller. This cannot be + # handled here because all this does is handle type names. + elif type_def.kind == "tuple": + optional = optional or is_special(type_def) + sub_set_items = [ + sub_spec + for sub_spec in type_def.items + if not (sub_spec.kind == "base" and sub_spec.name == "null") + ] + sub_types = [get_type_name(sub_spec, types, spec) for sub_spec in sub_set_items] + sub_types_str = ", ".join(sub_types) + if len(sub_types) >= 2: + name = f"({sub_types_str})" + elif len(sub_types) == 1: + name = sub_types[0] + else: + raise ValueError(f"Invalid number of items for tuple: {type_def}") + else: + raise ValueError(f"Unknown type kind: {type_def.kind}") + + return f"Option<{name}>" if optional else name + + +def is_special(type_def: model.LSP_TYPE_SPEC) -> bool: + if type_def.kind in ["or", "tuple"]: + for item in type_def.items: + if item.kind == "base" and item.name == "null": + return True + return False + + +def is_special_property(prop_def: model.Property) -> bool: + return is_special(prop_def.type) + + +def is_string_literal_property(prop_def: model.Property) -> bool: + return prop_def.type.kind == "stringLiteral" + + +def generate_literal_struct_name( + type_def: model.LiteralType, + types: TypeData, + spec: model.LSPModel, + name_context: Optional[str] = None, +) -> str: + ignore_list = ["Struct", "Type", "Kind", "Options", "Params", "Result", "Options"] + + initial_parts = ["Struct"] + if name_context: + initial_parts += get_parts(name_context) + + optional_props = [p for p in type_def.value.properties if p.optional] + required_props = [p for p in type_def.value.properties if not p.optional] + + required_parts = [] + for property in required_props: + for p in get_parts(property.name): + if p not in (ignore_list + required_parts): + required_parts.append(p) + + optional = ( + ["Options"] if len(optional_props) == len(type_def.value.properties) else [] + ) + + name_parts = initial_parts + name = to_upper_camel_case("_".join(name_parts)) + + all_ignore = all(n in ignore_list for n in name_parts) + if types.has_name(name) or all_ignore: + parts = [] + + for r in required_parts: + parts.append(r) + name = to_upper_camel_case("_".join(initial_parts + parts + optional)) + if not types.has_name(name): + return name + + for i in range(1, 100): + end = [f"{i}"] if i > 1 else [] + name = to_upper_camel_case( + "_".join(initial_parts + required_parts + optional + end) + ) + if not types.has_name(name): + return name + return name + + +def _get_doc(doc: Optional[str]) -> str: + if doc: + return lines_to_doc_comments(doc.splitlines(keepends=False)) + return [] + + +def generate_property( + prop_def: model.Property, types: TypeData, spec: model.LSPModel +) -> str: + prop_name = to_snake_case(prop_def.name) + prop_type = get_type_name( + prop_def.type, types, spec, prop_def.optional, prop_def.name + ) + optional = ( + [f'#[serde(skip_serializing_if = "Option::is_none")]'] + if is_special_property(prop_def) and not prop_def.optional + else [] + ) + + if prop_name in ["type"]: + prop_name = f"{prop_name}_" + if optional: + optional = [ + f'#[serde(rename = "{prop_def.name}", skip_serializing_if = "Option::is_none")]' + ] + else: + optional = [f'#[serde(rename = "{prop_def.name}")]'] + + return ( + _get_doc(prop_def.documentation) + + generate_extras(prop_def) + + optional + + [f"pub {prop_name}: {prop_type},"] + + [""] + ) + + +def get_message_type_name(type_def: Union[model.Notification, model.Request]) -> str: + name = fix_lsp_method_name(type_def.method) + if isinstance(type_def, model.Notification): + return f"{name}Notification" + return f"{name}Request" + + +def struct_wrapper( + type_def: Union[model.Structure, model.Notification, model.Request], + inner: List[str], +) -> List[str]: + if hasattr(type_def, "name"): + name = type_def.name + else: + name = get_message_type_name(type_def) + lines = ( + _get_doc(type_def.documentation) + + generate_extras(type_def) + + [ + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + '#[serde(rename_all = "camelCase")]', + f"pub struct {name}", + "{", + ] + ) + lines += indent_lines(inner) + lines += ["}", ""] + return lines + + +def type_alias_wrapper(type_def: model.TypeAlias, inner: List[str]) -> List[str]: + lines = ( + _get_doc(type_def.documentation) + + generate_extras(type_def) + + [ + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + "#[serde(untagged)]", + f"pub enum {type_def.name}", + "{", + ] + ) + lines += indent_lines(inner) + lines += ["}", ""] + return lines + + +def generate_literal_struct_type( + type_def: model.LiteralType, + types: TypeData, + spec: model.LSPModel, + name_context: Optional[str] = None, +) -> None: + if len(type_def.value.properties) == 0: + return "LSPObject" + + if types.has_id(type_def): + return type_def.name + + type_def.name = generate_literal_struct_name(type_def, types, spec, name_context) + + inner = [] + for prop_def in type_def.value.properties: + inner += generate_property(prop_def, types, spec) + + lines = struct_wrapper(type_def, inner) + types.add_type_info(type_def, type_def.name, lines) + return type_def.name + + +def generate_extras( + type_def: Union[ + model.Enum, model.EnumItem, model.Property, model.TypeAlias, model.Structure + ] +) -> List[str]: + extras = [] + if type_def.deprecated: + extras = ["#[deprecated]"] + elif type_def.proposed: + if type_def.since: + extras = [f'#[cfg(feature = "proposed", since = "{type_def.since}")]'] + else: + extras = [f'#[cfg(feature = "proposed")]'] + # else: + # if type_def.since: + # extras = [f'#[cfg(feature = "stable", since = "{type_def.since}")]'] + # else: + # extras = [f'#[cfg(feature = "stable")]'] + return extras diff --git a/generator/plugins/rust/rust_constants.py b/generator/plugins/rust/rust_constants.py new file mode 100644 index 0000000..5b7f7a9 --- /dev/null +++ b/generator/plugins/rust/rust_constants.py @@ -0,0 +1,2 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. diff --git a/generator/plugins/rust/rust_enum.py b/generator/plugins/rust/rust_enum.py new file mode 100644 index 0000000..5773d12 --- /dev/null +++ b/generator/plugins/rust/rust_enum.py @@ -0,0 +1,51 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from typing import List, Union + +import generator.model as model + +from .rust_commons import TypeData, generate_extras +from .rust_lang_utils import indent_lines, lines_to_doc_comments, to_upper_camel_case + + +def _get_enum_docs(enum: Union[model.Enum, model.EnumItem]) -> List[str]: + doc = enum.documentation.splitlines(keepends=False) if enum.documentation else [] + return lines_to_doc_comments(doc) + + +def generate_enum(enum: model.Enum, types: TypeData) -> None: + is_int = all(isinstance(item.value, int) for item in enum.values) + + lines = ( + _get_enum_docs(enum) + + generate_extras(enum) + + [ + "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", + f"pub enum {enum.name} " "{", + ] + ) + + for item in enum.values: + if is_int: + field = [ + f"{to_upper_camel_case(item.name)} = {item.value},", + ] + else: + field = [ + f'#[serde(rename = "{item.value}")]', + f"{to_upper_camel_case(item.name)},", + ] + + lines += indent_lines( + _get_enum_docs(item) + generate_extras(item) + field + [""] + ) + + lines += ["}"] + + types.add_type_info(enum, enum.name, lines) + + +def generate_enums(enums: List[model.Enum], types: TypeData) -> None: + for enum in enums: + generate_enum(enum, types) diff --git a/generator/plugins/rust/rust_file_header.py b/generator/plugins/rust/rust_file_header.py new file mode 100644 index 0000000..4928260 --- /dev/null +++ b/generator/plugins/rust/rust_file_header.py @@ -0,0 +1,15 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from typing import List + + +def license_header() -> List[str]: + return [ + "Copyright (c) Microsoft Corporation. All rights reserved.", + "Licensed under the MIT License.", + ] + + +def package_description() -> List[str]: + return ["Language Server Protocol types for Rust generated from LSP specification."] diff --git a/generator/plugins/rust/rust_lang_utils.py b/generator/plugins/rust/rust_lang_utils.py new file mode 100644 index 0000000..222d928 --- /dev/null +++ b/generator/plugins/rust/rust_lang_utils.py @@ -0,0 +1,73 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + + +import re +from typing import List + +BASIC_LINK_RE = re.compile(r"{@link +(\w+) ([\w ]+)}") +BASIC_LINK_RE2 = re.compile(r"{@link +(\w+)\.(\w+) ([\w \.`]+)}") +BASIC_LINK_RE3 = re.compile(r"{@link +(\w+)}") +BASIC_LINK_RE4 = re.compile(r"{@link +(\w+)\.(\w+)}") +PARTS_RE = re.compile(r"(([a-z0-9])([A-Z]))") +DEFAULT_INDENT = " " + + +def lines_to_comments(lines: List[str]) -> List[str]: + return ["// " + line for line in lines] + + +def lines_to_doc_comments(lines: List[str]) -> List[str]: + doc = [] + for line in lines: + line = BASIC_LINK_RE.sub(r"[\2][\1]", line) + line = BASIC_LINK_RE2.sub(r"[\3][`\1::\2`]", line) + line = BASIC_LINK_RE3.sub(r"[\1]", line) + line = BASIC_LINK_RE4.sub(r"[`\1::\2`]", line) + if line.startswith("///"): + doc.append(line) + else: + doc.append("/// " + line) + return doc + + +def lines_to_block_comment(lines: List[str]) -> List[str]: + return ["/*"] + lines + ["*/"] + + +def get_parts(name: str) -> List[str]: + name = name.replace("_", " ") + return PARTS_RE.sub(r"\2 \3", name).split() + + +def to_snake_case(name: str) -> str: + return "_".join([part.lower() for part in get_parts(name)]) + + +def has_upper_case(name: str) -> bool: + return any(c.isupper() for c in name) + + +def is_snake_case(name: str) -> bool: + return ( + not name.startswith("_") + and not name.endswith("_") + and ("_" in name) + and not has_upper_case(name) + ) + + +def to_upper_camel_case(name: str) -> str: + return "".join([c.capitalize() for c in get_parts(name)]) + + +def to_camel_case(name: str) -> str: + parts = get_parts(name) + if len(parts) > 1: + return parts[0] + "".join([c.capitalize() for c in parts[1:]]) + else: + return parts[0] + + +def indent_lines(lines: List[str], indent: str = DEFAULT_INDENT) -> List[str]: + return [f"{indent}{line}" for line in lines] diff --git a/generator/plugins/rust/rust_structs.py b/generator/plugins/rust/rust_structs.py new file mode 100644 index 0000000..571cd62 --- /dev/null +++ b/generator/plugins/rust/rust_structs.py @@ -0,0 +1,460 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from typing import Dict, Iterable, List, Optional + +import generator.model as model + +from .rust_commons import ( + TypeData, + fix_lsp_method_name, + generate_extras, + generate_literal_struct_name, + generate_property, + get_extended_properties, + get_message_type_name, + get_type_name, + struct_wrapper, + type_alias_wrapper, +) +from .rust_lang_utils import get_parts, lines_to_doc_comments, to_upper_camel_case + + +def generate_type_aliases(spec: model.LSPModel, types: TypeData) -> None: + for alias in spec.typeAliases: + if not types.has_id(alias): + generate_type_alias(alias, types, spec) + + +def _get_doc(doc: Optional[str]) -> str: + if doc: + return lines_to_doc_comments(doc.splitlines(keepends=False)) + return [] + + +def _is_some_array_type(items: Iterable[model.LSP_TYPE_SPEC]) -> bool: + items_list = list(items) + assert len(items_list) == 2 + item1, item2 = items_list + + if item1.kind == "array" and item2.kind == "reference": + return item1.element.kind == "reference" and item1.element.name == item2.name + + if item2.kind == "array" and item1.kind == "reference": + return item2.element.kind == "reference" and item2.element.name == item1.name + return False + + +def _get_some_array_code( + items: Iterable[model.LSP_TYPE_SPEC], + types: Dict[str, List[str]], + spec: model.LSPModel, +) -> List[str]: + assert _is_some_array_type(items) + items_list = list(items) + item1 = items_list[0] + item2 = items_list[1] + + if item1.kind == "array" and item2.kind == "reference": + return [ + f" One({get_type_name(item2, types, spec)}),", + f" Many({get_type_name(item1, types, spec)}),", + ] + + if item2.kind == "array" and item1.kind == "reference": + return [ + f" One({get_type_name(item1, types, spec)}),", + f" Many({get_type_name(item2, types, spec)}),", + ] + return [] + + +def _get_common_name(items: Iterable[model.LSP_TYPE_SPEC], kind: str) -> List[str]: + names = [get_parts(item.name) for item in list(items) if item.kind == kind] + if len(names) < 2: + return [] + + smallest = min(names, key=len) + common = [] + for i in range(len(smallest)): + if all(name[i] == smallest[i] for name in names): + common.append(smallest[i]) + return common + + +def _is_all_reference_similar_type(alias: model.TypeAlias) -> bool: + items_list = list(alias.type.items) + return all(item.kind in ["reference", "base", "literal"] for item in items_list) + + +def _get_all_reference_similar_code( + alias: model.TypeAlias, + types: TypeData, + spec: model.LSPModel, +) -> List[str]: + items = alias.type.items + assert _is_all_reference_similar_type(alias) + + # Ensure all literal types have a name + for item in list(items): + if item.kind == "literal": + get_type_name(item, types, spec, None, alias.name) + + common_name = [ + i.lower() + for i in ( + _get_common_name(items, "reference") + + _get_common_name(items, "literal") + + ["struct"] + ) + ] + + lines = [] + value = 0 + field_names = [] + for item in list(items): + if item.kind == "base" and item.name == "null": + lines += ["None,"] + field_names += ["None"] + elif item.kind == "base": + name = _base_to_field_name(item.name) + lines += [f"{name}({get_type_name(item, types, spec)}),"] + field_names += [name] + elif item.kind == "reference": + name = [ + part for part in get_parts(item.name) if part.lower() not in common_name + ] + if len(name) == 0: + name = [f"Value{value}"] + value += 1 + common_name += [n.lower() for n in name] + name = to_upper_camel_case("".join(name)) + field_names += [name] + lines += [f"{name}({get_type_name(item, types, spec)}),"] + elif item.kind == "literal": + name = [ + part for part in get_parts(item.name) if part.lower() not in common_name + ] + optional_props = [p for p in item.value.properties if p.optional] + required_props = [p for p in item.value.properties if not p.optional] + + # Try picking a name using required props first and then optional props + if len(name) == 0: + for p in required_props + optional_props: + name = [ + part + for part in get_parts(p.name) + if part.lower() not in common_name + ] + if len(name) != 0: + break + + # If we still don't have a name, then try picking a name using required props + # and then optional props without checking for common name list. But check + # that the name is not already used. + if len(name) == 0: + for p in required_props + optional_props: + if to_upper_camel_case(p.name) not in field_names: + name = get_parts(p.name) + break + + # If we still don't have a name, then just use a generic "Value{int}" as name + if len(name) == 0: + name = [f"Value{value}"] + value += 1 + common_name += [n.lower() for n in name] + name = to_upper_camel_case("".join(name)) + field_names += [name] + lines += [f"{name}({item.name}),"] + else: + raise ValueError(f"Unknown type {item}") + return lines + + +def _base_to_field_name(base_name: str) -> str: + if base_name == "boolean": + return "Bool" + if base_name == "integer": + return "Int" + if base_name == "decimal": + return "Real" + if base_name == "string": + return "String" + if base_name == "uinteger": + return "UInt" + if base_name == "null": + return "None" + raise ValueError(f"Unknown base type {base_name}") + + +def _get_literal_field_name(literal: model.LiteralType, types: TypeData) -> str: + properties = list(literal.value.properties) + + if len(properties) == 1 and properties[0].kind == "base": + return _base_to_field_name(properties[0].name) + + if len(properties) == 1 and properties[0].kind == "reference": + return to_upper_camel_case(properties[0].name) + + return generate_literal_struct_name(literal, types) + + +def _generate_or_type_alias( + alias_def: model.TypeAlias, types: Dict[str, List[str]], spec: model.LSPModel +) -> List[str]: + inner = [] + + if len(alias_def.type.items) == 2 and _is_some_array_type(alias_def.type.items): + inner += _get_some_array_code(alias_def.type.items, types, spec) + elif _is_all_reference_similar_type(alias_def): + inner += _get_all_reference_similar_code(alias_def, types, spec) + else: + index = 0 + + for sub_type in alias_def.type.items: + if sub_type.kind == "base" and sub_type.name == "null": + inner += [f"None,"] + else: + inner += [f"ValueType{index}({get_type_name(sub_type, types, spec)}),"] + index += 1 + return type_alias_wrapper(alias_def, inner) + + +def generate_type_alias( + alias_def: model.TypeAlias, types: TypeData, spec: model.LSPModel +) -> List[str]: + doc = _get_doc(alias_def.documentation) + doc += generate_extras(alias_def) + + lines = [] + if alias_def.type.kind == "reference": + lines += doc + lines += [f"pub type {alias_def.name} = {alias_def.type.name};"] + elif alias_def.type.kind == "array": + lines += doc + lines += [ + f"pub type {alias_def.name} = {get_type_name(alias_def.type, types, spec)};" + ] + elif alias_def.type.kind == "or": + lines += _generate_or_type_alias(alias_def, types, spec) + elif alias_def.type.kind == "and": + raise ValueError("And type not supported") + elif alias_def.type.kind == "literal": + lines += doc + lines += [ + f"pub type {alias_def.name} = {get_type_name(alias_def.type, types, spec)};" + ] + elif alias_def.type.kind == "base": + lines += doc + lines += [ + f"pub type {alias_def.name} = {get_type_name(alias_def.type, types, spec)};" + ] + else: + pass + + types.add_type_info(alias_def, alias_def.name, lines) + + +def generate_structures(spec: model.LSPModel, types: TypeData) -> Dict[str, List[str]]: + for struct in spec.structures: + if not types.has_id(struct): + generate_struct(struct, types, spec) + return types + + +def generate_struct( + struct_def: model.Structure, types: TypeData, spec: model.LSPModel +) -> None: + inner = [] + for prop_def in get_extended_properties(struct_def, spec): + inner += generate_property(prop_def, types, spec) + + lines = struct_wrapper(struct_def, inner) + types.add_type_info(struct_def, struct_def.name, lines) + + +def generate_notifications( + spec: model.LSPModel, types: TypeData +) -> Dict[str, List[str]]: + for notification in spec.notifications: + if not types.has_id(notification): + generate_notification(notification, types, spec) + return types + + +def required_rpc_properties(name: Optional[str] = None) -> List[model.Property]: + props = [ + model.Property( + name="jsonrpc", + type=model.BaseType(kind="base", name="string"), + optional=False, + documentation="The version of the JSON RPC protocol.", + ), + ] + if name: + props += [ + model.Property( + name="method", + type=model.ReferenceType(kind="reference", name=name), + optional=False, + documentation="The method to be invoked.", + ), + ] + return props + + +def generate_notification( + notification_def: model.Notification, types: TypeData, spec: model.LSPModel +) -> None: + properties = required_rpc_properties("LSPNotificationMethods") + if notification_def.params: + properties += [ + model.Property( + name="params", + type=notification_def.params, + ) + ] + + inner = [] + for prop_def in properties: + inner += generate_property(prop_def, types, spec) + + lines = struct_wrapper(notification_def, inner) + types.add_type_info( + notification_def, get_message_type_name(notification_def), lines + ) + + +def generate_required_request_types( + spec: model.LSPModel, types: TypeData +) -> Dict[str, List[str]]: + lsp_id = model.TypeAlias( + name="LSPId", + documentation="An identifier to denote a specific request.", + type=model.OrType( + kind="or", + items=[ + model.BaseType(kind="base", name="integer"), + model.BaseType(kind="base", name="string"), + ], + ), + ) + generate_type_alias(lsp_id, types, spec) + + lsp_id_optional = model.TypeAlias( + name="LSPIdOptional", + documentation="An identifier to denote a specific response.", + type=model.OrType( + kind="or", + items=[ + model.BaseType(kind="base", name="integer"), + model.BaseType(kind="base", name="string"), + model.BaseType(kind="base", name="null"), + ], + ), + ) + generate_type_alias(lsp_id_optional, types, spec) + + +def generate_requests(spec: model.LSPModel, types: TypeData) -> Dict[str, List[str]]: + generate_required_request_types(spec, types) + for request in spec.requests: + if not types.has_id(request): + generate_request(request, types, spec) + generate_response(request, types, spec) + generate_partial_result(request, types, spec) + generate_registration_options(request, types, spec) + return types + + +def generate_request( + request_def: model.Request, types: TypeData, spec: model.LSPModel +) -> None: + properties = required_rpc_properties("LSPRequestMethods") + + properties += [ + model.Property( + name="id", + type=model.ReferenceType(kind="reference", name="LSPId"), + optional=False, + documentation="The request id.", + ) + ] + if request_def.params: + properties += [ + model.Property( + name="params", + type=request_def.params, + ) + ] + + inner = [] + for prop_def in properties: + inner += generate_property(prop_def, types, spec) + + lines = struct_wrapper(request_def, inner) + types.add_type_info(request_def, get_message_type_name(request_def), lines) + + +def generate_response( + request_def: model.Request, types: TypeData, spec: model.LSPModel +) -> None: + properties = required_rpc_properties("LSPRequestMethods") + properties += [ + model.Property( + name="id", + type=model.ReferenceType(kind="reference", name="LSPIdOptional"), + optional=False, + documentation="The request id.", + ) + ] + if request_def.result: + if request_def.result.kind == "base" and request_def.result.name == "null": + properties += [ + model.Property( + name="result", + type=model.ReferenceType(kind="reference", name="LSPNull"), + ) + ] + else: + properties += [ + model.Property( + name="result", + type=request_def.result, + ) + ] + name = fix_lsp_method_name(request_def.method) + response_def = model.Structure( + name=f"{name}Response", + documentation=f"Response to the [{name}Request].", + properties=properties, + since=request_def.since, + deprecated=request_def.deprecated, + ) + + inner = [] + for prop_def in properties: + inner += generate_property(prop_def, types, spec) + + lines = struct_wrapper(response_def, inner) + types.add_type_info(response_def, response_def.name, lines) + + +def generate_partial_result( + request_def: model.Request, types: TypeData, spec: model.LSPModel +) -> None: + if not request_def.partialResult: + return + + if request_def.partialResult.kind not in ["and", "or"]: + return + + +def generate_registration_options( + request_def: model.Request, types: TypeData, spec: model.LSPModel +) -> None: + if not request_def.registrationOptions: + return + + if request_def.registrationOptions.kind not in ["and", "or"]: + return diff --git a/generator/plugins/rust/rust_utils.py b/generator/plugins/rust/rust_utils.py new file mode 100644 index 0000000..d817070 --- /dev/null +++ b/generator/plugins/rust/rust_utils.py @@ -0,0 +1,68 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import pathlib +from typing import List + +from generator import model + +from .rust_commons import TypeData, generate_commons +from .rust_enum import generate_enums +from .rust_file_header import license_header +from .rust_lang_utils import lines_to_comments +from .rust_structs import ( + generate_notifications, + generate_requests, + generate_structures, + generate_type_aliases, +) + +PACKAGE_DIR_NAME = "lsprotocol" + + +def generate_from_spec(spec: model.LSPModel, output_dir: str) -> None: + code = generate_package_code(spec) + + output_path = pathlib.Path(output_dir, PACKAGE_DIR_NAME) + if not output_path.exists(): + output_path.mkdir(parents=True, exist_ok=True) + (output_path / "src").mkdir(parents=True, exist_ok=True) + + for file_name in code: + (output_path / file_name).write_text(code[file_name], encoding="utf-8") + + +def generate_package_code(spec: model.LSPModel) -> List[str]: + return { + "src/lib.rs": generate_lib_rs(spec), + } + + +def generate_lib_rs(spec: model.LSPModel) -> List[str]: + lines = lines_to_comments(license_header()) + lines += [ + "", + "// ****** THIS IS A GENERATED FILE, DO NOT EDIT. ******", + "// Steps to generate:", + "// 1. Checkout https://github.com/microsoft/lsprotocol", + "// 2. Install nox: `python -m pip install nox`", + "// 3. Run command: `python -m nox --session build_lsp`", + "", + ] + lines += [ + "use serde::{Serialize, Deserialize};", + "use std::collections::HashMap;", + "use rust_decimal::Decimal;" "", + ] + + type_data = TypeData() + generate_commons(spec, type_data) + generate_enums(spec.enumerations, type_data) + + generate_type_aliases(spec, type_data) + generate_structures(spec, type_data) + generate_notifications(spec, type_data) + generate_requests(spec, type_data) + + lines += type_data.get_lines() + return "\n".join(lines) diff --git a/generator/plugins/testdata/__init__.py b/generator/plugins/testdata/__init__.py new file mode 100644 index 0000000..35cc498 --- /dev/null +++ b/generator/plugins/testdata/__init__.py @@ -0,0 +1,4 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from .testdata_utils import generate_from_spec as generate diff --git a/generator/plugins/testdata/testdata_generator.py b/generator/plugins/testdata/testdata_generator.py new file mode 100644 index 0000000..4d9b850 --- /dev/null +++ b/generator/plugins/testdata/testdata_generator.py @@ -0,0 +1,498 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import hashlib +import itertools +import json +import logging +import re +from copy import deepcopy +from typing import Any, Dict, List, Optional, Tuple, Union + +import generator.model as model + +LSP_MAX_INT = 2**31 - 1 +LSP_MIN_INT = -(2**31) + +LSP_MAX_UINT = 2**31 - 1 +LSP_MIN_UINT = 0 + +LSP_OVER_MAX_INT = LSP_MAX_INT + 1 +LSP_UNDER_MIN_INT = LSP_MIN_INT - 1 + +LSP_OVER_MAX_UINT = LSP_MAX_UINT + 1 +LSP_UNDER_MIN_UINT = LSP_MIN_UINT - 1 + + +def get_hash_from(text: str) -> str: + return hashlib.sha256(text.encode("utf-8")).hexdigest() + + +def request_variants(method: str): + for id_value in [1, LSP_MAX_INT, LSP_MIN_INT, "string-id-1"]: + yield True, {"jsonrpc": "2.0", "id": id_value, "method": method} + for id_value in [LSP_OVER_MAX_INT, LSP_UNDER_MIN_INT, 1.0, True, None]: + yield False, {"jsonrpc": "2.0", "id": id_value, "method": method} + yield False, {"jsonrpc": "2.0", "method": method} + yield False, {"jsonrpc": "2.0", "id": 1} + yield False, {"id": 1, "method": method} + + +def response_variants(): + for id_value in [1, LSP_MAX_INT, LSP_MIN_INT, "string-id-1"]: + yield True, {"jsonrpc": "2.0", "id": id_value} + for id_value in [LSP_OVER_MAX_INT, LSP_UNDER_MIN_INT, 1.0, True, None]: + yield False, {"jsonrpc": "2.0", "id": id_value} + yield False, {"jsonrpc": "2.0"} + yield False, {"id": 1} + + +def notify_variants(method: str): + yield True, {"jsonrpc": "2.0", "method": method} + yield False, {"jsonrpc": "2.0", "id": 1, "method": method} + + +def _get_struct(name: str, spec: model.LSPModel) -> Optional[model.Structure]: + for struct in spec.structures: + if struct.name == name: + return struct + return None + + +def _get_type_alias(name: str, spec: model.LSPModel) -> Optional[model.TypeAlias]: + for alias in spec.typeAliases: + if alias.name == name: + return alias + return None + + +def _get_enum(name: str, spec: model.LSPModel) -> Optional[model.Enum]: + for enum in spec.enumerations: + if enum.name == name: + return enum + return None + + +class Ignore: + pass + + +def extend(arr: List[Any], length: int) -> List[Any]: + result = arr * (length // len(arr)) + arr[: length % len(arr)] + return result + + +def extend_all(lists: List[List[Any]]) -> List[List[Any]]: + max_len = max(len(l) for l in lists) + max_len = min(1000, max_len) + return [extend(l, max_len) for l in lists] + + +def has_null_base_type(items: List[model.LSP_TYPE_SPEC]) -> bool: + return any(item.kind == "base" and item.name == "null" for item in items) + + +def filter_null_base_type( + items: List[model.LSP_TYPE_SPEC], +) -> List[model.LSP_TYPE_SPEC]: + return [item for item in items if not (item.kind == "base" and item.name == "null")] + + +def generate_for_base(name: str): + if name == "string": + yield (True, "some string 🐍🐜") + yield (True, "") + elif name == "integer": + yield (True, 1) + yield (True, LSP_MAX_INT) + yield (True, LSP_MIN_INT) + yield (False, LSP_OVER_MAX_INT) + yield (False, LSP_UNDER_MIN_INT) + elif name == "decimal": + yield (True, 1.0) + elif name == "boolean": + yield (True, True) + yield (True, False) + elif name == "null": + yield (True, None) + elif name == "uinteger": + yield (True, 1) + yield (True, LSP_MAX_UINT) + yield (True, LSP_MIN_UINT) + yield (False, LSP_OVER_MAX_UINT) + yield (False, LSP_UNDER_MIN_UINT) + elif name in ["URI", "DocumentUri"]: + yield (True, "file:///some/path") + elif name == "RegExp": + yield (True, ".*") + + +def generate_for_array( + type_def: model.LSP_TYPE_SPEC, spec: model.LSPModel, visited: List[str] +): + generated = list(generate_for_type(type_def, spec, visited)) + yield (True, []) + + # array with 1 item + for valid, value in generated: + if not isinstance(value, Ignore): + yield (valid, [value]) + + # array with 2 items + generated = generated[:100] if len(generated) > 100 else generated + values = itertools.product(generated, repeat=2) + for (valid1, value1), (valid2, value2) in values: + if not isinstance(value1, Ignore) and not isinstance(value2, Ignore): + yield (valid1 and valid2, [value1, value2]) + + +def generate_for_tuple( + type_defs: List[model.LSP_TYPE_SPEC], spec: model.LSPModel, visited: List[str] +): + generated = [ + list(generate_for_type(type_def, spec, visited)) for type_def in type_defs + ] + products = zip(*extend_all(generated)) + + for product in products: + is_valid = all(valid for valid, _ in product) + values = [value for _, value in product if not isinstance(value, Ignore)] + yield (is_valid, tuple(values)) + + +def generate_for_map( + key_def: model.LSP_TYPE_SPEC, + value_def: model.LSP_TYPE_SPEC, + spec: model.LSPModel, + visited: List[str], +): + key_values = list(generate_for_type(key_def, spec, visited)) + value_values = list(generate_for_type(value_def, spec, visited)) + + for key_valid, key_value in key_values: + for value_valid, value_value in value_values: + if not (isinstance(key_value, Ignore) or isinstance(value_value, Ignore)): + yield (key_valid and value_valid, {key_value: value_value}) + + +def get_all_extends(struct_def: model.Structure, spec) -> List[model.Structure]: + extends = [] + for extend in struct_def.extends: + extends.append(_get_struct(extend.name, spec)) + for struct in get_all_extends(_get_struct(extend.name, spec), spec): + if not any(struct.name == e.name for e in extends): + extends.append(struct) + return extends + + +def get_all_properties(struct: model.Structure, spec) -> List[model.Property]: + properties = [] + for prop in struct.properties: + properties.append(prop) + + for extend in get_all_extends(struct, spec): + for prop in get_all_properties(extend, spec): + if not any(prop.name == p.name for p in properties): + properties.append(prop) + + if not all(mixin.kind == "reference" for mixin in struct.mixins): + raise ValueError(f"Struct {struct.name} has non-reference mixins") + for mixin in [_get_struct(mixin.name, spec) for mixin in struct.mixins]: + for prop in get_all_properties(mixin, spec): + if not any(prop.name == p.name for p in properties): + properties.append(prop) + + return properties + + +def generate_for_property( + prop: model.Property, spec: model.LSPModel, visited: List[str] +): + if prop.optional: + yield (True, Ignore()) + yield from generate_for_type(prop.type, spec, visited) + + +def generate_for_reference( + refname: str, + spec: model.LSPModel, + visited: List[str], +): + if len([name for name in visited if name == refname]) > 2: + return + + ref = _get_struct(refname, spec) + alias = _get_type_alias(refname, spec) + enum = _get_enum(refname, spec) + if ref: + properties = get_all_properties(ref, spec) + if properties: + names = [prop.name for prop in properties] + value_variants = [ + list(generate_for_property(prop, spec, visited)) for prop in properties + ] + + products = zip(*extend_all(value_variants)) + for variants in products: + is_valid = all(valid for valid, _ in variants) + values = [value for _, value in variants] + variant = { + name: value + for name, value in zip(names, values) + if not isinstance(value, Ignore) + } + yield (is_valid, variant) + else: + yield (True, {"lspExtension": "some value"}) + yield (True, dict()) + elif alias: + if refname in ["LSPObject", "LSPAny", "LSPArray"]: + yield from ( + (True, value) + for _, value in generate_for_type(alias.type, spec, visited) + ) + else: + yield from generate_for_type(alias.type, spec, visited) + elif enum: + value = enum.values[0].value + yield (True, value) + if isinstance(value, int): + yield (bool(enum.supportsCustomValues), 12345) + elif isinstance(value, str): + yield (bool(enum.supportsCustomValues), "testCustomValue") + else: + raise ValueError(f"Unknown reference {refname}") + + +def generate_for_or( + type_defs: List[model.LSP_TYPE_SPEC], + spec: model.LSPModel, + visited: List[str], +): + if has_null_base_type(type_defs): + yield (True, None) + + subset = filter_null_base_type(type_defs) + generated = [ + list(generate_for_type(type_def, spec, visited)) for type_def in subset + ] + for valid, value in itertools.chain(*generated): + yield (valid, value) + + +def generate_for_and( + type_defs: List[model.LSP_TYPE_SPEC], + spec: model.LSPModel, + visited: List[str], +): + generated = [ + list(generate_for_type(type_def, spec, visited)) for type_def in type_defs + ] + products = zip(*extend_all(generated)) + for variants in products: + is_valid = all(valid for valid, _ in variants) + values = [value for _, value in variants] + variant = {} + for value in values: + variant.update(value) + yield (is_valid, variant) + + +def generate_for_literal( + type_def: model.LiteralType, + spec: model.LSPModel, + visited: List[str], +): + if type_def.value.properties: + names = [prop.name for prop in type_def.value.properties] + value_variants = [ + list(generate_for_type(prop.type, spec, visited)) + for prop in type_def.value.properties + ] + + products = zip(*extend_all(value_variants)) + for variants in products: + is_valid = all(valid for valid, _ in variants) + values = [value for _, value in variants] + variant = {name: value for name, value in zip(names, values)} + yield (is_valid, variant) + else: + # Literal with no properties are a way to extend LSP spec + # see: https://github.com/microsoft/vscode-languageserver-node/issues/997 + yield (True, {"lspExtension": "some value"}) + yield (True, dict()) + + +def generate_for_type( + type_def: model.LSP_TYPE_SPEC, + spec: model.LSPModel, + visited: List[str], +): + if type_def is None: + yield (True, None) + elif type_def.kind == "base": + yield from generate_for_base(type_def.name) + elif type_def.kind == "array": + yield from generate_for_array(type_def.element, spec, visited) + elif type_def.kind == "reference": + yield from generate_for_reference( + type_def.name, spec, visited + [type_def.name] + ) + elif type_def.kind == "stringLiteral": + yield (True, type_def.value) + # yield (False, f"invalid@{type_def.value}") + elif type_def.kind == "tuple": + yield from generate_for_tuple(type_def.items, spec, visited) + elif type_def.kind == "or": + yield from generate_for_or(type_def.items, spec, visited) + elif type_def.kind == "and": + yield from generate_for_and(type_def.items, spec, visited) + elif type_def.kind == "literal": + yield from generate_for_literal(type_def, spec, visited) + elif type_def.kind == "map": + yield from generate_for_map(type_def.key, type_def.value, spec, visited) + + +def generate_requests(request: model.Request, spec: model.LSPModel): + variants = zip( + *extend_all( + [ + list(request_variants(request.method)), + list(generate_for_type(request.params, spec, [])), + ] + ) + ) + + for (valid1, base), (valid2, params) in variants: + valid = valid1 and valid2 + if isinstance(params, Ignore): + yield (valid, base) + else: + message = deepcopy(base) + message.update({"params": params}) + yield (valid1 and valid2, message) + + +def generate_notifications(notify: model.Notification, spec: model.LSPModel) -> None: + variants = zip( + *extend_all( + [ + list(notify_variants(notify.method)), + list(generate_for_type(notify.params, spec, [])), + ] + ) + ) + + for (valid1, base), (valid2, params) in variants: + valid = valid1 and valid2 + if isinstance(params, Ignore): + yield (valid, base) + else: + message = deepcopy(base) + message.update({"params": params}) + yield (valid1 and valid2, message) + + +RESPONSE_ERROR = model.Structure( + **{ + "name": "ResponseError", + "properties": [ + { + "name": "code", + "type": {"kind": "base", "name": "integer"}, + }, + { + "name": "message", + "type": {"kind": "base", "name": "string"}, + }, + { + "name": "data", + "type": {"kind": "reference", "name": "LSPObject"}, + "optional": True, + }, + ], + } +) + + +def generate_responses(request: model.Request, spec: model.LSPModel) -> None: + variants = zip( + *extend_all( + [ + list(response_variants()), + list(generate_for_type(request.result, spec, [])), + list( + generate_for_type( + model.ReferenceType("reference", "ResponseError"), spec, [] + ) + ), + ] + ) + ) + + for (valid1, base), (valid2, result), (valid3, error) in variants: + valid = valid1 and valid2 and valid3 + if isinstance(result, Ignore): + yield (valid, base) + else: + message = deepcopy(base) + message.update({"result": result}) + message.update({"error": error}) + yield (valid, message) + + +PARTS_RE = re.compile(r"(([a-z0-9])([A-Z]))") + + +def get_parts(name: str) -> List[str]: + name = name.replace("_", " ") + return PARTS_RE.sub(r"\2 \3", name).split() + + +def to_upper_camel_case(name: str) -> str: + return "".join([c.capitalize() for c in get_parts(name)]) + + +def lsp_method_to_name(method: str) -> str: + if method.startswith("$"): + method = method[1:] + method = method.replace("/", "_") + return to_upper_camel_case(method) + + +def generate(spec: model.LSPModel, logger: logging.Logger): + spec.structures.append(RESPONSE_ERROR) + testdata = {} + for request in spec.requests: + counter = 0 + for valid, value in generate_requests(request, spec): + content = json.dumps(value, indent=4, ensure_ascii=False) + name = f"{lsp_method_to_name(request.method)}Request-{valid}-{get_hash_from(content)}.json" + if name in testdata: + continue + testdata[name] = content + counter += 1 + logger.info(f"Generated {counter} variants for Request: {request.method}") + + for valid, value in generate_responses(request, spec): + content = json.dumps(value, indent=4, ensure_ascii=False) + name = f"{lsp_method_to_name(request.method)}Response-{valid}-{get_hash_from(content)}.json" + if name in testdata: + continue + testdata[name] = content + counter += 1 + logger.info(f"Generated {counter} variants for Response: {request.method}") + + for notify in spec.notifications: + counter = 0 + for valid, value in generate_notifications(notify, spec): + content = json.dumps(value, indent=4, ensure_ascii=False) + name = f"{lsp_method_to_name(notify.method)}Notification-{valid}-{get_hash_from(content)}.json" + if name in testdata: + continue + testdata[name] = content + counter += 1 + logger.info(f"Generated {counter} variants for Notification: {notify.method}") + + logger.info(f"Generated {len(testdata)} test variants") + return testdata diff --git a/generator/plugins/testdata/testdata_utils.py b/generator/plugins/testdata/testdata_utils.py new file mode 100644 index 0000000..879ce2f --- /dev/null +++ b/generator/plugins/testdata/testdata_utils.py @@ -0,0 +1,34 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import logging +import pathlib +from typing import Dict, List + +import generator.model as model + +from .testdata_generator import generate + +logger = logging.getLogger("testdata") + + +def generate_from_spec(spec: model.LSPModel, output_dir: str) -> None: + """Generate the code for the given spec.""" + output = pathlib.Path(output_dir) + + if not output.exists(): + output.mkdir(parents=True, exist_ok=True) + + cleanup(output) + # key is the relative path to the file, value is the content + code: Dict[str, str] = generate(spec, logger) + for file_name in code: + # print file size + file = output / file_name + file.write_text(code[file_name], encoding="utf-8") + + +def cleanup(output_path: pathlib.Path) -> None: + """Cleanup the generated C# files.""" + for file in output_path.glob("*.json"): + file.unlink() diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 0000000..88cf122 --- /dev/null +++ b/noxfile.py @@ -0,0 +1,257 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +import json +import os +import pathlib +import urllib.request as url_lib + +import nox + + +def _install_requirements(session: nox.Session): + session.install( + "-r", + "./packages/python/requirements.txt", + "-r", + "./requirements.txt", + ) + session.run("pip", "list") + + +@nox.session() +def tests(session: nox.Session): + """Run tests for generator and generated code in all languages.""" + _install_requirements(session) + + session.log("Running test data generator.") + session.run("python", "-m", "generator", "--plugin", "testdata") + + session.log("Running tests: generator and generated Python code.") + session.run("pytest", "./tests") + + +@nox.session() +def lint(session: nox.Session): + """Linting for generator and generated code in all languages.""" + _install_requirements(session) + + session.log("Linting: generator and generated Python code.") + session.install("isort", "black", "mypy") + session.run("isort", "--profile", "black", "--check", ".") + session.run("black", "--check", ".") + session.run("mypy", "--strict", "--no-incremental", "./packages/python/lsprotocol") + + session.log("Linting: generated Rust code.") + with session.chdir("./packages/rust/lsprotocol"): + session.run("cargo", "fmt", "--check", external=True) + + +@nox.session() +def format(session: nox.Session): + """Format generator and lsprotocol package for PyPI.""" + _format_code(session) + + +def _format_code(session: nox.Session): + session.install("isort", "black") + + session.run("isort", "--profile", "black", "noxfile.py") + session.run("black", "noxfile.py") + + session.run("isort", "--profile", "black", "generator") + session.run("black", "generator") + + session.run("isort", "--profile", "black", "tests/generator") + session.run("black", "tests/generator") + + session.run("isort", "--profile", "black", "tests/python") + session.run("black", "tests/python") + + # this is for the lsprotocol package only + python_package_path = os.fspath(pathlib.Path("./packages/python/lsprotocol")) + session.run("isort", "--profile", "black", python_package_path) + session.run("black", python_package_path) + + +@nox.session() +def build(session: nox.Session): + """Build lsprotocol (python) package for PyPI.""" + session.install("flit") + with session.chdir("./packages/python"): + session.run("flit", "build") + + +def _get_content(uri) -> str: + with url_lib.urlopen(uri) as response: + content = response.read() + if isinstance(content, str): + return content + else: + return content.decode("utf-8") + + +MODEL_SCHEMA = "https://raw.githubusercontent.com/microsoft/vscode-languageserver-node/main/protocol/metaModel.schema.json" +MODEL = "https://raw.githubusercontent.com/microsoft/vscode-languageserver-node/main/protocol/metaModel.json" + + +def _download_models(session: nox.Session): + session.log("Downloading LSP model schema.") + model_schema_text: str = _get_content(MODEL_SCHEMA) + session.log("Downloading LSP model.") + model_text: str = _get_content(MODEL) + + schema_path = pathlib.Path(__file__).parent / "generator" / "lsp.schema.json" + model_path = schema_path.parent / "lsp.json" + + schema_path.write_text( + json.dumps(json.loads(model_schema_text), indent=4, ensure_ascii=False) + "\n", + encoding="utf-8", + ) + model_path.write_text( + json.dumps(json.loads(model_text), indent=4, ensure_ascii=False) + "\n", + encoding="utf-8", + ) + + +@nox.session() +def build_lsp(session: nox.Session): + """Generate lsprotocol for all languages.""" + generate_python(session) + generate_dotnet(session) + generate_rust(session) + + +@nox.session() +def update_lsp(session: nox.Session): + """Update the LSP model and generate the lsprotocol for all languages.""" + update_packages(session) + _download_models(session) + build_lsp(session) + + +@nox.session() +def update_packages(session: nox.Session): + """Update dependencies of generator and lsprotocol.""" + session.install("wheel", "pip-tools") + + session.run( + "pip-compile", + "--generate-hashes", + "--resolver=backtracking", + "--upgrade", + "./packages/python/requirements.in", + ) + session.run( + "pip-compile", + "--generate-hashes", + "--resolver=backtracking", + "--upgrade", + "./requirements.in", + ) + + +@nox.session() +def create_plugin(session: nox.Session): + """Create a new plugin.""" + name = input("Enter the name of the plugin: ") + + plugin_root = pathlib.Path(__file__).parent / "generator" / "plugins" / name + plugin_root.mkdir(parents=True, exist_ok=True) + + init_text = "\n".join( + [ + "# Copyright (c) Microsoft Corporation. All rights reserved.", + "# Licensed under the MIT License.", + "", + f"from .{name}_utils import generate_from_spec as generate", + "", + ] + ) + plugin_root.joinpath("__init__.py").write_text(init_text, encoding="utf-8") + + utils_text = "\n".join( + [ + "# Copyright (c) Microsoft Corporation. All rights reserved.", + "# Licensed under the MIT License.", + "", + "import pathlib", + "from typing import List, Dict", + "", + "import generator.model as model", + "", + "", + 'PACKAGE_DIR_NAME = "lsprotocol"', + "", + "", + "def generate_from_spec(spec: model.LSPModel, output_dir: str) -> None:", + ' """Generate the code for the given spec."""', + " # key is the relative path to the file, value is the content", + " code: Dict[str, str] = generate_package_code(spec)", + " for file_name in code:", + " pathlib.Path(output_dir, PACKAGE_DIR_NAME, file_name).write_text(", + ' code[file_name], encoding="utf-8"', + " )", + "", + "def generate_package_code(spec: model.LSPModel) -> List[str]:", + " return {", + ' "src/lib.rs": "code for lib.rs",', + " }", + "", + ] + ) + + plugin_root.joinpath(f"{name}_utils.py").write_text(utils_text, encoding="utf-8") + + package_root = pathlib.Path(__file__).parent / "packages" / name / "lsprotocol" + package_root.mkdir(parents=True, exist_ok=True) + package_root.joinpath("README.md").write_text( + f"# your generated code and other package files go under this directory.", + encoding="utf-8", + ) + + tests_root = pathlib.Path(__file__).parent / "tests" / name + tests_root.mkdir(parents=True, exist_ok=True) + tests_root.joinpath("README.md").write_text( + f"# your tests go under this directory.", encoding="utf-8" + ) + + launch_json_path = pathlib.Path(__file__).parent / ".vscode" / "launch.json" + launch_json = json.loads(launch_json_path.read_text(encoding="utf-8")) + + for i in launch_json["inputs"]: + if i["id"] == "plugin": + i["options"].append(name) + + launch_json_path.write_text(json.dumps(launch_json, indent=4), encoding="utf-8") + + session.log(f"Created plugin {name}.") + + +@nox.session() +def generate_dotnet(session: nox.Session): + """Update the dotnet code.""" + _install_requirements(session) + + session.run("python", "-m", "generator", "--plugin", "dotnet") + with session.chdir("./packages/dotnet/lsprotocol"): + session.run("dotnet", "format", external=True) + session.run("dotnet", "build", external=True) + + +@nox.session() +def generate_python(session: nox.Session): + """Update the python code.""" + _install_requirements(session) + + session.run("python", "-m", "generator", "--plugin", "python") + _format_code(session) + + +@nox.session() +def generate_rust(session: nox.Session): + """Update the rust code.""" + _install_requirements(session) + + session.run("python", "-m", "generator", "--plugin", "rust") + with session.chdir("./packages/rust/lsprotocol"): + session.run("cargo", "fmt", external=True) diff --git a/packages/dotnet/lsprotocol/.gitignore b/packages/dotnet/lsprotocol/.gitignore new file mode 100644 index 0000000..b07e4a5 --- /dev/null +++ b/packages/dotnet/lsprotocol/.gitignore @@ -0,0 +1 @@ +*.cs
\ No newline at end of file diff --git a/packages/dotnet/lsprotocol/lsprotocol.csproj b/packages/dotnet/lsprotocol/lsprotocol.csproj new file mode 100644 index 0000000..6ce7d32 --- /dev/null +++ b/packages/dotnet/lsprotocol/lsprotocol.csproj @@ -0,0 +1,12 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>net6.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> + </ItemGroup> +</Project> diff --git a/packages/python/LICENSE b/packages/python/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/packages/python/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/packages/python/README.md b/packages/python/README.md new file mode 100644 index 0000000..4eb329e --- /dev/null +++ b/packages/python/README.md @@ -0,0 +1,40 @@ +# Language Server Protocol Types implementation for Python + +`lsprotocol` is a python implementation of object types used in the Language Server Protocol (LSP). This repository contains the code generator and the generated types for LSP. + +## Overview + +LSP is used by editors to communicate with various tools to enables services like code completion, documentation on hover, formatting, code analysis, etc. The intent of this library is to allow you to build on top of the types used by LSP. This repository will be kept up to date with the latest version of LSP as it is updated. + +## Installation + +`python -m pip install lsprotocol` + +## Usage + +### Using LSP types + +```python +from lsprotocol import types + +position = types.Position(line=10, character=3) +``` + +### Using built-in type converters + +```python +# test.py +import json +from lsprotocol import converters, types + +position = types.Position(line=10, character=3) +converter = converters.get_converter() +print(json.dumps(converter.unstructure(position, unstructure_as=types.Position))) +``` + +Output: + +```console +> python test.py +{"line": 10, "character": 3} +``` diff --git a/packages/python/lsprotocol/__init__.py b/packages/python/lsprotocol/__init__.py new file mode 100644 index 0000000..5b7f7a9 --- /dev/null +++ b/packages/python/lsprotocol/__init__.py @@ -0,0 +1,2 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. diff --git a/packages/python/lsprotocol/_hooks.py b/packages/python/lsprotocol/_hooks.py new file mode 100644 index 0000000..e1ba9d6 --- /dev/null +++ b/packages/python/lsprotocol/_hooks.py @@ -0,0 +1,1233 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +import sys +from typing import Any, List, Optional, Tuple, Union + +import attrs +import cattrs + +from . import types as lsp_types + +LSPAny = lsp_types.LSPAny +OptionalPrimitive = Optional[Union[bool, int, str, float]] + +# Flag to ensure we only resolve forward references once. +_resolved_forward_references = False + + +def _resolve_forward_references() -> None: + """Resolve forward references for faster processing with cattrs.""" + global _resolved_forward_references + if not _resolved_forward_references: + + def _filter(p: Tuple[str, object]) -> bool: + return isinstance(p[1], type) and attrs.has(p[1]) + + # Creating a concrete list here because `resolve_types` mutates the provided map. + items = list(filter(_filter, lsp_types.ALL_TYPES_MAP.items())) + for _, value in items: + if isinstance(value, type): + attrs.resolve_types(value, lsp_types.ALL_TYPES_MAP, {}) # type: ignore + _resolved_forward_references = True + + +def register_hooks(converter: cattrs.Converter) -> cattrs.Converter: + _resolve_forward_references() + converter = _register_capabilities_hooks(converter) + converter = _register_required_structure_hooks(converter) + return _register_custom_property_hooks(converter) + + +def _register_capabilities_hooks(converter: cattrs.Converter) -> cattrs.Converter: + def _text_document_sync_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.TextDocumentSyncOptions]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.TextDocumentSyncOptions) + + def _notebook_document_sync_hook( + object_: Any, _: type + ) -> Optional[ + Union[ + lsp_types.NotebookDocumentSyncRegistrationOptions, + lsp_types.NotebookDocumentSyncOptions, + ] + ]: + if object_ is None: + return None + if "id" in object_: + return converter.structure( + object_, lsp_types.NotebookDocumentSyncRegistrationOptions + ) + else: + return converter.structure(object_, lsp_types.NotebookDocumentSyncOptions) + + def _hover_provider_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.HoverOptions]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.HoverOptions) + + def _declaration_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.DeclarationRegistrationOptions, + lsp_types.DeclarationOptions, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if "id" in object_: + return converter.structure( + object_, lsp_types.DeclarationRegistrationOptions + ) + else: + return converter.structure(object_, lsp_types.DeclarationOptions) + + def _definition_provider_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.DefinitionOptions]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.DefinitionOptions) + + def _type_definition_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.TypeDefinitionRegistrationOptions, + lsp_types.TypeDefinitionOptions, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if "id" in object_: + return converter.structure( + object_, lsp_types.TypeDefinitionRegistrationOptions + ) + else: + return converter.structure(object_, lsp_types.TypeDefinitionOptions) + + def _implementation_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.ImplementationRegistrationOptions, + lsp_types.ImplementationOptions, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if "id" in object_: + return converter.structure( + object_, lsp_types.ImplementationRegistrationOptions + ) + else: + return converter.structure(object_, lsp_types.ImplementationOptions) + + def _references_provider_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.ReferenceOptions]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.ReferenceOptions) + + def _position_encoding_hook( + object_: Union[lsp_types.PositionEncodingKind, OptionalPrimitive], _: type + ) -> Union[lsp_types.PositionEncodingKind, OptionalPrimitive]: + return object_ + + def _document_highlight_provider_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.DocumentHighlightOptions]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.DocumentHighlightOptions) + + def _document_symbol_provider_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.DocumentSymbolOptions]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.DocumentSymbolOptions) + + def _code_action_provider_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.CodeActionOptions]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.CodeActionOptions) + + def _color_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.DocumentColorRegistrationOptions, + lsp_types.DocumentColorOptions, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if "id" in object_: + return converter.structure( + object_, lsp_types.DocumentColorRegistrationOptions + ) + else: + return converter.structure(object_, lsp_types.DocumentColorOptions) + + def _workspace_symbol_provider_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.WorkspaceSymbolOptions]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.WorkspaceSymbolOptions) + + def _document_formatting_provider_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.DocumentFormattingOptions]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.DocumentFormattingOptions) + + def _document_range_formatting_provider_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.DocumentRangeFormattingOptions]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.DocumentRangeFormattingOptions) + + def _rename_provider_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.RenameOptions]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.RenameOptions) + + def _folding_range_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.FoldingRangeRegistrationOptions, + lsp_types.FoldingRangeOptions, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if "id" in object_: + return converter.structure( + object_, lsp_types.FoldingRangeRegistrationOptions + ) + else: + return converter.structure(object_, lsp_types.FoldingRangeOptions) + + def _selection_range_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.SelectionRangeRegistrationOptions, + lsp_types.SelectionRangeOptions, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if "id" in object_: + return converter.structure( + object_, lsp_types.SelectionRangeRegistrationOptions + ) + else: + return converter.structure(object_, lsp_types.SelectionRangeOptions) + + def _call_hierarchy_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.CallHierarchyRegistrationOptions, + lsp_types.CallHierarchyOptions, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if "id" in object_: + return converter.structure( + object_, lsp_types.CallHierarchyRegistrationOptions + ) + else: + return converter.structure(object_, lsp_types.CallHierarchyOptions) + + def _linked_editing_range_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.LinkedEditingRangeRegistrationOptions, + lsp_types.LinkedEditingRangeOptions, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if "id" in object_: + return converter.structure( + object_, lsp_types.LinkedEditingRangeRegistrationOptions + ) + else: + return converter.structure(object_, lsp_types.LinkedEditingRangeOptions) + + def _semantic_tokens_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.SemanticTokensRegistrationOptions, + lsp_types.SemanticTokensOptions, + ]: + if object_ is None: + return None + if "id" in object_: + return converter.structure( + object_, lsp_types.SemanticTokensRegistrationOptions + ) + else: + return converter.structure(object_, lsp_types.SemanticTokensOptions) + + def _moniker_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.MonikerRegistrationOptions, + lsp_types.MonikerOptions, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if "id" in object_: + return converter.structure(object_, lsp_types.MonikerRegistrationOptions) + else: + return converter.structure(object_, lsp_types.MonikerOptions) + + def _type_hierarchy_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.TypeHierarchyRegistrationOptions, + lsp_types.TypeHierarchyOptions, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if "id" in object_: + return converter.structure( + object_, lsp_types.TypeHierarchyRegistrationOptions + ) + else: + return converter.structure(object_, lsp_types.TypeHierarchyOptions) + + def _inline_value_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.InlineValueRegistrationOptions, + lsp_types.InlineValueOptions, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if "id" in object_: + return converter.structure( + object_, lsp_types.InlineValueRegistrationOptions + ) + else: + return converter.structure(object_, lsp_types.InlineValueOptions) + + def _inlay_hint_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.InlayHintRegistrationOptions, + lsp_types.InlayHintOptions, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if "id" in object_: + return converter.structure(object_, lsp_types.InlayHintRegistrationOptions) + else: + return converter.structure(object_, lsp_types.InlayHintOptions) + + def _inlay_hint_label_part_hook( + object_: Any, _: type + ) -> Union[str, List[lsp_types.InlayHintLabelPart]]: + if isinstance(object_, str): + return object_ + + return [ + converter.structure(item, lsp_types.InlayHintLabelPart) for item in object_ + ] + + def _diagnostic_provider_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.DiagnosticRegistrationOptions, + lsp_types.DiagnosticOptions, + ]: + if object_ is None: + return None + if "id" in object_: + return converter.structure(object_, lsp_types.DiagnosticRegistrationOptions) + else: + return converter.structure(object_, lsp_types.DiagnosticOptions) + + def _save_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.SaveOptions]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.SaveOptions) + + def _code_action_hook( + object_: Any, _: type + ) -> Union[lsp_types.Command, lsp_types.CodeAction]: + if "command" in object_: + return converter.structure(object_, lsp_types.Command) + else: + return converter.structure(object_, lsp_types.CodeAction) + + def _completion_list_hook( + object_: Any, _: type + ) -> Optional[Union[lsp_types.CompletionList, List[lsp_types.CompletionItem]]]: + if object_ is None: + return None + if isinstance(object_, list): + return [ + converter.structure(item, lsp_types.CompletionItem) for item in object_ + ] + else: + return converter.structure(object_, lsp_types.CompletionList) + + def _location_hook( + object_: Any, _: type + ) -> Optional[ + Union[ + lsp_types.Location, + List[lsp_types.Location], + List[lsp_types.LocationLink], + ] + ]: + if object_ is None: + return None + if isinstance(object_, list): + if len(object_) == 0: + return [] # type: ignore[return-value] + if "targetUri" in object_[0]: + return [ + converter.structure(item, lsp_types.LocationLink) + for item in object_ + ] + else: + return [ + converter.structure(item, lsp_types.Location) for item in object_ + ] + else: + return converter.structure(object_, lsp_types.Location) + + def _symbol_hook( + object_: Any, _: type + ) -> Optional[ + Union[List[lsp_types.DocumentSymbol], List[lsp_types.SymbolInformation]] + ]: + if object_ is None: + return None + if isinstance(object_, list): + if len(object_) == 0: + return [] # type: ignore[return-value] + if "location" in object_[0]: + return [ + converter.structure(item, lsp_types.SymbolInformation) + for item in object_ + ] + else: + return [ + converter.structure(item, lsp_types.DocumentSymbol) + for item in object_ + ] + else: + return None + + def _markup_content_hook( + object_: Any, _: type + ) -> Optional[ + Union[ + OptionalPrimitive, + lsp_types.MarkupContent, + lsp_types.MarkedString_Type1, + List[Union[OptionalPrimitive, lsp_types.MarkedString_Type1]], + ] + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + if isinstance(object_, list): + return [ + ( + item + if isinstance(item, (bool, int, str, float)) + else converter.structure(item, lsp_types.MarkedString_Type1) + ) + for item in object_ + ] + if "kind" in object_: + return converter.structure(object_, lsp_types.MarkupContent) + else: + return converter.structure(object_, lsp_types.MarkedString_Type1) + + def _document_edit_hook( + object_: Any, _: type + ) -> Optional[ + Union[ + lsp_types.TextDocumentEdit, + lsp_types.CreateFile, + lsp_types.RenameFile, + lsp_types.DeleteFile, + ] + ]: + if object_ is None: + return None + if "kind" in object_: + if object_["kind"] == "create": + return converter.structure(object_, lsp_types.CreateFile) + elif object_["kind"] == "rename": + return converter.structure(object_, lsp_types.RenameFile) + elif object_["kind"] == "delete": + return converter.structure(object_, lsp_types.DeleteFile) + else: + raise ValueError("Unknown edit kind: ", object_) + else: + return converter.structure(object_, lsp_types.TextDocumentEdit) + + def _semantic_tokens_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.SemanticTokensOptionsFullType1]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.SemanticTokensOptionsFullType1) + + def _semantic_tokens_capabilities_hook( + object_: Any, _: type + ) -> Union[ + OptionalPrimitive, + lsp_types.SemanticTokensClientCapabilitiesRequestsTypeFullType1, + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure( + object_, lsp_types.SemanticTokensClientCapabilitiesRequestsTypeFullType1 + ) + + def _code_action_kind_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.CodeActionKind]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.CodeActionKind) + + def _position_encoding_kind_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.PositionEncodingKind]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.PositionEncodingKind) + + def _folding_range_kind_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.FoldingRangeKind]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.FoldingRangeKind) + + def _semantic_token_types_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.SemanticTokenTypes]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.SemanticTokenTypes) + + def _semantic_token_modifiers_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.SemanticTokenModifiers]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.SemanticTokenModifiers) + + def _watch_kind_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.WatchKind]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.WatchKind) + + def _notebook_sync_option_selector_hook( + object_: Any, _: type + ) -> Union[ + lsp_types.NotebookDocumentSyncOptionsNotebookSelectorType1, + lsp_types.NotebookDocumentSyncOptionsNotebookSelectorType2, + ]: + if "notebook" in object_: + return converter.structure( + object_, lsp_types.NotebookDocumentSyncOptionsNotebookSelectorType1 + ) + else: + return converter.structure( + object_, lsp_types.NotebookDocumentSyncOptionsNotebookSelectorType2 + ) + + def _semantic_token_registration_options_hook( + object_: Any, _: type + ) -> Optional[ + Union[OptionalPrimitive, lsp_types.SemanticTokensRegistrationOptionsFullType1] + ]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure( + object_, lsp_types.SemanticTokensRegistrationOptionsFullType1 + ) + + def _inline_completion_provider_hook( + object_: Any, _: type + ) -> Optional[Union[OptionalPrimitive, lsp_types.InlineCompletionOptions]]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.InlineCompletionOptions) + + def _inline_completion_list_hook( + object_: Any, _: type + ) -> Optional[ + Union[lsp_types.InlineCompletionList, List[lsp_types.InlineCompletionItem]] + ]: + if object_ is None: + return None + if isinstance(object_, list): + return [ + converter.structure(item, lsp_types.InlineCompletionItem) + for item in object_ + ] + return converter.structure(object_, lsp_types.InlineCompletionList) + + def _string_value_hook( + object_: Any, _: type + ) -> Union[OptionalPrimitive, lsp_types.StringValue]: + if object_ is None: + return None + if isinstance(object_, (bool, int, str, float)): + return object_ + return converter.structure(object_, lsp_types.StringValue) + + def _symbol_list_hook( + object_: Any, _: type + ) -> Optional[ + Union[List[lsp_types.SymbolInformation], List[lsp_types.WorkspaceSymbol]] + ]: + if object_ is None: + return None + assert isinstance(object_, list) + if len(object_) == 0: + return [] # type: ignore[return-value] + if "location" in object_[0]: + return [ + converter.structure(item, lsp_types.SymbolInformation) + for item in object_ + ] + else: + return [ + converter.structure(item, lsp_types.WorkspaceSymbol) for item in object_ + ] + + def _notebook_sync_registration_option_selector_hook( + object_: Any, _: type + ) -> Union[ + lsp_types.NotebookDocumentSyncRegistrationOptionsNotebookSelectorType1, + lsp_types.NotebookDocumentSyncRegistrationOptionsNotebookSelectorType2, + ]: + if "notebook" in object_: + return converter.structure( + object_, + lsp_types.NotebookDocumentSyncRegistrationOptionsNotebookSelectorType1, + ) + else: + return converter.structure( + object_, + lsp_types.NotebookDocumentSyncRegistrationOptionsNotebookSelectorType2, + ) + + structure_hooks = [ + ( + Optional[ + Union[lsp_types.TextDocumentSyncOptions, lsp_types.TextDocumentSyncKind] + ], + _text_document_sync_hook, + ), + ( + Optional[ + Union[ + lsp_types.NotebookDocumentSyncOptions, + lsp_types.NotebookDocumentSyncRegistrationOptions, + ] + ], + _notebook_document_sync_hook, + ), + (Optional[Union[bool, lsp_types.HoverOptions]], _hover_provider_hook), + ( + Optional[ + Union[ + bool, + lsp_types.DeclarationOptions, + lsp_types.DeclarationRegistrationOptions, + ] + ], + _declaration_provider_hook, + ), + (Optional[Union[bool, lsp_types.DefinitionOptions]], _definition_provider_hook), + ( + Optional[ + Union[ + bool, + lsp_types.TypeDefinitionOptions, + lsp_types.TypeDefinitionRegistrationOptions, + ] + ], + _type_definition_provider_hook, + ), + ( + Optional[ + Union[ + bool, + lsp_types.ImplementationOptions, + lsp_types.ImplementationRegistrationOptions, + ] + ], + _implementation_provider_hook, + ), + (Optional[Union[bool, lsp_types.ReferenceOptions]], _references_provider_hook), + ( + Optional[Union[bool, lsp_types.DocumentHighlightOptions]], + _document_highlight_provider_hook, + ), + ( + Optional[Union[bool, lsp_types.DocumentSymbolOptions]], + _document_symbol_provider_hook, + ), + ( + Optional[Union[bool, lsp_types.CodeActionOptions]], + _code_action_provider_hook, + ), + ( + Optional[ + Union[ + bool, + lsp_types.DocumentColorOptions, + lsp_types.DocumentColorRegistrationOptions, + ] + ], + _color_provider_hook, + ), + ( + Optional[Union[bool, lsp_types.WorkspaceSymbolOptions]], + _workspace_symbol_provider_hook, + ), + ( + Optional[Union[bool, lsp_types.DocumentFormattingOptions]], + _document_formatting_provider_hook, + ), + ( + Optional[Union[bool, lsp_types.DocumentRangeFormattingOptions]], + _document_range_formatting_provider_hook, + ), + (Optional[Union[bool, lsp_types.RenameOptions]], _rename_provider_hook), + ( + Optional[ + Union[ + bool, + lsp_types.FoldingRangeOptions, + lsp_types.FoldingRangeRegistrationOptions, + ] + ], + _folding_range_provider_hook, + ), + ( + Optional[ + Union[ + bool, + lsp_types.SelectionRangeOptions, + lsp_types.SelectionRangeRegistrationOptions, + ] + ], + _selection_range_provider_hook, + ), + ( + Optional[ + Union[ + bool, + lsp_types.CallHierarchyOptions, + lsp_types.CallHierarchyRegistrationOptions, + ] + ], + _call_hierarchy_provider_hook, + ), + ( + Optional[ + Union[ + bool, + lsp_types.LinkedEditingRangeOptions, + lsp_types.LinkedEditingRangeRegistrationOptions, + ] + ], + _linked_editing_range_provider_hook, + ), + ( + Optional[ + Union[ + lsp_types.SemanticTokensOptions, + lsp_types.SemanticTokensRegistrationOptions, + ] + ], + _semantic_tokens_provider_hook, + ), + ( + Optional[ + Union[ + bool, lsp_types.MonikerOptions, lsp_types.MonikerRegistrationOptions + ] + ], + _moniker_provider_hook, + ), + ( + Optional[ + Union[ + bool, + lsp_types.TypeHierarchyOptions, + lsp_types.TypeHierarchyRegistrationOptions, + ] + ], + _type_hierarchy_provider_hook, + ), + ( + Optional[ + Union[ + bool, + lsp_types.InlineValueOptions, + lsp_types.InlineValueRegistrationOptions, + ] + ], + _inline_value_provider_hook, + ), + ( + Optional[ + Union[ + bool, + lsp_types.InlayHintOptions, + lsp_types.InlayHintRegistrationOptions, + ] + ], + _inlay_hint_provider_hook, + ), + ( + Union[str, List[lsp_types.InlayHintLabelPart]], + _inlay_hint_label_part_hook, + ), + ( + Optional[ + Union[ + lsp_types.DiagnosticOptions, lsp_types.DiagnosticRegistrationOptions + ] + ], + _diagnostic_provider_hook, + ), + ( + Optional[Union[lsp_types.SaveOptions, bool]], + _save_hook, + ), + ( + Union[lsp_types.Command, lsp_types.CodeAction], + _code_action_hook, + ), + ( + Optional[Union[List[lsp_types.CompletionItem], lsp_types.CompletionList]], + _completion_list_hook, + ), + ( + Optional[ + Union[ + lsp_types.Location, + List[lsp_types.Location], + List[lsp_types.LocationLink], + ] + ], + _location_hook, + ), + ( + Optional[ + Union[List[lsp_types.SymbolInformation], List[lsp_types.DocumentSymbol]] + ], + _symbol_hook, + ), + ( + Union[ + lsp_types.MarkupContent, + str, + lsp_types.MarkedString_Type1, + List[Union[str, lsp_types.MarkedString_Type1]], + ], + _markup_content_hook, + ), + ( + Union[ + lsp_types.TextDocumentEdit, + lsp_types.CreateFile, + lsp_types.RenameFile, + lsp_types.DeleteFile, + ], + _document_edit_hook, + ), + ( + Optional[Union[bool, lsp_types.SemanticTokensOptionsFullType1]], + _semantic_tokens_hook, + ), + ( + Optional[ + Union[ + bool, + lsp_types.SemanticTokensClientCapabilitiesRequestsTypeFullType1, + ] + ], + _semantic_tokens_capabilities_hook, + ), + ( + Optional[Union[str, lsp_types.MarkupContent]], + _markup_content_hook, + ), + ( + Optional[Union[lsp_types.CodeActionKind, str]], + _code_action_kind_hook, + ), + ( + Union[lsp_types.CodeActionKind, str], + _code_action_kind_hook, + ), + ( + Union[lsp_types.PositionEncodingKind, str], + _position_encoding_kind_hook, + ), + ( + Optional[Union[lsp_types.FoldingRangeKind, str]], + _folding_range_kind_hook, + ), + ( + Union[lsp_types.FoldingRangeKind, str], + _folding_range_kind_hook, + ), + ( + Union[lsp_types.SemanticTokenTypes, str], + _semantic_token_types_hook, + ), + ( + Optional[Union[lsp_types.SemanticTokenTypes, str]], + _semantic_token_types_hook, + ), + ( + Union[lsp_types.SemanticTokenModifiers, str], + _semantic_token_modifiers_hook, + ), + ( + Optional[Union[lsp_types.SemanticTokenModifiers, str]], + _semantic_token_modifiers_hook, + ), + ( + Union[lsp_types.WatchKind, int], + _watch_kind_hook, + ), + ( + Optional[Union[lsp_types.WatchKind, int]], + _watch_kind_hook, + ), + ( + Union[ + lsp_types.NotebookDocumentSyncOptionsNotebookSelectorType1, + lsp_types.NotebookDocumentSyncOptionsNotebookSelectorType2, + ], + _notebook_sync_option_selector_hook, + ), + ( + Optional[ + Union[ + lsp_types.PositionEncodingKind, + str, + ] + ], + _position_encoding_hook, + ), + ( + Optional[Union[bool, lsp_types.SemanticTokensRegistrationOptionsFullType1]], + _semantic_token_registration_options_hook, + ), + ( + Optional[Union[bool, lsp_types.InlineCompletionOptions]], + _inline_completion_provider_hook, + ), + ( + Optional[ + Union[ + lsp_types.InlineCompletionList, List[lsp_types.InlineCompletionItem] + ] + ], + _inline_completion_list_hook, + ), + ( + Union[str, lsp_types.StringValue], + _string_value_hook, + ), + ( + Optional[ + Union[ + List[lsp_types.SymbolInformation], List[lsp_types.WorkspaceSymbol] + ] + ], + _symbol_list_hook, + ), + ( + Union[ + lsp_types.NotebookDocumentSyncRegistrationOptionsNotebookSelectorType1, + lsp_types.NotebookDocumentSyncRegistrationOptionsNotebookSelectorType2, + ], + _notebook_sync_registration_option_selector_hook, + ), + ] + for type_, hook in structure_hooks: + converter.register_structure_hook(type_, hook) + return converter + + +def _register_required_structure_hooks( + converter: cattrs.Converter, +) -> cattrs.Converter: + def _lsp_object_hook(object_: Any, type_: type) -> Any: + return object_ + + def _parameter_information_label_hook( + object_: Any, type: type + ) -> Union[str, Tuple[int, int]]: + if isinstance(object_, str): + return object_ + else: + return (int(object_[0]), int(object_[1])) + + def _text_document_filter_hook( + object_: Any, _: type + ) -> Union[ + str, + lsp_types.TextDocumentFilter_Type1, + lsp_types.TextDocumentFilter_Type2, + lsp_types.TextDocumentFilter_Type3, + lsp_types.NotebookCellTextDocumentFilter, + ]: + if isinstance(object_, str): + return str(object_) + elif "notebook" in object_: + return converter.structure( + object_, lsp_types.NotebookCellTextDocumentFilter + ) + elif "language" in object_: + return converter.structure(object_, lsp_types.TextDocumentFilter_Type1) + elif "scheme" in object_: + return converter.structure(object_, lsp_types.TextDocumentFilter_Type2) + else: + return converter.structure(object_, lsp_types.TextDocumentFilter_Type3) + + def _notebook_filter_hook( + object_: Any, _: type + ) -> Union[ + str, + lsp_types.NotebookDocumentFilter_Type1, + lsp_types.NotebookDocumentFilter_Type2, + lsp_types.NotebookDocumentFilter_Type3, + ]: + if isinstance(object_, str): + return str(object_) + elif "notebookType" in object_: + return converter.structure(object_, lsp_types.NotebookDocumentFilter_Type1) + elif "scheme" in object_: + return converter.structure(object_, lsp_types.NotebookDocumentFilter_Type2) + else: + return converter.structure(object_, lsp_types.NotebookDocumentFilter_Type3) + + # TODO: Remove the ignore after this issue with attrs is addressed in either attrs or mypy + NotebookSelectorItem = attrs.fields( + lsp_types.NotebookCellTextDocumentFilter + ).notebook.type + STRUCTURE_HOOKS = [ + (type(None), lambda object_, _type: object_), + (Optional[Union[int, str]], lambda object_, _type: object_), + (Union[int, str], lambda object_, _type: object_), + (lsp_types.LSPAny, _lsp_object_hook), + (Optional[Union[str, bool]], lambda object_, _type: object_), + (Optional[Union[bool, Any]], lambda object_, _type: object_), + ( + Union[ + lsp_types.TextDocumentFilter_Type1, + lsp_types.TextDocumentFilter_Type2, + lsp_types.TextDocumentFilter_Type3, + lsp_types.NotebookCellTextDocumentFilter, + ], + _text_document_filter_hook, + ), + (lsp_types.DocumentFilter, _text_document_filter_hook), + ( + Union[ + str, + lsp_types.NotebookDocumentFilter_Type1, + lsp_types.NotebookDocumentFilter_Type2, + lsp_types.NotebookDocumentFilter_Type3, + ], + _notebook_filter_hook, + ), + (NotebookSelectorItem, _notebook_filter_hook), + ( + Union[lsp_types.LSPObject, List["LSPAny"], str, int, float, bool, None], + _lsp_object_hook, + ), + ( + Union[ + lsp_types.LSPObject, List[lsp_types.LSPAny], str, int, float, bool, None + ], + _lsp_object_hook, + ), + ( + Union[str, Tuple[int, int]], + _parameter_information_label_hook, + ), + (lsp_types.LSPObject, _lsp_object_hook), + ] + + if sys.version_info > (3, 8): + STRUCTURE_HOOKS += [ + ( + Union[ + lsp_types.LSPObject, + List[ + Union[ + lsp_types.LSPObject, + List["LSPAny"], + str, + int, + float, + bool, + None, + ] + ], + str, + int, + float, + bool, + None, + ], + _lsp_object_hook, + ) + ] + + for type_, hook in STRUCTURE_HOOKS: + converter.register_structure_hook(type_, hook) + + return converter + + +def _register_custom_property_hooks(converter: cattrs.Converter) -> cattrs.Converter: + def _to_camel_case(name: str) -> str: + # TODO: when min Python becomes >= 3.9, then update this to: + # `return name.removesuffix("_")`. + new_name = name[:-1] if name.endswith("_") else name + parts = new_name.split("_") + return parts[0] + "".join(p.title() for p in parts[1:]) + + def _omit(cls: type, prop: str) -> bool: + special = lsp_types.is_special_property(cls, prop) + return not special + + def _with_custom_unstructure(cls: type) -> Any: + attributes = { + a.name: cattrs.gen.override( + rename=_to_camel_case(a.name), + omit_if_default=_omit(cls, a.name), + ) + for a in attrs.fields(cls) # type: ignore + } + return cattrs.gen.make_dict_unstructure_fn(cls, converter, **attributes) + + def _with_custom_structure(cls: type) -> Any: + attributes = { + a.name: cattrs.gen.override( + rename=_to_camel_case(a.name), + omit_if_default=_omit(cls, a.name), + ) + for a in attrs.fields(cls) # type: ignore + } + return cattrs.gen.make_dict_structure_fn(cls, converter, **attributes) + + converter.register_unstructure_hook_factory(attrs.has, _with_custom_unstructure) + converter.register_structure_hook_factory(attrs.has, _with_custom_structure) + return converter diff --git a/packages/python/lsprotocol/converters.py b/packages/python/lsprotocol/converters.py new file mode 100644 index 0000000..db12c65 --- /dev/null +++ b/packages/python/lsprotocol/converters.py @@ -0,0 +1,17 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from typing import Optional + +import cattrs + +from . import _hooks + + +def get_converter( + converter: Optional[cattrs.Converter] = None, +) -> cattrs.Converter: + """Adds cattrs hooks for LSP lsp_types to the given converter.""" + if converter is None: + converter = cattrs.Converter() + return _hooks.register_hooks(converter) diff --git a/packages/python/lsprotocol/py.typed b/packages/python/lsprotocol/py.typed new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/packages/python/lsprotocol/py.typed diff --git a/packages/python/lsprotocol/types.py b/packages/python/lsprotocol/types.py new file mode 100644 index 0000000..98b2d4b --- /dev/null +++ b/packages/python/lsprotocol/types.py @@ -0,0 +1,12898 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# ****** THIS IS A GENERATED FILE, DO NOT EDIT. ****** +# Steps to generate: +# 1. Checkout https://github.com/microsoft/lsprotocol +# 2. Install nox: `python -m pip install nox` +# 3. Run command: `python -m nox --session build_lsp` + +import enum +import functools +from typing import Any, Dict, List, Optional, Tuple, Union + +import attrs + +from . import validators + +__lsp_version__ = "3.17.0" + + +@enum.unique +class SemanticTokenTypes(str, enum.Enum): + """A set of predefined token types. This set is not fixed + an clients can specify additional token types via the + corresponding client capabilities. + + @since 3.16.0""" + + # Since: 3.16.0 + Namespace = "namespace" + Type = "type" + """Represents a generic type. Acts as a fallback for types which can't be mapped to + a specific type like class or enum.""" + Class = "class" + Enum = "enum" + Interface = "interface" + Struct = "struct" + TypeParameter = "typeParameter" + Parameter = "parameter" + Variable = "variable" + Property = "property" + EnumMember = "enumMember" + Event = "event" + Function = "function" + Method = "method" + Macro = "macro" + Keyword = "keyword" + Modifier = "modifier" + Comment = "comment" + String = "string" + Number = "number" + Regexp = "regexp" + Operator = "operator" + Decorator = "decorator" + """@since 3.17.0""" + # Since: 3.17.0 + + +@enum.unique +class SemanticTokenModifiers(str, enum.Enum): + """A set of predefined token modifiers. This set is not fixed + an clients can specify additional token types via the + corresponding client capabilities. + + @since 3.16.0""" + + # Since: 3.16.0 + Declaration = "declaration" + Definition = "definition" + Readonly = "readonly" + Static = "static" + Deprecated = "deprecated" + Abstract = "abstract" + Async = "async" + Modification = "modification" + Documentation = "documentation" + DefaultLibrary = "defaultLibrary" + + +@enum.unique +class DocumentDiagnosticReportKind(str, enum.Enum): + """The document diagnostic report kinds. + + @since 3.17.0""" + + # Since: 3.17.0 + Full = "full" + """A diagnostic report with a full + set of problems.""" + Unchanged = "unchanged" + """A report indicating that the last + returned report is still accurate.""" + + +class ErrorCodes(int, enum.Enum): + """Predefined error codes.""" + + ParseError = -32700 + InvalidRequest = -32600 + MethodNotFound = -32601 + InvalidParams = -32602 + InternalError = -32603 + ServerNotInitialized = -32002 + """Error code indicating that a server received a notification or + request before the server has received the `initialize` request.""" + UnknownErrorCode = -32001 + + +class LSPErrorCodes(int, enum.Enum): + RequestFailed = -32803 + """A request failed but it was syntactically correct, e.g the + method name was known and the parameters were valid. The error + message should contain human readable information about why + the request failed. + + @since 3.17.0""" + # Since: 3.17.0 + ServerCancelled = -32802 + """The server cancelled the request. This error code should + only be used for requests that explicitly support being + server cancellable. + + @since 3.17.0""" + # Since: 3.17.0 + ContentModified = -32801 + """The server detected that the content of a document got + modified outside normal conditions. A server should + NOT send this error code if it detects a content change + in it unprocessed messages. The result even computed + on an older state might still be useful for the client. + + If a client decides that a result is not of any use anymore + the client should cancel the request.""" + RequestCancelled = -32800 + """The client has canceled a request and a server as detected + the cancel.""" + + +@enum.unique +class FoldingRangeKind(str, enum.Enum): + """A set of predefined range kinds.""" + + Comment = "comment" + """Folding range for a comment""" + Imports = "imports" + """Folding range for an import or include""" + Region = "region" + """Folding range for a region (e.g. `#region`)""" + + +@enum.unique +class SymbolKind(int, enum.Enum): + """A symbol kind.""" + + File = 1 + Module = 2 + Namespace = 3 + Package = 4 + Class = 5 + Method = 6 + Property = 7 + Field = 8 + Constructor = 9 + Enum = 10 + Interface = 11 + Function = 12 + Variable = 13 + Constant = 14 + String = 15 + Number = 16 + Boolean = 17 + Array = 18 + Object = 19 + Key = 20 + Null = 21 + EnumMember = 22 + Struct = 23 + Event = 24 + Operator = 25 + TypeParameter = 26 + + +@enum.unique +class SymbolTag(int, enum.Enum): + """Symbol tags are extra annotations that tweak the rendering of a symbol. + + @since 3.16""" + + # Since: 3.16 + Deprecated = 1 + """Render a symbol as obsolete, usually using a strike-out.""" + + +@enum.unique +class UniquenessLevel(str, enum.Enum): + """Moniker uniqueness level to define scope of the moniker. + + @since 3.16.0""" + + # Since: 3.16.0 + Document = "document" + """The moniker is only unique inside a document""" + Project = "project" + """The moniker is unique inside a project for which a dump got created""" + Group = "group" + """The moniker is unique inside the group to which a project belongs""" + Scheme = "scheme" + """The moniker is unique inside the moniker scheme.""" + Global = "global" + """The moniker is globally unique""" + + +@enum.unique +class MonikerKind(str, enum.Enum): + """The moniker kind. + + @since 3.16.0""" + + # Since: 3.16.0 + Import = "import" + """The moniker represent a symbol that is imported into a project""" + Export = "export" + """The moniker represents a symbol that is exported from a project""" + Local = "local" + """The moniker represents a symbol that is local to a project (e.g. a local + variable of a function, a class not visible outside the project, ...)""" + + +@enum.unique +class InlayHintKind(int, enum.Enum): + """Inlay hint kinds. + + @since 3.17.0""" + + # Since: 3.17.0 + Type = 1 + """An inlay hint that for a type annotation.""" + Parameter = 2 + """An inlay hint that is for a parameter.""" + + +@enum.unique +class MessageType(int, enum.Enum): + """The message type""" + + Error = 1 + """An error message.""" + Warning = 2 + """A warning message.""" + Info = 3 + """An information message.""" + Log = 4 + """A log message.""" + Debug = 5 + """A debug message. + + @since 3.18.0""" + # Since: 3.18.0 + + +@enum.unique +class TextDocumentSyncKind(int, enum.Enum): + """Defines how the host (editor) should sync + document changes to the language server.""" + + None_ = 0 + """Documents should not be synced at all.""" + Full = 1 + """Documents are synced by always sending the full content + of the document.""" + Incremental = 2 + """Documents are synced by sending the full content on open. + After that only incremental updates to the document are + send.""" + + +@enum.unique +class TextDocumentSaveReason(int, enum.Enum): + """Represents reasons why a text document is saved.""" + + Manual = 1 + """Manually triggered, e.g. by the user pressing save, by starting debugging, + or by an API call.""" + AfterDelay = 2 + """Automatic after a delay.""" + FocusOut = 3 + """When the editor lost focus.""" + + +@enum.unique +class CompletionItemKind(int, enum.Enum): + """The kind of a completion entry.""" + + Text = 1 + Method = 2 + Function = 3 + Constructor = 4 + Field = 5 + Variable = 6 + Class = 7 + Interface = 8 + Module = 9 + Property = 10 + Unit = 11 + Value = 12 + Enum = 13 + Keyword = 14 + Snippet = 15 + Color = 16 + File = 17 + Reference = 18 + Folder = 19 + EnumMember = 20 + Constant = 21 + Struct = 22 + Event = 23 + Operator = 24 + TypeParameter = 25 + + +@enum.unique +class CompletionItemTag(int, enum.Enum): + """Completion item tags are extra annotations that tweak the rendering of a completion + item. + + @since 3.15.0""" + + # Since: 3.15.0 + Deprecated = 1 + """Render a completion as obsolete, usually using a strike-out.""" + + +@enum.unique +class InsertTextFormat(int, enum.Enum): + """Defines whether the insert text in a completion item should be interpreted as + plain text or a snippet.""" + + PlainText = 1 + """The primary text to be inserted is treated as a plain string.""" + Snippet = 2 + """The primary text to be inserted is treated as a snippet. + + A snippet can define tab stops and placeholders with `$1`, `$2` + and `${3:foo}`. `$0` defines the final tab stop, it defaults to + the end of the snippet. Placeholders with equal identifiers are linked, + that is typing in one will update others too. + + See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax""" + + +@enum.unique +class InsertTextMode(int, enum.Enum): + """How whitespace and indentation is handled during completion + item insertion. + + @since 3.16.0""" + + # Since: 3.16.0 + AsIs = 1 + """The insertion or replace strings is taken as it is. If the + value is multi line the lines below the cursor will be + inserted using the indentation defined in the string value. + The client will not apply any kind of adjustments to the + string.""" + AdjustIndentation = 2 + """The editor adjusts leading whitespace of new lines so that + they match the indentation up to the cursor of the line for + which the item is accepted. + + Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a + multi line completion item is indented using 2 tabs and all + following lines inserted will be indented using 2 tabs as well.""" + + +@enum.unique +class DocumentHighlightKind(int, enum.Enum): + """A document highlight kind.""" + + Text = 1 + """A textual occurrence.""" + Read = 2 + """Read-access of a symbol, like reading a variable.""" + Write = 3 + """Write-access of a symbol, like writing to a variable.""" + + +@enum.unique +class CodeActionKind(str, enum.Enum): + """A set of predefined code action kinds""" + + Empty = "" + """Empty kind.""" + QuickFix = "quickfix" + """Base kind for quickfix actions: 'quickfix'""" + Refactor = "refactor" + """Base kind for refactoring actions: 'refactor'""" + RefactorExtract = "refactor.extract" + """Base kind for refactoring extraction actions: 'refactor.extract' + + Example extract actions: + + - Extract method + - Extract function + - Extract variable + - Extract interface from class + - ...""" + RefactorInline = "refactor.inline" + """Base kind for refactoring inline actions: 'refactor.inline' + + Example inline actions: + + - Inline function + - Inline variable + - Inline constant + - ...""" + RefactorRewrite = "refactor.rewrite" + """Base kind for refactoring rewrite actions: 'refactor.rewrite' + + Example rewrite actions: + + - Convert JavaScript function to class + - Add or remove parameter + - Encapsulate field + - Make method static + - Move method to base class + - ...""" + Source = "source" + """Base kind for source actions: `source` + + Source code actions apply to the entire file.""" + SourceOrganizeImports = "source.organizeImports" + """Base kind for an organize imports source action: `source.organizeImports`""" + SourceFixAll = "source.fixAll" + """Base kind for auto-fix source actions: `source.fixAll`. + + Fix all actions automatically fix errors that have a clear fix that do not require user input. + They should not suppress errors or perform unsafe fixes such as generating new types or classes. + + @since 3.15.0""" + # Since: 3.15.0 + + +@enum.unique +class TraceValues(str, enum.Enum): + Off = "off" + """Turn tracing off.""" + Messages = "messages" + """Trace messages only.""" + Verbose = "verbose" + """Verbose message tracing.""" + + +@enum.unique +class MarkupKind(str, enum.Enum): + """Describes the content type that a client supports in various + result literals like `Hover`, `ParameterInfo` or `CompletionItem`. + + Please note that `MarkupKinds` must not start with a `$`. This kinds + are reserved for internal usage.""" + + PlainText = "plaintext" + """Plain text is supported as a content format""" + Markdown = "markdown" + """Markdown is supported as a content format""" + + +@enum.unique +class InlineCompletionTriggerKind(int, enum.Enum): + """Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered. + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + Invoked = 0 + """Completion was triggered explicitly by a user gesture.""" + Automatic = 1 + """Completion was triggered automatically while editing.""" + + +@enum.unique +class PositionEncodingKind(str, enum.Enum): + """A set of predefined position encoding kinds. + + @since 3.17.0""" + + # Since: 3.17.0 + Utf8 = "utf-8" + """Character offsets count UTF-8 code units (e.g. bytes).""" + Utf16 = "utf-16" + """Character offsets count UTF-16 code units. + + This is the default and must always be supported + by servers""" + Utf32 = "utf-32" + """Character offsets count UTF-32 code units. + + Implementation note: these are the same as Unicode codepoints, + so this `PositionEncodingKind` may also be used for an + encoding-agnostic representation of character offsets.""" + + +@enum.unique +class FileChangeType(int, enum.Enum): + """The file event type""" + + Created = 1 + """The file got created.""" + Changed = 2 + """The file got changed.""" + Deleted = 3 + """The file got deleted.""" + + +@enum.unique +class WatchKind(int, enum.Enum): + Create = 1 + """Interested in create events.""" + Change = 2 + """Interested in change events""" + Delete = 4 + """Interested in delete events""" + + +@enum.unique +class DiagnosticSeverity(int, enum.Enum): + """The diagnostic's severity.""" + + Error = 1 + """Reports an error.""" + Warning = 2 + """Reports a warning.""" + Information = 3 + """Reports an information.""" + Hint = 4 + """Reports a hint.""" + + +@enum.unique +class DiagnosticTag(int, enum.Enum): + """The diagnostic tags. + + @since 3.15.0""" + + # Since: 3.15.0 + Unnecessary = 1 + """Unused or unnecessary code. + + Clients are allowed to render diagnostics with this tag faded out instead of having + an error squiggle.""" + Deprecated = 2 + """Deprecated or obsolete code. + + Clients are allowed to rendered diagnostics with this tag strike through.""" + + +@enum.unique +class CompletionTriggerKind(int, enum.Enum): + """How a completion was triggered""" + + Invoked = 1 + """Completion was triggered by typing an identifier (24x7 code + complete), manual invocation (e.g Ctrl+Space) or via API.""" + TriggerCharacter = 2 + """Completion was triggered by a trigger character specified by + the `triggerCharacters` properties of the `CompletionRegistrationOptions`.""" + TriggerForIncompleteCompletions = 3 + """Completion was re-triggered as current completion list is incomplete""" + + +@enum.unique +class SignatureHelpTriggerKind(int, enum.Enum): + """How a signature help was triggered. + + @since 3.15.0""" + + # Since: 3.15.0 + Invoked = 1 + """Signature help was invoked manually by the user or by a command.""" + TriggerCharacter = 2 + """Signature help was triggered by a trigger character.""" + ContentChange = 3 + """Signature help was triggered by the cursor moving or by the document content changing.""" + + +@enum.unique +class CodeActionTriggerKind(int, enum.Enum): + """The reason why code actions were requested. + + @since 3.17.0""" + + # Since: 3.17.0 + Invoked = 1 + """Code actions were explicitly requested by the user or by an extension.""" + Automatic = 2 + """Code actions were requested automatically. + + This typically happens when current selection in a file changes, but can + also be triggered when file content changes.""" + + +@enum.unique +class FileOperationPatternKind(str, enum.Enum): + """A pattern kind describing if a glob pattern matches a file a folder or + both. + + @since 3.16.0""" + + # Since: 3.16.0 + File = "file" + """The pattern matches a file only.""" + Folder = "folder" + """The pattern matches a folder only.""" + + +@enum.unique +class NotebookCellKind(int, enum.Enum): + """A notebook cell kind. + + @since 3.17.0""" + + # Since: 3.17.0 + Markup = 1 + """A markup-cell is formatted source that is used for display.""" + Code = 2 + """A code-cell is source code.""" + + +@enum.unique +class ResourceOperationKind(str, enum.Enum): + Create = "create" + """Supports creating new files and folders.""" + Rename = "rename" + """Supports renaming existing files and folders.""" + Delete = "delete" + """Supports deleting existing files and folders.""" + + +@enum.unique +class FailureHandlingKind(str, enum.Enum): + Abort = "abort" + """Applying the workspace change is simply aborted if one of the changes provided + fails. All operations executed before the failing operation stay executed.""" + Transactional = "transactional" + """All operations are executed transactional. That means they either all + succeed or no changes at all are applied to the workspace.""" + TextOnlyTransactional = "textOnlyTransactional" + """If the workspace edit contains only textual file changes they are executed transactional. + If resource changes (create, rename or delete file) are part of the change the failure + handling strategy is abort.""" + Undo = "undo" + """The client tries to undo the operations already executed. But there is no + guarantee that this is succeeding.""" + + +@enum.unique +class PrepareSupportDefaultBehavior(int, enum.Enum): + Identifier = 1 + """The client's default behavior is to select the identifier + according the to language's syntax rule.""" + + +@enum.unique +class TokenFormat(str, enum.Enum): + Relative = "relative" + + +class LSPObject: + """LSP object definition. + @since 3.17.0""" + + # Since: 3.17.0 + pass + + +Definition = Union["Location", List["Location"]] +"""The definition of a symbol represented as one or many {@link Location locations}. +For most programming languages there is only one location at which a symbol is +defined. + +Servers should prefer returning `DefinitionLink` over `Definition` if supported +by the client.""" + + +DefinitionLink = Union["LocationLink", "LocationLink"] +"""Information about where a symbol is defined. + +Provides additional metadata over normal {@link Location location} definitions, including the range of +the defining symbol""" + + +LSPArray = List["LSPAny"] +"""LSP arrays. +@since 3.17.0""" +# Since: 3.17.0 + + +LSPAny = Union[Any, None] +"""The LSP any type. +Please note that strictly speaking a property with the value `undefined` +can't be converted into JSON preserving the property name. However for +convenience it is allowed and assumed that all these properties are +optional as well. +@since 3.17.0""" +# Since: 3.17.0 + + +Declaration = Union["Location", List["Location"]] +"""The declaration of a symbol representation as one or many {@link Location locations}.""" + + +DeclarationLink = Union["LocationLink", "LocationLink"] +"""Information about where a symbol is declared. + +Provides additional metadata over normal {@link Location location} declarations, including the range of +the declaring symbol. + +Servers should prefer returning `DeclarationLink` over `Declaration` if supported +by the client.""" + + +InlineValue = Union[ + "InlineValueText", "InlineValueVariableLookup", "InlineValueEvaluatableExpression" +] +"""Inline value information can be provided by different means: +- directly as a text value (class InlineValueText). +- as a name to use for a variable lookup (class InlineValueVariableLookup) +- as an evaluatable expression (class InlineValueEvaluatableExpression) +The InlineValue types combines all inline value types into one type. + +@since 3.17.0""" +# Since: 3.17.0 + + +DocumentDiagnosticReport = Union[ + "RelatedFullDocumentDiagnosticReport", "RelatedUnchangedDocumentDiagnosticReport" +] +"""The result of a document diagnostic pull request. A report can +either be a full report containing all diagnostics for the +requested document or an unchanged report indicating that nothing +has changed in terms of diagnostics in comparison to the last +pull request. + +@since 3.17.0""" +# Since: 3.17.0 + + +@attrs.define +class PrepareRenameResult_Type1: + range: "Range" = attrs.field() + + placeholder: str = attrs.field(validator=attrs.validators.instance_of(str)) + + +@attrs.define +class PrepareRenameResult_Type2: + default_behavior: bool = attrs.field(validator=attrs.validators.instance_of(bool)) + + +PrepareRenameResult = Union[ + "Range", "PrepareRenameResult_Type1", "PrepareRenameResult_Type2" +] + + +DocumentSelector = List["DocumentFilter"] +"""A document selector is the combination of one or many document filters. + +@sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**/tsconfig.json' }]`; + +The use of a string as a document filter is deprecated @since 3.16.0.""" +# Since: 3.16.0. + + +ProgressToken = Union[int, str] + + +ChangeAnnotationIdentifier = str +"""An identifier to refer to a change annotation stored with a workspace edit.""" + + +WorkspaceDocumentDiagnosticReport = Union[ + "WorkspaceFullDocumentDiagnosticReport", + "WorkspaceUnchangedDocumentDiagnosticReport", +] +"""A workspace diagnostic document report. + +@since 3.17.0""" +# Since: 3.17.0 + + +@attrs.define +class TextDocumentContentChangeEvent_Type1: + range: "Range" = attrs.field() + """The range of the document that changed.""" + + text: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The new text for the provided range.""" + + range_length: Optional[int] = attrs.field( + validator=attrs.validators.optional(validators.uinteger_validator), default=None + ) + """The optional length of the range that got replaced. + + @deprecated use range instead.""" + + +@attrs.define +class TextDocumentContentChangeEvent_Type2: + text: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The new text of the whole document.""" + + +TextDocumentContentChangeEvent = Union[ + "TextDocumentContentChangeEvent_Type1", "TextDocumentContentChangeEvent_Type2" +] +"""An event describing a change to a text document. If only a text is provided +it is considered to be the full content of the document.""" + + +@attrs.define +class MarkedString_Type1: + language: str = attrs.field(validator=attrs.validators.instance_of(str)) + + value: str = attrs.field(validator=attrs.validators.instance_of(str)) + + +MarkedString = Union[str, "MarkedString_Type1"] +"""MarkedString can be used to render human readable text. It is either a markdown string +or a code-block that provides a language and a code snippet. The language identifier +is semantically equal to the optional language identifier in fenced code blocks in GitHub +issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting + +The pair of a language and a value is an equivalent to markdown: +```${language} +${value} +``` + +Note that markdown strings will be sanitized - that means html will be escaped. +@deprecated use MarkupContent instead.""" + + +DocumentFilter = Union["TextDocumentFilter", "NotebookCellTextDocumentFilter"] +"""A document filter describes a top level text document or +a notebook cell document. + +@since 3.17.0 - proposed support for NotebookCellTextDocumentFilter.""" +# Since: 3.17.0 - proposed support for NotebookCellTextDocumentFilter. + + +GlobPattern = Union["Pattern", "RelativePattern"] +"""The glob pattern. Either a string pattern or a relative pattern. + +@since 3.17.0""" +# Since: 3.17.0 + + +@attrs.define +class TextDocumentFilter_Type1: + language: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A language id, like `typescript`.""" + + scheme: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.""" + + pattern: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.""" + + +@attrs.define +class TextDocumentFilter_Type2: + scheme: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.""" + + language: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A language id, like `typescript`.""" + + pattern: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.""" + + +@attrs.define +class TextDocumentFilter_Type3: + pattern: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.""" + + language: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A language id, like `typescript`.""" + + scheme: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.""" + + +TextDocumentFilter = Union[ + "TextDocumentFilter_Type1", "TextDocumentFilter_Type2", "TextDocumentFilter_Type3" +] +"""A document filter denotes a document by different properties like +the {@link TextDocument.languageId language}, the {@link Uri.scheme scheme} of +its resource, or a glob-pattern that is applied to the {@link TextDocument.fileName path}. + +Glob patterns can have the following syntax: +- `*` to match one or more characters in a path segment +- `?` to match on one character in a path segment +- `**` to match any number of path segments, including none +- `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files) +- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) +- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) + +@sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }` +@sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }` + +@since 3.17.0""" +# Since: 3.17.0 + + +@attrs.define +class NotebookDocumentFilter_Type1: + notebook_type: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The type of the enclosing notebook.""" + + scheme: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.""" + + pattern: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A glob pattern.""" + + +@attrs.define +class NotebookDocumentFilter_Type2: + scheme: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.""" + + notebook_type: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The type of the enclosing notebook.""" + + pattern: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A glob pattern.""" + + +@attrs.define +class NotebookDocumentFilter_Type3: + pattern: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A glob pattern.""" + + notebook_type: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The type of the enclosing notebook.""" + + scheme: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.""" + + +NotebookDocumentFilter = Union[ + "NotebookDocumentFilter_Type1", + "NotebookDocumentFilter_Type2", + "NotebookDocumentFilter_Type3", +] +"""A notebook document filter denotes a notebook document by +different properties. The properties will be match +against the notebook's URI (same as with documents) + +@since 3.17.0""" +# Since: 3.17.0 + + +Pattern = str +"""The glob pattern to watch relative to the base path. Glob patterns can have the following syntax: +- `*` to match one or more characters in a path segment +- `?` to match on one character in a path segment +- `**` to match any number of path segments, including none +- `{}` to group conditions (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files) +- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) +- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) + +@since 3.17.0""" +# Since: 3.17.0 + + +@attrs.define +class TextDocumentPositionParams: + """A parameter literal used in requests to pass a text document and a position inside that + document.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + +@attrs.define +class WorkDoneProgressParams: + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class PartialResultParams: + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class ImplementationParams: + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class Location: + """Represents a location inside a resource, such as a line + inside a text file.""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + + range: "Range" = attrs.field() + + def __eq__(self, o: object) -> bool: + if not isinstance(o, Location): + return NotImplemented + return (self.uri == o.uri) and (self.range == o.range) + + def __repr__(self) -> str: + return f"{self.uri}:{self.range!r}" + + +@attrs.define +class TextDocumentRegistrationOptions: + """General text document registration options.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + +@attrs.define +class WorkDoneProgressOptions: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class ImplementationOptions: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class StaticRegistrationOptions: + """Static registration options to be returned in the initialize + request.""" + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class ImplementationRegistrationOptions: + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class TypeDefinitionParams: + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class TypeDefinitionOptions: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class TypeDefinitionRegistrationOptions: + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class WorkspaceFolder: + """A workspace folder inside a client.""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The associated URI for this workspace folder.""" + + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The name of the workspace folder. Used to refer to this + workspace folder in the user interface.""" + + +@attrs.define +class DidChangeWorkspaceFoldersParams: + """The parameters of a `workspace/didChangeWorkspaceFolders` notification.""" + + event: "WorkspaceFoldersChangeEvent" = attrs.field() + """The actual workspace folder change event.""" + + +@attrs.define +class ConfigurationParams: + """The parameters of a configuration request.""" + + items: List["ConfigurationItem"] = attrs.field() + + +@attrs.define +class DocumentColorParams: + """Parameters for a {@link DocumentColorRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class ColorInformation: + """Represents a color range from a document.""" + + range: "Range" = attrs.field() + """The range in the document where this color appears.""" + + color: "Color" = attrs.field() + """The actual color value for this color range.""" + + +@attrs.define +class DocumentColorOptions: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DocumentColorRegistrationOptions: + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class ColorPresentationParams: + """Parameters for a {@link ColorPresentationRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + color: "Color" = attrs.field() + """The color to request presentations for.""" + + range: "Range" = attrs.field() + """The range where the color would be inserted. Serves as a context.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class ColorPresentation: + label: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The label of this color presentation. It will be shown on the color + picker header. By default this is also the text that is inserted when selecting + this color presentation.""" + + text_edit: Optional["TextEdit"] = attrs.field(default=None) + """An {@link TextEdit edit} which is applied to a document when selecting + this presentation for the color. When `falsy` the {@link ColorPresentation.label label} + is used.""" + + additional_text_edits: Optional[List["TextEdit"]] = attrs.field(default=None) + """An optional array of additional {@link TextEdit text edits} that are applied when + selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves.""" + + +@attrs.define +class FoldingRangeParams: + """Parameters for a {@link FoldingRangeRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class FoldingRange: + """Represents a folding range. To be valid, start and end line must be bigger than zero and smaller + than the number of lines in the document. Clients are free to ignore invalid ranges. + """ + + start_line: int = attrs.field(validator=validators.uinteger_validator) + """The zero-based start line of the range to fold. The folded area starts after the line's last character. + To be valid, the end must be zero or larger and smaller than the number of lines in the document.""" + + end_line: int = attrs.field(validator=validators.uinteger_validator) + """The zero-based end line of the range to fold. The folded area ends with the line's last character. + To be valid, the end must be zero or larger and smaller than the number of lines in the document.""" + + start_character: Optional[int] = attrs.field( + validator=attrs.validators.optional(validators.uinteger_validator), default=None + ) + """The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.""" + + end_character: Optional[int] = attrs.field( + validator=attrs.validators.optional(validators.uinteger_validator), default=None + ) + """The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.""" + + kind: Optional[Union[FoldingRangeKind, str]] = attrs.field(default=None) + """Describes the kind of the folding range such as `comment' or 'region'. The kind + is used to categorize folding ranges and used by commands like 'Fold all comments'. + See {@link FoldingRangeKind} for an enumeration of standardized kinds.""" + + collapsed_text: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The text that the client should show when the specified range is + collapsed. If not defined or not supported by the client, a default + will be chosen by the client. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class FoldingRangeOptions: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class FoldingRangeRegistrationOptions: + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class DeclarationParams: + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class DeclarationOptions: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DeclarationRegistrationOptions: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class SelectionRangeParams: + """A parameter literal used in selection range requests.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + positions: List["Position"] = attrs.field() + """The positions inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class SelectionRange: + """A selection range represents a part of a selection hierarchy. A selection range + may have a parent selection range that contains it.""" + + range: "Range" = attrs.field() + """The {@link Range range} of this selection range.""" + + parent: Optional["SelectionRange"] = attrs.field(default=None) + """The parent selection range containing this range. Therefore `parent.range` must contain `this.range`.""" + + +@attrs.define +class SelectionRangeOptions: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class SelectionRangeRegistrationOptions: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class WorkDoneProgressCreateParams: + token: ProgressToken = attrs.field() + """The token to be used to report progress.""" + + +@attrs.define +class WorkDoneProgressCancelParams: + token: ProgressToken = attrs.field() + """The token to be used to report progress.""" + + +@attrs.define +class CallHierarchyPrepareParams: + """The parameter of a `textDocument/prepareCallHierarchy` request. + + @since 3.16.0""" + + # Since: 3.16.0 + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class CallHierarchyItem: + """Represents programming constructs like functions or constructors in the context + of call hierarchy. + + @since 3.16.0""" + + # Since: 3.16.0 + + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The name of this item.""" + + kind: SymbolKind = attrs.field() + """The kind of this item.""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The resource identifier of this item.""" + + range: "Range" = attrs.field() + """The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.""" + + selection_range: "Range" = attrs.field() + """The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. + Must be contained by the {@link CallHierarchyItem.range `range`}.""" + + tags: Optional[List[SymbolTag]] = attrs.field(default=None) + """Tags for this item.""" + + detail: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """More detail for this item, e.g. the signature of a function.""" + + data: Optional[LSPAny] = attrs.field(default=None) + """A data entry field that is preserved between a call hierarchy prepare and + incoming calls or outgoing calls requests.""" + + +@attrs.define +class CallHierarchyOptions: + """Call hierarchy options used during static registration. + + @since 3.16.0""" + + # Since: 3.16.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class CallHierarchyRegistrationOptions: + """Call hierarchy options used during static or dynamic registration. + + @since 3.16.0""" + + # Since: 3.16.0 + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class CallHierarchyIncomingCallsParams: + """The parameter of a `callHierarchy/incomingCalls` request. + + @since 3.16.0""" + + # Since: 3.16.0 + + item: CallHierarchyItem = attrs.field() + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class CallHierarchyIncomingCall: + """Represents an incoming call, e.g. a caller of a method or constructor. + + @since 3.16.0""" + + # Since: 3.16.0 + + from_: CallHierarchyItem = attrs.field() + """The item that makes the call.""" + + from_ranges: List["Range"] = attrs.field() + """The ranges at which the calls appear. This is relative to the caller + denoted by {@link CallHierarchyIncomingCall.from `this.from`}.""" + + +@attrs.define +class CallHierarchyOutgoingCallsParams: + """The parameter of a `callHierarchy/outgoingCalls` request. + + @since 3.16.0""" + + # Since: 3.16.0 + + item: CallHierarchyItem = attrs.field() + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class CallHierarchyOutgoingCall: + """Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc. + + @since 3.16.0""" + + # Since: 3.16.0 + + to: CallHierarchyItem = attrs.field() + """The item that is called.""" + + from_ranges: List["Range"] = attrs.field() + """The range at which this item is called. This is the range relative to the caller, e.g the item + passed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls `provideCallHierarchyOutgoingCalls`} + and not {@link CallHierarchyOutgoingCall.to `this.to`}.""" + + +@attrs.define +class SemanticTokensParams: + """@since 3.16.0""" + + # Since: 3.16.0 + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class SemanticTokens: + """@since 3.16.0""" + + # Since: 3.16.0 + + data: List[int] = attrs.field() + """The actual tokens.""" + + result_id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """An optional result id. If provided and clients support delta updating + the client will include the result id in the next semantic token request. + A server can then instead of computing all semantic tokens again simply + send a delta.""" + + +@attrs.define +class SemanticTokensPartialResult: + """@since 3.16.0""" + + # Since: 3.16.0 + + data: List[int] = attrs.field() + + +@attrs.define +class SemanticTokensOptionsFullType1: + delta: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server supports deltas for full documents.""" + + +@attrs.define +class SemanticTokensOptions: + """@since 3.16.0""" + + # Since: 3.16.0 + + legend: "SemanticTokensLegend" = attrs.field() + """The legend used by the server""" + + range: Optional[Union[bool, Any]] = attrs.field(default=None) + """Server supports providing semantic tokens for a specific range + of a document.""" + + full: Optional[Union[bool, "SemanticTokensOptionsFullType1"]] = attrs.field( + default=None + ) + """Server supports providing semantic tokens for a full document.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class SemanticTokensRegistrationOptionsFullType1: + delta: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server supports deltas for full documents.""" + + +@attrs.define +class SemanticTokensRegistrationOptions: + """@since 3.16.0""" + + # Since: 3.16.0 + + legend: "SemanticTokensLegend" = attrs.field() + """The legend used by the server""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + range: Optional[Union[bool, Any]] = attrs.field(default=None) + """Server supports providing semantic tokens for a specific range + of a document.""" + + full: Optional[ + Union[bool, "SemanticTokensRegistrationOptionsFullType1"] + ] = attrs.field(default=None) + """Server supports providing semantic tokens for a full document.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class SemanticTokensDeltaParams: + """@since 3.16.0""" + + # Since: 3.16.0 + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + previous_result_id: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The result id of a previous response. The result Id can either point to a full response + or a delta response depending on what was received last.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class SemanticTokensDelta: + """@since 3.16.0""" + + # Since: 3.16.0 + + edits: List["SemanticTokensEdit"] = attrs.field() + """The semantic token edits to transform a previous result into a new result.""" + + result_id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + +@attrs.define +class SemanticTokensDeltaPartialResult: + """@since 3.16.0""" + + # Since: 3.16.0 + + edits: List["SemanticTokensEdit"] = attrs.field() + + +@attrs.define +class SemanticTokensRangeParams: + """@since 3.16.0""" + + # Since: 3.16.0 + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + range: "Range" = attrs.field() + """The range the semantic tokens are requested for.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class ShowDocumentParams: + """Params to show a resource in the UI. + + @since 3.16.0""" + + # Since: 3.16.0 + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The uri to show.""" + + external: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Indicates to show the resource in an external program. + To show, for example, `https://code.visualstudio.com/` + in the default WEB browser set `external` to `true`.""" + + take_focus: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """An optional property to indicate whether the editor + showing the document should take focus or not. + Clients might ignore this property if an external + program is started.""" + + selection: Optional["Range"] = attrs.field(default=None) + """An optional selection range if the document is a text + document. Clients might ignore the property if an + external program is started or the file is not a text + file.""" + + +@attrs.define +class ShowDocumentResult: + """The result of a showDocument request. + + @since 3.16.0""" + + # Since: 3.16.0 + + success: bool = attrs.field(validator=attrs.validators.instance_of(bool)) + """A boolean indicating if the show was successful.""" + + +@attrs.define +class LinkedEditingRangeParams: + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class LinkedEditingRanges: + """The result of a linked editing range request. + + @since 3.16.0""" + + # Since: 3.16.0 + + ranges: List["Range"] = attrs.field() + """A list of ranges that can be edited together. The ranges must have + identical length and contain identical text content. The ranges cannot overlap.""" + + word_pattern: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """An optional word pattern (regular expression) that describes valid contents for + the given ranges. If no pattern is provided, the client configuration's word + pattern will be used.""" + + +@attrs.define +class LinkedEditingRangeOptions: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class LinkedEditingRangeRegistrationOptions: + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class CreateFilesParams: + """The parameters sent in notifications/requests for user-initiated creation of + files. + + @since 3.16.0""" + + # Since: 3.16.0 + + files: List["FileCreate"] = attrs.field() + """An array of all files/folders created in this operation.""" + + +@attrs.define +class WorkspaceEdit: + """A workspace edit represents changes to many resources managed in the workspace. The edit + should either provide `changes` or `documentChanges`. If documentChanges are present + they are preferred over `changes` if the client can handle versioned document edits. + + Since version 3.13.0 a workspace edit can contain resource operations as well. If resource + operations are present clients need to execute the operations in the order in which they + are provided. So a workspace edit for example can consist of the following two changes: + (1) a create file a.txt and (2) a text document edit which insert text into file a.txt. + + An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will + cause failure of the operation. How the client recovers from the failure is described by + the client capability: `workspace.workspaceEdit.failureHandling`""" + + changes: Optional[Dict[str, List["TextEdit"]]] = attrs.field(default=None) + """Holds changes to existing resources.""" + + document_changes: Optional[ + List[Union["TextDocumentEdit", "CreateFile", "RenameFile", "DeleteFile"]] + ] = attrs.field(default=None) + """Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes + are either an array of `TextDocumentEdit`s to express changes to n different text documents + where each text document edit addresses a specific version of a text document. Or it can contain + above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations. + + Whether a client supports versioned document edits is expressed via + `workspace.workspaceEdit.documentChanges` client capability. + + If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then + only plain `TextEdit`s using the `changes` property are supported.""" + + change_annotations: Optional[ + Dict[ChangeAnnotationIdentifier, "ChangeAnnotation"] + ] = attrs.field(default=None) + """A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and + delete file / folder operations. + + Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class FileOperationRegistrationOptions: + """The options to register for file operations. + + @since 3.16.0""" + + # Since: 3.16.0 + + filters: List["FileOperationFilter"] = attrs.field() + """The actual filters.""" + + +@attrs.define +class RenameFilesParams: + """The parameters sent in notifications/requests for user-initiated renames of + files. + + @since 3.16.0""" + + # Since: 3.16.0 + + files: List["FileRename"] = attrs.field() + """An array of all files/folders renamed in this operation. When a folder is renamed, only + the folder will be included, and not its children.""" + + +@attrs.define +class DeleteFilesParams: + """The parameters sent in notifications/requests for user-initiated deletes of + files. + + @since 3.16.0""" + + # Since: 3.16.0 + + files: List["FileDelete"] = attrs.field() + """An array of all files/folders deleted in this operation.""" + + +@attrs.define +class MonikerParams: + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class Moniker: + """Moniker definition to match LSIF 0.5 moniker definition. + + @since 3.16.0""" + + # Since: 3.16.0 + + scheme: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The scheme of the moniker. For example tsc or .Net""" + + identifier: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The identifier of the moniker. The value is opaque in LSIF however + schema owners are allowed to define the structure if they want.""" + + unique: UniquenessLevel = attrs.field() + """The scope in which the moniker is unique""" + + kind: Optional[MonikerKind] = attrs.field(default=None) + """The moniker kind if known.""" + + +@attrs.define +class MonikerOptions: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class MonikerRegistrationOptions: + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class TypeHierarchyPrepareParams: + """The parameter of a `textDocument/prepareTypeHierarchy` request. + + @since 3.17.0""" + + # Since: 3.17.0 + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class TypeHierarchyItem: + """@since 3.17.0""" + + # Since: 3.17.0 + + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The name of this item.""" + + kind: SymbolKind = attrs.field() + """The kind of this item.""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The resource identifier of this item.""" + + range: "Range" = attrs.field() + """The range enclosing this symbol not including leading/trailing whitespace + but everything else, e.g. comments and code.""" + + selection_range: "Range" = attrs.field() + """The range that should be selected and revealed when this symbol is being + picked, e.g. the name of a function. Must be contained by the + {@link TypeHierarchyItem.range `range`}.""" + + tags: Optional[List[SymbolTag]] = attrs.field(default=None) + """Tags for this item.""" + + detail: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """More detail for this item, e.g. the signature of a function.""" + + data: Optional[LSPAny] = attrs.field(default=None) + """A data entry field that is preserved between a type hierarchy prepare and + supertypes or subtypes requests. It could also be used to identify the + type hierarchy in the server, helping improve the performance on + resolving supertypes and subtypes.""" + + +@attrs.define +class TypeHierarchyOptions: + """Type hierarchy options used during static registration. + + @since 3.17.0""" + + # Since: 3.17.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class TypeHierarchyRegistrationOptions: + """Type hierarchy options used during static or dynamic registration. + + @since 3.17.0""" + + # Since: 3.17.0 + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class TypeHierarchySupertypesParams: + """The parameter of a `typeHierarchy/supertypes` request. + + @since 3.17.0""" + + # Since: 3.17.0 + + item: TypeHierarchyItem = attrs.field() + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class TypeHierarchySubtypesParams: + """The parameter of a `typeHierarchy/subtypes` request. + + @since 3.17.0""" + + # Since: 3.17.0 + + item: TypeHierarchyItem = attrs.field() + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class InlineValueParams: + """A parameter literal used in inline value requests. + + @since 3.17.0""" + + # Since: 3.17.0 + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + range: "Range" = attrs.field() + """The document range for which inline values should be computed.""" + + context: "InlineValueContext" = attrs.field() + """Additional information about the context in which inline values were + requested.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class InlineValueOptions: + """Inline value options used during static registration. + + @since 3.17.0""" + + # Since: 3.17.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class InlineValueRegistrationOptions: + """Inline value options used during static or dynamic registration. + + @since 3.17.0""" + + # Since: 3.17.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class InlayHintParams: + """A parameter literal used in inlay hint requests. + + @since 3.17.0""" + + # Since: 3.17.0 + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + range: "Range" = attrs.field() + """The document range for which inlay hints should be computed.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class InlayHint: + """Inlay hint information. + + @since 3.17.0""" + + # Since: 3.17.0 + + position: "Position" = attrs.field() + """The position of this hint.""" + + label: Union[str, List["InlayHintLabelPart"]] = attrs.field() + """The label of this hint. A human readable string or an array of + InlayHintLabelPart label parts. + + *Note* that neither the string nor the label part can be empty.""" + + kind: Optional[InlayHintKind] = attrs.field(default=None) + """The kind of this hint. Can be omitted in which case the client + should fall back to a reasonable default.""" + + text_edits: Optional[List["TextEdit"]] = attrs.field(default=None) + """Optional text edits that are performed when accepting this inlay hint. + + *Note* that edits are expected to change the document so that the inlay + hint (or its nearest variant) is now part of the document and the inlay + hint itself is now obsolete.""" + + tooltip: Optional[Union[str, "MarkupContent"]] = attrs.field(default=None) + """The tooltip text when you hover over this item.""" + + padding_left: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Render padding before the hint. + + Note: Padding should use the editor's background color, not the + background color of the hint itself. That means padding can be used + to visually align/separate an inlay hint.""" + + padding_right: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Render padding after the hint. + + Note: Padding should use the editor's background color, not the + background color of the hint itself. That means padding can be used + to visually align/separate an inlay hint.""" + + data: Optional[LSPAny] = attrs.field(default=None) + """A data entry field that is preserved on an inlay hint between + a `textDocument/inlayHint` and a `inlayHint/resolve` request.""" + + +@attrs.define +class InlayHintOptions: + """Inlay hint options used during static registration. + + @since 3.17.0""" + + # Since: 3.17.0 + + resolve_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server provides support to resolve additional + information for an inlay hint item.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class InlayHintRegistrationOptions: + """Inlay hint options used during static or dynamic registration. + + @since 3.17.0""" + + # Since: 3.17.0 + + resolve_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server provides support to resolve additional + information for an inlay hint item.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class DocumentDiagnosticParams: + """Parameters of the document diagnostic request. + + @since 3.17.0""" + + # Since: 3.17.0 + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + identifier: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The additional identifier provided during registration.""" + + previous_result_id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The result id of a previous response if provided.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class DocumentDiagnosticReportPartialResult: + """A partial result for a document diagnostic report. + + @since 3.17.0""" + + # Since: 3.17.0 + + related_documents: Dict[ + str, Union["FullDocumentDiagnosticReport", "UnchangedDocumentDiagnosticReport"] + ] = attrs.field() + + +@attrs.define +class DiagnosticServerCancellationData: + """Cancellation data returned from a diagnostic request. + + @since 3.17.0""" + + # Since: 3.17.0 + + retrigger_request: bool = attrs.field(validator=attrs.validators.instance_of(bool)) + + +@attrs.define +class DiagnosticOptions: + """Diagnostic options. + + @since 3.17.0""" + + # Since: 3.17.0 + + inter_file_dependencies: bool = attrs.field( + validator=attrs.validators.instance_of(bool) + ) + """Whether the language has inter file dependencies meaning that + editing code in one file can result in a different diagnostic + set in another file. Inter file dependencies are common for + most programming languages and typically uncommon for linters.""" + + workspace_diagnostics: bool = attrs.field( + validator=attrs.validators.instance_of(bool) + ) + """The server provides support for workspace diagnostics as well.""" + + identifier: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """An optional identifier under which the diagnostics are + managed by the client.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DiagnosticRegistrationOptions: + """Diagnostic registration options. + + @since 3.17.0""" + + # Since: 3.17.0 + + inter_file_dependencies: bool = attrs.field( + validator=attrs.validators.instance_of(bool) + ) + """Whether the language has inter file dependencies meaning that + editing code in one file can result in a different diagnostic + set in another file. Inter file dependencies are common for + most programming languages and typically uncommon for linters.""" + + workspace_diagnostics: bool = attrs.field( + validator=attrs.validators.instance_of(bool) + ) + """The server provides support for workspace diagnostics as well.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + identifier: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """An optional identifier under which the diagnostics are + managed by the client.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class WorkspaceDiagnosticParams: + """Parameters of the workspace diagnostic request. + + @since 3.17.0""" + + # Since: 3.17.0 + + previous_result_ids: List["PreviousResultId"] = attrs.field() + """The currently known diagnostic reports with their + previous result ids.""" + + identifier: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The additional identifier provided during registration.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class WorkspaceDiagnosticReport: + """A workspace diagnostic report. + + @since 3.17.0""" + + # Since: 3.17.0 + + items: List[WorkspaceDocumentDiagnosticReport] = attrs.field() + + +@attrs.define +class WorkspaceDiagnosticReportPartialResult: + """A partial result for a workspace diagnostic report. + + @since 3.17.0""" + + # Since: 3.17.0 + + items: List[WorkspaceDocumentDiagnosticReport] = attrs.field() + + +@attrs.define +class DidOpenNotebookDocumentParams: + """The params sent in an open notebook document notification. + + @since 3.17.0""" + + # Since: 3.17.0 + + notebook_document: "NotebookDocument" = attrs.field() + """The notebook document that got opened.""" + + cell_text_documents: List["TextDocumentItem"] = attrs.field() + """The text documents that represent the content + of a notebook cell.""" + + +@attrs.define +class DidChangeNotebookDocumentParams: + """The params sent in a change notebook document notification. + + @since 3.17.0""" + + # Since: 3.17.0 + + notebook_document: "VersionedNotebookDocumentIdentifier" = attrs.field() + """The notebook document that did change. The version number points + to the version after all provided changes have been applied. If + only the text document content of a cell changes the notebook version + doesn't necessarily have to change.""" + + change: "NotebookDocumentChangeEvent" = attrs.field() + """The actual changes to the notebook document. + + The changes describe single state changes to the notebook document. + So if there are two changes c1 (at array index 0) and c2 (at array + index 1) for a notebook in state S then c1 moves the notebook from + S to S' and c2 from S' to S''. So c1 is computed on the state S and + c2 is computed on the state S'. + + To mirror the content of a notebook using change events use the following approach: + - start with the same initial content + - apply the 'notebookDocument/didChange' notifications in the order you receive them. + - apply the `NotebookChangeEvent`s in a single notification in the order + you receive them.""" + + +@attrs.define +class DidSaveNotebookDocumentParams: + """The params sent in a save notebook document notification. + + @since 3.17.0""" + + # Since: 3.17.0 + + notebook_document: "NotebookDocumentIdentifier" = attrs.field() + """The notebook document that got saved.""" + + +@attrs.define +class DidCloseNotebookDocumentParams: + """The params sent in a close notebook document notification. + + @since 3.17.0""" + + # Since: 3.17.0 + + notebook_document: "NotebookDocumentIdentifier" = attrs.field() + """The notebook document that got closed.""" + + cell_text_documents: List["TextDocumentIdentifier"] = attrs.field() + """The text documents that represent the content + of a notebook cell that got closed.""" + + +@attrs.define +class InlineCompletionParams: + """A parameter literal used in inline completion requests. + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + + context: "InlineCompletionContext" = attrs.field() + """Additional information about the context in which inline completions were + requested.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class InlineCompletionList: + """Represents a collection of {@link InlineCompletionItem inline completion items} to be presented in the editor. + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + + items: List["InlineCompletionItem"] = attrs.field() + """The inline completion items""" + + +@attrs.define +class InlineCompletionItem: + """An inline completion item represents a text snippet that is proposed inline to complete text that is being typed. + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + + insert_text: Union[str, "StringValue"] = attrs.field() + """The text to replace the range with. Must be set.""" + + filter_text: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A text that is used to decide if this inline completion should be shown. When `falsy` the {@link InlineCompletionItem.insertText} is used.""" + + range: Optional["Range"] = attrs.field(default=None) + """The range to replace. Must begin and end on the same line.""" + + command: Optional["Command"] = attrs.field(default=None) + """An optional {@link Command} that is executed *after* inserting this completion.""" + + +@attrs.define +class InlineCompletionOptions: + """Inline completion options used during static registration. + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class InlineCompletionRegistrationOptions: + """Inline completion options used during static or dynamic registration. + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class RegistrationParams: + registrations: List["Registration"] = attrs.field() + + +@attrs.define +class UnregistrationParams: + unregisterations: List["Unregistration"] = attrs.field() + + +@attrs.define +class InitializeParamsClientInfoType: + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The name of the client as defined by the client.""" + + version: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The client's version as defined by the client.""" + + +@attrs.define +class _InitializeParams: + """The initialize parameters""" + + capabilities: "ClientCapabilities" = attrs.field() + """The capabilities provided by the client (editor or tool)""" + + process_id: Optional[Union[int, None]] = attrs.field(default=None) + """The process Id of the parent process that started + the server. + + Is `null` if the process has not been started by another process. + If the parent process is not alive then the server should exit.""" + + client_info: Optional["InitializeParamsClientInfoType"] = attrs.field(default=None) + """Information about the client + + @since 3.15.0""" + # Since: 3.15.0 + + locale: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The locale the client is currently showing the user interface + in. This must not necessarily be the locale of the operating + system. + + Uses IETF language tags as the value's syntax + (See https://en.wikipedia.org/wiki/IETF_language_tag) + + @since 3.16.0""" + # Since: 3.16.0 + + root_path: Optional[Union[str, None]] = attrs.field(default=None) + """The rootPath of the workspace. Is null + if no folder is open. + + @deprecated in favour of rootUri.""" + + root_uri: Optional[Union[str, None]] = attrs.field(default=None) + """The rootUri of the workspace. Is null if no + folder is open. If both `rootPath` and `rootUri` are set + `rootUri` wins. + + @deprecated in favour of workspaceFolders.""" + + initialization_options: Optional[LSPAny] = attrs.field(default=None) + """User provided initialization options.""" + + trace: Optional[TraceValues] = attrs.field(default=None) + """The initial trace setting. If omitted trace is disabled ('off').""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class WorkspaceFoldersInitializeParams: + workspace_folders: Optional[Union[List[WorkspaceFolder], None]] = attrs.field( + default=None + ) + """The workspace folders configured in the client when the server starts. + + This property is only available if the client supports workspace folders. + It can be `null` if the client supports workspace folders but none are + configured. + + @since 3.6.0""" + # Since: 3.6.0 + + +@attrs.define +class InitializeParams: + capabilities: "ClientCapabilities" = attrs.field() + """The capabilities provided by the client (editor or tool)""" + + process_id: Optional[Union[int, None]] = attrs.field(default=None) + """The process Id of the parent process that started + the server. + + Is `null` if the process has not been started by another process. + If the parent process is not alive then the server should exit.""" + + client_info: Optional["InitializeParamsClientInfoType"] = attrs.field(default=None) + """Information about the client + + @since 3.15.0""" + # Since: 3.15.0 + + locale: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The locale the client is currently showing the user interface + in. This must not necessarily be the locale of the operating + system. + + Uses IETF language tags as the value's syntax + (See https://en.wikipedia.org/wiki/IETF_language_tag) + + @since 3.16.0""" + # Since: 3.16.0 + + root_path: Optional[Union[str, None]] = attrs.field(default=None) + """The rootPath of the workspace. Is null + if no folder is open. + + @deprecated in favour of rootUri.""" + + root_uri: Optional[Union[str, None]] = attrs.field(default=None) + """The rootUri of the workspace. Is null if no + folder is open. If both `rootPath` and `rootUri` are set + `rootUri` wins. + + @deprecated in favour of workspaceFolders.""" + + initialization_options: Optional[LSPAny] = attrs.field(default=None) + """User provided initialization options.""" + + trace: Optional[TraceValues] = attrs.field(default=None) + """The initial trace setting. If omitted trace is disabled ('off').""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + workspace_folders: Optional[Union[List[WorkspaceFolder], None]] = attrs.field( + default=None + ) + """The workspace folders configured in the client when the server starts. + + This property is only available if the client supports workspace folders. + It can be `null` if the client supports workspace folders but none are + configured. + + @since 3.6.0""" + # Since: 3.6.0 + + +@attrs.define +class InitializeResultServerInfoType: + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The name of the server as defined by the server.""" + + version: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The server's version as defined by the server.""" + + +@attrs.define +class InitializeResult: + """The result returned from an initialize request.""" + + capabilities: "ServerCapabilities" = attrs.field() + """The capabilities the language server provides.""" + + server_info: Optional["InitializeResultServerInfoType"] = attrs.field(default=None) + """Information about the server. + + @since 3.15.0""" + # Since: 3.15.0 + + +@attrs.define +class InitializeError: + """The data type of the ResponseError if the + initialize request fails.""" + + retry: bool = attrs.field(validator=attrs.validators.instance_of(bool)) + """Indicates whether the client execute the following retry logic: + (1) show the message provided by the ResponseError to the user + (2) user selects retry or cancel + (3) if user selected retry the initialize method is sent again.""" + + +@attrs.define +class InitializedParams: + pass + + +@attrs.define +class DidChangeConfigurationParams: + """The parameters of a change configuration notification.""" + + settings: LSPAny = attrs.field() + """The actual changed settings""" + + +@attrs.define +class DidChangeConfigurationRegistrationOptions: + section: Optional[Union[str, List[str]]] = attrs.field(default=None) + + +@attrs.define +class ShowMessageParams: + """The parameters of a notification message.""" + + type: MessageType = attrs.field() + """The message type. See {@link MessageType}""" + + message: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The actual message.""" + + +@attrs.define +class ShowMessageRequestParams: + type: MessageType = attrs.field() + """The message type. See {@link MessageType}""" + + message: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The actual message.""" + + actions: Optional[List["MessageActionItem"]] = attrs.field(default=None) + """The message action items to present.""" + + +@attrs.define +class MessageActionItem: + title: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A short title like 'Retry', 'Open Log' etc.""" + + +@attrs.define +class LogMessageParams: + """The log message parameters.""" + + type: MessageType = attrs.field() + """The message type. See {@link MessageType}""" + + message: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The actual message.""" + + +@attrs.define +class DidOpenTextDocumentParams: + """The parameters sent in an open text document notification""" + + text_document: "TextDocumentItem" = attrs.field() + """The document that was opened.""" + + +@attrs.define +class DidChangeTextDocumentParams: + """The change text document notification's parameters.""" + + text_document: "VersionedTextDocumentIdentifier" = attrs.field() + """The document that did change. The version number points + to the version after all provided content changes have + been applied.""" + + content_changes: List[TextDocumentContentChangeEvent] = attrs.field() + """The actual content changes. The content changes describe single state changes + to the document. So if there are two content changes c1 (at array index 0) and + c2 (at array index 1) for a document in state S then c1 moves the document from + S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed + on the state S'. + + To mirror the content of a document using change events use the following approach: + - start with the same initial content + - apply the 'textDocument/didChange' notifications in the order you receive them. + - apply the `TextDocumentContentChangeEvent`s in a single notification in the order + you receive them.""" + + +@attrs.define +class TextDocumentChangeRegistrationOptions: + """Describe options to be used when registered for text document change events.""" + + sync_kind: TextDocumentSyncKind = attrs.field() + """How documents are synced to the server.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + +@attrs.define +class DidCloseTextDocumentParams: + """The parameters sent in a close text document notification""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The document that was closed.""" + + +@attrs.define +class DidSaveTextDocumentParams: + """The parameters sent in a save text document notification""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The document that was saved.""" + + text: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """Optional the content when saved. Depends on the includeText value + when the save notification was requested.""" + + +@attrs.define +class SaveOptions: + """Save options.""" + + include_text: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client is supposed to include the content on save.""" + + +@attrs.define +class TextDocumentSaveRegistrationOptions: + """Save registration options.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + include_text: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client is supposed to include the content on save.""" + + +@attrs.define +class WillSaveTextDocumentParams: + """The parameters sent in a will save text document notification.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The document that will be saved.""" + + reason: TextDocumentSaveReason = attrs.field() + """The 'TextDocumentSaveReason'.""" + + +@attrs.define +class TextEdit: + """A text edit applicable to a text document.""" + + range: "Range" = attrs.field() + """The range of the text document to be manipulated. To insert + text into a document create a range where start === end.""" + + new_text: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The string to be inserted. For delete operations use an + empty string.""" + + +@attrs.define +class DidChangeWatchedFilesParams: + """The watched files change notification's parameters.""" + + changes: List["FileEvent"] = attrs.field() + """The actual file events.""" + + +@attrs.define +class DidChangeWatchedFilesRegistrationOptions: + """Describe options to be used when registered for text document change events.""" + + watchers: List["FileSystemWatcher"] = attrs.field() + """The watchers to register.""" + + +@attrs.define +class PublishDiagnosticsParams: + """The publish diagnostic notification's parameters.""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The URI for which diagnostic information is reported.""" + + diagnostics: List["Diagnostic"] = attrs.field() + """An array of diagnostic information items.""" + + version: Optional[int] = attrs.field( + validator=attrs.validators.optional(validators.integer_validator), default=None + ) + """Optional the version number of the document the diagnostics are published for. + + @since 3.15.0""" + # Since: 3.15.0 + + +@attrs.define +class CompletionParams: + """Completion parameters""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + context: Optional["CompletionContext"] = attrs.field(default=None) + """The completion context. This is only available it the client specifies + to send this using the client capability `textDocument.completion.contextSupport === true`""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class CompletionItem: + """A completion item represents a text snippet that is + proposed to complete text that is being typed.""" + + label: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The label of this completion item. + + The label property is also by default the text that + is inserted when selecting this completion. + + If label details are provided the label itself should + be an unqualified name of the completion item.""" + + label_details: Optional["CompletionItemLabelDetails"] = attrs.field(default=None) + """Additional details for the label + + @since 3.17.0""" + # Since: 3.17.0 + + kind: Optional[CompletionItemKind] = attrs.field(default=None) + """The kind of this completion item. Based of the kind + an icon is chosen by the editor.""" + + tags: Optional[List[CompletionItemTag]] = attrs.field(default=None) + """Tags for this completion item. + + @since 3.15.0""" + # Since: 3.15.0 + + detail: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A human-readable string with additional information + about this item, like type or symbol information.""" + + documentation: Optional[Union[str, "MarkupContent"]] = attrs.field(default=None) + """A human-readable string that represents a doc-comment.""" + + deprecated: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Indicates if this item is deprecated. + @deprecated Use `tags` instead.""" + + preselect: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Select this item when showing. + + *Note* that only one completion item can be selected and that the + tool / client decides which item that is. The rule is that the *first* + item of those that match best is selected.""" + + sort_text: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A string that should be used when comparing this item + with other items. When `falsy` the {@link CompletionItem.label label} + is used.""" + + filter_text: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A string that should be used when filtering a set of + completion items. When `falsy` the {@link CompletionItem.label label} + is used.""" + + insert_text: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A string that should be inserted into a document when selecting + this completion. When `falsy` the {@link CompletionItem.label label} + is used. + + The `insertText` is subject to interpretation by the client side. + Some tools might not take the string literally. For example + VS Code when code complete is requested in this example + `con<cursor position>` and a completion item with an `insertText` of + `console` is provided it will only insert `sole`. Therefore it is + recommended to use `textEdit` instead since it avoids additional client + side interpretation.""" + + insert_text_format: Optional[InsertTextFormat] = attrs.field(default=None) + """The format of the insert text. The format applies to both the + `insertText` property and the `newText` property of a provided + `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`. + + Please note that the insertTextFormat doesn't apply to + `additionalTextEdits`.""" + + insert_text_mode: Optional[InsertTextMode] = attrs.field(default=None) + """How whitespace and indentation is handled during completion + item insertion. If not provided the clients default value depends on + the `textDocument.completion.insertTextMode` client capability. + + @since 3.16.0""" + # Since: 3.16.0 + + text_edit: Optional[Union[TextEdit, "InsertReplaceEdit"]] = attrs.field( + default=None + ) + """An {@link TextEdit edit} which is applied to a document when selecting + this completion. When an edit is provided the value of + {@link CompletionItem.insertText insertText} is ignored. + + Most editors support two different operations when accepting a completion + item. One is to insert a completion text and the other is to replace an + existing text with a completion text. Since this can usually not be + predetermined by a server it can report both ranges. Clients need to + signal support for `InsertReplaceEdits` via the + `textDocument.completion.insertReplaceSupport` client capability + property. + + *Note 1:* The text edit's range as well as both ranges from an insert + replace edit must be a [single line] and they must contain the position + at which completion has been requested. + *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range + must be a prefix of the edit's replace range, that means it must be + contained and starting at the same position. + + @since 3.16.0 additional type `InsertReplaceEdit`""" + # Since: 3.16.0 additional type `InsertReplaceEdit` + + text_edit_text: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The edit text used if the completion item is part of a CompletionList and + CompletionList defines an item default for the text edit range. + + Clients will only honor this property if they opt into completion list + item defaults using the capability `completionList.itemDefaults`. + + If not provided and a list's default range is provided the label + property is used as a text. + + @since 3.17.0""" + # Since: 3.17.0 + + additional_text_edits: Optional[List[TextEdit]] = attrs.field(default=None) + """An optional array of additional {@link TextEdit text edits} that are applied when + selecting this completion. Edits must not overlap (including the same insert position) + with the main {@link CompletionItem.textEdit edit} nor with themselves. + + Additional text edits should be used to change text unrelated to the current cursor position + (for example adding an import statement at the top of the file if the completion item will + insert an unqualified type).""" + + commit_characters: Optional[List[str]] = attrs.field(default=None) + """An optional set of characters that when pressed while this completion is active will accept it first and + then type that character. *Note* that all commit characters should have `length=1` and that superfluous + characters will be ignored.""" + + command: Optional["Command"] = attrs.field(default=None) + """An optional {@link Command command} that is executed *after* inserting this completion. *Note* that + additional modifications to the current document should be described with the + {@link CompletionItem.additionalTextEdits additionalTextEdits}-property.""" + + data: Optional[LSPAny] = attrs.field(default=None) + """A data entry field that is preserved on a completion item between a + {@link CompletionRequest} and a {@link CompletionResolveRequest}.""" + + +@attrs.define +class CompletionListItemDefaultsTypeEditRangeType1: + insert: "Range" = attrs.field() + + replace: "Range" = attrs.field() + + +@attrs.define +class CompletionListItemDefaultsType: + commit_characters: Optional[List[str]] = attrs.field(default=None) + """A default commit character set. + + @since 3.17.0""" + # Since: 3.17.0 + + edit_range: Optional[ + Union["Range", "CompletionListItemDefaultsTypeEditRangeType1"] + ] = attrs.field(default=None) + """A default edit range. + + @since 3.17.0""" + # Since: 3.17.0 + + insert_text_format: Optional[InsertTextFormat] = attrs.field(default=None) + """A default insert text format. + + @since 3.17.0""" + # Since: 3.17.0 + + insert_text_mode: Optional[InsertTextMode] = attrs.field(default=None) + """A default insert text mode. + + @since 3.17.0""" + # Since: 3.17.0 + + data: Optional[LSPAny] = attrs.field(default=None) + """A default data value. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class CompletionList: + """Represents a collection of {@link CompletionItem completion items} to be presented + in the editor.""" + + is_incomplete: bool = attrs.field(validator=attrs.validators.instance_of(bool)) + """This list it not complete. Further typing results in recomputing this list. + + Recomputed lists have all their items replaced (not appended) in the + incomplete completion sessions.""" + + items: List[CompletionItem] = attrs.field() + """The completion items.""" + + item_defaults: Optional["CompletionListItemDefaultsType"] = attrs.field( + default=None + ) + """In many cases the items of an actual completion result share the same + value for properties like `commitCharacters` or the range of a text + edit. A completion list can therefore define item defaults which will + be used if a completion item itself doesn't specify the value. + + If a completion list specifies a default value and a completion item + also specifies a corresponding value the one from the item is used. + + Servers are only allowed to return default values if the client + signals support for this via the `completionList.itemDefaults` + capability. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class CompletionOptionsCompletionItemType: + label_details_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server has support for completion item label + details (see also `CompletionItemLabelDetails`) when + receiving a completion item in a resolve call. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class CompletionOptions: + """Completion options.""" + + trigger_characters: Optional[List[str]] = attrs.field(default=None) + """Most tools trigger completion request automatically without explicitly requesting + it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + starts to type an identifier. For example if the user types `c` in a JavaScript file + code complete will automatically pop up present `console` besides others as a + completion item. Characters that make up identifiers don't need to be listed here. + + If code complete should automatically be trigger on characters not being valid inside + an identifier (for example `.` in JavaScript) list them in `triggerCharacters`.""" + + all_commit_characters: Optional[List[str]] = attrs.field(default=None) + """The list of all possible characters that commit a completion. This field can be used + if clients don't support individual commit characters per completion item. See + `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` + + If a server provides both `allCommitCharacters` and commit characters on an individual + completion item the ones on the completion item win. + + @since 3.2.0""" + # Since: 3.2.0 + + resolve_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server provides support to resolve additional + information for a completion item.""" + + completion_item: Optional["CompletionOptionsCompletionItemType"] = attrs.field( + default=None + ) + """The server supports the following `CompletionItem` specific + capabilities. + + @since 3.17.0""" + # Since: 3.17.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class CompletionRegistrationOptionsCompletionItemType: + label_details_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server has support for completion item label + details (see also `CompletionItemLabelDetails`) when + receiving a completion item in a resolve call. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class CompletionRegistrationOptions: + """Registration options for a {@link CompletionRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + trigger_characters: Optional[List[str]] = attrs.field(default=None) + """Most tools trigger completion request automatically without explicitly requesting + it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + starts to type an identifier. For example if the user types `c` in a JavaScript file + code complete will automatically pop up present `console` besides others as a + completion item. Characters that make up identifiers don't need to be listed here. + + If code complete should automatically be trigger on characters not being valid inside + an identifier (for example `.` in JavaScript) list them in `triggerCharacters`.""" + + all_commit_characters: Optional[List[str]] = attrs.field(default=None) + """The list of all possible characters that commit a completion. This field can be used + if clients don't support individual commit characters per completion item. See + `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` + + If a server provides both `allCommitCharacters` and commit characters on an individual + completion item the ones on the completion item win. + + @since 3.2.0""" + # Since: 3.2.0 + + resolve_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server provides support to resolve additional + information for a completion item.""" + + completion_item: Optional[ + "CompletionRegistrationOptionsCompletionItemType" + ] = attrs.field(default=None) + """The server supports the following `CompletionItem` specific + capabilities. + + @since 3.17.0""" + # Since: 3.17.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class HoverParams: + """Parameters for a {@link HoverRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class Hover: + """The result of a hover request.""" + + contents: Union["MarkupContent", MarkedString, List[MarkedString]] = attrs.field() + """The hover's content""" + + range: Optional["Range"] = attrs.field(default=None) + """An optional range inside the text document that is used to + visualize the hover, e.g. by changing the background color.""" + + +@attrs.define +class HoverOptions: + """Hover options.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class HoverRegistrationOptions: + """Registration options for a {@link HoverRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class SignatureHelpParams: + """Parameters for a {@link SignatureHelpRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + context: Optional["SignatureHelpContext"] = attrs.field(default=None) + """The signature help context. This is only available if the client specifies + to send this using the client capability `textDocument.signatureHelp.contextSupport === true` + + @since 3.15.0""" + # Since: 3.15.0 + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class SignatureHelp: + """Signature help represents the signature of something + callable. There can be multiple signature but only one + active and only one active parameter.""" + + signatures: List["SignatureInformation"] = attrs.field() + """One or more signatures.""" + + active_signature: Optional[int] = attrs.field( + validator=attrs.validators.optional(validators.uinteger_validator), default=None + ) + """The active signature. If omitted or the value lies outside the + range of `signatures` the value defaults to zero or is ignored if + the `SignatureHelp` has no signatures. + + Whenever possible implementors should make an active decision about + the active signature and shouldn't rely on a default value. + + In future version of the protocol this property might become + mandatory to better express this.""" + + active_parameter: Optional[int] = attrs.field( + validator=attrs.validators.optional(validators.uinteger_validator), default=None + ) + """The active parameter of the active signature. If omitted or the value + lies outside the range of `signatures[activeSignature].parameters` + defaults to 0 if the active signature has parameters. If + the active signature has no parameters it is ignored. + In future version of the protocol this property might become + mandatory to better express the active parameter if the + active signature does have any.""" + + +@attrs.define +class SignatureHelpOptions: + """Server Capabilities for a {@link SignatureHelpRequest}.""" + + trigger_characters: Optional[List[str]] = attrs.field(default=None) + """List of characters that trigger signature help automatically.""" + + retrigger_characters: Optional[List[str]] = attrs.field(default=None) + """List of characters that re-trigger signature help. + + These trigger characters are only active when signature help is already showing. All trigger characters + are also counted as re-trigger characters. + + @since 3.15.0""" + # Since: 3.15.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class SignatureHelpRegistrationOptions: + """Registration options for a {@link SignatureHelpRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + trigger_characters: Optional[List[str]] = attrs.field(default=None) + """List of characters that trigger signature help automatically.""" + + retrigger_characters: Optional[List[str]] = attrs.field(default=None) + """List of characters that re-trigger signature help. + + These trigger characters are only active when signature help is already showing. All trigger characters + are also counted as re-trigger characters. + + @since 3.15.0""" + # Since: 3.15.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DefinitionParams: + """Parameters for a {@link DefinitionRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class DefinitionOptions: + """Server Capabilities for a {@link DefinitionRequest}.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DefinitionRegistrationOptions: + """Registration options for a {@link DefinitionRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class ReferenceParams: + """Parameters for a {@link ReferencesRequest}.""" + + context: "ReferenceContext" = attrs.field() + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class ReferenceOptions: + """Reference options.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class ReferenceRegistrationOptions: + """Registration options for a {@link ReferencesRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DocumentHighlightParams: + """Parameters for a {@link DocumentHighlightRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class DocumentHighlight: + """A document highlight is a range inside a text document which deserves + special attention. Usually a document highlight is visualized by changing + the background color of its range.""" + + range: "Range" = attrs.field() + """The range this highlight applies to.""" + + kind: Optional[DocumentHighlightKind] = attrs.field(default=None) + """The highlight kind, default is {@link DocumentHighlightKind.Text text}.""" + + +@attrs.define +class DocumentHighlightOptions: + """Provider options for a {@link DocumentHighlightRequest}.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DocumentHighlightRegistrationOptions: + """Registration options for a {@link DocumentHighlightRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DocumentSymbolParams: + """Parameters for a {@link DocumentSymbolRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class BaseSymbolInformation: + """A base for all symbol information.""" + + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The name of this symbol.""" + + kind: SymbolKind = attrs.field() + """The kind of this symbol.""" + + tags: Optional[List[SymbolTag]] = attrs.field(default=None) + """Tags for this symbol. + + @since 3.16.0""" + # Since: 3.16.0 + + container_name: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The name of the symbol containing this symbol. This information is for + user interface purposes (e.g. to render a qualifier in the user interface + if necessary). It can't be used to re-infer a hierarchy for the document + symbols.""" + + +@attrs.define +class SymbolInformation: + """Represents information about programming constructs like variables, classes, + interfaces etc.""" + + location: Location = attrs.field() + """The location of this symbol. The location's range is used by a tool + to reveal the location in the editor. If the symbol is selected in the + tool the range's start information is used to position the cursor. So + the range usually spans more than the actual symbol's name and does + normally include things like visibility modifiers. + + The range doesn't have to denote a node range in the sense of an abstract + syntax tree. It can therefore not be used to re-construct a hierarchy of + the symbols.""" + + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The name of this symbol.""" + + kind: SymbolKind = attrs.field() + """The kind of this symbol.""" + + deprecated: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Indicates if this symbol is deprecated. + + @deprecated Use tags instead""" + + tags: Optional[List[SymbolTag]] = attrs.field(default=None) + """Tags for this symbol. + + @since 3.16.0""" + # Since: 3.16.0 + + container_name: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The name of the symbol containing this symbol. This information is for + user interface purposes (e.g. to render a qualifier in the user interface + if necessary). It can't be used to re-infer a hierarchy for the document + symbols.""" + + +@attrs.define +class DocumentSymbol: + """Represents programming constructs like variables, classes, interfaces etc. + that appear in a document. Document symbols can be hierarchical and they + have two ranges: one that encloses its definition and one that points to + its most interesting range, e.g. the range of an identifier.""" + + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The name of this symbol. Will be displayed in the user interface and therefore must not be + an empty string or a string only consisting of white spaces.""" + + kind: SymbolKind = attrs.field() + """The kind of this symbol.""" + + range: "Range" = attrs.field() + """The range enclosing this symbol not including leading/trailing whitespace but everything else + like comments. This information is typically used to determine if the clients cursor is + inside the symbol to reveal in the symbol in the UI.""" + + selection_range: "Range" = attrs.field() + """The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. + Must be contained by the `range`.""" + + detail: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """More detail for this symbol, e.g the signature of a function.""" + + tags: Optional[List[SymbolTag]] = attrs.field(default=None) + """Tags for this document symbol. + + @since 3.16.0""" + # Since: 3.16.0 + + deprecated: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Indicates if this symbol is deprecated. + + @deprecated Use tags instead""" + + children: Optional[List["DocumentSymbol"]] = attrs.field(default=None) + """Children of this symbol, e.g. properties of a class.""" + + +@attrs.define +class DocumentSymbolOptions: + """Provider options for a {@link DocumentSymbolRequest}.""" + + label: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A human-readable string that is shown when multiple outlines trees + are shown for the same document. + + @since 3.16.0""" + # Since: 3.16.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DocumentSymbolRegistrationOptions: + """Registration options for a {@link DocumentSymbolRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + label: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A human-readable string that is shown when multiple outlines trees + are shown for the same document. + + @since 3.16.0""" + # Since: 3.16.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class CodeActionParams: + """The parameters of a {@link CodeActionRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The document in which the command was invoked.""" + + range: "Range" = attrs.field() + """The range for which the command was invoked.""" + + context: "CodeActionContext" = attrs.field() + """Context carrying additional information.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class Command: + """Represents a reference to a command. Provides a title which + will be used to represent a command in the UI and, optionally, + an array of arguments which will be passed to the command handler + function when invoked.""" + + title: str = attrs.field(validator=attrs.validators.instance_of(str)) + """Title of the command, like `save`.""" + + command: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The identifier of the actual command handler.""" + + arguments: Optional[List[LSPAny]] = attrs.field(default=None) + """Arguments that the command handler should be + invoked with.""" + + +@attrs.define +class CodeActionDisabledType: + reason: str = attrs.field(validator=attrs.validators.instance_of(str)) + """Human readable description of why the code action is currently disabled. + + This is displayed in the code actions UI.""" + + +@attrs.define +class CodeAction: + """A code action represents a change that can be performed in code, e.g. to fix a problem or + to refactor code. + + A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed. + """ + + title: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A short, human-readable, title for this code action.""" + + kind: Optional[Union[CodeActionKind, str]] = attrs.field(default=None) + """The kind of the code action. + + Used to filter code actions.""" + + diagnostics: Optional[List["Diagnostic"]] = attrs.field(default=None) + """The diagnostics that this code action resolves.""" + + is_preferred: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted + by keybindings. + + A quick fix should be marked preferred if it properly addresses the underlying error. + A refactoring should be marked preferred if it is the most reasonable choice of actions to take. + + @since 3.15.0""" + # Since: 3.15.0 + + disabled: Optional["CodeActionDisabledType"] = attrs.field(default=None) + """Marks that the code action cannot currently be applied. + + Clients should follow the following guidelines regarding disabled code actions: + + - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) + code action menus. + + - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type + of code action, such as refactorings. + + - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions) + that auto applies a code action and only disabled code actions are returned, the client should show the user an + error message with `reason` in the editor. + + @since 3.16.0""" + # Since: 3.16.0 + + edit: Optional[WorkspaceEdit] = attrs.field(default=None) + """The workspace edit this code action performs.""" + + command: Optional[Command] = attrs.field(default=None) + """A command this code action executes. If a code action + provides an edit and a command, first the edit is + executed and then the command.""" + + data: Optional[LSPAny] = attrs.field(default=None) + """A data entry field that is preserved on a code action between + a `textDocument/codeAction` and a `codeAction/resolve` request. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class CodeActionOptions: + """Provider options for a {@link CodeActionRequest}.""" + + code_action_kinds: Optional[List[Union[CodeActionKind, str]]] = attrs.field( + default=None + ) + """CodeActionKinds that this server may return. + + The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + may list out every specific kind they provide.""" + + resolve_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server provides support to resolve additional + information for a code action. + + @since 3.16.0""" + # Since: 3.16.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class CodeActionRegistrationOptions: + """Registration options for a {@link CodeActionRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + code_action_kinds: Optional[List[Union[CodeActionKind, str]]] = attrs.field( + default=None + ) + """CodeActionKinds that this server may return. + + The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + may list out every specific kind they provide.""" + + resolve_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server provides support to resolve additional + information for a code action. + + @since 3.16.0""" + # Since: 3.16.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class WorkspaceSymbolParams: + """The parameters of a {@link WorkspaceSymbolRequest}.""" + + query: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A query string to filter symbols by. Clients may send an empty + string here to request all symbols.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class WorkspaceSymbolLocationType1: + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + + +@attrs.define +class WorkspaceSymbol: + """A special workspace symbol that supports locations without a range. + + See also SymbolInformation. + + @since 3.17.0""" + + # Since: 3.17.0 + + location: Union[Location, "WorkspaceSymbolLocationType1"] = attrs.field() + """The location of the symbol. Whether a server is allowed to + return a location without a range depends on the client + capability `workspace.symbol.resolveSupport`. + + See SymbolInformation#location for more details.""" + + name: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The name of this symbol.""" + + kind: SymbolKind = attrs.field() + """The kind of this symbol.""" + + data: Optional[LSPAny] = attrs.field(default=None) + """A data entry field that is preserved on a workspace symbol between a + workspace symbol request and a workspace symbol resolve request.""" + + tags: Optional[List[SymbolTag]] = attrs.field(default=None) + """Tags for this symbol. + + @since 3.16.0""" + # Since: 3.16.0 + + container_name: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The name of the symbol containing this symbol. This information is for + user interface purposes (e.g. to render a qualifier in the user interface + if necessary). It can't be used to re-infer a hierarchy for the document + symbols.""" + + +@attrs.define +class WorkspaceSymbolOptions: + """Server capabilities for a {@link WorkspaceSymbolRequest}.""" + + resolve_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server provides support to resolve additional + information for a workspace symbol. + + @since 3.17.0""" + # Since: 3.17.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class WorkspaceSymbolRegistrationOptions: + """Registration options for a {@link WorkspaceSymbolRequest}.""" + + resolve_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server provides support to resolve additional + information for a workspace symbol. + + @since 3.17.0""" + # Since: 3.17.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class CodeLensParams: + """The parameters of a {@link CodeLensRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The document to request code lens for.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class CodeLens: + """A code lens represents a {@link Command command} that should be shown along with + source text, like the number of references, a way to run tests, etc. + + A code lens is _unresolved_ when no command is associated to it. For performance + reasons the creation of a code lens and resolving should be done in two stages.""" + + range: "Range" = attrs.field() + """The range in which this code lens is valid. Should only span a single line.""" + + command: Optional[Command] = attrs.field(default=None) + """The command this code lens represents.""" + + data: Optional[LSPAny] = attrs.field(default=None) + """A data entry field that is preserved on a code lens item between + a {@link CodeLensRequest} and a {@link CodeLensResolveRequest}""" + + +@attrs.define +class CodeLensOptions: + """Code Lens provider options of a {@link CodeLensRequest}.""" + + resolve_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Code lens has a resolve provider as well.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class CodeLensRegistrationOptions: + """Registration options for a {@link CodeLensRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + resolve_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Code lens has a resolve provider as well.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DocumentLinkParams: + """The parameters of a {@link DocumentLinkRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The document to provide document links for.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + partial_result_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report partial results (e.g. streaming) to + the client.""" + + +@attrs.define +class DocumentLink: + """A document link is a range in a text document that links to an internal or external resource, like another + text document or a web site.""" + + range: "Range" = attrs.field() + """The range this link applies to.""" + + target: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The uri this link points to. If missing a resolve request is sent later.""" + + tooltip: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The tooltip text when you hover over this link. + + If a tooltip is provided, is will be displayed in a string that includes instructions on how to + trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS, + user settings, and localization. + + @since 3.15.0""" + # Since: 3.15.0 + + data: Optional[LSPAny] = attrs.field(default=None) + """A data entry field that is preserved on a document link between a + DocumentLinkRequest and a DocumentLinkResolveRequest.""" + + +@attrs.define +class DocumentLinkOptions: + """Provider options for a {@link DocumentLinkRequest}.""" + + resolve_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Document links have a resolve provider as well.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DocumentLinkRegistrationOptions: + """Registration options for a {@link DocumentLinkRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + resolve_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Document links have a resolve provider as well.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DocumentFormattingParams: + """The parameters of a {@link DocumentFormattingRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The document to format.""" + + options: "FormattingOptions" = attrs.field() + """The format options.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class DocumentFormattingOptions: + """Provider options for a {@link DocumentFormattingRequest}.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DocumentFormattingRegistrationOptions: + """Registration options for a {@link DocumentFormattingRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DocumentRangeFormattingParams: + """The parameters of a {@link DocumentRangeFormattingRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The document to format.""" + + range: "Range" = attrs.field() + """The range to format""" + + options: "FormattingOptions" = attrs.field() + """The format options""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class DocumentRangeFormattingOptions: + """Provider options for a {@link DocumentRangeFormattingRequest}.""" + + ranges_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the server supports formatting multiple ranges at once. + + @since 3.18.0 + @proposed""" + # Since: 3.18.0 + # Proposed + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DocumentRangeFormattingRegistrationOptions: + """Registration options for a {@link DocumentRangeFormattingRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + ranges_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the server supports formatting multiple ranges at once. + + @since 3.18.0 + @proposed""" + # Since: 3.18.0 + # Proposed + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class DocumentRangesFormattingParams: + """The parameters of a {@link DocumentRangesFormattingRequest}. + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + + text_document: "TextDocumentIdentifier" = attrs.field() + """The document to format.""" + + ranges: List["Range"] = attrs.field() + """The ranges to format""" + + options: "FormattingOptions" = attrs.field() + """The format options""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class DocumentOnTypeFormattingParams: + """The parameters of a {@link DocumentOnTypeFormattingRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The document to format.""" + + position: "Position" = attrs.field() + """The position around which the on type formatting should happen. + This is not necessarily the exact position where the character denoted + by the property `ch` got typed.""" + + ch: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The character that has been typed that triggered the formatting + on type request. That is not necessarily the last character that + got inserted into the document since the client could auto insert + characters as well (e.g. like automatic brace completion).""" + + options: "FormattingOptions" = attrs.field() + """The formatting options.""" + + +@attrs.define +class DocumentOnTypeFormattingOptions: + """Provider options for a {@link DocumentOnTypeFormattingRequest}.""" + + first_trigger_character: str = attrs.field( + validator=attrs.validators.instance_of(str) + ) + """A character on which formatting should be triggered, like `{`.""" + + more_trigger_character: Optional[List[str]] = attrs.field(default=None) + """More trigger characters.""" + + +@attrs.define +class DocumentOnTypeFormattingRegistrationOptions: + """Registration options for a {@link DocumentOnTypeFormattingRequest}.""" + + first_trigger_character: str = attrs.field( + validator=attrs.validators.instance_of(str) + ) + """A character on which formatting should be triggered, like `{`.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + more_trigger_character: Optional[List[str]] = attrs.field(default=None) + """More trigger characters.""" + + +@attrs.define +class RenameParams: + """The parameters of a {@link RenameRequest}.""" + + text_document: "TextDocumentIdentifier" = attrs.field() + """The document to rename.""" + + position: "Position" = attrs.field() + """The position at which this request was sent.""" + + new_name: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The new name of the symbol. If the given name is not valid the + request must return a {@link ResponseError} with an + appropriate message set.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class RenameOptions: + """Provider options for a {@link RenameRequest}.""" + + prepare_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Renames should be checked and tested before being executed. + + @since version 3.12.0""" + # Since: version 3.12.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class RenameRegistrationOptions: + """Registration options for a {@link RenameRequest}.""" + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + prepare_provider: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Renames should be checked and tested before being executed. + + @since version 3.12.0""" + # Since: version 3.12.0 + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class PrepareRenameParams: + text_document: "TextDocumentIdentifier" = attrs.field() + """The text document.""" + + position: "Position" = attrs.field() + """The position inside the text document.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class ExecuteCommandParams: + """The parameters of a {@link ExecuteCommandRequest}.""" + + command: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The identifier of the actual command handler.""" + + arguments: Optional[List[LSPAny]] = attrs.field(default=None) + """Arguments that the command should be invoked with.""" + + work_done_token: Optional[ProgressToken] = attrs.field(default=None) + """An optional token that a server can use to report work done progress.""" + + +@attrs.define +class ExecuteCommandOptions: + """The server capabilities of a {@link ExecuteCommandRequest}.""" + + commands: List[str] = attrs.field() + """The commands to be executed on the server""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class ExecuteCommandRegistrationOptions: + """Registration options for a {@link ExecuteCommandRequest}.""" + + commands: List[str] = attrs.field() + """The commands to be executed on the server""" + + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + +@attrs.define +class ApplyWorkspaceEditParams: + """The parameters passed via an apply workspace edit request.""" + + edit: WorkspaceEdit = attrs.field() + """The edits to apply.""" + + label: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """An optional label of the workspace edit. This label is + presented in the user interface for example on an undo + stack to undo the workspace edit.""" + + +@attrs.define +class ApplyWorkspaceEditResult: + """The result returned from the apply workspace edit request. + + @since 3.17 renamed from ApplyWorkspaceEditResponse""" + + # Since: 3.17 renamed from ApplyWorkspaceEditResponse + + applied: bool = attrs.field(validator=attrs.validators.instance_of(bool)) + """Indicates whether the edit was applied or not.""" + + failure_reason: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """An optional textual description for why the edit was not applied. + This may be used by the server for diagnostic logging or to provide + a suitable error for a request that triggered the edit.""" + + failed_change: Optional[int] = attrs.field( + validator=attrs.validators.optional(validators.uinteger_validator), default=None + ) + """Depending on the client's failure handling strategy `failedChange` might + contain the index of the change that failed. This property is only available + if the client signals a `failureHandlingStrategy` in its client capabilities.""" + + +@attrs.define +class WorkDoneProgressBegin: + title: str = attrs.field(validator=attrs.validators.instance_of(str)) + """Mandatory title of the progress operation. Used to briefly inform about + the kind of operation being performed. + + Examples: "Indexing" or "Linking dependencies".""" + + kind: str = attrs.field(validator=attrs.validators.in_(["begin"]), default="begin") + + cancellable: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Controls if a cancel button should show to allow the user to cancel the + long running operation. Clients that don't support cancellation are allowed + to ignore the setting.""" + + message: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """Optional, more detailed associated progress message. Contains + complementary information to the `title`. + + Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". + If unset, the previous progress message (if any) is still valid.""" + + percentage: Optional[int] = attrs.field( + validator=attrs.validators.optional(validators.uinteger_validator), default=None + ) + """Optional progress percentage to display (value 100 is considered 100%). + If not provided infinite progress is assumed and clients are allowed + to ignore the `percentage` value in subsequent in report notifications. + + The value should be steadily rising. Clients are free to ignore values + that are not following this rule. The value range is [0, 100].""" + + +@attrs.define +class WorkDoneProgressReport: + kind: str = attrs.field( + validator=attrs.validators.in_(["report"]), default="report" + ) + + cancellable: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Controls enablement state of a cancel button. + + Clients that don't support cancellation or don't support controlling the button's + enablement state are allowed to ignore the property.""" + + message: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """Optional, more detailed associated progress message. Contains + complementary information to the `title`. + + Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". + If unset, the previous progress message (if any) is still valid.""" + + percentage: Optional[int] = attrs.field( + validator=attrs.validators.optional(validators.uinteger_validator), default=None + ) + """Optional progress percentage to display (value 100 is considered 100%). + If not provided infinite progress is assumed and clients are allowed + to ignore the `percentage` value in subsequent in report notifications. + + The value should be steadily rising. Clients are free to ignore values + that are not following this rule. The value range is [0, 100]""" + + +@attrs.define +class WorkDoneProgressEnd: + kind: str = attrs.field(validator=attrs.validators.in_(["end"]), default="end") + + message: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """Optional, a final message indicating to for example indicate the outcome + of the operation.""" + + +@attrs.define +class SetTraceParams: + value: TraceValues = attrs.field() + + +@attrs.define +class LogTraceParams: + message: str = attrs.field(validator=attrs.validators.instance_of(str)) + + verbose: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + + +@attrs.define +class CancelParams: + id: Union[int, str] = attrs.field() + """The request id to cancel.""" + + +@attrs.define +class ProgressParams: + token: ProgressToken = attrs.field() + """The progress token provided by the client or server.""" + + value: LSPAny = attrs.field() + """The progress data.""" + + +@attrs.define +class LocationLink: + """Represents the connection of two locations. Provides additional metadata over normal {@link Location locations}, + including an origin range.""" + + target_uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The target resource identifier of this link.""" + + target_range: "Range" = attrs.field() + """The full target range of this link. If the target for example is a symbol then target range is the + range enclosing this symbol not including leading/trailing whitespace but everything else + like comments. This information is typically used to highlight the range in the editor.""" + + target_selection_range: "Range" = attrs.field() + """The range that should be selected and revealed when this link is being followed, e.g the name of a function. + Must be contained by the `targetRange`. See also `DocumentSymbol#range`""" + + origin_selection_range: Optional["Range"] = attrs.field(default=None) + """Span of the origin of this link. + + Used as the underlined span for mouse interaction. Defaults to the word range at + the definition position.""" + + +@attrs.define +class Range: + """A range in a text document expressed as (zero-based) start and end positions. + + If you want to specify a range that contains a line including the line ending + character(s) then use an end position denoting the start of the next line. + For example: + ```ts + { + start: { line: 5, character: 23 } + end : { line 6, character : 0 } + } + ```""" + + start: "Position" = attrs.field() + """The range's start position.""" + + end: "Position" = attrs.field() + """The range's end position.""" + + def __eq__(self, o: object) -> bool: + if not isinstance(o, Range): + return NotImplemented + return (self.start == o.start) and (self.end == o.end) + + def __repr__(self) -> str: + return f"{self.start!r}-{self.end!r}" + + +@attrs.define +class WorkspaceFoldersChangeEvent: + """The workspace folder change event.""" + + added: List[WorkspaceFolder] = attrs.field() + """The array of added workspace folders""" + + removed: List[WorkspaceFolder] = attrs.field() + """The array of the removed workspace folders""" + + +@attrs.define +class ConfigurationItem: + scope_uri: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The scope to get the configuration section for.""" + + section: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The configuration section asked for.""" + + +@attrs.define +class TextDocumentIdentifier: + """A literal to identify a text document in the client.""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The text document's uri.""" + + +@attrs.define +class Color: + """Represents a color in RGBA space.""" + + red: float = attrs.field(validator=attrs.validators.instance_of(float)) + """The red component of this color in the range [0-1].""" + + green: float = attrs.field(validator=attrs.validators.instance_of(float)) + """The green component of this color in the range [0-1].""" + + blue: float = attrs.field(validator=attrs.validators.instance_of(float)) + """The blue component of this color in the range [0-1].""" + + alpha: float = attrs.field(validator=attrs.validators.instance_of(float)) + """The alpha component of this color in the range [0-1].""" + + +@attrs.define +@functools.total_ordering +class Position: + """Position in a text document expressed as zero-based line and character + offset. Prior to 3.17 the offsets were always based on a UTF-16 string + representation. So a string of the form `a𐐀b` the character offset of the + character `a` is 0, the character offset of `𐐀` is 1 and the character + offset of b is 3 since `𐐀` is represented using two code units in UTF-16. + Since 3.17 clients and servers can agree on a different string encoding + representation (e.g. UTF-8). The client announces it's supported encoding + via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities). + The value is an array of position encodings the client supports, with + decreasing preference (e.g. the encoding at index `0` is the most preferred + one). To stay backwards compatible the only mandatory encoding is UTF-16 + represented via the string `utf-16`. The server can pick one of the + encodings offered by the client and signals that encoding back to the + client via the initialize result's property + [`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value + `utf-16` is missing from the client's capability `general.positionEncodings` + servers can safely assume that the client supports UTF-16. If the server + omits the position encoding in its initialize result the encoding defaults + to the string value `utf-16`. Implementation considerations: since the + conversion from one encoding into another requires the content of the + file / line the conversion is best done where the file is read which is + usually on the server side. + + Positions are line end character agnostic. So you can not specify a position + that denotes `\r|\n` or `\n|` where `|` represents the character offset. + + @since 3.17.0 - support for negotiated position encoding.""" + + # Since: 3.17.0 - support for negotiated position encoding. + + line: int = attrs.field(validator=validators.uinteger_validator) + """Line position in a document (zero-based). + + If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. + If a line number is negative, it defaults to 0.""" + + character: int = attrs.field(validator=validators.uinteger_validator) + """Character offset on a line in a document (zero-based). + + The meaning of this offset is determined by the negotiated + `PositionEncodingKind`. + + If the character value is greater than the line length it defaults back to the + line length.""" + + def __eq__(self, o: object) -> bool: + if not isinstance(o, Position): + return NotImplemented + return (self.line, self.character) == (o.line, o.character) + + def __gt__(self, o: "Position") -> bool: + if not isinstance(o, Position): + return NotImplemented + return (self.line, self.character) > (o.line, o.character) + + def __repr__(self) -> str: + return f"{self.line}:{self.character}" + + +@attrs.define +class SemanticTokensEdit: + """@since 3.16.0""" + + # Since: 3.16.0 + + start: int = attrs.field(validator=validators.uinteger_validator) + """The start offset of the edit.""" + + delete_count: int = attrs.field(validator=validators.uinteger_validator) + """The count of elements to remove.""" + + data: Optional[List[int]] = attrs.field(default=None) + """The elements to insert.""" + + +@attrs.define +class FileCreate: + """Represents information on a file/folder create. + + @since 3.16.0""" + + # Since: 3.16.0 + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A file:// URI for the location of the file/folder being created.""" + + +@attrs.define +class TextDocumentEdit: + """Describes textual changes on a text document. A TextDocumentEdit describes all changes + on a document version Si and after they are applied move the document to version Si+1. + So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any + kind of ordering. However the edits must be non overlapping.""" + + text_document: "OptionalVersionedTextDocumentIdentifier" = attrs.field() + """The text document to change.""" + + edits: List[Union[TextEdit, "AnnotatedTextEdit"]] = attrs.field() + """The edits to be applied. + + @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a + client capability.""" + # Since: 3.16.0 - support for AnnotatedTextEdit. This is guarded using aclient capability. + + +@attrs.define +class ResourceOperation: + """A generic resource operation.""" + + kind: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The resource operation kind.""" + + annotation_id: Optional[ChangeAnnotationIdentifier] = attrs.field(default=None) + """An optional annotation identifier describing the operation. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class CreateFile: + """Create file operation.""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The resource to create.""" + + kind: str = attrs.field( + validator=attrs.validators.in_(["create"]), default="create" + ) + """A create""" + + options: Optional["CreateFileOptions"] = attrs.field(default=None) + """Additional options""" + + annotation_id: Optional[ChangeAnnotationIdentifier] = attrs.field(default=None) + """An optional annotation identifier describing the operation. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class RenameFile: + """Rename file operation""" + + old_uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The old (existing) location.""" + + new_uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The new location.""" + + kind: str = attrs.field( + validator=attrs.validators.in_(["rename"]), default="rename" + ) + """A rename""" + + options: Optional["RenameFileOptions"] = attrs.field(default=None) + """Rename options.""" + + annotation_id: Optional[ChangeAnnotationIdentifier] = attrs.field(default=None) + """An optional annotation identifier describing the operation. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class DeleteFile: + """Delete file operation""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The file to delete.""" + + kind: str = attrs.field( + validator=attrs.validators.in_(["delete"]), default="delete" + ) + """A delete""" + + options: Optional["DeleteFileOptions"] = attrs.field(default=None) + """Delete options.""" + + annotation_id: Optional[ChangeAnnotationIdentifier] = attrs.field(default=None) + """An optional annotation identifier describing the operation. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class ChangeAnnotation: + """Additional information that describes document changes. + + @since 3.16.0""" + + # Since: 3.16.0 + + label: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A human-readable string describing the actual change. The string + is rendered prominent in the user interface.""" + + needs_confirmation: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """A flag which indicates that user confirmation is needed + before applying the change.""" + + description: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A human-readable string which is rendered less prominent in + the user interface.""" + + +@attrs.define +class FileOperationFilter: + """A filter to describe in which file operation requests or notifications + the server is interested in receiving. + + @since 3.16.0""" + + # Since: 3.16.0 + + pattern: "FileOperationPattern" = attrs.field() + """The actual file operation pattern.""" + + scheme: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A Uri scheme like `file` or `untitled`.""" + + +@attrs.define +class FileRename: + """Represents information on a file/folder rename. + + @since 3.16.0""" + + # Since: 3.16.0 + + old_uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A file:// URI for the original location of the file/folder being renamed.""" + + new_uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A file:// URI for the new location of the file/folder being renamed.""" + + +@attrs.define +class FileDelete: + """Represents information on a file/folder delete. + + @since 3.16.0""" + + # Since: 3.16.0 + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A file:// URI for the location of the file/folder being deleted.""" + + +@attrs.define +class InlineValueContext: + """@since 3.17.0""" + + # Since: 3.17.0 + + frame_id: int = attrs.field(validator=validators.integer_validator) + """The stack frame (as a DAP Id) where the execution has stopped.""" + + stopped_location: Range = attrs.field() + """The document range where execution has stopped. + Typically the end position of the range denotes the line where the inline values are shown.""" + + +@attrs.define +class InlineValueText: + """Provide inline value as text. + + @since 3.17.0""" + + # Since: 3.17.0 + + range: Range = attrs.field() + """The document range for which the inline value applies.""" + + text: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The text of the inline value.""" + + +@attrs.define +class InlineValueVariableLookup: + """Provide inline value through a variable lookup. + If only a range is specified, the variable name will be extracted from the underlying document. + An optional variable name can be used to override the extracted name. + + @since 3.17.0""" + + # Since: 3.17.0 + + range: Range = attrs.field() + """The document range for which the inline value applies. + The range is used to extract the variable name from the underlying document.""" + + case_sensitive_lookup: bool = attrs.field( + validator=attrs.validators.instance_of(bool) + ) + """How to perform the lookup.""" + + variable_name: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """If specified the name of the variable to look up.""" + + +@attrs.define +class InlineValueEvaluatableExpression: + """Provide an inline value through an expression evaluation. + If only a range is specified, the expression will be extracted from the underlying document. + An optional expression can be used to override the extracted expression. + + @since 3.17.0""" + + # Since: 3.17.0 + + range: Range = attrs.field() + """The document range for which the inline value applies. + The range is used to extract the evaluatable expression from the underlying document.""" + + expression: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """If specified the expression overrides the extracted expression.""" + + +@attrs.define +class InlayHintLabelPart: + """An inlay hint label part allows for interactive and composite labels + of inlay hints. + + @since 3.17.0""" + + # Since: 3.17.0 + + value: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The value of this label part.""" + + tooltip: Optional[Union[str, "MarkupContent"]] = attrs.field(default=None) + """The tooltip text when you hover over this label part. Depending on + the client capability `inlayHint.resolveSupport` clients might resolve + this property late using the resolve request.""" + + location: Optional[Location] = attrs.field(default=None) + """An optional source code location that represents this + label part. + + The editor will use this location for the hover and for code navigation + features: This part will become a clickable link that resolves to the + definition of the symbol at the given location (not necessarily the + location itself), it shows the hover that shows at the given location, + and it shows a context menu with further code navigation commands. + + Depending on the client capability `inlayHint.resolveSupport` clients + might resolve this property late using the resolve request.""" + + command: Optional[Command] = attrs.field(default=None) + """An optional command for this label part. + + Depending on the client capability `inlayHint.resolveSupport` clients + might resolve this property late using the resolve request.""" + + +@attrs.define +class MarkupContent: + """A `MarkupContent` literal represents a string value which content is interpreted base on its + kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds. + + If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues. + See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting + + Here is an example how such a string can be constructed using JavaScript / TypeScript: + ```ts + let markdown: MarkdownContent = { + kind: MarkupKind.Markdown, + value: [ + '# Header', + 'Some text', + '```typescript', + 'someCode();', + '```' + ].join('\n') + }; + ``` + + *Please Note* that clients might sanitize the return markdown. A client could decide to + remove HTML from the markdown to avoid script execution.""" + + kind: MarkupKind = attrs.field() + """The type of the Markup""" + + value: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The content itself""" + + +@attrs.define +class FullDocumentDiagnosticReport: + """A diagnostic report with a full set of problems. + + @since 3.17.0""" + + # Since: 3.17.0 + + items: List["Diagnostic"] = attrs.field() + """The actual items.""" + + kind: str = attrs.field(validator=attrs.validators.in_(["full"]), default="full") + """A full document diagnostic report.""" + + result_id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """An optional result id. If provided it will + be sent on the next diagnostic request for the + same document.""" + + +@attrs.define +class RelatedFullDocumentDiagnosticReport: + """A full diagnostic report with a set of related documents. + + @since 3.17.0""" + + # Since: 3.17.0 + + items: List["Diagnostic"] = attrs.field() + """The actual items.""" + + related_documents: Optional[ + Dict[ + str, + Union[FullDocumentDiagnosticReport, "UnchangedDocumentDiagnosticReport"], + ] + ] = attrs.field(default=None) + """Diagnostics of related documents. This information is useful + in programming languages where code in a file A can generate + diagnostics in a file B which A depends on. An example of + such a language is C/C++ where marco definitions in a file + a.cpp and result in errors in a header file b.hpp. + + @since 3.17.0""" + # Since: 3.17.0 + + kind: str = attrs.field(validator=attrs.validators.in_(["full"]), default="full") + """A full document diagnostic report.""" + + result_id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """An optional result id. If provided it will + be sent on the next diagnostic request for the + same document.""" + + +@attrs.define +class UnchangedDocumentDiagnosticReport: + """A diagnostic report indicating that the last returned + report is still accurate. + + @since 3.17.0""" + + # Since: 3.17.0 + + result_id: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A result id which will be sent on the next + diagnostic request for the same document.""" + + kind: str = attrs.field( + validator=attrs.validators.in_(["unchanged"]), default="unchanged" + ) + """A document diagnostic report indicating + no changes to the last result. A server can + only return `unchanged` if result ids are + provided.""" + + +@attrs.define +class RelatedUnchangedDocumentDiagnosticReport: + """An unchanged diagnostic report with a set of related documents. + + @since 3.17.0""" + + # Since: 3.17.0 + + result_id: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A result id which will be sent on the next + diagnostic request for the same document.""" + + related_documents: Optional[ + Dict[ + str, Union[FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport] + ] + ] = attrs.field(default=None) + """Diagnostics of related documents. This information is useful + in programming languages where code in a file A can generate + diagnostics in a file B which A depends on. An example of + such a language is C/C++ where marco definitions in a file + a.cpp and result in errors in a header file b.hpp. + + @since 3.17.0""" + # Since: 3.17.0 + + kind: str = attrs.field( + validator=attrs.validators.in_(["unchanged"]), default="unchanged" + ) + """A document diagnostic report indicating + no changes to the last result. A server can + only return `unchanged` if result ids are + provided.""" + + +@attrs.define +class PreviousResultId: + """A previous result id in a workspace pull request. + + @since 3.17.0""" + + # Since: 3.17.0 + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The URI for which the client knowns a + result id.""" + + value: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The value of the previous result id.""" + + +@attrs.define +class NotebookDocument: + """A notebook document. + + @since 3.17.0""" + + # Since: 3.17.0 + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The notebook document's uri.""" + + notebook_type: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The type of the notebook.""" + + version: int = attrs.field(validator=validators.integer_validator) + """The version number of this document (it will increase after each + change, including undo/redo).""" + + cells: List["NotebookCell"] = attrs.field() + """The cells of a notebook.""" + + metadata: Optional[LSPObject] = attrs.field(default=None) + """Additional metadata stored with the notebook + document. + + Note: should always be an object literal (e.g. LSPObject)""" + + +@attrs.define +class TextDocumentItem: + """An item to transfer a text document from the client to the + server.""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The text document's uri.""" + + language_id: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The text document's language identifier.""" + + version: int = attrs.field(validator=validators.integer_validator) + """The version number of this document (it will increase after each + change, including undo/redo).""" + + text: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The content of the opened text document.""" + + +@attrs.define +class VersionedNotebookDocumentIdentifier: + """A versioned notebook document identifier. + + @since 3.17.0""" + + # Since: 3.17.0 + + version: int = attrs.field(validator=validators.integer_validator) + """The version number of this notebook document.""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The notebook document's uri.""" + + +@attrs.define +class NotebookDocumentChangeEventCellsTypeStructureType: + array: "NotebookCellArrayChange" = attrs.field() + """The change to the cell array.""" + + did_open: Optional[List[TextDocumentItem]] = attrs.field(default=None) + """Additional opened cell text documents.""" + + did_close: Optional[List[TextDocumentIdentifier]] = attrs.field(default=None) + """Additional closed cell text documents.""" + + +@attrs.define +class NotebookDocumentChangeEventCellsTypeTextContentType: + document: "VersionedTextDocumentIdentifier" = attrs.field() + + changes: List[TextDocumentContentChangeEvent] = attrs.field() + + +@attrs.define +class NotebookDocumentChangeEventCellsType: + structure: Optional[ + "NotebookDocumentChangeEventCellsTypeStructureType" + ] = attrs.field(default=None) + """Changes to the cell structure to add or + remove cells.""" + + data: Optional[List["NotebookCell"]] = attrs.field(default=None) + """Changes to notebook cells properties like its + kind, execution summary or metadata.""" + + text_content: Optional[ + List["NotebookDocumentChangeEventCellsTypeTextContentType"] + ] = attrs.field(default=None) + """Changes to the text content of notebook cells.""" + + +@attrs.define +class NotebookDocumentChangeEvent: + """A change event for a notebook document. + + @since 3.17.0""" + + # Since: 3.17.0 + + metadata: Optional[LSPObject] = attrs.field(default=None) + """The changed meta data if any. + + Note: should always be an object literal (e.g. LSPObject)""" + + cells: Optional["NotebookDocumentChangeEventCellsType"] = attrs.field(default=None) + """Changes to cells""" + + +@attrs.define +class NotebookDocumentIdentifier: + """A literal to identify a notebook document in the client. + + @since 3.17.0""" + + # Since: 3.17.0 + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The notebook document's uri.""" + + +@attrs.define +class InlineCompletionContext: + """Provides information about the context in which an inline completion was requested. + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + + trigger_kind: InlineCompletionTriggerKind = attrs.field() + """Describes how the inline completion was triggered.""" + + selected_completion_info: Optional["SelectedCompletionInfo"] = attrs.field( + default=None + ) + """Provides information about the currently selected item in the autocomplete widget if it is visible.""" + + +@attrs.define +class StringValue: + """A string value used as a snippet is a template which allows to insert text + and to control the editor cursor when insertion happens. + + A snippet can define tab stops and placeholders with `$1`, `$2` + and `${3:foo}`. `$0` defines the final tab stop, it defaults to + the end of the snippet. Variables are defined with `$name` and + `${name:default value}`. + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + + value: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The snippet string.""" + + kind: str = attrs.field( + validator=attrs.validators.in_(["snippet"]), default="snippet" + ) + """The kind of string value.""" + + +@attrs.define +class Registration: + """General parameters to register for a notification or to register a provider.""" + + id: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The id used to register the request. The id can be used to deregister + the request again.""" + + method: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The method / capability to register for.""" + + register_options: Optional[LSPAny] = attrs.field(default=None) + """Options necessary for the registration.""" + + +@attrs.define +class Unregistration: + """General parameters to unregister a request or notification.""" + + id: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The id used to unregister the request or notification. Usually an id + provided during the register request.""" + + method: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The method to unregister for.""" + + +@attrs.define +class ServerCapabilitiesWorkspaceType: + workspace_folders: Optional["WorkspaceFoldersServerCapabilities"] = attrs.field( + default=None + ) + """The server supports workspace folder. + + @since 3.6.0""" + # Since: 3.6.0 + + file_operations: Optional["FileOperationOptions"] = attrs.field(default=None) + """The server is interested in notifications/requests for operations on files. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class ServerCapabilities: + """Defines the capabilities provided by a language + server.""" + + position_encoding: Optional[Union[PositionEncodingKind, str]] = attrs.field( + default=None + ) + """The position encoding the server picked from the encodings offered + by the client via the client capability `general.positionEncodings`. + + If the client didn't provide any position encodings the only valid + value that a server can return is 'utf-16'. + + If omitted it defaults to 'utf-16'. + + @since 3.17.0""" + # Since: 3.17.0 + + text_document_sync: Optional[ + Union["TextDocumentSyncOptions", TextDocumentSyncKind] + ] = attrs.field(default=None) + """Defines how text documents are synced. Is either a detailed structure + defining each notification or for backwards compatibility the + TextDocumentSyncKind number.""" + + notebook_document_sync: Optional[ + Union["NotebookDocumentSyncOptions", "NotebookDocumentSyncRegistrationOptions"] + ] = attrs.field(default=None) + """Defines how notebook documents are synced. + + @since 3.17.0""" + # Since: 3.17.0 + + completion_provider: Optional[CompletionOptions] = attrs.field(default=None) + """The server provides completion support.""" + + hover_provider: Optional[Union[bool, HoverOptions]] = attrs.field(default=None) + """The server provides hover support.""" + + signature_help_provider: Optional[SignatureHelpOptions] = attrs.field(default=None) + """The server provides signature help support.""" + + declaration_provider: Optional[ + Union[bool, DeclarationOptions, DeclarationRegistrationOptions] + ] = attrs.field(default=None) + """The server provides Goto Declaration support.""" + + definition_provider: Optional[Union[bool, DefinitionOptions]] = attrs.field( + default=None + ) + """The server provides goto definition support.""" + + type_definition_provider: Optional[ + Union[bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions] + ] = attrs.field(default=None) + """The server provides Goto Type Definition support.""" + + implementation_provider: Optional[ + Union[bool, ImplementationOptions, ImplementationRegistrationOptions] + ] = attrs.field(default=None) + """The server provides Goto Implementation support.""" + + references_provider: Optional[Union[bool, ReferenceOptions]] = attrs.field( + default=None + ) + """The server provides find references support.""" + + document_highlight_provider: Optional[ + Union[bool, DocumentHighlightOptions] + ] = attrs.field(default=None) + """The server provides document highlight support.""" + + document_symbol_provider: Optional[ + Union[bool, DocumentSymbolOptions] + ] = attrs.field(default=None) + """The server provides document symbol support.""" + + code_action_provider: Optional[Union[bool, CodeActionOptions]] = attrs.field( + default=None + ) + """The server provides code actions. CodeActionOptions may only be + specified if the client states that it supports + `codeActionLiteralSupport` in its initial `initialize` request.""" + + code_lens_provider: Optional[CodeLensOptions] = attrs.field(default=None) + """The server provides code lens.""" + + document_link_provider: Optional[DocumentLinkOptions] = attrs.field(default=None) + """The server provides document link support.""" + + color_provider: Optional[ + Union[bool, DocumentColorOptions, DocumentColorRegistrationOptions] + ] = attrs.field(default=None) + """The server provides color provider support.""" + + workspace_symbol_provider: Optional[ + Union[bool, WorkspaceSymbolOptions] + ] = attrs.field(default=None) + """The server provides workspace symbol support.""" + + document_formatting_provider: Optional[ + Union[bool, DocumentFormattingOptions] + ] = attrs.field(default=None) + """The server provides document formatting.""" + + document_range_formatting_provider: Optional[ + Union[bool, DocumentRangeFormattingOptions] + ] = attrs.field(default=None) + """The server provides document range formatting.""" + + document_on_type_formatting_provider: Optional[ + DocumentOnTypeFormattingOptions + ] = attrs.field(default=None) + """The server provides document formatting on typing.""" + + rename_provider: Optional[Union[bool, RenameOptions]] = attrs.field(default=None) + """The server provides rename support. RenameOptions may only be + specified if the client states that it supports + `prepareSupport` in its initial `initialize` request.""" + + folding_range_provider: Optional[ + Union[bool, FoldingRangeOptions, FoldingRangeRegistrationOptions] + ] = attrs.field(default=None) + """The server provides folding provider support.""" + + selection_range_provider: Optional[ + Union[bool, SelectionRangeOptions, SelectionRangeRegistrationOptions] + ] = attrs.field(default=None) + """The server provides selection range support.""" + + execute_command_provider: Optional[ExecuteCommandOptions] = attrs.field( + default=None + ) + """The server provides execute command support.""" + + call_hierarchy_provider: Optional[ + Union[bool, CallHierarchyOptions, CallHierarchyRegistrationOptions] + ] = attrs.field(default=None) + """The server provides call hierarchy support. + + @since 3.16.0""" + # Since: 3.16.0 + + linked_editing_range_provider: Optional[ + Union[bool, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions] + ] = attrs.field(default=None) + """The server provides linked editing range support. + + @since 3.16.0""" + # Since: 3.16.0 + + semantic_tokens_provider: Optional[ + Union[SemanticTokensOptions, SemanticTokensRegistrationOptions] + ] = attrs.field(default=None) + """The server provides semantic tokens support. + + @since 3.16.0""" + # Since: 3.16.0 + + moniker_provider: Optional[ + Union[bool, MonikerOptions, MonikerRegistrationOptions] + ] = attrs.field(default=None) + """The server provides moniker support. + + @since 3.16.0""" + # Since: 3.16.0 + + type_hierarchy_provider: Optional[ + Union[bool, TypeHierarchyOptions, TypeHierarchyRegistrationOptions] + ] = attrs.field(default=None) + """The server provides type hierarchy support. + + @since 3.17.0""" + # Since: 3.17.0 + + inline_value_provider: Optional[ + Union[bool, InlineValueOptions, InlineValueRegistrationOptions] + ] = attrs.field(default=None) + """The server provides inline values. + + @since 3.17.0""" + # Since: 3.17.0 + + inlay_hint_provider: Optional[ + Union[bool, InlayHintOptions, InlayHintRegistrationOptions] + ] = attrs.field(default=None) + """The server provides inlay hints. + + @since 3.17.0""" + # Since: 3.17.0 + + diagnostic_provider: Optional[ + Union[DiagnosticOptions, DiagnosticRegistrationOptions] + ] = attrs.field(default=None) + """The server has support for pull model diagnostics. + + @since 3.17.0""" + # Since: 3.17.0 + + inline_completion_provider: Optional[ + Union[bool, InlineCompletionOptions] + ] = attrs.field(default=None) + """Inline completion options used during static registration. + + @since 3.18.0 + @proposed""" + # Since: 3.18.0 + # Proposed + + workspace: Optional["ServerCapabilitiesWorkspaceType"] = attrs.field(default=None) + """Workspace specific server capabilities.""" + + experimental: Optional[LSPAny] = attrs.field(default=None) + """Experimental server capabilities.""" + + +@attrs.define +class VersionedTextDocumentIdentifier: + """A text document identifier to denote a specific version of a text document.""" + + version: int = attrs.field(validator=validators.integer_validator) + """The version number of this document.""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The text document's uri.""" + + +@attrs.define +class FileEvent: + """An event describing a file change.""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The file's uri.""" + + type: FileChangeType = attrs.field() + """The change type.""" + + +@attrs.define +class FileSystemWatcher: + glob_pattern: GlobPattern = attrs.field() + """The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail. + + @since 3.17.0 support for relative patterns.""" + # Since: 3.17.0 support for relative patterns. + + kind: Optional[Union[WatchKind, int]] = attrs.field(default=None) + """The kind of events of interest. If omitted it defaults + to WatchKind.Create | WatchKind.Change | WatchKind.Delete + which is 7.""" + + +@attrs.define +class Diagnostic: + """Represents a diagnostic, such as a compiler error or warning. Diagnostic objects + are only valid in the scope of a resource.""" + + range: Range = attrs.field() + """The range at which the message applies""" + + message: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The diagnostic's message. It usually appears in the user interface""" + + severity: Optional[DiagnosticSeverity] = attrs.field(default=None) + """The diagnostic's severity. Can be omitted. If omitted it is up to the + client to interpret diagnostics as error, warning, info or hint.""" + + code: Optional[Union[int, str]] = attrs.field(default=None) + """The diagnostic's code, which usually appear in the user interface.""" + + code_description: Optional["CodeDescription"] = attrs.field(default=None) + """An optional property to describe the error code. + Requires the code field (above) to be present/not null. + + @since 3.16.0""" + # Since: 3.16.0 + + source: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A human-readable string describing the source of this + diagnostic, e.g. 'typescript' or 'super lint'. It usually + appears in the user interface.""" + + tags: Optional[List[DiagnosticTag]] = attrs.field(default=None) + """Additional metadata about the diagnostic. + + @since 3.15.0""" + # Since: 3.15.0 + + related_information: Optional[List["DiagnosticRelatedInformation"]] = attrs.field( + default=None + ) + """An array of related diagnostic information, e.g. when symbol-names within + a scope collide all definitions can be marked via this property.""" + + data: Optional[LSPAny] = attrs.field(default=None) + """A data entry field that is preserved between a `textDocument/publishDiagnostics` + notification and `textDocument/codeAction` request. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class CompletionContext: + """Contains additional information about the context in which a completion request is triggered.""" + + trigger_kind: CompletionTriggerKind = attrs.field() + """How the completion was triggered.""" + + trigger_character: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The trigger character (a single character) that has trigger code complete. + Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`""" + + +@attrs.define +class CompletionItemLabelDetails: + """Additional details for a completion item label. + + @since 3.17.0""" + + # Since: 3.17.0 + + detail: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """An optional string which is rendered less prominently directly after {@link CompletionItem.label label}, + without any spacing. Should be used for function signatures and type annotations.""" + + description: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used + for fully qualified names and file paths.""" + + +@attrs.define +class InsertReplaceEdit: + """A special text edit to provide an insert and a replace operation. + + @since 3.16.0""" + + # Since: 3.16.0 + + new_text: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The string to be inserted.""" + + insert: Range = attrs.field() + """The range if the insert is requested""" + + replace: Range = attrs.field() + """The range if the replace is requested.""" + + +@attrs.define +class SignatureHelpContext: + """Additional information about the context in which a signature help request was triggered. + + @since 3.15.0""" + + # Since: 3.15.0 + + trigger_kind: SignatureHelpTriggerKind = attrs.field() + """Action that caused signature help to be triggered.""" + + is_retrigger: bool = attrs.field(validator=attrs.validators.instance_of(bool)) + """`true` if signature help was already showing when it was triggered. + + Retriggers occurs when the signature help is already active and can be caused by actions such as + typing a trigger character, a cursor move, or document content changes.""" + + trigger_character: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """Character that caused signature help to be triggered. + + This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter`""" + + active_signature_help: Optional[SignatureHelp] = attrs.field(default=None) + """The currently active `SignatureHelp`. + + The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on + the user navigating through available signatures.""" + + +@attrs.define +class SignatureInformation: + """Represents the signature of something callable. A signature + can have a label, like a function-name, a doc-comment, and + a set of parameters.""" + + label: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The label of this signature. Will be shown in + the UI.""" + + documentation: Optional[Union[str, MarkupContent]] = attrs.field(default=None) + """The human-readable doc-comment of this signature. Will be shown + in the UI but can be omitted.""" + + parameters: Optional[List["ParameterInformation"]] = attrs.field(default=None) + """The parameters of this signature.""" + + active_parameter: Optional[int] = attrs.field( + validator=attrs.validators.optional(validators.uinteger_validator), default=None + ) + """The index of the active parameter. + + If provided, this is used in place of `SignatureHelp.activeParameter`. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class ReferenceContext: + """Value-object that contains additional information when + requesting references.""" + + include_declaration: bool = attrs.field( + validator=attrs.validators.instance_of(bool) + ) + """Include the declaration of the current symbol.""" + + +@attrs.define +class CodeActionContext: + """Contains additional diagnostic information about the context in which + a {@link CodeActionProvider.provideCodeActions code action} is run.""" + + diagnostics: List[Diagnostic] = attrs.field() + """An array of diagnostics known on the client side overlapping the range provided to the + `textDocument/codeAction` request. They are provided so that the server knows which + errors are currently presented to the user for the given range. There is no guarantee + that these accurately reflect the error state of the resource. The primary parameter + to compute code actions is the provided range.""" + + only: Optional[List[Union[CodeActionKind, str]]] = attrs.field(default=None) + """Requested kind of actions to return. + + Actions not of this kind are filtered out by the client before being shown. So servers + can omit computing them.""" + + trigger_kind: Optional[CodeActionTriggerKind] = attrs.field(default=None) + """The reason why code actions were requested. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class FormattingOptions: + """Value-object describing what options formatting should use.""" + + tab_size: int = attrs.field(validator=validators.uinteger_validator) + """Size of a tab in spaces.""" + + insert_spaces: bool = attrs.field(validator=attrs.validators.instance_of(bool)) + """Prefer spaces over tabs.""" + + trim_trailing_whitespace: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Trim trailing whitespace on a line. + + @since 3.15.0""" + # Since: 3.15.0 + + insert_final_newline: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Insert a newline character at the end of the file if one does not exist. + + @since 3.15.0""" + # Since: 3.15.0 + + trim_final_newlines: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Trim all newlines after the final newline at the end of the file. + + @since 3.15.0""" + # Since: 3.15.0 + + +@attrs.define +class SemanticTokensLegend: + """@since 3.16.0""" + + # Since: 3.16.0 + + token_types: List[str] = attrs.field() + """The token types a server uses.""" + + token_modifiers: List[str] = attrs.field() + """The token modifiers a server uses.""" + + +@attrs.define +class OptionalVersionedTextDocumentIdentifier: + """A text document identifier to optionally denote a specific version of a text document.""" + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The text document's uri.""" + + version: Optional[Union[int, None]] = attrs.field(default=None) + """The version number of this document. If a versioned text document identifier + is sent from the server to the client and the file is not open in the editor + (the server has not received an open notification before) the server can send + `null` to indicate that the version is unknown and the content on disk is the + truth (as specified with document content ownership).""" + + +@attrs.define +class AnnotatedTextEdit: + """A special text edit with an additional change annotation. + + @since 3.16.0.""" + + # Since: 3.16.0. + + annotation_id: ChangeAnnotationIdentifier = attrs.field() + """The actual identifier of the change annotation""" + + range: Range = attrs.field() + """The range of the text document to be manipulated. To insert + text into a document create a range where start === end.""" + + new_text: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The string to be inserted. For delete operations use an + empty string.""" + + +@attrs.define +class CreateFileOptions: + """Options to create a file.""" + + overwrite: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Overwrite existing file. Overwrite wins over `ignoreIfExists`""" + + ignore_if_exists: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Ignore if exists.""" + + +@attrs.define +class RenameFileOptions: + """Rename file options""" + + overwrite: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Overwrite target if existing. Overwrite wins over `ignoreIfExists`""" + + ignore_if_exists: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Ignores if target exists.""" + + +@attrs.define +class DeleteFileOptions: + """Delete file options""" + + recursive: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Delete the content recursively if a folder is denoted.""" + + ignore_if_not_exists: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Ignore the operation if the file doesn't exist.""" + + +@attrs.define +class FileOperationPattern: + """A pattern to describe in which file operation requests or notifications + the server is interested in receiving. + + @since 3.16.0""" + + # Since: 3.16.0 + + glob: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The glob pattern to match. Glob patterns can have the following syntax: + - `*` to match one or more characters in a path segment + - `?` to match on one character in a path segment + - `**` to match any number of path segments, including none + - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files) + - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) + - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)""" + + matches: Optional[FileOperationPatternKind] = attrs.field(default=None) + """Whether to match files or folders with this pattern. + + Matches both if undefined.""" + + options: Optional["FileOperationPatternOptions"] = attrs.field(default=None) + """Additional options used during matching.""" + + +@attrs.define +class WorkspaceFullDocumentDiagnosticReport: + """A full document diagnostic report for a workspace diagnostic result. + + @since 3.17.0""" + + # Since: 3.17.0 + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The URI for which diagnostic information is reported.""" + + items: List[Diagnostic] = attrs.field() + """The actual items.""" + + version: Optional[Union[int, None]] = attrs.field(default=None) + """The version number for which the diagnostics are reported. + If the document is not marked as open `null` can be provided.""" + + kind: str = attrs.field(validator=attrs.validators.in_(["full"]), default="full") + """A full document diagnostic report.""" + + result_id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """An optional result id. If provided it will + be sent on the next diagnostic request for the + same document.""" + + +@attrs.define +class WorkspaceUnchangedDocumentDiagnosticReport: + """An unchanged document diagnostic report for a workspace diagnostic result. + + @since 3.17.0""" + + # Since: 3.17.0 + + uri: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The URI for which diagnostic information is reported.""" + + result_id: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A result id which will be sent on the next + diagnostic request for the same document.""" + + version: Optional[Union[int, None]] = attrs.field(default=None) + """The version number for which the diagnostics are reported. + If the document is not marked as open `null` can be provided.""" + + kind: str = attrs.field( + validator=attrs.validators.in_(["unchanged"]), default="unchanged" + ) + """A document diagnostic report indicating + no changes to the last result. A server can + only return `unchanged` if result ids are + provided.""" + + +@attrs.define +class NotebookCell: + """A notebook cell. + + A cell's document URI must be unique across ALL notebook + cells and can therefore be used to uniquely identify a + notebook cell or the cell's text document. + + @since 3.17.0""" + + # Since: 3.17.0 + + kind: NotebookCellKind = attrs.field() + """The cell's kind""" + + document: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The URI of the cell's text document + content.""" + + metadata: Optional[LSPObject] = attrs.field(default=None) + """Additional metadata stored with the cell. + + Note: should always be an object literal (e.g. LSPObject)""" + + execution_summary: Optional["ExecutionSummary"] = attrs.field(default=None) + """Additional execution summary information + if supported by the client.""" + + +@attrs.define +class NotebookCellArrayChange: + """A change describing how to move a `NotebookCell` + array from state S to S'. + + @since 3.17.0""" + + # Since: 3.17.0 + + start: int = attrs.field(validator=validators.uinteger_validator) + """The start oftest of the cell that changed.""" + + delete_count: int = attrs.field(validator=validators.uinteger_validator) + """The deleted cells""" + + cells: Optional[List[NotebookCell]] = attrs.field(default=None) + """The new cells, if any""" + + +@attrs.define +class SelectedCompletionInfo: + """Describes the currently selected completion item. + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + + range: Range = attrs.field() + """The range that will be replaced if this completion item is accepted.""" + + text: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The text the range will be replaced with if this completion is accepted.""" + + +@attrs.define +class ClientCapabilities: + """Defines the capabilities provided by the client.""" + + workspace: Optional["WorkspaceClientCapabilities"] = attrs.field(default=None) + """Workspace specific client capabilities.""" + + text_document: Optional["TextDocumentClientCapabilities"] = attrs.field( + default=None + ) + """Text document specific client capabilities.""" + + notebook_document: Optional["NotebookDocumentClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the notebook document support. + + @since 3.17.0""" + # Since: 3.17.0 + + window: Optional["WindowClientCapabilities"] = attrs.field(default=None) + """Window specific client capabilities.""" + + general: Optional["GeneralClientCapabilities"] = attrs.field(default=None) + """General client capabilities. + + @since 3.16.0""" + # Since: 3.16.0 + + experimental: Optional[LSPAny] = attrs.field(default=None) + """Experimental client capabilities.""" + + +@attrs.define +class TextDocumentSyncOptions: + open_close: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Open and close notifications are sent to the server. If omitted open close notification should not + be sent.""" + + change: Optional[TextDocumentSyncKind] = attrs.field(default=None) + """Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full + and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None.""" + + will_save: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """If present will save notifications are sent to the server. If omitted the notification should not be + sent.""" + + will_save_wait_until: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """If present will save wait until requests are sent to the server. If omitted the request should not be + sent.""" + + save: Optional[Union[bool, SaveOptions]] = attrs.field(default=None) + """If present save notifications are sent to the server. If omitted the notification should not be + sent.""" + + +@attrs.define +class NotebookDocumentSyncOptionsNotebookSelectorType1CellsType: + language: str = attrs.field(validator=attrs.validators.instance_of(str)) + + +@attrs.define +class NotebookDocumentSyncOptionsNotebookSelectorType1: + notebook: Union[str, NotebookDocumentFilter] = attrs.field() + """The notebook to be synced If a string + value is provided it matches against the + notebook type. '*' matches every notebook.""" + + cells: Optional[ + List["NotebookDocumentSyncOptionsNotebookSelectorType1CellsType"] + ] = attrs.field(default=None) + """The cells of the matching notebook to be synced.""" + + +@attrs.define +class NotebookDocumentSyncOptionsNotebookSelectorType2CellsType: + language: str = attrs.field(validator=attrs.validators.instance_of(str)) + + +@attrs.define +class NotebookDocumentSyncOptionsNotebookSelectorType2: + cells: List[ + "NotebookDocumentSyncOptionsNotebookSelectorType2CellsType" + ] = attrs.field() + """The cells of the matching notebook to be synced.""" + + notebook: Optional[Union[str, NotebookDocumentFilter]] = attrs.field(default=None) + """The notebook to be synced If a string + value is provided it matches against the + notebook type. '*' matches every notebook.""" + + +@attrs.define +class NotebookDocumentSyncOptions: + """Options specific to a notebook plus its cells + to be synced to the server. + + If a selector provides a notebook document + filter but no cell selector all cells of a + matching notebook document will be synced. + + If a selector provides no notebook document + filter but only a cell selector all notebook + document that contain at least one matching + cell will be synced. + + @since 3.17.0""" + + # Since: 3.17.0 + + notebook_selector: List[ + Union[ + "NotebookDocumentSyncOptionsNotebookSelectorType1", + "NotebookDocumentSyncOptionsNotebookSelectorType2", + ] + ] = attrs.field() + """The notebooks to be synced""" + + save: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether save notification should be forwarded to + the server. Will only be honored if mode === `notebook`.""" + + +@attrs.define +class NotebookDocumentSyncRegistrationOptionsNotebookSelectorType1CellsType: + language: str = attrs.field(validator=attrs.validators.instance_of(str)) + + +@attrs.define +class NotebookDocumentSyncRegistrationOptionsNotebookSelectorType1: + notebook: Union[str, NotebookDocumentFilter] = attrs.field() + """The notebook to be synced If a string + value is provided it matches against the + notebook type. '*' matches every notebook.""" + + cells: Optional[ + List["NotebookDocumentSyncRegistrationOptionsNotebookSelectorType1CellsType"] + ] = attrs.field(default=None) + """The cells of the matching notebook to be synced.""" + + +@attrs.define +class NotebookDocumentSyncRegistrationOptionsNotebookSelectorType2CellsType: + language: str = attrs.field(validator=attrs.validators.instance_of(str)) + + +@attrs.define +class NotebookDocumentSyncRegistrationOptionsNotebookSelectorType2: + cells: List[ + "NotebookDocumentSyncRegistrationOptionsNotebookSelectorType2CellsType" + ] = attrs.field() + """The cells of the matching notebook to be synced.""" + + notebook: Optional[Union[str, NotebookDocumentFilter]] = attrs.field(default=None) + """The notebook to be synced If a string + value is provided it matches against the + notebook type. '*' matches every notebook.""" + + +@attrs.define +class NotebookDocumentSyncRegistrationOptions: + """Registration options specific to a notebook. + + @since 3.17.0""" + + # Since: 3.17.0 + + notebook_selector: List[ + Union[ + "NotebookDocumentSyncRegistrationOptionsNotebookSelectorType1", + "NotebookDocumentSyncRegistrationOptionsNotebookSelectorType2", + ] + ] = attrs.field() + """The notebooks to be synced""" + + save: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether save notification should be forwarded to + the server. Will only be honored if mode === `notebook`.""" + + id: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The id used to register the request. The id can be used to deregister + the request again. See also Registration#id.""" + + +@attrs.define +class WorkspaceFoldersServerCapabilities: + supported: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The server has support for workspace folders""" + + change_notifications: Optional[Union[str, bool]] = attrs.field(default=None) + """Whether the server wants to receive workspace folder + change notifications. + + If a string is provided the string is treated as an ID + under which the notification is registered on the client + side. The ID can be used to unregister for these events + using the `client/unregisterCapability` request.""" + + +@attrs.define +class FileOperationOptions: + """Options for notifications/requests for user operations on files. + + @since 3.16.0""" + + # Since: 3.16.0 + + did_create: Optional[FileOperationRegistrationOptions] = attrs.field(default=None) + """The server is interested in receiving didCreateFiles notifications.""" + + will_create: Optional[FileOperationRegistrationOptions] = attrs.field(default=None) + """The server is interested in receiving willCreateFiles requests.""" + + did_rename: Optional[FileOperationRegistrationOptions] = attrs.field(default=None) + """The server is interested in receiving didRenameFiles notifications.""" + + will_rename: Optional[FileOperationRegistrationOptions] = attrs.field(default=None) + """The server is interested in receiving willRenameFiles requests.""" + + did_delete: Optional[FileOperationRegistrationOptions] = attrs.field(default=None) + """The server is interested in receiving didDeleteFiles file notifications.""" + + will_delete: Optional[FileOperationRegistrationOptions] = attrs.field(default=None) + """The server is interested in receiving willDeleteFiles file requests.""" + + +@attrs.define +class CodeDescription: + """Structure to capture a description for an error code. + + @since 3.16.0""" + + # Since: 3.16.0 + + href: str = attrs.field(validator=attrs.validators.instance_of(str)) + """An URI to open with more information about the diagnostic error.""" + + +@attrs.define +class DiagnosticRelatedInformation: + """Represents a related message and source code location for a diagnostic. This should be + used to point to code locations that cause or related to a diagnostics, e.g when duplicating + a symbol in a scope.""" + + location: Location = attrs.field() + """The location of this related diagnostic information.""" + + message: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The message of this related diagnostic information.""" + + +@attrs.define +class ParameterInformation: + """Represents a parameter of a callable-signature. A parameter can + have a label and a doc-comment.""" + + label: Union[str, Tuple[int, int]] = attrs.field() + """The label of this parameter information. + + Either a string or an inclusive start and exclusive end offsets within its containing + signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 + string representation as `Position` and `Range` does. + + *Note*: a label of type string should be a substring of its containing signature label. + Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.""" + + documentation: Optional[Union[str, MarkupContent]] = attrs.field(default=None) + """The human-readable doc-comment of this parameter. Will be shown + in the UI but can be omitted.""" + + +@attrs.define +class NotebookCellTextDocumentFilter: + """A notebook cell text document filter denotes a cell text + document by different properties. + + @since 3.17.0""" + + # Since: 3.17.0 + + notebook: Union[str, NotebookDocumentFilter] = attrs.field() + """A filter that matches against the notebook + containing the notebook cell. If a string + value is provided it matches against the + notebook type. '*' matches every notebook.""" + + language: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """A language id like `python`. + + Will be matched against the language id of the + notebook cell document. '*' matches every language.""" + + +@attrs.define +class FileOperationPatternOptions: + """Matching options for the file operation pattern. + + @since 3.16.0""" + + # Since: 3.16.0 + + ignore_case: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The pattern should be matched ignoring casing.""" + + +@attrs.define +class ExecutionSummary: + execution_order: int = attrs.field(validator=validators.uinteger_validator) + """A strict monotonically increasing value + indicating the execution order of a cell + inside a notebook.""" + + success: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the execution was successful or + not if known by the client.""" + + +@attrs.define +class WorkspaceClientCapabilities: + """Workspace specific client capabilities.""" + + apply_edit: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports applying batch edits + to the workspace by supporting the request + 'workspace/applyEdit'""" + + workspace_edit: Optional["WorkspaceEditClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to `WorkspaceEdit`s.""" + + did_change_configuration: Optional[ + "DidChangeConfigurationClientCapabilities" + ] = attrs.field(default=None) + """Capabilities specific to the `workspace/didChangeConfiguration` notification.""" + + did_change_watched_files: Optional[ + "DidChangeWatchedFilesClientCapabilities" + ] = attrs.field(default=None) + """Capabilities specific to the `workspace/didChangeWatchedFiles` notification.""" + + symbol: Optional["WorkspaceSymbolClientCapabilities"] = attrs.field(default=None) + """Capabilities specific to the `workspace/symbol` request.""" + + execute_command: Optional["ExecuteCommandClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the `workspace/executeCommand` request.""" + + workspace_folders: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client has support for workspace folders. + + @since 3.6.0""" + # Since: 3.6.0 + + configuration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports `workspace/configuration` requests. + + @since 3.6.0""" + # Since: 3.6.0 + + semantic_tokens: Optional[ + "SemanticTokensWorkspaceClientCapabilities" + ] = attrs.field(default=None) + """Capabilities specific to the semantic token requests scoped to the + workspace. + + @since 3.16.0.""" + # Since: 3.16.0. + + code_lens: Optional["CodeLensWorkspaceClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the code lens requests scoped to the + workspace. + + @since 3.16.0.""" + # Since: 3.16.0. + + file_operations: Optional["FileOperationClientCapabilities"] = attrs.field( + default=None + ) + """The client has support for file notifications/requests for user operations on files. + + Since 3.16.0""" + + inline_value: Optional["InlineValueWorkspaceClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the inline values requests scoped to the + workspace. + + @since 3.17.0.""" + # Since: 3.17.0. + + inlay_hint: Optional["InlayHintWorkspaceClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the inlay hint requests scoped to the + workspace. + + @since 3.17.0.""" + # Since: 3.17.0. + + diagnostics: Optional["DiagnosticWorkspaceClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the diagnostic requests scoped to the + workspace. + + @since 3.17.0.""" + # Since: 3.17.0. + + folding_range: Optional["FoldingRangeWorkspaceClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the folding range requests scoped to the workspace. + + @since 3.18.0 + @proposed""" + # Since: 3.18.0 + # Proposed + + +@attrs.define +class TextDocumentClientCapabilities: + """Text document specific client capabilities.""" + + synchronization: Optional["TextDocumentSyncClientCapabilities"] = attrs.field( + default=None + ) + """Defines which synchronization capabilities the client supports.""" + + completion: Optional["CompletionClientCapabilities"] = attrs.field(default=None) + """Capabilities specific to the `textDocument/completion` request.""" + + hover: Optional["HoverClientCapabilities"] = attrs.field(default=None) + """Capabilities specific to the `textDocument/hover` request.""" + + signature_help: Optional["SignatureHelpClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the `textDocument/signatureHelp` request.""" + + declaration: Optional["DeclarationClientCapabilities"] = attrs.field(default=None) + """Capabilities specific to the `textDocument/declaration` request. + + @since 3.14.0""" + # Since: 3.14.0 + + definition: Optional["DefinitionClientCapabilities"] = attrs.field(default=None) + """Capabilities specific to the `textDocument/definition` request.""" + + type_definition: Optional["TypeDefinitionClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the `textDocument/typeDefinition` request. + + @since 3.6.0""" + # Since: 3.6.0 + + implementation: Optional["ImplementationClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the `textDocument/implementation` request. + + @since 3.6.0""" + # Since: 3.6.0 + + references: Optional["ReferenceClientCapabilities"] = attrs.field(default=None) + """Capabilities specific to the `textDocument/references` request.""" + + document_highlight: Optional["DocumentHighlightClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the `textDocument/documentHighlight` request.""" + + document_symbol: Optional["DocumentSymbolClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the `textDocument/documentSymbol` request.""" + + code_action: Optional["CodeActionClientCapabilities"] = attrs.field(default=None) + """Capabilities specific to the `textDocument/codeAction` request.""" + + code_lens: Optional["CodeLensClientCapabilities"] = attrs.field(default=None) + """Capabilities specific to the `textDocument/codeLens` request.""" + + document_link: Optional["DocumentLinkClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the `textDocument/documentLink` request.""" + + color_provider: Optional["DocumentColorClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the `textDocument/documentColor` and the + `textDocument/colorPresentation` request. + + @since 3.6.0""" + # Since: 3.6.0 + + formatting: Optional["DocumentFormattingClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the `textDocument/formatting` request.""" + + range_formatting: Optional[ + "DocumentRangeFormattingClientCapabilities" + ] = attrs.field(default=None) + """Capabilities specific to the `textDocument/rangeFormatting` request.""" + + on_type_formatting: Optional[ + "DocumentOnTypeFormattingClientCapabilities" + ] = attrs.field(default=None) + """Capabilities specific to the `textDocument/onTypeFormatting` request.""" + + rename: Optional["RenameClientCapabilities"] = attrs.field(default=None) + """Capabilities specific to the `textDocument/rename` request.""" + + folding_range: Optional["FoldingRangeClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the `textDocument/foldingRange` request. + + @since 3.10.0""" + # Since: 3.10.0 + + selection_range: Optional["SelectionRangeClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the `textDocument/selectionRange` request. + + @since 3.15.0""" + # Since: 3.15.0 + + publish_diagnostics: Optional["PublishDiagnosticsClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the `textDocument/publishDiagnostics` notification.""" + + call_hierarchy: Optional["CallHierarchyClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the various call hierarchy requests. + + @since 3.16.0""" + # Since: 3.16.0 + + semantic_tokens: Optional["SemanticTokensClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the various semantic token request. + + @since 3.16.0""" + # Since: 3.16.0 + + linked_editing_range: Optional[ + "LinkedEditingRangeClientCapabilities" + ] = attrs.field(default=None) + """Capabilities specific to the `textDocument/linkedEditingRange` request. + + @since 3.16.0""" + # Since: 3.16.0 + + moniker: Optional["MonikerClientCapabilities"] = attrs.field(default=None) + """Client capabilities specific to the `textDocument/moniker` request. + + @since 3.16.0""" + # Since: 3.16.0 + + type_hierarchy: Optional["TypeHierarchyClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the various type hierarchy requests. + + @since 3.17.0""" + # Since: 3.17.0 + + inline_value: Optional["InlineValueClientCapabilities"] = attrs.field(default=None) + """Capabilities specific to the `textDocument/inlineValue` request. + + @since 3.17.0""" + # Since: 3.17.0 + + inlay_hint: Optional["InlayHintClientCapabilities"] = attrs.field(default=None) + """Capabilities specific to the `textDocument/inlayHint` request. + + @since 3.17.0""" + # Since: 3.17.0 + + diagnostic: Optional["DiagnosticClientCapabilities"] = attrs.field(default=None) + """Capabilities specific to the diagnostic pull model. + + @since 3.17.0""" + # Since: 3.17.0 + + inline_completion: Optional["InlineCompletionClientCapabilities"] = attrs.field( + default=None + ) + """Client capabilities specific to inline completions. + + @since 3.18.0 + @proposed""" + # Since: 3.18.0 + # Proposed + + +@attrs.define +class NotebookDocumentClientCapabilities: + """Capabilities specific to the notebook document support. + + @since 3.17.0""" + + # Since: 3.17.0 + + synchronization: "NotebookDocumentSyncClientCapabilities" = attrs.field() + """Capabilities specific to notebook document synchronization + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class WindowClientCapabilities: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """It indicates whether the client supports server initiated + progress using the `window/workDoneProgress/create` request. + + The capability also controls Whether client supports handling + of progress notifications. If set servers are allowed to report a + `workDoneProgress` property in the request specific server + capabilities. + + @since 3.15.0""" + # Since: 3.15.0 + + show_message: Optional["ShowMessageRequestClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the showMessage request. + + @since 3.16.0""" + # Since: 3.16.0 + + show_document: Optional["ShowDocumentClientCapabilities"] = attrs.field( + default=None + ) + """Capabilities specific to the showDocument request. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class GeneralClientCapabilitiesStaleRequestSupportType: + cancel: bool = attrs.field(validator=attrs.validators.instance_of(bool)) + """The client will actively cancel the request.""" + + retry_on_content_modified: List[str] = attrs.field() + """The list of requests for which the client + will retry the request if it receives a + response with error code `ContentModified`""" + + +@attrs.define +class GeneralClientCapabilities: + """General client capabilities. + + @since 3.16.0""" + + # Since: 3.16.0 + + stale_request_support: Optional[ + "GeneralClientCapabilitiesStaleRequestSupportType" + ] = attrs.field(default=None) + """Client capability that signals how the client + handles stale requests (e.g. a request + for which the client will not process the response + anymore since the information is outdated). + + @since 3.17.0""" + # Since: 3.17.0 + + regular_expressions: Optional["RegularExpressionsClientCapabilities"] = attrs.field( + default=None + ) + """Client capabilities specific to regular expressions. + + @since 3.16.0""" + # Since: 3.16.0 + + markdown: Optional["MarkdownClientCapabilities"] = attrs.field(default=None) + """Client capabilities specific to the client's markdown parser. + + @since 3.16.0""" + # Since: 3.16.0 + + position_encodings: Optional[List[Union[PositionEncodingKind, str]]] = attrs.field( + default=None + ) + """The position encodings supported by the client. Client and server + have to agree on the same position encoding to ensure that offsets + (e.g. character position in a line) are interpreted the same on both + sides. + + To keep the protocol backwards compatible the following applies: if + the value 'utf-16' is missing from the array of position encodings + servers can assume that the client supports UTF-16. UTF-16 is + therefore a mandatory encoding. + + If omitted it defaults to ['utf-16']. + + Implementation considerations: since the conversion from one encoding + into another requires the content of the file / line the conversion + is best done where the file is read which is usually on the server + side. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class RelativePattern: + """A relative pattern is a helper to construct glob patterns that are matched + relatively to a base URI. The common value for a `baseUri` is a workspace + folder root, but it can be another absolute URI as well. + + @since 3.17.0""" + + # Since: 3.17.0 + + base_uri: Union[WorkspaceFolder, str] = attrs.field() + """A workspace folder or a base URI to which this pattern will be matched + against relatively.""" + + pattern: Pattern = attrs.field() + """The actual glob pattern;""" + + +@attrs.define +class WorkspaceEditClientCapabilitiesChangeAnnotationSupportType: + groups_on_label: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client groups edits with equal labels into tree nodes, + for instance all edits labelled with "Changes in Strings" would + be a tree node.""" + + +@attrs.define +class WorkspaceEditClientCapabilities: + document_changes: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports versioned document changes in `WorkspaceEdit`s""" + + resource_operations: Optional[List[ResourceOperationKind]] = attrs.field( + default=None + ) + """The resource operations the client supports. Clients should at least + support 'create', 'rename' and 'delete' files and folders. + + @since 3.13.0""" + # Since: 3.13.0 + + failure_handling: Optional[FailureHandlingKind] = attrs.field(default=None) + """The failure handling strategy of a client if applying the workspace edit + fails. + + @since 3.13.0""" + # Since: 3.13.0 + + normalizes_line_endings: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client normalizes line endings to the client specific + setting. + If set to `true` the client will normalize line ending characters + in a workspace edit to the client-specified new line + character. + + @since 3.16.0""" + # Since: 3.16.0 + + change_annotation_support: Optional[ + "WorkspaceEditClientCapabilitiesChangeAnnotationSupportType" + ] = attrs.field(default=None) + """Whether the client in general supports change annotations on text edits, + create file, rename file and delete file changes. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class DidChangeConfigurationClientCapabilities: + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Did change configuration notification supports dynamic registration.""" + + +@attrs.define +class DidChangeWatchedFilesClientCapabilities: + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Did change watched files notification supports dynamic registration. Please note + that the current protocol doesn't support static configuration for file changes + from the server side.""" + + relative_pattern_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client has support for {@link RelativePattern relative pattern} + or not. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class WorkspaceSymbolClientCapabilitiesSymbolKindType: + value_set: Optional[List[SymbolKind]] = attrs.field(default=None) + """The symbol kind values the client supports. When this + property exists the client also guarantees that it will + handle values outside its set gracefully and falls back + to a default value when unknown. + + If this property is not present the client only supports + the symbol kinds from `File` to `Array` as defined in + the initial version of the protocol.""" + + +@attrs.define +class WorkspaceSymbolClientCapabilitiesTagSupportType: + value_set: List[SymbolTag] = attrs.field() + """The tags supported by the client.""" + + +@attrs.define +class WorkspaceSymbolClientCapabilitiesResolveSupportType: + properties: List[str] = attrs.field() + """The properties that a client can resolve lazily. Usually + `location.range`""" + + +@attrs.define +class WorkspaceSymbolClientCapabilities: + """Client capabilities for a {@link WorkspaceSymbolRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Symbol request supports dynamic registration.""" + + symbol_kind: Optional[ + "WorkspaceSymbolClientCapabilitiesSymbolKindType" + ] = attrs.field(default=None) + """Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.""" + + tag_support: Optional[ + "WorkspaceSymbolClientCapabilitiesTagSupportType" + ] = attrs.field(default=None) + """The client supports tags on `SymbolInformation`. + Clients supporting tags have to handle unknown tags gracefully. + + @since 3.16.0""" + # Since: 3.16.0 + + resolve_support: Optional[ + "WorkspaceSymbolClientCapabilitiesResolveSupportType" + ] = attrs.field(default=None) + """The client support partial workspace symbols. The client will send the + request `workspaceSymbol/resolve` to the server to resolve additional + properties. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class ExecuteCommandClientCapabilities: + """The client capabilities of a {@link ExecuteCommandRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Execute command supports dynamic registration.""" + + +@attrs.define +class SemanticTokensWorkspaceClientCapabilities: + """@since 3.16.0""" + + # Since: 3.16.0 + + refresh_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client implementation supports a refresh request sent from + the server to the client. + + Note that this event is global and will force the client to refresh all + semantic tokens currently shown. It should be used with absolute care + and is useful for situation where a server for example detects a project + wide change that requires such a calculation.""" + + +@attrs.define +class CodeLensWorkspaceClientCapabilities: + """@since 3.16.0""" + + # Since: 3.16.0 + + refresh_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client implementation supports a refresh request sent from the + server to the client. + + Note that this event is global and will force the client to refresh all + code lenses currently shown. It should be used with absolute care and is + useful for situation where a server for example detect a project wide + change that requires such a calculation.""" + + +@attrs.define +class FileOperationClientCapabilities: + """Capabilities relating to events from file operations by the user in the client. + + These events do not come from the file system, they come from user operations + like renaming a file in the UI. + + @since 3.16.0""" + + # Since: 3.16.0 + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client supports dynamic registration for file requests/notifications.""" + + did_create: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client has support for sending didCreateFiles notifications.""" + + will_create: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client has support for sending willCreateFiles requests.""" + + did_rename: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client has support for sending didRenameFiles notifications.""" + + will_rename: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client has support for sending willRenameFiles requests.""" + + did_delete: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client has support for sending didDeleteFiles notifications.""" + + will_delete: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client has support for sending willDeleteFiles requests.""" + + +@attrs.define +class InlineValueWorkspaceClientCapabilities: + """Client workspace capabilities specific to inline values. + + @since 3.17.0""" + + # Since: 3.17.0 + + refresh_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client implementation supports a refresh request sent from the + server to the client. + + Note that this event is global and will force the client to refresh all + inline values currently shown. It should be used with absolute care and is + useful for situation where a server for example detects a project wide + change that requires such a calculation.""" + + +@attrs.define +class InlayHintWorkspaceClientCapabilities: + """Client workspace capabilities specific to inlay hints. + + @since 3.17.0""" + + # Since: 3.17.0 + + refresh_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client implementation supports a refresh request sent from + the server to the client. + + Note that this event is global and will force the client to refresh all + inlay hints currently shown. It should be used with absolute care and + is useful for situation where a server for example detects a project wide + change that requires such a calculation.""" + + +@attrs.define +class DiagnosticWorkspaceClientCapabilities: + """Workspace client capabilities specific to diagnostic pull requests. + + @since 3.17.0""" + + # Since: 3.17.0 + + refresh_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client implementation supports a refresh request sent from + the server to the client. + + Note that this event is global and will force the client to refresh all + pulled diagnostics currently shown. It should be used with absolute care and + is useful for situation where a server for example detects a project wide + change that requires such a calculation.""" + + +@attrs.define +class FoldingRangeWorkspaceClientCapabilities: + """Client workspace capabilities specific to folding ranges + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + + refresh_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client implementation supports a refresh request sent from the + server to the client. + + Note that this event is global and will force the client to refresh all + folding ranges currently shown. It should be used with absolute care and is + useful for situation where a server for example detects a project wide + change that requires such a calculation. + + @since 3.18.0 + @proposed""" + # Since: 3.18.0 + # Proposed + + +@attrs.define +class TextDocumentSyncClientCapabilities: + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether text document synchronization supports dynamic registration.""" + + will_save: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports sending will save notifications.""" + + will_save_wait_until: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports sending a will save request and + waits for a response providing text edits which will + be applied to the document before it is saved.""" + + did_save: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports did save notifications.""" + + +@attrs.define +class CompletionClientCapabilitiesCompletionItemTypeTagSupportType: + value_set: List[CompletionItemTag] = attrs.field() + """The tags supported by the client.""" + + +@attrs.define +class CompletionClientCapabilitiesCompletionItemTypeResolveSupportType: + properties: List[str] = attrs.field() + """The properties that a client can resolve lazily.""" + + +@attrs.define +class CompletionClientCapabilitiesCompletionItemTypeInsertTextModeSupportType: + value_set: List[InsertTextMode] = attrs.field() + + +@attrs.define +class CompletionClientCapabilitiesCompletionItemType: + snippet_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Client supports snippets as insert text. + + A snippet can define tab stops and placeholders with `$1`, `$2` + and `${3:foo}`. `$0` defines the final tab stop, it defaults to + the end of the snippet. Placeholders with equal identifiers are linked, + that is typing in one will update others too.""" + + commit_characters_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Client supports commit characters on a completion item.""" + + documentation_format: Optional[List[MarkupKind]] = attrs.field(default=None) + """Client supports the following content formats for the documentation + property. The order describes the preferred format of the client.""" + + deprecated_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Client supports the deprecated property on a completion item.""" + + preselect_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Client supports the preselect property on a completion item.""" + + tag_support: Optional[ + "CompletionClientCapabilitiesCompletionItemTypeTagSupportType" + ] = attrs.field(default=None) + """Client supports the tag property on a completion item. Clients supporting + tags have to handle unknown tags gracefully. Clients especially need to + preserve unknown tags when sending a completion item back to the server in + a resolve call. + + @since 3.15.0""" + # Since: 3.15.0 + + insert_replace_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Client support insert replace edit to control different behavior if a + completion item is inserted in the text or should replace text. + + @since 3.16.0""" + # Since: 3.16.0 + + resolve_support: Optional[ + "CompletionClientCapabilitiesCompletionItemTypeResolveSupportType" + ] = attrs.field(default=None) + """Indicates which properties a client can resolve lazily on a completion + item. Before version 3.16.0 only the predefined properties `documentation` + and `details` could be resolved lazily. + + @since 3.16.0""" + # Since: 3.16.0 + + insert_text_mode_support: Optional[ + "CompletionClientCapabilitiesCompletionItemTypeInsertTextModeSupportType" + ] = attrs.field(default=None) + """The client supports the `insertTextMode` property on + a completion item to override the whitespace handling mode + as defined by the client (see `insertTextMode`). + + @since 3.16.0""" + # Since: 3.16.0 + + label_details_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client has support for completion item label + details (see also `CompletionItemLabelDetails`). + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class CompletionClientCapabilitiesCompletionItemKindType: + value_set: Optional[List[CompletionItemKind]] = attrs.field(default=None) + """The completion item kind values the client supports. When this + property exists the client also guarantees that it will + handle values outside its set gracefully and falls back + to a default value when unknown. + + If this property is not present the client only supports + the completion items kinds from `Text` to `Reference` as defined in + the initial version of the protocol.""" + + +@attrs.define +class CompletionClientCapabilitiesCompletionListType: + item_defaults: Optional[List[str]] = attrs.field(default=None) + """The client supports the following itemDefaults on + a completion list. + + The value lists the supported property names of the + `CompletionList.itemDefaults` object. If omitted + no properties are supported. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class CompletionClientCapabilities: + """Completion client capabilities""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether completion supports dynamic registration.""" + + completion_item: Optional[ + "CompletionClientCapabilitiesCompletionItemType" + ] = attrs.field(default=None) + """The client supports the following `CompletionItem` specific + capabilities.""" + + completion_item_kind: Optional[ + "CompletionClientCapabilitiesCompletionItemKindType" + ] = attrs.field(default=None) + + insert_text_mode: Optional[InsertTextMode] = attrs.field(default=None) + """Defines how the client handles whitespace and indentation + when accepting a completion item that uses multi line + text in either `insertText` or `textEdit`. + + @since 3.17.0""" + # Since: 3.17.0 + + context_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports to send additional context information for a + `textDocument/completion` request.""" + + completion_list: Optional[ + "CompletionClientCapabilitiesCompletionListType" + ] = attrs.field(default=None) + """The client supports the following `CompletionList` specific + capabilities. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class HoverClientCapabilities: + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether hover supports dynamic registration.""" + + content_format: Optional[List[MarkupKind]] = attrs.field(default=None) + """Client supports the following content formats for the content + property. The order describes the preferred format of the client.""" + + +@attrs.define +class SignatureHelpClientCapabilitiesSignatureInformationTypeParameterInformationType: + label_offset_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports processing label offsets instead of a + simple label string. + + @since 3.14.0""" + # Since: 3.14.0 + + +@attrs.define +class SignatureHelpClientCapabilitiesSignatureInformationType: + documentation_format: Optional[List[MarkupKind]] = attrs.field(default=None) + """Client supports the following content formats for the documentation + property. The order describes the preferred format of the client.""" + + parameter_information: Optional[ + "SignatureHelpClientCapabilitiesSignatureInformationTypeParameterInformationType" + ] = attrs.field(default=None) + """Client capabilities specific to parameter information.""" + + active_parameter_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports the `activeParameter` property on `SignatureInformation` + literal. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class SignatureHelpClientCapabilities: + """Client Capabilities for a {@link SignatureHelpRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether signature help supports dynamic registration.""" + + signature_information: Optional[ + "SignatureHelpClientCapabilitiesSignatureInformationType" + ] = attrs.field(default=None) + """The client supports the following `SignatureInformation` + specific properties.""" + + context_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports to send additional context information for a + `textDocument/signatureHelp` request. A client that opts into + contextSupport will also support the `retriggerCharacters` on + `SignatureHelpOptions`. + + @since 3.15.0""" + # Since: 3.15.0 + + +@attrs.define +class DeclarationClientCapabilities: + """@since 3.14.0""" + + # Since: 3.14.0 + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether declaration supports dynamic registration. If this is set to `true` + the client supports the new `DeclarationRegistrationOptions` return value + for the corresponding server capability as well.""" + + link_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports additional metadata in the form of declaration links.""" + + +@attrs.define +class DefinitionClientCapabilities: + """Client Capabilities for a {@link DefinitionRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether definition supports dynamic registration.""" + + link_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports additional metadata in the form of definition links. + + @since 3.14.0""" + # Since: 3.14.0 + + +@attrs.define +class TypeDefinitionClientCapabilities: + """Since 3.6.0""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration. If this is set to `true` + the client supports the new `TypeDefinitionRegistrationOptions` return value + for the corresponding server capability as well.""" + + link_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports additional metadata in the form of definition links. + + Since 3.14.0""" + + +@attrs.define +class ImplementationClientCapabilities: + """@since 3.6.0""" + + # Since: 3.6.0 + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration. If this is set to `true` + the client supports the new `ImplementationRegistrationOptions` return value + for the corresponding server capability as well.""" + + link_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports additional metadata in the form of definition links. + + @since 3.14.0""" + # Since: 3.14.0 + + +@attrs.define +class ReferenceClientCapabilities: + """Client Capabilities for a {@link ReferencesRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether references supports dynamic registration.""" + + +@attrs.define +class DocumentHighlightClientCapabilities: + """Client Capabilities for a {@link DocumentHighlightRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether document highlight supports dynamic registration.""" + + +@attrs.define +class DocumentSymbolClientCapabilitiesSymbolKindType: + value_set: Optional[List[SymbolKind]] = attrs.field(default=None) + """The symbol kind values the client supports. When this + property exists the client also guarantees that it will + handle values outside its set gracefully and falls back + to a default value when unknown. + + If this property is not present the client only supports + the symbol kinds from `File` to `Array` as defined in + the initial version of the protocol.""" + + +@attrs.define +class DocumentSymbolClientCapabilitiesTagSupportType: + value_set: List[SymbolTag] = attrs.field() + """The tags supported by the client.""" + + +@attrs.define +class DocumentSymbolClientCapabilities: + """Client Capabilities for a {@link DocumentSymbolRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether document symbol supports dynamic registration.""" + + symbol_kind: Optional[ + "DocumentSymbolClientCapabilitiesSymbolKindType" + ] = attrs.field(default=None) + """Specific capabilities for the `SymbolKind` in the + `textDocument/documentSymbol` request.""" + + hierarchical_document_symbol_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports hierarchical document symbols.""" + + tag_support: Optional[ + "DocumentSymbolClientCapabilitiesTagSupportType" + ] = attrs.field(default=None) + """The client supports tags on `SymbolInformation`. Tags are supported on + `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true. + Clients supporting tags have to handle unknown tags gracefully. + + @since 3.16.0""" + # Since: 3.16.0 + + label_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports an additional label presented in the UI when + registering a document symbol provider. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class CodeActionClientCapabilitiesCodeActionLiteralSupportTypeCodeActionKindType: + value_set: List[Union[CodeActionKind, str]] = attrs.field() + """The code action kind values the client supports. When this + property exists the client also guarantees that it will + handle values outside its set gracefully and falls back + to a default value when unknown.""" + + +@attrs.define +class CodeActionClientCapabilitiesCodeActionLiteralSupportType: + code_action_kind: "CodeActionClientCapabilitiesCodeActionLiteralSupportTypeCodeActionKindType" = ( + attrs.field() + ) + """The code action kind is support with the following value + set.""" + + +@attrs.define +class CodeActionClientCapabilitiesResolveSupportType: + properties: List[str] = attrs.field() + """The properties that a client can resolve lazily.""" + + +@attrs.define +class CodeActionClientCapabilities: + """The Client Capabilities of a {@link CodeActionRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether code action supports dynamic registration.""" + + code_action_literal_support: Optional[ + "CodeActionClientCapabilitiesCodeActionLiteralSupportType" + ] = attrs.field(default=None) + """The client support code action literals of type `CodeAction` as a valid + response of the `textDocument/codeAction` request. If the property is not + set the request can only return `Command` literals. + + @since 3.8.0""" + # Since: 3.8.0 + + is_preferred_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether code action supports the `isPreferred` property. + + @since 3.15.0""" + # Since: 3.15.0 + + disabled_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether code action supports the `disabled` property. + + @since 3.16.0""" + # Since: 3.16.0 + + data_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether code action supports the `data` property which is + preserved between a `textDocument/codeAction` and a + `codeAction/resolve` request. + + @since 3.16.0""" + # Since: 3.16.0 + + resolve_support: Optional[ + "CodeActionClientCapabilitiesResolveSupportType" + ] = attrs.field(default=None) + """Whether the client supports resolving additional code action + properties via a separate `codeAction/resolve` request. + + @since 3.16.0""" + # Since: 3.16.0 + + honors_change_annotations: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client honors the change annotations in + text edits and resource operations returned via the + `CodeAction#edit` property by for example presenting + the workspace edit in the user interface and asking + for confirmation. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class CodeLensClientCapabilities: + """The client capabilities of a {@link CodeLensRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether code lens supports dynamic registration.""" + + +@attrs.define +class DocumentLinkClientCapabilities: + """The client capabilities of a {@link DocumentLinkRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether document link supports dynamic registration.""" + + tooltip_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client supports the `tooltip` property on `DocumentLink`. + + @since 3.15.0""" + # Since: 3.15.0 + + +@attrs.define +class DocumentColorClientCapabilities: + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration. If this is set to `true` + the client supports the new `DocumentColorRegistrationOptions` return value + for the corresponding server capability as well.""" + + +@attrs.define +class DocumentFormattingClientCapabilities: + """Client capabilities of a {@link DocumentFormattingRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether formatting supports dynamic registration.""" + + +@attrs.define +class DocumentRangeFormattingClientCapabilities: + """Client capabilities of a {@link DocumentRangeFormattingRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether range formatting supports dynamic registration.""" + + ranges_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client supports formatting multiple ranges at once. + + @since 3.18.0 + @proposed""" + # Since: 3.18.0 + # Proposed + + +@attrs.define +class DocumentOnTypeFormattingClientCapabilities: + """Client capabilities of a {@link DocumentOnTypeFormattingRequest}.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether on type formatting supports dynamic registration.""" + + +@attrs.define +class RenameClientCapabilities: + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether rename supports dynamic registration.""" + + prepare_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Client supports testing for validity of rename operations + before execution. + + @since 3.12.0""" + # Since: 3.12.0 + + prepare_support_default_behavior: Optional[ + PrepareSupportDefaultBehavior + ] = attrs.field(default=None) + """Client supports the default behavior result. + + The value indicates the default behavior used by the + client. + + @since 3.16.0""" + # Since: 3.16.0 + + honors_change_annotations: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client honors the change annotations in + text edits and resource operations returned via the + rename request's workspace edit by for example presenting + the workspace edit in the user interface and asking + for confirmation. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class FoldingRangeClientCapabilitiesFoldingRangeKindType: + value_set: Optional[List[Union[FoldingRangeKind, str]]] = attrs.field(default=None) + """The folding range kind values the client supports. When this + property exists the client also guarantees that it will + handle values outside its set gracefully and falls back + to a default value when unknown.""" + + +@attrs.define +class FoldingRangeClientCapabilitiesFoldingRangeType: + collapsed_text: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """If set, the client signals that it supports setting collapsedText on + folding ranges to display custom labels instead of the default text. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class FoldingRangeClientCapabilities: + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration for folding range + providers. If this is set to `true` the client supports the new + `FoldingRangeRegistrationOptions` return value for the corresponding + server capability as well.""" + + range_limit: Optional[int] = attrs.field( + validator=attrs.validators.optional(validators.uinteger_validator), default=None + ) + """The maximum number of folding ranges that the client prefers to receive + per document. The value serves as a hint, servers are free to follow the + limit.""" + + line_folding_only: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """If set, the client signals that it only supports folding complete lines. + If set, client will ignore specified `startCharacter` and `endCharacter` + properties in a FoldingRange.""" + + folding_range_kind: Optional[ + "FoldingRangeClientCapabilitiesFoldingRangeKindType" + ] = attrs.field(default=None) + """Specific options for the folding range kind. + + @since 3.17.0""" + # Since: 3.17.0 + + folding_range: Optional[ + "FoldingRangeClientCapabilitiesFoldingRangeType" + ] = attrs.field(default=None) + """Specific options for the folding range. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class SelectionRangeClientCapabilities: + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration for selection range providers. If this is set to `true` + the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server + capability as well.""" + + +@attrs.define +class PublishDiagnosticsClientCapabilitiesTagSupportType: + value_set: List[DiagnosticTag] = attrs.field() + """The tags supported by the client.""" + + +@attrs.define +class PublishDiagnosticsClientCapabilities: + """The publish diagnostic client capabilities.""" + + related_information: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the clients accepts diagnostics with related information.""" + + tag_support: Optional[ + "PublishDiagnosticsClientCapabilitiesTagSupportType" + ] = attrs.field(default=None) + """Client supports the tag property to provide meta data about a diagnostic. + Clients supporting tags have to handle unknown tags gracefully. + + @since 3.15.0""" + # Since: 3.15.0 + + version_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client interprets the version property of the + `textDocument/publishDiagnostics` notification's parameter. + + @since 3.15.0""" + # Since: 3.15.0 + + code_description_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Client supports a codeDescription property + + @since 3.16.0""" + # Since: 3.16.0 + + data_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether code action supports the `data` property which is + preserved between a `textDocument/publishDiagnostics` and + `textDocument/codeAction` request. + + @since 3.16.0""" + # Since: 3.16.0 + + +@attrs.define +class CallHierarchyClientCapabilities: + """@since 3.16.0""" + + # Since: 3.16.0 + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration. If this is set to `true` + the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + return value for the corresponding server capability as well.""" + + +@attrs.define +class SemanticTokensClientCapabilitiesRequestsTypeFullType1: + delta: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client will send the `textDocument/semanticTokens/full/delta` request if + the server provides a corresponding handler.""" + + +@attrs.define +class SemanticTokensClientCapabilitiesRequestsType: + range: Optional[Union[bool, Any]] = attrs.field(default=None) + """The client will send the `textDocument/semanticTokens/range` request if + the server provides a corresponding handler.""" + + full: Optional[ + Union[bool, "SemanticTokensClientCapabilitiesRequestsTypeFullType1"] + ] = attrs.field(default=None) + """The client will send the `textDocument/semanticTokens/full` request if + the server provides a corresponding handler.""" + + +@attrs.define +class SemanticTokensClientCapabilities: + """@since 3.16.0""" + + # Since: 3.16.0 + + requests: "SemanticTokensClientCapabilitiesRequestsType" = attrs.field() + """Which requests the client supports and might send to the server + depending on the server's capability. Please note that clients might not + show semantic tokens or degrade some of the user experience if a range + or full request is advertised by the client but not provided by the + server. If for example the client capability `requests.full` and + `request.range` are both set to true but the server only provides a + range provider the client might not render a minimap correctly or might + even decide to not show any semantic tokens at all.""" + + token_types: List[str] = attrs.field() + """The token types that the client supports.""" + + token_modifiers: List[str] = attrs.field() + """The token modifiers that the client supports.""" + + formats: List[TokenFormat] = attrs.field() + """The token formats the clients supports.""" + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration. If this is set to `true` + the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + return value for the corresponding server capability as well.""" + + overlapping_token_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client supports tokens that can overlap each other.""" + + multiline_token_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client supports tokens that can span multiple lines.""" + + server_cancel_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client allows the server to actively cancel a + semantic token request, e.g. supports returning + LSPErrorCodes.ServerCancelled. If a server does the client + needs to retrigger the request. + + @since 3.17.0""" + # Since: 3.17.0 + + augments_syntax_tokens: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client uses semantic tokens to augment existing + syntax tokens. If set to `true` client side created syntax + tokens and semantic tokens are both used for colorization. If + set to `false` the client only uses the returned semantic tokens + for colorization. + + If the value is `undefined` then the client behavior is not + specified. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class LinkedEditingRangeClientCapabilities: + """Client capabilities for the linked editing range request. + + @since 3.16.0""" + + # Since: 3.16.0 + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration. If this is set to `true` + the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + return value for the corresponding server capability as well.""" + + +@attrs.define +class MonikerClientCapabilities: + """Client capabilities specific to the moniker request. + + @since 3.16.0""" + + # Since: 3.16.0 + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether moniker supports dynamic registration. If this is set to `true` + the client supports the new `MonikerRegistrationOptions` return value + for the corresponding server capability as well.""" + + +@attrs.define +class TypeHierarchyClientCapabilities: + """@since 3.17.0""" + + # Since: 3.17.0 + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration. If this is set to `true` + the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + return value for the corresponding server capability as well.""" + + +@attrs.define +class InlineValueClientCapabilities: + """Client capabilities specific to inline values. + + @since 3.17.0""" + + # Since: 3.17.0 + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration for inline value providers.""" + + +@attrs.define +class InlayHintClientCapabilitiesResolveSupportType: + properties: List[str] = attrs.field() + """The properties that a client can resolve lazily.""" + + +@attrs.define +class InlayHintClientCapabilities: + """Inlay hint client capabilities. + + @since 3.17.0""" + + # Since: 3.17.0 + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether inlay hints support dynamic registration.""" + + resolve_support: Optional[ + "InlayHintClientCapabilitiesResolveSupportType" + ] = attrs.field(default=None) + """Indicates which properties a client can resolve lazily on an inlay + hint.""" + + +@attrs.define +class DiagnosticClientCapabilities: + """Client capabilities specific to diagnostic pull requests. + + @since 3.17.0""" + + # Since: 3.17.0 + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration. If this is set to `true` + the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + return value for the corresponding server capability as well.""" + + related_document_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the clients supports related documents for document diagnostic pulls.""" + + +@attrs.define +class InlineCompletionClientCapabilities: + """Client capabilities specific to inline completions. + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration for inline completion providers.""" + + +@attrs.define +class NotebookDocumentSyncClientCapabilities: + """Notebook specific client capabilities. + + @since 3.17.0""" + + # Since: 3.17.0 + + dynamic_registration: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether implementation supports dynamic registration. If this is + set to `true` the client supports the new + `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + return value for the corresponding server capability as well.""" + + execution_summary_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """The client supports sending execution summary data per cell.""" + + +@attrs.define +class ShowMessageRequestClientCapabilitiesMessageActionItemType: + additional_properties_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Whether the client supports additional attributes which + are preserved and send back to the server in the + request's response.""" + + +@attrs.define +class ShowMessageRequestClientCapabilities: + """Show message request client capabilities""" + + message_action_item: Optional[ + "ShowMessageRequestClientCapabilitiesMessageActionItemType" + ] = attrs.field(default=None) + """Capabilities specific to the `MessageActionItem` type.""" + + +@attrs.define +class ShowDocumentClientCapabilities: + """Client capabilities for the showDocument request. + + @since 3.16.0""" + + # Since: 3.16.0 + + support: bool = attrs.field(validator=attrs.validators.instance_of(bool)) + """The client has support for the showDocument + request.""" + + +@attrs.define +class RegularExpressionsClientCapabilities: + """Client capabilities specific to regular expressions. + + @since 3.16.0""" + + # Since: 3.16.0 + + engine: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The engine's name.""" + + version: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The engine's version.""" + + +@attrs.define +class MarkdownClientCapabilities: + """Client capabilities specific to the used markdown parser. + + @since 3.16.0""" + + # Since: 3.16.0 + + parser: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The name of the parser.""" + + version: Optional[str] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(str)), + default=None, + ) + """The version of the parser.""" + + allowed_tags: Optional[List[str]] = attrs.field(default=None) + """A list of HTML tags that the client allows / supports in + Markdown. + + @since 3.17.0""" + # Since: 3.17.0 + + +@attrs.define +class TextDocumentColorPresentationOptions: + work_done_progress: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + + document_selector: Optional[Union[DocumentSelector, None]] = attrs.field( + default=None + ) + """A document selector to identify the scope of the registration. If set to null + the document selector provided on the client side will be used.""" + + +@attrs.define +class ResponseError: + code: int = attrs.field(validator=validators.integer_validator) + """A number indicating the error type that occurred.""" + message: str = attrs.field(validator=attrs.validators.instance_of(str)) + """A string providing a short description of the error.""" + data: Optional[LSPAny] = attrs.field(default=None) + """A primitive or structured value that contains additional information + about the error. Can be omitted.""" + + +@attrs.define +class ResponseErrorMessage: + id: Optional[Union[int, str]] = attrs.field(default=None) + """The request id where the error occurred.""" + error: Optional[ResponseError] = attrs.field(default=None) + """The error object in case a request fails.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentImplementationRequest: + """A request to resolve the implementation locations of a symbol at a given text + document position. The request's parameter is of type {@link TextDocumentPositionParams} + the response is of type {@link Definition} or a Thenable that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: ImplementationParams = attrs.field() + method: str = "textDocument/implementation" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentImplementationResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[Definition, List[DefinitionLink], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentTypeDefinitionRequest: + """A request to resolve the type definition locations of a symbol at a given text + document position. The request's parameter is of type {@link TextDocumentPositionParams} + the response is of type {@link Definition} or a Thenable that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: TypeDefinitionParams = attrs.field() + method: str = "textDocument/typeDefinition" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentTypeDefinitionResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[Definition, List[DefinitionLink], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceWorkspaceFoldersRequest: + """The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: Optional[None] = attrs.field(default=None) + method: str = "workspace/workspaceFolders" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceWorkspaceFoldersResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[WorkspaceFolder], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +WorkspaceConfigurationParams = ConfigurationParams + + +@attrs.define +class WorkspaceConfigurationRequest: + """The 'workspace/configuration' request is sent from the server to the client to fetch a certain + configuration setting. + + This pull model replaces the old push model were the client signaled configuration change via an + event. If the server still needs to react to configuration changes (since the server caches the + result of `workspace/configuration` requests) the server should register for an empty configuration + change event and empty the cache if such an event is received.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: WorkspaceConfigurationParams = attrs.field() + method: str = "workspace/configuration" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceConfigurationResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: List[LSPAny] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDocumentColorRequest: + """A request to list all color symbols found in a given text document. The request's + parameter is of type {@link DocumentColorParams} the + response is of type {@link ColorInformation ColorInformation[]} or a Thenable + that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DocumentColorParams = attrs.field() + method: str = "textDocument/documentColor" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDocumentColorResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: List[ColorInformation] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentColorPresentationRequest: + """A request to list all presentation for a color. The request's + parameter is of type {@link ColorPresentationParams} the + response is of type {@link ColorInformation ColorInformation[]} or a Thenable + that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: ColorPresentationParams = attrs.field() + method: str = "textDocument/colorPresentation" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentColorPresentationResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: List[ColorPresentation] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentFoldingRangeRequest: + """A request to provide folding ranges in a document. The request's + parameter is of type {@link FoldingRangeParams}, the + response is of type {@link FoldingRangeList} or a Thenable + that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: FoldingRangeParams = attrs.field() + method: str = "textDocument/foldingRange" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentFoldingRangeResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[FoldingRange], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceFoldingRangeRefreshRequest: + """@since 3.18.0 + @proposed""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: Optional[None] = attrs.field(default=None) + method: str = "workspace/foldingRange/refresh" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceFoldingRangeRefreshResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: None = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDeclarationRequest: + """A request to resolve the type definition locations of a symbol at a given text + document position. The request's parameter is of type {@link TextDocumentPositionParams} + the response is of type {@link Declaration} or a typed array of {@link DeclarationLink} + or a Thenable that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DeclarationParams = attrs.field() + method: str = "textDocument/declaration" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDeclarationResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[Declaration, List[DeclarationLink], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentSelectionRangeRequest: + """A request to provide selection ranges in a document. The request's + parameter is of type {@link SelectionRangeParams}, the + response is of type {@link SelectionRange SelectionRange[]} or a Thenable + that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: SelectionRangeParams = attrs.field() + method: str = "textDocument/selectionRange" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentSelectionRangeResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[SelectionRange], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WindowWorkDoneProgressCreateRequest: + """The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress + reporting from the server.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: WorkDoneProgressCreateParams = attrs.field() + method: str = "window/workDoneProgress/create" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WindowWorkDoneProgressCreateResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: None = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentPrepareCallHierarchyRequest: + """A request to result a `CallHierarchyItem` in a document at a given position. + Can be used as an input to an incoming or outgoing call hierarchy. + + @since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: CallHierarchyPrepareParams = attrs.field() + method: str = "textDocument/prepareCallHierarchy" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentPrepareCallHierarchyResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[CallHierarchyItem], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class CallHierarchyIncomingCallsRequest: + """A request to resolve the incoming calls for a given `CallHierarchyItem`. + + @since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: CallHierarchyIncomingCallsParams = attrs.field() + method: str = "callHierarchy/incomingCalls" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class CallHierarchyIncomingCallsResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[CallHierarchyIncomingCall], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class CallHierarchyOutgoingCallsRequest: + """A request to resolve the outgoing calls for a given `CallHierarchyItem`. + + @since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: CallHierarchyOutgoingCallsParams = attrs.field() + method: str = "callHierarchy/outgoingCalls" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class CallHierarchyOutgoingCallsResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[CallHierarchyOutgoingCall], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentSemanticTokensFullRequest: + """@since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: SemanticTokensParams = attrs.field() + method: str = "textDocument/semanticTokens/full" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentSemanticTokensFullResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[SemanticTokens, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentSemanticTokensFullDeltaRequest: + """@since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: SemanticTokensDeltaParams = attrs.field() + method: str = "textDocument/semanticTokens/full/delta" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentSemanticTokensFullDeltaResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[SemanticTokens, SemanticTokensDelta, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentSemanticTokensRangeRequest: + """@since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: SemanticTokensRangeParams = attrs.field() + method: str = "textDocument/semanticTokens/range" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentSemanticTokensRangeResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[SemanticTokens, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceSemanticTokensRefreshRequest: + """@since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: Optional[None] = attrs.field(default=None) + method: str = "workspace/semanticTokens/refresh" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceSemanticTokensRefreshResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: None = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WindowShowDocumentRequest: + """A request to show a document. This request might open an + external program depending on the value of the URI to open. + For example a request to open `https://code.visualstudio.com/` + will very likely open the URI in a WEB browser. + + @since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: ShowDocumentParams = attrs.field() + method: str = "window/showDocument" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WindowShowDocumentResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: ShowDocumentResult = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentLinkedEditingRangeRequest: + """A request to provide ranges that can be edited together. + + @since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: LinkedEditingRangeParams = attrs.field() + method: str = "textDocument/linkedEditingRange" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentLinkedEditingRangeResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[LinkedEditingRanges, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceWillCreateFilesRequest: + """The will create files request is sent from the client to the server before files are actually + created as long as the creation is triggered from within the client. + + The request can return a `WorkspaceEdit` which will be applied to workspace before the + files are created. Hence the `WorkspaceEdit` can not manipulate the content of the file + to be created. + + @since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: CreateFilesParams = attrs.field() + method: str = "workspace/willCreateFiles" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceWillCreateFilesResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[WorkspaceEdit, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceWillRenameFilesRequest: + """The will rename files request is sent from the client to the server before files are actually + renamed as long as the rename is triggered from within the client. + + @since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: RenameFilesParams = attrs.field() + method: str = "workspace/willRenameFiles" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceWillRenameFilesResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[WorkspaceEdit, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceWillDeleteFilesRequest: + """The did delete files notification is sent from the client to the server when + files were deleted from within the client. + + @since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DeleteFilesParams = attrs.field() + method: str = "workspace/willDeleteFiles" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceWillDeleteFilesResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[WorkspaceEdit, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentMonikerRequest: + """A request to get the moniker of a symbol at a given text document position. + The request parameter is of type {@link TextDocumentPositionParams}. + The response is of type {@link Moniker Moniker[]} or `null`.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: MonikerParams = attrs.field() + method: str = "textDocument/moniker" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentMonikerResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[Moniker], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentPrepareTypeHierarchyRequest: + """A request to result a `TypeHierarchyItem` in a document at a given position. + Can be used as an input to a subtypes or supertypes type hierarchy. + + @since 3.17.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: TypeHierarchyPrepareParams = attrs.field() + method: str = "textDocument/prepareTypeHierarchy" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentPrepareTypeHierarchyResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[TypeHierarchyItem], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TypeHierarchySupertypesRequest: + """A request to resolve the supertypes for a given `TypeHierarchyItem`. + + @since 3.17.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: TypeHierarchySupertypesParams = attrs.field() + method: str = "typeHierarchy/supertypes" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TypeHierarchySupertypesResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[TypeHierarchyItem], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TypeHierarchySubtypesRequest: + """A request to resolve the subtypes for a given `TypeHierarchyItem`. + + @since 3.17.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: TypeHierarchySubtypesParams = attrs.field() + method: str = "typeHierarchy/subtypes" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TypeHierarchySubtypesResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[TypeHierarchyItem], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentInlineValueRequest: + """A request to provide inline values in a document. The request's parameter is of + type {@link InlineValueParams}, the response is of type + {@link InlineValue InlineValue[]} or a Thenable that resolves to such. + + @since 3.17.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: InlineValueParams = attrs.field() + method: str = "textDocument/inlineValue" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentInlineValueResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[InlineValue], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceInlineValueRefreshRequest: + """@since 3.17.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: Optional[None] = attrs.field(default=None) + method: str = "workspace/inlineValue/refresh" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceInlineValueRefreshResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: None = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentInlayHintRequest: + """A request to provide inlay hints in a document. The request's parameter is of + type {@link InlayHintsParams}, the response is of type + {@link InlayHint InlayHint[]} or a Thenable that resolves to such. + + @since 3.17.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: InlayHintParams = attrs.field() + method: str = "textDocument/inlayHint" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentInlayHintResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[InlayHint], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class InlayHintResolveRequest: + """A request to resolve additional properties for an inlay hint. + The request's parameter is of type {@link InlayHint}, the response is + of type {@link InlayHint} or a Thenable that resolves to such. + + @since 3.17.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: InlayHint = attrs.field() + method: str = "inlayHint/resolve" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class InlayHintResolveResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: InlayHint = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceInlayHintRefreshRequest: + """@since 3.17.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: Optional[None] = attrs.field(default=None) + method: str = "workspace/inlayHint/refresh" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceInlayHintRefreshResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: None = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDiagnosticRequest: + """The document diagnostic request definition. + + @since 3.17.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DocumentDiagnosticParams = attrs.field() + method: str = "textDocument/diagnostic" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDiagnosticResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: DocumentDiagnosticReport = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceDiagnosticRequest: + """The workspace diagnostic request definition. + + @since 3.17.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: WorkspaceDiagnosticParams = attrs.field() + method: str = "workspace/diagnostic" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceDiagnosticResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: WorkspaceDiagnosticReport = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceDiagnosticRefreshRequest: + """The diagnostic refresh request definition. + + @since 3.17.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: Optional[None] = attrs.field(default=None) + method: str = "workspace/diagnostic/refresh" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceDiagnosticRefreshResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: None = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentInlineCompletionRequest: + """A request to provide inline completions in a document. The request's parameter is of + type {@link InlineCompletionParams}, the response is of type + {@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such. + + @since 3.18.0 + @proposed""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: InlineCompletionParams = attrs.field() + method: str = "textDocument/inlineCompletion" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentInlineCompletionResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[InlineCompletionList, List[InlineCompletionItem], None] = attrs.field( + default=None + ) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class ClientRegisterCapabilityRequest: + """The `client/registerCapability` request is sent from the server to the client to register a new capability + handler on the client side.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: RegistrationParams = attrs.field() + method: str = "client/registerCapability" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class ClientRegisterCapabilityResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: None = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class ClientUnregisterCapabilityRequest: + """The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability + handler on the client side.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: UnregistrationParams = attrs.field() + method: str = "client/unregisterCapability" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class ClientUnregisterCapabilityResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: None = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class InitializeRequest: + """The initialize request is sent from the client to the server. + It is sent once as the request after starting up the server. + The requests parameter is of type {@link InitializeParams} + the response if of type {@link InitializeResult} of a Thenable that + resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: InitializeParams = attrs.field() + method: str = "initialize" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class InitializeResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: InitializeResult = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class ShutdownRequest: + """A shutdown request is sent from the client to the server. + It is sent once when the client decides to shutdown the + server. The only notification that is sent after a shutdown request + is the exit event.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: Optional[None] = attrs.field(default=None) + method: str = "shutdown" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class ShutdownResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: None = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WindowShowMessageRequestRequest: + """The show message request is sent from the server to the client to show a message + and a set of options actions to the user.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: ShowMessageRequestParams = attrs.field() + method: str = "window/showMessageRequest" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WindowShowMessageRequestResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[MessageActionItem, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentWillSaveWaitUntilRequest: + """A document will save request is sent from the client to the server before + the document is actually saved. The request can return an array of TextEdits + which will be applied to the text document before it is saved. Please note that + clients might drop results if computing the text edits took too long or if a + server constantly fails on this request. This is done to keep the save fast and + reliable.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: WillSaveTextDocumentParams = attrs.field() + method: str = "textDocument/willSaveWaitUntil" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentWillSaveWaitUntilResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[TextEdit], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentCompletionRequest: + """Request to request completion at a given text document position. The request's + parameter is of type {@link TextDocumentPosition} the response + is of type {@link CompletionItem CompletionItem[]} or {@link CompletionList} + or a Thenable that resolves to such. + + The request can delay the computation of the {@link CompletionItem.detail `detail`} + and {@link CompletionItem.documentation `documentation`} properties to the `completionItem/resolve` + request. However, properties that are needed for the initial sorting and filtering, like `sortText`, + `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: CompletionParams = attrs.field() + method: str = "textDocument/completion" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentCompletionResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[CompletionItem], CompletionList, None] = attrs.field( + default=None + ) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class CompletionItemResolveRequest: + """Request to resolve additional information for a given completion item.The request's + parameter is of type {@link CompletionItem} the response + is of type {@link CompletionItem} or a Thenable that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: CompletionItem = attrs.field() + method: str = "completionItem/resolve" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class CompletionItemResolveResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: CompletionItem = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentHoverRequest: + """Request to request hover information at a given text document position. The request's + parameter is of type {@link TextDocumentPosition} the response is of + type {@link Hover} or a Thenable that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: HoverParams = attrs.field() + method: str = "textDocument/hover" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentHoverResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[Hover, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentSignatureHelpRequest: + id: Union[int, str] = attrs.field() + """The request id.""" + params: SignatureHelpParams = attrs.field() + method: str = "textDocument/signatureHelp" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentSignatureHelpResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[SignatureHelp, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDefinitionRequest: + """A request to resolve the definition location of a symbol at a given text + document position. The request's parameter is of type {@link TextDocumentPosition} + the response is of either type {@link Definition} or a typed array of + {@link DefinitionLink} or a Thenable that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DefinitionParams = attrs.field() + method: str = "textDocument/definition" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDefinitionResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[Definition, List[DefinitionLink], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentReferencesRequest: + """A request to resolve project-wide references for the symbol denoted + by the given text document position. The request's parameter is of + type {@link ReferenceParams} the response is of type + {@link Location Location[]} or a Thenable that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: ReferenceParams = attrs.field() + method: str = "textDocument/references" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentReferencesResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[Location], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDocumentHighlightRequest: + """Request to resolve a {@link DocumentHighlight} for a given + text document position. The request's parameter is of type {@link TextDocumentPosition} + the request response is an array of type {@link DocumentHighlight} + or a Thenable that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DocumentHighlightParams = attrs.field() + method: str = "textDocument/documentHighlight" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDocumentHighlightResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[DocumentHighlight], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDocumentSymbolRequest: + """A request to list all symbols found in a given text document. The request's + parameter is of type {@link TextDocumentIdentifier} the + response is of type {@link SymbolInformation SymbolInformation[]} or a Thenable + that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DocumentSymbolParams = attrs.field() + method: str = "textDocument/documentSymbol" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDocumentSymbolResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[SymbolInformation], List[DocumentSymbol], None] = attrs.field( + default=None + ) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentCodeActionRequest: + """A request to provide commands for the given text document and range.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: CodeActionParams = attrs.field() + method: str = "textDocument/codeAction" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentCodeActionResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[Union[Command, CodeAction]], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class CodeActionResolveRequest: + """Request to resolve additional information for a given code action.The request's + parameter is of type {@link CodeAction} the response + is of type {@link CodeAction} or a Thenable that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: CodeAction = attrs.field() + method: str = "codeAction/resolve" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class CodeActionResolveResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: CodeAction = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceSymbolRequest: + """A request to list project-wide symbols matching the query string given + by the {@link WorkspaceSymbolParams}. The response is + of type {@link SymbolInformation SymbolInformation[]} or a Thenable that + resolves to such. + + @since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients + need to advertise support for WorkspaceSymbols via the client capability + `workspace.symbol.resolveSupport`.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: WorkspaceSymbolParams = attrs.field() + method: str = "workspace/symbol" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceSymbolResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[SymbolInformation], List[WorkspaceSymbol], None] = attrs.field( + default=None + ) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceSymbolResolveRequest: + """A request to resolve the range inside the workspace + symbol's location. + + @since 3.17.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: WorkspaceSymbol = attrs.field() + method: str = "workspaceSymbol/resolve" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceSymbolResolveResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: WorkspaceSymbol = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentCodeLensRequest: + """A request to provide code lens for the given text document.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: CodeLensParams = attrs.field() + method: str = "textDocument/codeLens" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentCodeLensResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[CodeLens], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class CodeLensResolveRequest: + """A request to resolve a command for a given code lens.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: CodeLens = attrs.field() + method: str = "codeLens/resolve" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class CodeLensResolveResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: CodeLens = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceCodeLensRefreshRequest: + """A request to refresh all code actions + + @since 3.16.0""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: Optional[None] = attrs.field(default=None) + method: str = "workspace/codeLens/refresh" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceCodeLensRefreshResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: None = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDocumentLinkRequest: + """A request to provide document links""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DocumentLinkParams = attrs.field() + method: str = "textDocument/documentLink" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDocumentLinkResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[DocumentLink], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class DocumentLinkResolveRequest: + """Request to resolve additional information for a given document link. The request's + parameter is of type {@link DocumentLink} the response + is of type {@link DocumentLink} or a Thenable that resolves to such.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DocumentLink = attrs.field() + method: str = "documentLink/resolve" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class DocumentLinkResolveResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: DocumentLink = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentFormattingRequest: + """A request to format a whole document.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DocumentFormattingParams = attrs.field() + method: str = "textDocument/formatting" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentFormattingResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[TextEdit], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentRangeFormattingRequest: + """A request to format a range in a document.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DocumentRangeFormattingParams = attrs.field() + method: str = "textDocument/rangeFormatting" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentRangeFormattingResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[TextEdit], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentRangesFormattingRequest: + """A request to format ranges in a document. + + @since 3.18.0 + @proposed""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DocumentRangesFormattingParams = attrs.field() + method: str = "textDocument/rangesFormatting" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentRangesFormattingResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[TextEdit], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentOnTypeFormattingRequest: + """A request to format a document on type.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: DocumentOnTypeFormattingParams = attrs.field() + method: str = "textDocument/onTypeFormatting" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentOnTypeFormattingResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[List[TextEdit], None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentRenameRequest: + """A request to rename a symbol.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: RenameParams = attrs.field() + method: str = "textDocument/rename" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentRenameResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[WorkspaceEdit, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentPrepareRenameRequest: + """A request to test and perform the setup necessary for a rename. + + @since 3.16 - support for default behavior""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: PrepareRenameParams = attrs.field() + method: str = "textDocument/prepareRename" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentPrepareRenameResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[PrepareRenameResult, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceExecuteCommandRequest: + """A request send from the client to the server to execute a command. The request might return + a workspace edit which the client will apply to the workspace.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: ExecuteCommandParams = attrs.field() + method: str = "workspace/executeCommand" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceExecuteCommandResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: Union[LSPAny, None] = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceApplyEditRequest: + """A request sent from the server to the client to modified certain resources.""" + + id: Union[int, str] = attrs.field() + """The request id.""" + params: ApplyWorkspaceEditParams = attrs.field() + method: str = "workspace/applyEdit" + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceApplyEditResponse: + id: Optional[Union[int, str]] = attrs.field() + """The request id.""" + result: ApplyWorkspaceEditResult = attrs.field(default=None) + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceDidChangeWorkspaceFoldersNotification: + """The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace + folder configuration changes.""" + + params: DidChangeWorkspaceFoldersParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["workspace/didChangeWorkspaceFolders"]), + default="workspace/didChangeWorkspaceFolders", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WindowWorkDoneProgressCancelNotification: + """The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress + initiated on the server side.""" + + params: WorkDoneProgressCancelParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["window/workDoneProgress/cancel"]), + default="window/workDoneProgress/cancel", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceDidCreateFilesNotification: + """The did create files notification is sent from the client to the server when + files were created from within the client. + + @since 3.16.0""" + + params: CreateFilesParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["workspace/didCreateFiles"]), + default="workspace/didCreateFiles", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceDidRenameFilesNotification: + """The did rename files notification is sent from the client to the server when + files were renamed from within the client. + + @since 3.16.0""" + + params: RenameFilesParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["workspace/didRenameFiles"]), + default="workspace/didRenameFiles", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceDidDeleteFilesNotification: + """The will delete files request is sent from the client to the server before files are actually + deleted as long as the deletion is triggered from within the client. + + @since 3.16.0""" + + params: DeleteFilesParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["workspace/didDeleteFiles"]), + default="workspace/didDeleteFiles", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class NotebookDocumentDidOpenNotification: + """A notification sent when a notebook opens. + + @since 3.17.0""" + + params: DidOpenNotebookDocumentParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["notebookDocument/didOpen"]), + default="notebookDocument/didOpen", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class NotebookDocumentDidChangeNotification: + params: DidChangeNotebookDocumentParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["notebookDocument/didChange"]), + default="notebookDocument/didChange", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class NotebookDocumentDidSaveNotification: + """A notification sent when a notebook document is saved. + + @since 3.17.0""" + + params: DidSaveNotebookDocumentParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["notebookDocument/didSave"]), + default="notebookDocument/didSave", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class NotebookDocumentDidCloseNotification: + """A notification sent when a notebook closes. + + @since 3.17.0""" + + params: DidCloseNotebookDocumentParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["notebookDocument/didClose"]), + default="notebookDocument/didClose", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class InitializedNotification: + """The initialized notification is sent from the client to the + server after the client is fully initialized and the server + is allowed to send requests from the server to the client.""" + + params: InitializedParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["initialized"]), + default="initialized", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class ExitNotification: + """The exit event is sent from the client to the server to + ask the server to exit its process.""" + + params: Optional[None] = attrs.field(default=None) + method: str = attrs.field( + validator=attrs.validators.in_(["exit"]), + default="exit", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceDidChangeConfigurationNotification: + """The configuration change notification is sent from the client to the server + when the client's configuration has changed. The notification contains + the changed configuration as defined by the language client.""" + + params: DidChangeConfigurationParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["workspace/didChangeConfiguration"]), + default="workspace/didChangeConfiguration", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WindowShowMessageNotification: + """The show message notification is sent from a server to a client to ask + the client to display a particular message in the user interface.""" + + params: ShowMessageParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["window/showMessage"]), + default="window/showMessage", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WindowLogMessageNotification: + """The log message notification is sent from the server to the client to ask + the client to log a particular message.""" + + params: LogMessageParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["window/logMessage"]), + default="window/logMessage", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TelemetryEventNotification: + """The telemetry event notification is sent from the server to the client to ask + the client to log telemetry data.""" + + params: LSPAny = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["telemetry/event"]), + default="telemetry/event", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDidOpenNotification: + """The document open notification is sent from the client to the server to signal + newly opened text documents. The document's truth is now managed by the client + and the server must not try to read the document's truth using the document's + uri. Open in this sense means it is managed by the client. It doesn't necessarily + mean that its content is presented in an editor. An open notification must not + be sent more than once without a corresponding close notification send before. + This means open and close notification must be balanced and the max open count + is one.""" + + params: DidOpenTextDocumentParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["textDocument/didOpen"]), + default="textDocument/didOpen", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDidChangeNotification: + """The document change notification is sent from the client to the server to signal + changes to a text document.""" + + params: DidChangeTextDocumentParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["textDocument/didChange"]), + default="textDocument/didChange", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDidCloseNotification: + """The document close notification is sent from the client to the server when + the document got closed in the client. The document's truth now exists where + the document's uri points to (e.g. if the document's uri is a file uri the + truth now exists on disk). As with the open notification the close notification + is about managing the document's content. Receiving a close notification + doesn't mean that the document was open in an editor before. A close + notification requires a previous open notification to be sent.""" + + params: DidCloseTextDocumentParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["textDocument/didClose"]), + default="textDocument/didClose", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentDidSaveNotification: + """The document save notification is sent from the client to the server when + the document got saved in the client.""" + + params: DidSaveTextDocumentParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["textDocument/didSave"]), + default="textDocument/didSave", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentWillSaveNotification: + """A document will save notification is sent from the client to the server before + the document is actually saved.""" + + params: WillSaveTextDocumentParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["textDocument/willSave"]), + default="textDocument/willSave", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class WorkspaceDidChangeWatchedFilesNotification: + """The watched files notification is sent from the client to the server when + the client detects changes to file watched by the language client.""" + + params: DidChangeWatchedFilesParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["workspace/didChangeWatchedFiles"]), + default="workspace/didChangeWatchedFiles", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class TextDocumentPublishDiagnosticsNotification: + """Diagnostics notification are sent from the server to the client to signal + results of validation runs.""" + + params: PublishDiagnosticsParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["textDocument/publishDiagnostics"]), + default="textDocument/publishDiagnostics", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class SetTraceNotification: + params: SetTraceParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["$/setTrace"]), + default="$/setTrace", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class LogTraceNotification: + params: LogTraceParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["$/logTrace"]), + default="$/logTrace", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class CancelRequestNotification: + params: CancelParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["$/cancelRequest"]), + default="$/cancelRequest", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@attrs.define +class ProgressNotification: + params: ProgressParams = attrs.field() + method: str = attrs.field( + validator=attrs.validators.in_(["$/progress"]), + default="$/progress", + ) + """The method to be invoked.""" + jsonrpc: str = attrs.field(default="2.0") + + +@enum.unique +class MessageDirection(enum.Enum): + Both = "both" + ClientToServer = "clientToServer" + ServerToClient = "serverToClient" + + +CALL_HIERARCHY_INCOMING_CALLS = "callHierarchy/incomingCalls" +CALL_HIERARCHY_OUTGOING_CALLS = "callHierarchy/outgoingCalls" +CANCEL_REQUEST = "$/cancelRequest" +CLIENT_REGISTER_CAPABILITY = "client/registerCapability" +CLIENT_UNREGISTER_CAPABILITY = "client/unregisterCapability" +CODE_ACTION_RESOLVE = "codeAction/resolve" +CODE_LENS_RESOLVE = "codeLens/resolve" +COMPLETION_ITEM_RESOLVE = "completionItem/resolve" +DOCUMENT_LINK_RESOLVE = "documentLink/resolve" +EXIT = "exit" +INITIALIZE = "initialize" +INITIALIZED = "initialized" +INLAY_HINT_RESOLVE = "inlayHint/resolve" +LOG_TRACE = "$/logTrace" +NOTEBOOK_DOCUMENT_DID_CHANGE = "notebookDocument/didChange" +NOTEBOOK_DOCUMENT_DID_CLOSE = "notebookDocument/didClose" +NOTEBOOK_DOCUMENT_DID_OPEN = "notebookDocument/didOpen" +NOTEBOOK_DOCUMENT_DID_SAVE = "notebookDocument/didSave" +PROGRESS = "$/progress" +SET_TRACE = "$/setTrace" +SHUTDOWN = "shutdown" +TELEMETRY_EVENT = "telemetry/event" +TEXT_DOCUMENT_CODE_ACTION = "textDocument/codeAction" +TEXT_DOCUMENT_CODE_LENS = "textDocument/codeLens" +TEXT_DOCUMENT_COLOR_PRESENTATION = "textDocument/colorPresentation" +TEXT_DOCUMENT_COMPLETION = "textDocument/completion" +TEXT_DOCUMENT_DECLARATION = "textDocument/declaration" +TEXT_DOCUMENT_DEFINITION = "textDocument/definition" +TEXT_DOCUMENT_DIAGNOSTIC = "textDocument/diagnostic" +TEXT_DOCUMENT_DID_CHANGE = "textDocument/didChange" +TEXT_DOCUMENT_DID_CLOSE = "textDocument/didClose" +TEXT_DOCUMENT_DID_OPEN = "textDocument/didOpen" +TEXT_DOCUMENT_DID_SAVE = "textDocument/didSave" +TEXT_DOCUMENT_DOCUMENT_COLOR = "textDocument/documentColor" +TEXT_DOCUMENT_DOCUMENT_HIGHLIGHT = "textDocument/documentHighlight" +TEXT_DOCUMENT_DOCUMENT_LINK = "textDocument/documentLink" +TEXT_DOCUMENT_DOCUMENT_SYMBOL = "textDocument/documentSymbol" +TEXT_DOCUMENT_FOLDING_RANGE = "textDocument/foldingRange" +TEXT_DOCUMENT_FORMATTING = "textDocument/formatting" +TEXT_DOCUMENT_HOVER = "textDocument/hover" +TEXT_DOCUMENT_IMPLEMENTATION = "textDocument/implementation" +TEXT_DOCUMENT_INLAY_HINT = "textDocument/inlayHint" +TEXT_DOCUMENT_INLINE_COMPLETION = "textDocument/inlineCompletion" +TEXT_DOCUMENT_INLINE_VALUE = "textDocument/inlineValue" +TEXT_DOCUMENT_LINKED_EDITING_RANGE = "textDocument/linkedEditingRange" +TEXT_DOCUMENT_MONIKER = "textDocument/moniker" +TEXT_DOCUMENT_ON_TYPE_FORMATTING = "textDocument/onTypeFormatting" +TEXT_DOCUMENT_PREPARE_CALL_HIERARCHY = "textDocument/prepareCallHierarchy" +TEXT_DOCUMENT_PREPARE_RENAME = "textDocument/prepareRename" +TEXT_DOCUMENT_PREPARE_TYPE_HIERARCHY = "textDocument/prepareTypeHierarchy" +TEXT_DOCUMENT_PUBLISH_DIAGNOSTICS = "textDocument/publishDiagnostics" +TEXT_DOCUMENT_RANGES_FORMATTING = "textDocument/rangesFormatting" +TEXT_DOCUMENT_RANGE_FORMATTING = "textDocument/rangeFormatting" +TEXT_DOCUMENT_REFERENCES = "textDocument/references" +TEXT_DOCUMENT_RENAME = "textDocument/rename" +TEXT_DOCUMENT_SELECTION_RANGE = "textDocument/selectionRange" +TEXT_DOCUMENT_SEMANTIC_TOKENS_FULL = "textDocument/semanticTokens/full" +TEXT_DOCUMENT_SEMANTIC_TOKENS_FULL_DELTA = "textDocument/semanticTokens/full/delta" +TEXT_DOCUMENT_SEMANTIC_TOKENS_RANGE = "textDocument/semanticTokens/range" +TEXT_DOCUMENT_SIGNATURE_HELP = "textDocument/signatureHelp" +TEXT_DOCUMENT_TYPE_DEFINITION = "textDocument/typeDefinition" +TEXT_DOCUMENT_WILL_SAVE = "textDocument/willSave" +TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL = "textDocument/willSaveWaitUntil" +TYPE_HIERARCHY_SUBTYPES = "typeHierarchy/subtypes" +TYPE_HIERARCHY_SUPERTYPES = "typeHierarchy/supertypes" +WINDOW_LOG_MESSAGE = "window/logMessage" +WINDOW_SHOW_DOCUMENT = "window/showDocument" +WINDOW_SHOW_MESSAGE = "window/showMessage" +WINDOW_SHOW_MESSAGE_REQUEST = "window/showMessageRequest" +WINDOW_WORK_DONE_PROGRESS_CANCEL = "window/workDoneProgress/cancel" +WINDOW_WORK_DONE_PROGRESS_CREATE = "window/workDoneProgress/create" +WORKSPACE_APPLY_EDIT = "workspace/applyEdit" +WORKSPACE_CODE_LENS_REFRESH = "workspace/codeLens/refresh" +WORKSPACE_CONFIGURATION = "workspace/configuration" +WORKSPACE_DIAGNOSTIC = "workspace/diagnostic" +WORKSPACE_DIAGNOSTIC_REFRESH = "workspace/diagnostic/refresh" +WORKSPACE_DID_CHANGE_CONFIGURATION = "workspace/didChangeConfiguration" +WORKSPACE_DID_CHANGE_WATCHED_FILES = "workspace/didChangeWatchedFiles" +WORKSPACE_DID_CHANGE_WORKSPACE_FOLDERS = "workspace/didChangeWorkspaceFolders" +WORKSPACE_DID_CREATE_FILES = "workspace/didCreateFiles" +WORKSPACE_DID_DELETE_FILES = "workspace/didDeleteFiles" +WORKSPACE_DID_RENAME_FILES = "workspace/didRenameFiles" +WORKSPACE_EXECUTE_COMMAND = "workspace/executeCommand" +WORKSPACE_FOLDING_RANGE_REFRESH = "workspace/foldingRange/refresh" +WORKSPACE_INLAY_HINT_REFRESH = "workspace/inlayHint/refresh" +WORKSPACE_INLINE_VALUE_REFRESH = "workspace/inlineValue/refresh" +WORKSPACE_SEMANTIC_TOKENS_REFRESH = "workspace/semanticTokens/refresh" +WORKSPACE_SYMBOL = "workspace/symbol" +WORKSPACE_SYMBOL_RESOLVE = "workspaceSymbol/resolve" +WORKSPACE_WILL_CREATE_FILES = "workspace/willCreateFiles" +WORKSPACE_WILL_DELETE_FILES = "workspace/willDeleteFiles" +WORKSPACE_WILL_RENAME_FILES = "workspace/willRenameFiles" +WORKSPACE_WORKSPACE_FOLDERS = "workspace/workspaceFolders" + +METHOD_TO_TYPES = { + # Requests + CALL_HIERARCHY_INCOMING_CALLS: ( + CallHierarchyIncomingCallsRequest, + CallHierarchyIncomingCallsResponse, + CallHierarchyIncomingCallsParams, + None, + ), + CALL_HIERARCHY_OUTGOING_CALLS: ( + CallHierarchyOutgoingCallsRequest, + CallHierarchyOutgoingCallsResponse, + CallHierarchyOutgoingCallsParams, + None, + ), + CLIENT_REGISTER_CAPABILITY: ( + ClientRegisterCapabilityRequest, + ClientRegisterCapabilityResponse, + RegistrationParams, + None, + ), + CLIENT_UNREGISTER_CAPABILITY: ( + ClientUnregisterCapabilityRequest, + ClientUnregisterCapabilityResponse, + UnregistrationParams, + None, + ), + CODE_ACTION_RESOLVE: ( + CodeActionResolveRequest, + CodeActionResolveResponse, + CodeAction, + None, + ), + CODE_LENS_RESOLVE: ( + CodeLensResolveRequest, + CodeLensResolveResponse, + CodeLens, + None, + ), + COMPLETION_ITEM_RESOLVE: ( + CompletionItemResolveRequest, + CompletionItemResolveResponse, + CompletionItem, + None, + ), + DOCUMENT_LINK_RESOLVE: ( + DocumentLinkResolveRequest, + DocumentLinkResolveResponse, + DocumentLink, + None, + ), + INITIALIZE: (InitializeRequest, InitializeResponse, InitializeParams, None), + INLAY_HINT_RESOLVE: ( + InlayHintResolveRequest, + InlayHintResolveResponse, + InlayHint, + None, + ), + SHUTDOWN: (ShutdownRequest, ShutdownResponse, None, None), + TEXT_DOCUMENT_CODE_ACTION: ( + TextDocumentCodeActionRequest, + TextDocumentCodeActionResponse, + CodeActionParams, + CodeActionRegistrationOptions, + ), + TEXT_DOCUMENT_CODE_LENS: ( + TextDocumentCodeLensRequest, + TextDocumentCodeLensResponse, + CodeLensParams, + CodeLensRegistrationOptions, + ), + TEXT_DOCUMENT_COLOR_PRESENTATION: ( + TextDocumentColorPresentationRequest, + TextDocumentColorPresentationResponse, + ColorPresentationParams, + TextDocumentColorPresentationOptions, + ), + TEXT_DOCUMENT_COMPLETION: ( + TextDocumentCompletionRequest, + TextDocumentCompletionResponse, + CompletionParams, + CompletionRegistrationOptions, + ), + TEXT_DOCUMENT_DECLARATION: ( + TextDocumentDeclarationRequest, + TextDocumentDeclarationResponse, + DeclarationParams, + DeclarationRegistrationOptions, + ), + TEXT_DOCUMENT_DEFINITION: ( + TextDocumentDefinitionRequest, + TextDocumentDefinitionResponse, + DefinitionParams, + DefinitionRegistrationOptions, + ), + TEXT_DOCUMENT_DIAGNOSTIC: ( + TextDocumentDiagnosticRequest, + TextDocumentDiagnosticResponse, + DocumentDiagnosticParams, + DiagnosticRegistrationOptions, + ), + TEXT_DOCUMENT_DOCUMENT_COLOR: ( + TextDocumentDocumentColorRequest, + TextDocumentDocumentColorResponse, + DocumentColorParams, + DocumentColorRegistrationOptions, + ), + TEXT_DOCUMENT_DOCUMENT_HIGHLIGHT: ( + TextDocumentDocumentHighlightRequest, + TextDocumentDocumentHighlightResponse, + DocumentHighlightParams, + DocumentHighlightRegistrationOptions, + ), + TEXT_DOCUMENT_DOCUMENT_LINK: ( + TextDocumentDocumentLinkRequest, + TextDocumentDocumentLinkResponse, + DocumentLinkParams, + DocumentLinkRegistrationOptions, + ), + TEXT_DOCUMENT_DOCUMENT_SYMBOL: ( + TextDocumentDocumentSymbolRequest, + TextDocumentDocumentSymbolResponse, + DocumentSymbolParams, + DocumentSymbolRegistrationOptions, + ), + TEXT_DOCUMENT_FOLDING_RANGE: ( + TextDocumentFoldingRangeRequest, + TextDocumentFoldingRangeResponse, + FoldingRangeParams, + FoldingRangeRegistrationOptions, + ), + TEXT_DOCUMENT_FORMATTING: ( + TextDocumentFormattingRequest, + TextDocumentFormattingResponse, + DocumentFormattingParams, + DocumentFormattingRegistrationOptions, + ), + TEXT_DOCUMENT_HOVER: ( + TextDocumentHoverRequest, + TextDocumentHoverResponse, + HoverParams, + HoverRegistrationOptions, + ), + TEXT_DOCUMENT_IMPLEMENTATION: ( + TextDocumentImplementationRequest, + TextDocumentImplementationResponse, + ImplementationParams, + ImplementationRegistrationOptions, + ), + TEXT_DOCUMENT_INLAY_HINT: ( + TextDocumentInlayHintRequest, + TextDocumentInlayHintResponse, + InlayHintParams, + InlayHintRegistrationOptions, + ), + TEXT_DOCUMENT_INLINE_COMPLETION: ( + TextDocumentInlineCompletionRequest, + TextDocumentInlineCompletionResponse, + InlineCompletionParams, + InlineCompletionRegistrationOptions, + ), + TEXT_DOCUMENT_INLINE_VALUE: ( + TextDocumentInlineValueRequest, + TextDocumentInlineValueResponse, + InlineValueParams, + InlineValueRegistrationOptions, + ), + TEXT_DOCUMENT_LINKED_EDITING_RANGE: ( + TextDocumentLinkedEditingRangeRequest, + TextDocumentLinkedEditingRangeResponse, + LinkedEditingRangeParams, + LinkedEditingRangeRegistrationOptions, + ), + TEXT_DOCUMENT_MONIKER: ( + TextDocumentMonikerRequest, + TextDocumentMonikerResponse, + MonikerParams, + MonikerRegistrationOptions, + ), + TEXT_DOCUMENT_ON_TYPE_FORMATTING: ( + TextDocumentOnTypeFormattingRequest, + TextDocumentOnTypeFormattingResponse, + DocumentOnTypeFormattingParams, + DocumentOnTypeFormattingRegistrationOptions, + ), + TEXT_DOCUMENT_PREPARE_CALL_HIERARCHY: ( + TextDocumentPrepareCallHierarchyRequest, + TextDocumentPrepareCallHierarchyResponse, + CallHierarchyPrepareParams, + CallHierarchyRegistrationOptions, + ), + TEXT_DOCUMENT_PREPARE_RENAME: ( + TextDocumentPrepareRenameRequest, + TextDocumentPrepareRenameResponse, + PrepareRenameParams, + None, + ), + TEXT_DOCUMENT_PREPARE_TYPE_HIERARCHY: ( + TextDocumentPrepareTypeHierarchyRequest, + TextDocumentPrepareTypeHierarchyResponse, + TypeHierarchyPrepareParams, + TypeHierarchyRegistrationOptions, + ), + TEXT_DOCUMENT_RANGES_FORMATTING: ( + TextDocumentRangesFormattingRequest, + TextDocumentRangesFormattingResponse, + DocumentRangesFormattingParams, + DocumentRangeFormattingRegistrationOptions, + ), + TEXT_DOCUMENT_RANGE_FORMATTING: ( + TextDocumentRangeFormattingRequest, + TextDocumentRangeFormattingResponse, + DocumentRangeFormattingParams, + DocumentRangeFormattingRegistrationOptions, + ), + TEXT_DOCUMENT_REFERENCES: ( + TextDocumentReferencesRequest, + TextDocumentReferencesResponse, + ReferenceParams, + ReferenceRegistrationOptions, + ), + TEXT_DOCUMENT_RENAME: ( + TextDocumentRenameRequest, + TextDocumentRenameResponse, + RenameParams, + RenameRegistrationOptions, + ), + TEXT_DOCUMENT_SELECTION_RANGE: ( + TextDocumentSelectionRangeRequest, + TextDocumentSelectionRangeResponse, + SelectionRangeParams, + SelectionRangeRegistrationOptions, + ), + TEXT_DOCUMENT_SEMANTIC_TOKENS_FULL: ( + TextDocumentSemanticTokensFullRequest, + TextDocumentSemanticTokensFullResponse, + SemanticTokensParams, + SemanticTokensRegistrationOptions, + ), + TEXT_DOCUMENT_SEMANTIC_TOKENS_FULL_DELTA: ( + TextDocumentSemanticTokensFullDeltaRequest, + TextDocumentSemanticTokensFullDeltaResponse, + SemanticTokensDeltaParams, + SemanticTokensRegistrationOptions, + ), + TEXT_DOCUMENT_SEMANTIC_TOKENS_RANGE: ( + TextDocumentSemanticTokensRangeRequest, + TextDocumentSemanticTokensRangeResponse, + SemanticTokensRangeParams, + None, + ), + TEXT_DOCUMENT_SIGNATURE_HELP: ( + TextDocumentSignatureHelpRequest, + TextDocumentSignatureHelpResponse, + SignatureHelpParams, + SignatureHelpRegistrationOptions, + ), + TEXT_DOCUMENT_TYPE_DEFINITION: ( + TextDocumentTypeDefinitionRequest, + TextDocumentTypeDefinitionResponse, + TypeDefinitionParams, + TypeDefinitionRegistrationOptions, + ), + TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL: ( + TextDocumentWillSaveWaitUntilRequest, + TextDocumentWillSaveWaitUntilResponse, + WillSaveTextDocumentParams, + TextDocumentRegistrationOptions, + ), + TYPE_HIERARCHY_SUBTYPES: ( + TypeHierarchySubtypesRequest, + TypeHierarchySubtypesResponse, + TypeHierarchySubtypesParams, + None, + ), + TYPE_HIERARCHY_SUPERTYPES: ( + TypeHierarchySupertypesRequest, + TypeHierarchySupertypesResponse, + TypeHierarchySupertypesParams, + None, + ), + WINDOW_SHOW_DOCUMENT: ( + WindowShowDocumentRequest, + WindowShowDocumentResponse, + ShowDocumentParams, + None, + ), + WINDOW_SHOW_MESSAGE_REQUEST: ( + WindowShowMessageRequestRequest, + WindowShowMessageRequestResponse, + ShowMessageRequestParams, + None, + ), + WINDOW_WORK_DONE_PROGRESS_CREATE: ( + WindowWorkDoneProgressCreateRequest, + WindowWorkDoneProgressCreateResponse, + WorkDoneProgressCreateParams, + None, + ), + WORKSPACE_APPLY_EDIT: ( + WorkspaceApplyEditRequest, + WorkspaceApplyEditResponse, + ApplyWorkspaceEditParams, + None, + ), + WORKSPACE_CODE_LENS_REFRESH: ( + WorkspaceCodeLensRefreshRequest, + WorkspaceCodeLensRefreshResponse, + None, + None, + ), + WORKSPACE_CONFIGURATION: ( + WorkspaceConfigurationRequest, + WorkspaceConfigurationResponse, + ConfigurationParams, + None, + ), + WORKSPACE_DIAGNOSTIC: ( + WorkspaceDiagnosticRequest, + WorkspaceDiagnosticResponse, + WorkspaceDiagnosticParams, + None, + ), + WORKSPACE_DIAGNOSTIC_REFRESH: ( + WorkspaceDiagnosticRefreshRequest, + WorkspaceDiagnosticRefreshResponse, + None, + None, + ), + WORKSPACE_EXECUTE_COMMAND: ( + WorkspaceExecuteCommandRequest, + WorkspaceExecuteCommandResponse, + ExecuteCommandParams, + ExecuteCommandRegistrationOptions, + ), + WORKSPACE_FOLDING_RANGE_REFRESH: ( + WorkspaceFoldingRangeRefreshRequest, + WorkspaceFoldingRangeRefreshResponse, + None, + None, + ), + WORKSPACE_INLAY_HINT_REFRESH: ( + WorkspaceInlayHintRefreshRequest, + WorkspaceInlayHintRefreshResponse, + None, + None, + ), + WORKSPACE_INLINE_VALUE_REFRESH: ( + WorkspaceInlineValueRefreshRequest, + WorkspaceInlineValueRefreshResponse, + None, + None, + ), + WORKSPACE_SEMANTIC_TOKENS_REFRESH: ( + WorkspaceSemanticTokensRefreshRequest, + WorkspaceSemanticTokensRefreshResponse, + None, + None, + ), + WORKSPACE_SYMBOL: ( + WorkspaceSymbolRequest, + WorkspaceSymbolResponse, + WorkspaceSymbolParams, + WorkspaceSymbolRegistrationOptions, + ), + WORKSPACE_SYMBOL_RESOLVE: ( + WorkspaceSymbolResolveRequest, + WorkspaceSymbolResolveResponse, + WorkspaceSymbol, + None, + ), + WORKSPACE_WILL_CREATE_FILES: ( + WorkspaceWillCreateFilesRequest, + WorkspaceWillCreateFilesResponse, + CreateFilesParams, + FileOperationRegistrationOptions, + ), + WORKSPACE_WILL_DELETE_FILES: ( + WorkspaceWillDeleteFilesRequest, + WorkspaceWillDeleteFilesResponse, + DeleteFilesParams, + FileOperationRegistrationOptions, + ), + WORKSPACE_WILL_RENAME_FILES: ( + WorkspaceWillRenameFilesRequest, + WorkspaceWillRenameFilesResponse, + RenameFilesParams, + FileOperationRegistrationOptions, + ), + WORKSPACE_WORKSPACE_FOLDERS: ( + WorkspaceWorkspaceFoldersRequest, + WorkspaceWorkspaceFoldersResponse, + None, + None, + ), + # Notifications + CANCEL_REQUEST: (CancelRequestNotification, None, CancelParams, None), + EXIT: (ExitNotification, None, None, None), + INITIALIZED: (InitializedNotification, None, InitializedParams, None), + LOG_TRACE: (LogTraceNotification, None, LogTraceParams, None), + NOTEBOOK_DOCUMENT_DID_CHANGE: ( + NotebookDocumentDidChangeNotification, + None, + DidChangeNotebookDocumentParams, + None, + ), + NOTEBOOK_DOCUMENT_DID_CLOSE: ( + NotebookDocumentDidCloseNotification, + None, + DidCloseNotebookDocumentParams, + None, + ), + NOTEBOOK_DOCUMENT_DID_OPEN: ( + NotebookDocumentDidOpenNotification, + None, + DidOpenNotebookDocumentParams, + None, + ), + NOTEBOOK_DOCUMENT_DID_SAVE: ( + NotebookDocumentDidSaveNotification, + None, + DidSaveNotebookDocumentParams, + None, + ), + PROGRESS: (ProgressNotification, None, ProgressParams, None), + SET_TRACE: (SetTraceNotification, None, SetTraceParams, None), + TELEMETRY_EVENT: (TelemetryEventNotification, None, LSPAny, None), + TEXT_DOCUMENT_DID_CHANGE: ( + TextDocumentDidChangeNotification, + None, + DidChangeTextDocumentParams, + TextDocumentChangeRegistrationOptions, + ), + TEXT_DOCUMENT_DID_CLOSE: ( + TextDocumentDidCloseNotification, + None, + DidCloseTextDocumentParams, + TextDocumentRegistrationOptions, + ), + TEXT_DOCUMENT_DID_OPEN: ( + TextDocumentDidOpenNotification, + None, + DidOpenTextDocumentParams, + TextDocumentRegistrationOptions, + ), + TEXT_DOCUMENT_DID_SAVE: ( + TextDocumentDidSaveNotification, + None, + DidSaveTextDocumentParams, + TextDocumentSaveRegistrationOptions, + ), + TEXT_DOCUMENT_PUBLISH_DIAGNOSTICS: ( + TextDocumentPublishDiagnosticsNotification, + None, + PublishDiagnosticsParams, + None, + ), + TEXT_DOCUMENT_WILL_SAVE: ( + TextDocumentWillSaveNotification, + None, + WillSaveTextDocumentParams, + TextDocumentRegistrationOptions, + ), + WINDOW_LOG_MESSAGE: (WindowLogMessageNotification, None, LogMessageParams, None), + WINDOW_SHOW_MESSAGE: (WindowShowMessageNotification, None, ShowMessageParams, None), + WINDOW_WORK_DONE_PROGRESS_CANCEL: ( + WindowWorkDoneProgressCancelNotification, + None, + WorkDoneProgressCancelParams, + None, + ), + WORKSPACE_DID_CHANGE_CONFIGURATION: ( + WorkspaceDidChangeConfigurationNotification, + None, + DidChangeConfigurationParams, + DidChangeConfigurationRegistrationOptions, + ), + WORKSPACE_DID_CHANGE_WATCHED_FILES: ( + WorkspaceDidChangeWatchedFilesNotification, + None, + DidChangeWatchedFilesParams, + DidChangeWatchedFilesRegistrationOptions, + ), + WORKSPACE_DID_CHANGE_WORKSPACE_FOLDERS: ( + WorkspaceDidChangeWorkspaceFoldersNotification, + None, + DidChangeWorkspaceFoldersParams, + None, + ), + WORKSPACE_DID_CREATE_FILES: ( + WorkspaceDidCreateFilesNotification, + None, + CreateFilesParams, + FileOperationRegistrationOptions, + ), + WORKSPACE_DID_DELETE_FILES: ( + WorkspaceDidDeleteFilesNotification, + None, + DeleteFilesParams, + FileOperationRegistrationOptions, + ), + WORKSPACE_DID_RENAME_FILES: ( + WorkspaceDidRenameFilesNotification, + None, + RenameFilesParams, + FileOperationRegistrationOptions, + ), +} +REQUESTS = Union[ + CallHierarchyIncomingCallsRequest, + CallHierarchyOutgoingCallsRequest, + ClientRegisterCapabilityRequest, + ClientUnregisterCapabilityRequest, + CodeActionResolveRequest, + CodeLensResolveRequest, + CompletionItemResolveRequest, + DocumentLinkResolveRequest, + InitializeRequest, + InlayHintResolveRequest, + ShutdownRequest, + TextDocumentCodeActionRequest, + TextDocumentCodeLensRequest, + TextDocumentColorPresentationRequest, + TextDocumentCompletionRequest, + TextDocumentDeclarationRequest, + TextDocumentDefinitionRequest, + TextDocumentDiagnosticRequest, + TextDocumentDocumentColorRequest, + TextDocumentDocumentHighlightRequest, + TextDocumentDocumentLinkRequest, + TextDocumentDocumentSymbolRequest, + TextDocumentFoldingRangeRequest, + TextDocumentFormattingRequest, + TextDocumentHoverRequest, + TextDocumentImplementationRequest, + TextDocumentInlayHintRequest, + TextDocumentInlineCompletionRequest, + TextDocumentInlineValueRequest, + TextDocumentLinkedEditingRangeRequest, + TextDocumentMonikerRequest, + TextDocumentOnTypeFormattingRequest, + TextDocumentPrepareCallHierarchyRequest, + TextDocumentPrepareRenameRequest, + TextDocumentPrepareTypeHierarchyRequest, + TextDocumentRangeFormattingRequest, + TextDocumentRangesFormattingRequest, + TextDocumentReferencesRequest, + TextDocumentRenameRequest, + TextDocumentSelectionRangeRequest, + TextDocumentSemanticTokensFullDeltaRequest, + TextDocumentSemanticTokensFullRequest, + TextDocumentSemanticTokensRangeRequest, + TextDocumentSignatureHelpRequest, + TextDocumentTypeDefinitionRequest, + TextDocumentWillSaveWaitUntilRequest, + TypeHierarchySubtypesRequest, + TypeHierarchySupertypesRequest, + WindowShowDocumentRequest, + WindowShowMessageRequestRequest, + WindowWorkDoneProgressCreateRequest, + WorkspaceApplyEditRequest, + WorkspaceCodeLensRefreshRequest, + WorkspaceConfigurationRequest, + WorkspaceDiagnosticRefreshRequest, + WorkspaceDiagnosticRequest, + WorkspaceExecuteCommandRequest, + WorkspaceFoldingRangeRefreshRequest, + WorkspaceInlayHintRefreshRequest, + WorkspaceInlineValueRefreshRequest, + WorkspaceSemanticTokensRefreshRequest, + WorkspaceSymbolRequest, + WorkspaceSymbolResolveRequest, + WorkspaceWillCreateFilesRequest, + WorkspaceWillDeleteFilesRequest, + WorkspaceWillRenameFilesRequest, + WorkspaceWorkspaceFoldersRequest, +] +RESPONSES = Union[ + CallHierarchyIncomingCallsResponse, + CallHierarchyOutgoingCallsResponse, + ClientRegisterCapabilityResponse, + ClientUnregisterCapabilityResponse, + CodeActionResolveResponse, + CodeLensResolveResponse, + CompletionItemResolveResponse, + DocumentLinkResolveResponse, + InitializeResponse, + InlayHintResolveResponse, + ShutdownResponse, + TextDocumentCodeActionResponse, + TextDocumentCodeLensResponse, + TextDocumentColorPresentationResponse, + TextDocumentCompletionResponse, + TextDocumentDeclarationResponse, + TextDocumentDefinitionResponse, + TextDocumentDiagnosticResponse, + TextDocumentDocumentColorResponse, + TextDocumentDocumentHighlightResponse, + TextDocumentDocumentLinkResponse, + TextDocumentDocumentSymbolResponse, + TextDocumentFoldingRangeResponse, + TextDocumentFormattingResponse, + TextDocumentHoverResponse, + TextDocumentImplementationResponse, + TextDocumentInlayHintResponse, + TextDocumentInlineCompletionResponse, + TextDocumentInlineValueResponse, + TextDocumentLinkedEditingRangeResponse, + TextDocumentMonikerResponse, + TextDocumentOnTypeFormattingResponse, + TextDocumentPrepareCallHierarchyResponse, + TextDocumentPrepareRenameResponse, + TextDocumentPrepareTypeHierarchyResponse, + TextDocumentRangeFormattingResponse, + TextDocumentRangesFormattingResponse, + TextDocumentReferencesResponse, + TextDocumentRenameResponse, + TextDocumentSelectionRangeResponse, + TextDocumentSemanticTokensFullDeltaResponse, + TextDocumentSemanticTokensFullResponse, + TextDocumentSemanticTokensRangeResponse, + TextDocumentSignatureHelpResponse, + TextDocumentTypeDefinitionResponse, + TextDocumentWillSaveWaitUntilResponse, + TypeHierarchySubtypesResponse, + TypeHierarchySupertypesResponse, + WindowShowDocumentResponse, + WindowShowMessageRequestResponse, + WindowWorkDoneProgressCreateResponse, + WorkspaceApplyEditResponse, + WorkspaceCodeLensRefreshResponse, + WorkspaceConfigurationResponse, + WorkspaceDiagnosticRefreshResponse, + WorkspaceDiagnosticResponse, + WorkspaceExecuteCommandResponse, + WorkspaceFoldingRangeRefreshResponse, + WorkspaceInlayHintRefreshResponse, + WorkspaceInlineValueRefreshResponse, + WorkspaceSemanticTokensRefreshResponse, + WorkspaceSymbolResolveResponse, + WorkspaceSymbolResponse, + WorkspaceWillCreateFilesResponse, + WorkspaceWillDeleteFilesResponse, + WorkspaceWillRenameFilesResponse, + WorkspaceWorkspaceFoldersResponse, +] +NOTIFICATIONS = Union[ + CancelRequestNotification, + ExitNotification, + InitializedNotification, + LogTraceNotification, + NotebookDocumentDidChangeNotification, + NotebookDocumentDidCloseNotification, + NotebookDocumentDidOpenNotification, + NotebookDocumentDidSaveNotification, + ProgressNotification, + SetTraceNotification, + TelemetryEventNotification, + TextDocumentDidChangeNotification, + TextDocumentDidCloseNotification, + TextDocumentDidOpenNotification, + TextDocumentDidSaveNotification, + TextDocumentPublishDiagnosticsNotification, + TextDocumentWillSaveNotification, + WindowLogMessageNotification, + WindowShowMessageNotification, + WindowWorkDoneProgressCancelNotification, + WorkspaceDidChangeConfigurationNotification, + WorkspaceDidChangeWatchedFilesNotification, + WorkspaceDidChangeWorkspaceFoldersNotification, + WorkspaceDidCreateFilesNotification, + WorkspaceDidDeleteFilesNotification, + WorkspaceDidRenameFilesNotification, +] +MESSAGE_TYPES = Union[REQUESTS, RESPONSES, NOTIFICATIONS, ResponseErrorMessage] + +_KEYWORD_CLASSES = [CallHierarchyIncomingCall] + + +def is_keyword_class(cls: type) -> bool: + """Returns true if the class has a property that may be python keyword.""" + return any(cls is c for c in _KEYWORD_CLASSES) + + +_SPECIAL_CLASSES = [ + CallHierarchyIncomingCallsRequest, + CallHierarchyIncomingCallsResponse, + CallHierarchyOutgoingCallsRequest, + CallHierarchyOutgoingCallsResponse, + CallHierarchyRegistrationOptions, + CancelRequestNotification, + ClientRegisterCapabilityRequest, + ClientRegisterCapabilityResponse, + ClientUnregisterCapabilityRequest, + ClientUnregisterCapabilityResponse, + CodeActionRegistrationOptions, + CodeActionResolveRequest, + CodeActionResolveResponse, + CodeLensRegistrationOptions, + CodeLensResolveRequest, + CodeLensResolveResponse, + CompletionItemResolveRequest, + CompletionItemResolveResponse, + CompletionRegistrationOptions, + CreateFile, + DeclarationRegistrationOptions, + DefinitionRegistrationOptions, + DeleteFile, + DiagnosticRegistrationOptions, + DocumentColorRegistrationOptions, + DocumentFormattingRegistrationOptions, + DocumentHighlightRegistrationOptions, + DocumentLinkRegistrationOptions, + DocumentLinkResolveRequest, + DocumentLinkResolveResponse, + DocumentOnTypeFormattingRegistrationOptions, + DocumentRangeFormattingRegistrationOptions, + DocumentSymbolRegistrationOptions, + ExitNotification, + FoldingRangeRegistrationOptions, + FullDocumentDiagnosticReport, + HoverRegistrationOptions, + ImplementationRegistrationOptions, + InitializeParams, + InitializeRequest, + InitializeResponse, + InitializedNotification, + InlayHintRegistrationOptions, + InlayHintResolveRequest, + InlayHintResolveResponse, + InlineCompletionRegistrationOptions, + InlineValueRegistrationOptions, + LinkedEditingRangeRegistrationOptions, + LogTraceNotification, + MonikerRegistrationOptions, + NotebookDocumentDidChangeNotification, + NotebookDocumentDidCloseNotification, + NotebookDocumentDidOpenNotification, + NotebookDocumentDidSaveNotification, + OptionalVersionedTextDocumentIdentifier, + ProgressNotification, + ReferenceRegistrationOptions, + RelatedFullDocumentDiagnosticReport, + RelatedUnchangedDocumentDiagnosticReport, + RenameFile, + RenameRegistrationOptions, + ResponseErrorMessage, + SelectionRangeRegistrationOptions, + SemanticTokensRegistrationOptions, + SetTraceNotification, + ShutdownRequest, + ShutdownResponse, + SignatureHelpRegistrationOptions, + StringValue, + TelemetryEventNotification, + TextDocumentChangeRegistrationOptions, + TextDocumentCodeActionRequest, + TextDocumentCodeActionResponse, + TextDocumentCodeLensRequest, + TextDocumentCodeLensResponse, + TextDocumentColorPresentationOptions, + TextDocumentColorPresentationRequest, + TextDocumentColorPresentationResponse, + TextDocumentCompletionRequest, + TextDocumentCompletionResponse, + TextDocumentDeclarationRequest, + TextDocumentDeclarationResponse, + TextDocumentDefinitionRequest, + TextDocumentDefinitionResponse, + TextDocumentDiagnosticRequest, + TextDocumentDiagnosticResponse, + TextDocumentDidChangeNotification, + TextDocumentDidCloseNotification, + TextDocumentDidOpenNotification, + TextDocumentDidSaveNotification, + TextDocumentDocumentColorRequest, + TextDocumentDocumentColorResponse, + TextDocumentDocumentHighlightRequest, + TextDocumentDocumentHighlightResponse, + TextDocumentDocumentLinkRequest, + TextDocumentDocumentLinkResponse, + TextDocumentDocumentSymbolRequest, + TextDocumentDocumentSymbolResponse, + TextDocumentFoldingRangeRequest, + TextDocumentFoldingRangeResponse, + TextDocumentFormattingRequest, + TextDocumentFormattingResponse, + TextDocumentHoverRequest, + TextDocumentHoverResponse, + TextDocumentImplementationRequest, + TextDocumentImplementationResponse, + TextDocumentInlayHintRequest, + TextDocumentInlayHintResponse, + TextDocumentInlineCompletionRequest, + TextDocumentInlineCompletionResponse, + TextDocumentInlineValueRequest, + TextDocumentInlineValueResponse, + TextDocumentLinkedEditingRangeRequest, + TextDocumentLinkedEditingRangeResponse, + TextDocumentMonikerRequest, + TextDocumentMonikerResponse, + TextDocumentOnTypeFormattingRequest, + TextDocumentOnTypeFormattingResponse, + TextDocumentPrepareCallHierarchyRequest, + TextDocumentPrepareCallHierarchyResponse, + TextDocumentPrepareRenameRequest, + TextDocumentPrepareRenameResponse, + TextDocumentPrepareTypeHierarchyRequest, + TextDocumentPrepareTypeHierarchyResponse, + TextDocumentPublishDiagnosticsNotification, + TextDocumentRangeFormattingRequest, + TextDocumentRangeFormattingResponse, + TextDocumentRangesFormattingRequest, + TextDocumentRangesFormattingResponse, + TextDocumentReferencesRequest, + TextDocumentReferencesResponse, + TextDocumentRegistrationOptions, + TextDocumentRenameRequest, + TextDocumentRenameResponse, + TextDocumentSaveRegistrationOptions, + TextDocumentSelectionRangeRequest, + TextDocumentSelectionRangeResponse, + TextDocumentSemanticTokensFullDeltaRequest, + TextDocumentSemanticTokensFullDeltaResponse, + TextDocumentSemanticTokensFullRequest, + TextDocumentSemanticTokensFullResponse, + TextDocumentSemanticTokensRangeRequest, + TextDocumentSemanticTokensRangeResponse, + TextDocumentSignatureHelpRequest, + TextDocumentSignatureHelpResponse, + TextDocumentTypeDefinitionRequest, + TextDocumentTypeDefinitionResponse, + TextDocumentWillSaveNotification, + TextDocumentWillSaveWaitUntilRequest, + TextDocumentWillSaveWaitUntilResponse, + TypeDefinitionRegistrationOptions, + TypeHierarchyRegistrationOptions, + TypeHierarchySubtypesRequest, + TypeHierarchySubtypesResponse, + TypeHierarchySupertypesRequest, + TypeHierarchySupertypesResponse, + UnchangedDocumentDiagnosticReport, + WindowLogMessageNotification, + WindowShowDocumentRequest, + WindowShowDocumentResponse, + WindowShowMessageNotification, + WindowShowMessageRequestRequest, + WindowShowMessageRequestResponse, + WindowWorkDoneProgressCancelNotification, + WindowWorkDoneProgressCreateRequest, + WindowWorkDoneProgressCreateResponse, + WorkDoneProgressBegin, + WorkDoneProgressEnd, + WorkDoneProgressReport, + WorkspaceApplyEditRequest, + WorkspaceApplyEditResponse, + WorkspaceCodeLensRefreshRequest, + WorkspaceCodeLensRefreshResponse, + WorkspaceConfigurationRequest, + WorkspaceConfigurationResponse, + WorkspaceDiagnosticRefreshRequest, + WorkspaceDiagnosticRefreshResponse, + WorkspaceDiagnosticRequest, + WorkspaceDiagnosticResponse, + WorkspaceDidChangeConfigurationNotification, + WorkspaceDidChangeWatchedFilesNotification, + WorkspaceDidChangeWorkspaceFoldersNotification, + WorkspaceDidCreateFilesNotification, + WorkspaceDidDeleteFilesNotification, + WorkspaceDidRenameFilesNotification, + WorkspaceExecuteCommandRequest, + WorkspaceExecuteCommandResponse, + WorkspaceFoldersInitializeParams, + WorkspaceFoldingRangeRefreshRequest, + WorkspaceFoldingRangeRefreshResponse, + WorkspaceFullDocumentDiagnosticReport, + WorkspaceInlayHintRefreshRequest, + WorkspaceInlayHintRefreshResponse, + WorkspaceInlineValueRefreshRequest, + WorkspaceInlineValueRefreshResponse, + WorkspaceSemanticTokensRefreshRequest, + WorkspaceSemanticTokensRefreshResponse, + WorkspaceSymbolRequest, + WorkspaceSymbolResolveRequest, + WorkspaceSymbolResolveResponse, + WorkspaceSymbolResponse, + WorkspaceUnchangedDocumentDiagnosticReport, + WorkspaceWillCreateFilesRequest, + WorkspaceWillCreateFilesResponse, + WorkspaceWillDeleteFilesRequest, + WorkspaceWillDeleteFilesResponse, + WorkspaceWillRenameFilesRequest, + WorkspaceWillRenameFilesResponse, + WorkspaceWorkspaceFoldersRequest, + WorkspaceWorkspaceFoldersResponse, + _InitializeParams, +] + + +def is_special_class(cls: type) -> bool: + """Returns true if the class or its properties require special handling.""" + return any(cls is c for c in _SPECIAL_CLASSES) + + +_SPECIAL_PROPERTIES = [ + "CallHierarchyIncomingCallsRequest.jsonrpc", + "CallHierarchyIncomingCallsRequest.method", + "CallHierarchyIncomingCallsResponse.jsonrpc", + "CallHierarchyIncomingCallsResponse.result", + "CallHierarchyOutgoingCallsRequest.jsonrpc", + "CallHierarchyOutgoingCallsRequest.method", + "CallHierarchyOutgoingCallsResponse.jsonrpc", + "CallHierarchyOutgoingCallsResponse.result", + "CallHierarchyRegistrationOptions.document_selector", + "CancelRequestNotification.jsonrpc", + "CancelRequestNotification.method", + "ClientRegisterCapabilityRequest.jsonrpc", + "ClientRegisterCapabilityRequest.method", + "ClientRegisterCapabilityResponse.jsonrpc", + "ClientRegisterCapabilityResponse.result", + "ClientUnregisterCapabilityRequest.jsonrpc", + "ClientUnregisterCapabilityRequest.method", + "ClientUnregisterCapabilityResponse.jsonrpc", + "ClientUnregisterCapabilityResponse.result", + "CodeActionRegistrationOptions.document_selector", + "CodeActionResolveRequest.jsonrpc", + "CodeActionResolveRequest.method", + "CodeActionResolveResponse.jsonrpc", + "CodeActionResolveResponse.result", + "CodeLensRegistrationOptions.document_selector", + "CodeLensResolveRequest.jsonrpc", + "CodeLensResolveRequest.method", + "CodeLensResolveResponse.jsonrpc", + "CodeLensResolveResponse.result", + "CompletionItemResolveRequest.jsonrpc", + "CompletionItemResolveRequest.method", + "CompletionItemResolveResponse.jsonrpc", + "CompletionItemResolveResponse.result", + "CompletionRegistrationOptions.document_selector", + "CreateFile.kind", + "DeclarationRegistrationOptions.document_selector", + "DefinitionRegistrationOptions.document_selector", + "DeleteFile.kind", + "DiagnosticRegistrationOptions.document_selector", + "DocumentColorRegistrationOptions.document_selector", + "DocumentFormattingRegistrationOptions.document_selector", + "DocumentHighlightRegistrationOptions.document_selector", + "DocumentLinkRegistrationOptions.document_selector", + "DocumentLinkResolveRequest.jsonrpc", + "DocumentLinkResolveRequest.method", + "DocumentLinkResolveResponse.jsonrpc", + "DocumentLinkResolveResponse.result", + "DocumentOnTypeFormattingRegistrationOptions.document_selector", + "DocumentRangeFormattingRegistrationOptions.document_selector", + "DocumentSymbolRegistrationOptions.document_selector", + "ExitNotification.jsonrpc", + "ExitNotification.method", + "FoldingRangeRegistrationOptions.document_selector", + "FullDocumentDiagnosticReport.kind", + "HoverRegistrationOptions.document_selector", + "ImplementationRegistrationOptions.document_selector", + "InitializeParams.process_id", + "InitializeParams.root_path", + "InitializeParams.root_uri", + "InitializeParams.workspace_folders", + "InitializeRequest.jsonrpc", + "InitializeRequest.method", + "InitializeResponse.jsonrpc", + "InitializeResponse.result", + "InitializedNotification.jsonrpc", + "InitializedNotification.method", + "InlayHintRegistrationOptions.document_selector", + "InlayHintResolveRequest.jsonrpc", + "InlayHintResolveRequest.method", + "InlayHintResolveResponse.jsonrpc", + "InlayHintResolveResponse.result", + "InlineCompletionRegistrationOptions.document_selector", + "InlineValueRegistrationOptions.document_selector", + "LinkedEditingRangeRegistrationOptions.document_selector", + "LogTraceNotification.jsonrpc", + "LogTraceNotification.method", + "MonikerRegistrationOptions.document_selector", + "NotebookDocumentDidChangeNotification.jsonrpc", + "NotebookDocumentDidChangeNotification.method", + "NotebookDocumentDidCloseNotification.jsonrpc", + "NotebookDocumentDidCloseNotification.method", + "NotebookDocumentDidOpenNotification.jsonrpc", + "NotebookDocumentDidOpenNotification.method", + "NotebookDocumentDidSaveNotification.jsonrpc", + "NotebookDocumentDidSaveNotification.method", + "OptionalVersionedTextDocumentIdentifier.version", + "ProgressNotification.jsonrpc", + "ProgressNotification.method", + "ReferenceRegistrationOptions.document_selector", + "RelatedFullDocumentDiagnosticReport.kind", + "RelatedUnchangedDocumentDiagnosticReport.kind", + "RenameFile.kind", + "RenameRegistrationOptions.document_selector", + "ResponseErrorMessage.error", + "ResponseErrorMessage.jsonrpc", + "SelectionRangeRegistrationOptions.document_selector", + "SemanticTokensRegistrationOptions.document_selector", + "SetTraceNotification.jsonrpc", + "SetTraceNotification.method", + "ShutdownRequest.jsonrpc", + "ShutdownRequest.method", + "ShutdownResponse.jsonrpc", + "ShutdownResponse.result", + "SignatureHelpRegistrationOptions.document_selector", + "StringValue.kind", + "TelemetryEventNotification.jsonrpc", + "TelemetryEventNotification.method", + "TextDocumentChangeRegistrationOptions.document_selector", + "TextDocumentCodeActionRequest.jsonrpc", + "TextDocumentCodeActionRequest.method", + "TextDocumentCodeActionResponse.jsonrpc", + "TextDocumentCodeActionResponse.result", + "TextDocumentCodeLensRequest.jsonrpc", + "TextDocumentCodeLensRequest.method", + "TextDocumentCodeLensResponse.jsonrpc", + "TextDocumentCodeLensResponse.result", + "TextDocumentColorPresentationOptions.document_selector", + "TextDocumentColorPresentationRequest.jsonrpc", + "TextDocumentColorPresentationRequest.method", + "TextDocumentColorPresentationResponse.jsonrpc", + "TextDocumentColorPresentationResponse.result", + "TextDocumentCompletionRequest.jsonrpc", + "TextDocumentCompletionRequest.method", + "TextDocumentCompletionResponse.jsonrpc", + "TextDocumentCompletionResponse.result", + "TextDocumentDeclarationRequest.jsonrpc", + "TextDocumentDeclarationRequest.method", + "TextDocumentDeclarationResponse.jsonrpc", + "TextDocumentDeclarationResponse.result", + "TextDocumentDefinitionRequest.jsonrpc", + "TextDocumentDefinitionRequest.method", + "TextDocumentDefinitionResponse.jsonrpc", + "TextDocumentDefinitionResponse.result", + "TextDocumentDiagnosticRequest.jsonrpc", + "TextDocumentDiagnosticRequest.method", + "TextDocumentDiagnosticResponse.jsonrpc", + "TextDocumentDiagnosticResponse.result", + "TextDocumentDidChangeNotification.jsonrpc", + "TextDocumentDidChangeNotification.method", + "TextDocumentDidCloseNotification.jsonrpc", + "TextDocumentDidCloseNotification.method", + "TextDocumentDidOpenNotification.jsonrpc", + "TextDocumentDidOpenNotification.method", + "TextDocumentDidSaveNotification.jsonrpc", + "TextDocumentDidSaveNotification.method", + "TextDocumentDocumentColorRequest.jsonrpc", + "TextDocumentDocumentColorRequest.method", + "TextDocumentDocumentColorResponse.jsonrpc", + "TextDocumentDocumentColorResponse.result", + "TextDocumentDocumentHighlightRequest.jsonrpc", + "TextDocumentDocumentHighlightRequest.method", + "TextDocumentDocumentHighlightResponse.jsonrpc", + "TextDocumentDocumentHighlightResponse.result", + "TextDocumentDocumentLinkRequest.jsonrpc", + "TextDocumentDocumentLinkRequest.method", + "TextDocumentDocumentLinkResponse.jsonrpc", + "TextDocumentDocumentLinkResponse.result", + "TextDocumentDocumentSymbolRequest.jsonrpc", + "TextDocumentDocumentSymbolRequest.method", + "TextDocumentDocumentSymbolResponse.jsonrpc", + "TextDocumentDocumentSymbolResponse.result", + "TextDocumentFoldingRangeRequest.jsonrpc", + "TextDocumentFoldingRangeRequest.method", + "TextDocumentFoldingRangeResponse.jsonrpc", + "TextDocumentFoldingRangeResponse.result", + "TextDocumentFormattingRequest.jsonrpc", + "TextDocumentFormattingRequest.method", + "TextDocumentFormattingResponse.jsonrpc", + "TextDocumentFormattingResponse.result", + "TextDocumentHoverRequest.jsonrpc", + "TextDocumentHoverRequest.method", + "TextDocumentHoverResponse.jsonrpc", + "TextDocumentHoverResponse.result", + "TextDocumentImplementationRequest.jsonrpc", + "TextDocumentImplementationRequest.method", + "TextDocumentImplementationResponse.jsonrpc", + "TextDocumentImplementationResponse.result", + "TextDocumentInlayHintRequest.jsonrpc", + "TextDocumentInlayHintRequest.method", + "TextDocumentInlayHintResponse.jsonrpc", + "TextDocumentInlayHintResponse.result", + "TextDocumentInlineCompletionRequest.jsonrpc", + "TextDocumentInlineCompletionRequest.method", + "TextDocumentInlineCompletionResponse.jsonrpc", + "TextDocumentInlineCompletionResponse.result", + "TextDocumentInlineValueRequest.jsonrpc", + "TextDocumentInlineValueRequest.method", + "TextDocumentInlineValueResponse.jsonrpc", + "TextDocumentInlineValueResponse.result", + "TextDocumentLinkedEditingRangeRequest.jsonrpc", + "TextDocumentLinkedEditingRangeRequest.method", + "TextDocumentLinkedEditingRangeResponse.jsonrpc", + "TextDocumentLinkedEditingRangeResponse.result", + "TextDocumentMonikerRequest.jsonrpc", + "TextDocumentMonikerRequest.method", + "TextDocumentMonikerResponse.jsonrpc", + "TextDocumentMonikerResponse.result", + "TextDocumentOnTypeFormattingRequest.jsonrpc", + "TextDocumentOnTypeFormattingRequest.method", + "TextDocumentOnTypeFormattingResponse.jsonrpc", + "TextDocumentOnTypeFormattingResponse.result", + "TextDocumentPrepareCallHierarchyRequest.jsonrpc", + "TextDocumentPrepareCallHierarchyRequest.method", + "TextDocumentPrepareCallHierarchyResponse.jsonrpc", + "TextDocumentPrepareCallHierarchyResponse.result", + "TextDocumentPrepareRenameRequest.jsonrpc", + "TextDocumentPrepareRenameRequest.method", + "TextDocumentPrepareRenameResponse.jsonrpc", + "TextDocumentPrepareRenameResponse.result", + "TextDocumentPrepareTypeHierarchyRequest.jsonrpc", + "TextDocumentPrepareTypeHierarchyRequest.method", + "TextDocumentPrepareTypeHierarchyResponse.jsonrpc", + "TextDocumentPrepareTypeHierarchyResponse.result", + "TextDocumentPublishDiagnosticsNotification.jsonrpc", + "TextDocumentPublishDiagnosticsNotification.method", + "TextDocumentRangeFormattingRequest.jsonrpc", + "TextDocumentRangeFormattingRequest.method", + "TextDocumentRangeFormattingResponse.jsonrpc", + "TextDocumentRangeFormattingResponse.result", + "TextDocumentRangesFormattingRequest.jsonrpc", + "TextDocumentRangesFormattingRequest.method", + "TextDocumentRangesFormattingResponse.jsonrpc", + "TextDocumentRangesFormattingResponse.result", + "TextDocumentReferencesRequest.jsonrpc", + "TextDocumentReferencesRequest.method", + "TextDocumentReferencesResponse.jsonrpc", + "TextDocumentReferencesResponse.result", + "TextDocumentRegistrationOptions.document_selector", + "TextDocumentRenameRequest.jsonrpc", + "TextDocumentRenameRequest.method", + "TextDocumentRenameResponse.jsonrpc", + "TextDocumentRenameResponse.result", + "TextDocumentSaveRegistrationOptions.document_selector", + "TextDocumentSelectionRangeRequest.jsonrpc", + "TextDocumentSelectionRangeRequest.method", + "TextDocumentSelectionRangeResponse.jsonrpc", + "TextDocumentSelectionRangeResponse.result", + "TextDocumentSemanticTokensFullDeltaRequest.jsonrpc", + "TextDocumentSemanticTokensFullDeltaRequest.method", + "TextDocumentSemanticTokensFullDeltaResponse.jsonrpc", + "TextDocumentSemanticTokensFullDeltaResponse.result", + "TextDocumentSemanticTokensFullRequest.jsonrpc", + "TextDocumentSemanticTokensFullRequest.method", + "TextDocumentSemanticTokensFullResponse.jsonrpc", + "TextDocumentSemanticTokensFullResponse.result", + "TextDocumentSemanticTokensRangeRequest.jsonrpc", + "TextDocumentSemanticTokensRangeRequest.method", + "TextDocumentSemanticTokensRangeResponse.jsonrpc", + "TextDocumentSemanticTokensRangeResponse.result", + "TextDocumentSignatureHelpRequest.jsonrpc", + "TextDocumentSignatureHelpRequest.method", + "TextDocumentSignatureHelpResponse.jsonrpc", + "TextDocumentSignatureHelpResponse.result", + "TextDocumentTypeDefinitionRequest.jsonrpc", + "TextDocumentTypeDefinitionRequest.method", + "TextDocumentTypeDefinitionResponse.jsonrpc", + "TextDocumentTypeDefinitionResponse.result", + "TextDocumentWillSaveNotification.jsonrpc", + "TextDocumentWillSaveNotification.method", + "TextDocumentWillSaveWaitUntilRequest.jsonrpc", + "TextDocumentWillSaveWaitUntilRequest.method", + "TextDocumentWillSaveWaitUntilResponse.jsonrpc", + "TextDocumentWillSaveWaitUntilResponse.result", + "TypeDefinitionRegistrationOptions.document_selector", + "TypeHierarchyRegistrationOptions.document_selector", + "TypeHierarchySubtypesRequest.jsonrpc", + "TypeHierarchySubtypesRequest.method", + "TypeHierarchySubtypesResponse.jsonrpc", + "TypeHierarchySubtypesResponse.result", + "TypeHierarchySupertypesRequest.jsonrpc", + "TypeHierarchySupertypesRequest.method", + "TypeHierarchySupertypesResponse.jsonrpc", + "TypeHierarchySupertypesResponse.result", + "UnchangedDocumentDiagnosticReport.kind", + "WindowLogMessageNotification.jsonrpc", + "WindowLogMessageNotification.method", + "WindowShowDocumentRequest.jsonrpc", + "WindowShowDocumentRequest.method", + "WindowShowDocumentResponse.jsonrpc", + "WindowShowDocumentResponse.result", + "WindowShowMessageNotification.jsonrpc", + "WindowShowMessageNotification.method", + "WindowShowMessageRequestRequest.jsonrpc", + "WindowShowMessageRequestRequest.method", + "WindowShowMessageRequestResponse.jsonrpc", + "WindowShowMessageRequestResponse.result", + "WindowWorkDoneProgressCancelNotification.jsonrpc", + "WindowWorkDoneProgressCancelNotification.method", + "WindowWorkDoneProgressCreateRequest.jsonrpc", + "WindowWorkDoneProgressCreateRequest.method", + "WindowWorkDoneProgressCreateResponse.jsonrpc", + "WindowWorkDoneProgressCreateResponse.result", + "WorkDoneProgressBegin.kind", + "WorkDoneProgressEnd.kind", + "WorkDoneProgressReport.kind", + "WorkspaceApplyEditRequest.jsonrpc", + "WorkspaceApplyEditRequest.method", + "WorkspaceApplyEditResponse.jsonrpc", + "WorkspaceApplyEditResponse.result", + "WorkspaceCodeLensRefreshRequest.jsonrpc", + "WorkspaceCodeLensRefreshRequest.method", + "WorkspaceCodeLensRefreshResponse.jsonrpc", + "WorkspaceCodeLensRefreshResponse.result", + "WorkspaceConfigurationRequest.jsonrpc", + "WorkspaceConfigurationRequest.method", + "WorkspaceConfigurationResponse.jsonrpc", + "WorkspaceConfigurationResponse.result", + "WorkspaceDiagnosticRefreshRequest.jsonrpc", + "WorkspaceDiagnosticRefreshRequest.method", + "WorkspaceDiagnosticRefreshResponse.jsonrpc", + "WorkspaceDiagnosticRefreshResponse.result", + "WorkspaceDiagnosticRequest.jsonrpc", + "WorkspaceDiagnosticRequest.method", + "WorkspaceDiagnosticResponse.jsonrpc", + "WorkspaceDiagnosticResponse.result", + "WorkspaceDidChangeConfigurationNotification.jsonrpc", + "WorkspaceDidChangeConfigurationNotification.method", + "WorkspaceDidChangeWatchedFilesNotification.jsonrpc", + "WorkspaceDidChangeWatchedFilesNotification.method", + "WorkspaceDidChangeWorkspaceFoldersNotification.jsonrpc", + "WorkspaceDidChangeWorkspaceFoldersNotification.method", + "WorkspaceDidCreateFilesNotification.jsonrpc", + "WorkspaceDidCreateFilesNotification.method", + "WorkspaceDidDeleteFilesNotification.jsonrpc", + "WorkspaceDidDeleteFilesNotification.method", + "WorkspaceDidRenameFilesNotification.jsonrpc", + "WorkspaceDidRenameFilesNotification.method", + "WorkspaceExecuteCommandRequest.jsonrpc", + "WorkspaceExecuteCommandRequest.method", + "WorkspaceExecuteCommandResponse.jsonrpc", + "WorkspaceExecuteCommandResponse.result", + "WorkspaceFoldersInitializeParams.workspace_folders", + "WorkspaceFoldingRangeRefreshRequest.jsonrpc", + "WorkspaceFoldingRangeRefreshRequest.method", + "WorkspaceFoldingRangeRefreshResponse.jsonrpc", + "WorkspaceFoldingRangeRefreshResponse.result", + "WorkspaceFullDocumentDiagnosticReport.kind", + "WorkspaceFullDocumentDiagnosticReport.version", + "WorkspaceInlayHintRefreshRequest.jsonrpc", + "WorkspaceInlayHintRefreshRequest.method", + "WorkspaceInlayHintRefreshResponse.jsonrpc", + "WorkspaceInlayHintRefreshResponse.result", + "WorkspaceInlineValueRefreshRequest.jsonrpc", + "WorkspaceInlineValueRefreshRequest.method", + "WorkspaceInlineValueRefreshResponse.jsonrpc", + "WorkspaceInlineValueRefreshResponse.result", + "WorkspaceSemanticTokensRefreshRequest.jsonrpc", + "WorkspaceSemanticTokensRefreshRequest.method", + "WorkspaceSemanticTokensRefreshResponse.jsonrpc", + "WorkspaceSemanticTokensRefreshResponse.result", + "WorkspaceSymbolRequest.jsonrpc", + "WorkspaceSymbolRequest.method", + "WorkspaceSymbolResolveRequest.jsonrpc", + "WorkspaceSymbolResolveRequest.method", + "WorkspaceSymbolResolveResponse.jsonrpc", + "WorkspaceSymbolResolveResponse.result", + "WorkspaceSymbolResponse.jsonrpc", + "WorkspaceSymbolResponse.result", + "WorkspaceUnchangedDocumentDiagnosticReport.kind", + "WorkspaceUnchangedDocumentDiagnosticReport.version", + "WorkspaceWillCreateFilesRequest.jsonrpc", + "WorkspaceWillCreateFilesRequest.method", + "WorkspaceWillCreateFilesResponse.jsonrpc", + "WorkspaceWillCreateFilesResponse.result", + "WorkspaceWillDeleteFilesRequest.jsonrpc", + "WorkspaceWillDeleteFilesRequest.method", + "WorkspaceWillDeleteFilesResponse.jsonrpc", + "WorkspaceWillDeleteFilesResponse.result", + "WorkspaceWillRenameFilesRequest.jsonrpc", + "WorkspaceWillRenameFilesRequest.method", + "WorkspaceWillRenameFilesResponse.jsonrpc", + "WorkspaceWillRenameFilesResponse.result", + "WorkspaceWorkspaceFoldersRequest.jsonrpc", + "WorkspaceWorkspaceFoldersRequest.method", + "WorkspaceWorkspaceFoldersResponse.jsonrpc", + "WorkspaceWorkspaceFoldersResponse.result", + "_InitializeParams.process_id", + "_InitializeParams.root_path", + "_InitializeParams.root_uri", +] + + +def is_special_property(cls: type, property_name: str) -> bool: + """Returns true if the class or its properties require special handling. + Example: + Consider RenameRegistrationOptions + * document_selector property: + When you set `document_selector` to None in python it has to be preserved when + serializing it. Since the serialized JSON value `{"document_selector": null}` + means use the Clients document selector. Omitting it might throw error. + * prepare_provider property + This property does NOT need special handling, since omitting it or using + `{"prepare_provider": null}` in JSON has the same meaning. + """ + qualified_name = f"{cls.__name__}.{property_name}" + return qualified_name in _SPECIAL_PROPERTIES + + +ALL_TYPES_MAP: Dict[str, Union[type, object]] = { + "AnnotatedTextEdit": AnnotatedTextEdit, + "ApplyWorkspaceEditParams": ApplyWorkspaceEditParams, + "ApplyWorkspaceEditResult": ApplyWorkspaceEditResult, + "BaseSymbolInformation": BaseSymbolInformation, + "CallHierarchyClientCapabilities": CallHierarchyClientCapabilities, + "CallHierarchyIncomingCall": CallHierarchyIncomingCall, + "CallHierarchyIncomingCallsParams": CallHierarchyIncomingCallsParams, + "CallHierarchyIncomingCallsRequest": CallHierarchyIncomingCallsRequest, + "CallHierarchyIncomingCallsResponse": CallHierarchyIncomingCallsResponse, + "CallHierarchyItem": CallHierarchyItem, + "CallHierarchyOptions": CallHierarchyOptions, + "CallHierarchyOutgoingCall": CallHierarchyOutgoingCall, + "CallHierarchyOutgoingCallsParams": CallHierarchyOutgoingCallsParams, + "CallHierarchyOutgoingCallsRequest": CallHierarchyOutgoingCallsRequest, + "CallHierarchyOutgoingCallsResponse": CallHierarchyOutgoingCallsResponse, + "CallHierarchyPrepareParams": CallHierarchyPrepareParams, + "CallHierarchyRegistrationOptions": CallHierarchyRegistrationOptions, + "CancelParams": CancelParams, + "CancelRequestNotification": CancelRequestNotification, + "ChangeAnnotation": ChangeAnnotation, + "ChangeAnnotationIdentifier": ChangeAnnotationIdentifier, + "ClientCapabilities": ClientCapabilities, + "ClientRegisterCapabilityRequest": ClientRegisterCapabilityRequest, + "ClientRegisterCapabilityResponse": ClientRegisterCapabilityResponse, + "ClientUnregisterCapabilityRequest": ClientUnregisterCapabilityRequest, + "ClientUnregisterCapabilityResponse": ClientUnregisterCapabilityResponse, + "CodeAction": CodeAction, + "CodeActionClientCapabilities": CodeActionClientCapabilities, + "CodeActionClientCapabilitiesCodeActionLiteralSupportType": CodeActionClientCapabilitiesCodeActionLiteralSupportType, + "CodeActionClientCapabilitiesCodeActionLiteralSupportTypeCodeActionKindType": CodeActionClientCapabilitiesCodeActionLiteralSupportTypeCodeActionKindType, + "CodeActionClientCapabilitiesResolveSupportType": CodeActionClientCapabilitiesResolveSupportType, + "CodeActionContext": CodeActionContext, + "CodeActionDisabledType": CodeActionDisabledType, + "CodeActionKind": CodeActionKind, + "CodeActionOptions": CodeActionOptions, + "CodeActionParams": CodeActionParams, + "CodeActionRegistrationOptions": CodeActionRegistrationOptions, + "CodeActionResolveRequest": CodeActionResolveRequest, + "CodeActionResolveResponse": CodeActionResolveResponse, + "CodeActionTriggerKind": CodeActionTriggerKind, + "CodeDescription": CodeDescription, + "CodeLens": CodeLens, + "CodeLensClientCapabilities": CodeLensClientCapabilities, + "CodeLensOptions": CodeLensOptions, + "CodeLensParams": CodeLensParams, + "CodeLensRegistrationOptions": CodeLensRegistrationOptions, + "CodeLensResolveRequest": CodeLensResolveRequest, + "CodeLensResolveResponse": CodeLensResolveResponse, + "CodeLensWorkspaceClientCapabilities": CodeLensWorkspaceClientCapabilities, + "Color": Color, + "ColorInformation": ColorInformation, + "ColorPresentation": ColorPresentation, + "ColorPresentationParams": ColorPresentationParams, + "Command": Command, + "CompletionClientCapabilities": CompletionClientCapabilities, + "CompletionClientCapabilitiesCompletionItemKindType": CompletionClientCapabilitiesCompletionItemKindType, + "CompletionClientCapabilitiesCompletionItemType": CompletionClientCapabilitiesCompletionItemType, + "CompletionClientCapabilitiesCompletionItemTypeInsertTextModeSupportType": CompletionClientCapabilitiesCompletionItemTypeInsertTextModeSupportType, + "CompletionClientCapabilitiesCompletionItemTypeResolveSupportType": CompletionClientCapabilitiesCompletionItemTypeResolveSupportType, + "CompletionClientCapabilitiesCompletionItemTypeTagSupportType": CompletionClientCapabilitiesCompletionItemTypeTagSupportType, + "CompletionClientCapabilitiesCompletionListType": CompletionClientCapabilitiesCompletionListType, + "CompletionContext": CompletionContext, + "CompletionItem": CompletionItem, + "CompletionItemKind": CompletionItemKind, + "CompletionItemLabelDetails": CompletionItemLabelDetails, + "CompletionItemResolveRequest": CompletionItemResolveRequest, + "CompletionItemResolveResponse": CompletionItemResolveResponse, + "CompletionItemTag": CompletionItemTag, + "CompletionList": CompletionList, + "CompletionListItemDefaultsType": CompletionListItemDefaultsType, + "CompletionListItemDefaultsTypeEditRangeType1": CompletionListItemDefaultsTypeEditRangeType1, + "CompletionOptions": CompletionOptions, + "CompletionOptionsCompletionItemType": CompletionOptionsCompletionItemType, + "CompletionParams": CompletionParams, + "CompletionRegistrationOptions": CompletionRegistrationOptions, + "CompletionRegistrationOptionsCompletionItemType": CompletionRegistrationOptionsCompletionItemType, + "CompletionTriggerKind": CompletionTriggerKind, + "ConfigurationItem": ConfigurationItem, + "ConfigurationParams": ConfigurationParams, + "CreateFile": CreateFile, + "CreateFileOptions": CreateFileOptions, + "CreateFilesParams": CreateFilesParams, + "Declaration": Declaration, + "DeclarationClientCapabilities": DeclarationClientCapabilities, + "DeclarationLink": DeclarationLink, + "DeclarationOptions": DeclarationOptions, + "DeclarationParams": DeclarationParams, + "DeclarationRegistrationOptions": DeclarationRegistrationOptions, + "Definition": Definition, + "DefinitionClientCapabilities": DefinitionClientCapabilities, + "DefinitionLink": DefinitionLink, + "DefinitionOptions": DefinitionOptions, + "DefinitionParams": DefinitionParams, + "DefinitionRegistrationOptions": DefinitionRegistrationOptions, + "DeleteFile": DeleteFile, + "DeleteFileOptions": DeleteFileOptions, + "DeleteFilesParams": DeleteFilesParams, + "Diagnostic": Diagnostic, + "DiagnosticClientCapabilities": DiagnosticClientCapabilities, + "DiagnosticOptions": DiagnosticOptions, + "DiagnosticRegistrationOptions": DiagnosticRegistrationOptions, + "DiagnosticRelatedInformation": DiagnosticRelatedInformation, + "DiagnosticServerCancellationData": DiagnosticServerCancellationData, + "DiagnosticSeverity": DiagnosticSeverity, + "DiagnosticTag": DiagnosticTag, + "DiagnosticWorkspaceClientCapabilities": DiagnosticWorkspaceClientCapabilities, + "DidChangeConfigurationClientCapabilities": DidChangeConfigurationClientCapabilities, + "DidChangeConfigurationParams": DidChangeConfigurationParams, + "DidChangeConfigurationRegistrationOptions": DidChangeConfigurationRegistrationOptions, + "DidChangeNotebookDocumentParams": DidChangeNotebookDocumentParams, + "DidChangeTextDocumentParams": DidChangeTextDocumentParams, + "DidChangeWatchedFilesClientCapabilities": DidChangeWatchedFilesClientCapabilities, + "DidChangeWatchedFilesParams": DidChangeWatchedFilesParams, + "DidChangeWatchedFilesRegistrationOptions": DidChangeWatchedFilesRegistrationOptions, + "DidChangeWorkspaceFoldersParams": DidChangeWorkspaceFoldersParams, + "DidCloseNotebookDocumentParams": DidCloseNotebookDocumentParams, + "DidCloseTextDocumentParams": DidCloseTextDocumentParams, + "DidOpenNotebookDocumentParams": DidOpenNotebookDocumentParams, + "DidOpenTextDocumentParams": DidOpenTextDocumentParams, + "DidSaveNotebookDocumentParams": DidSaveNotebookDocumentParams, + "DidSaveTextDocumentParams": DidSaveTextDocumentParams, + "DocumentColorClientCapabilities": DocumentColorClientCapabilities, + "DocumentColorOptions": DocumentColorOptions, + "DocumentColorParams": DocumentColorParams, + "DocumentColorRegistrationOptions": DocumentColorRegistrationOptions, + "DocumentDiagnosticParams": DocumentDiagnosticParams, + "DocumentDiagnosticReport": DocumentDiagnosticReport, + "DocumentDiagnosticReportKind": DocumentDiagnosticReportKind, + "DocumentDiagnosticReportPartialResult": DocumentDiagnosticReportPartialResult, + "DocumentFilter": DocumentFilter, + "DocumentFormattingClientCapabilities": DocumentFormattingClientCapabilities, + "DocumentFormattingOptions": DocumentFormattingOptions, + "DocumentFormattingParams": DocumentFormattingParams, + "DocumentFormattingRegistrationOptions": DocumentFormattingRegistrationOptions, + "DocumentHighlight": DocumentHighlight, + "DocumentHighlightClientCapabilities": DocumentHighlightClientCapabilities, + "DocumentHighlightKind": DocumentHighlightKind, + "DocumentHighlightOptions": DocumentHighlightOptions, + "DocumentHighlightParams": DocumentHighlightParams, + "DocumentHighlightRegistrationOptions": DocumentHighlightRegistrationOptions, + "DocumentLink": DocumentLink, + "DocumentLinkClientCapabilities": DocumentLinkClientCapabilities, + "DocumentLinkOptions": DocumentLinkOptions, + "DocumentLinkParams": DocumentLinkParams, + "DocumentLinkRegistrationOptions": DocumentLinkRegistrationOptions, + "DocumentLinkResolveRequest": DocumentLinkResolveRequest, + "DocumentLinkResolveResponse": DocumentLinkResolveResponse, + "DocumentOnTypeFormattingClientCapabilities": DocumentOnTypeFormattingClientCapabilities, + "DocumentOnTypeFormattingOptions": DocumentOnTypeFormattingOptions, + "DocumentOnTypeFormattingParams": DocumentOnTypeFormattingParams, + "DocumentOnTypeFormattingRegistrationOptions": DocumentOnTypeFormattingRegistrationOptions, + "DocumentRangeFormattingClientCapabilities": DocumentRangeFormattingClientCapabilities, + "DocumentRangeFormattingOptions": DocumentRangeFormattingOptions, + "DocumentRangeFormattingParams": DocumentRangeFormattingParams, + "DocumentRangeFormattingRegistrationOptions": DocumentRangeFormattingRegistrationOptions, + "DocumentRangesFormattingParams": DocumentRangesFormattingParams, + "DocumentSelector": DocumentSelector, + "DocumentSymbol": DocumentSymbol, + "DocumentSymbolClientCapabilities": DocumentSymbolClientCapabilities, + "DocumentSymbolClientCapabilitiesSymbolKindType": DocumentSymbolClientCapabilitiesSymbolKindType, + "DocumentSymbolClientCapabilitiesTagSupportType": DocumentSymbolClientCapabilitiesTagSupportType, + "DocumentSymbolOptions": DocumentSymbolOptions, + "DocumentSymbolParams": DocumentSymbolParams, + "DocumentSymbolRegistrationOptions": DocumentSymbolRegistrationOptions, + "ErrorCodes": ErrorCodes, + "ExecuteCommandClientCapabilities": ExecuteCommandClientCapabilities, + "ExecuteCommandOptions": ExecuteCommandOptions, + "ExecuteCommandParams": ExecuteCommandParams, + "ExecuteCommandRegistrationOptions": ExecuteCommandRegistrationOptions, + "ExecutionSummary": ExecutionSummary, + "ExitNotification": ExitNotification, + "FailureHandlingKind": FailureHandlingKind, + "FileChangeType": FileChangeType, + "FileCreate": FileCreate, + "FileDelete": FileDelete, + "FileEvent": FileEvent, + "FileOperationClientCapabilities": FileOperationClientCapabilities, + "FileOperationFilter": FileOperationFilter, + "FileOperationOptions": FileOperationOptions, + "FileOperationPattern": FileOperationPattern, + "FileOperationPatternKind": FileOperationPatternKind, + "FileOperationPatternOptions": FileOperationPatternOptions, + "FileOperationRegistrationOptions": FileOperationRegistrationOptions, + "FileRename": FileRename, + "FileSystemWatcher": FileSystemWatcher, + "FoldingRange": FoldingRange, + "FoldingRangeClientCapabilities": FoldingRangeClientCapabilities, + "FoldingRangeClientCapabilitiesFoldingRangeKindType": FoldingRangeClientCapabilitiesFoldingRangeKindType, + "FoldingRangeClientCapabilitiesFoldingRangeType": FoldingRangeClientCapabilitiesFoldingRangeType, + "FoldingRangeKind": FoldingRangeKind, + "FoldingRangeOptions": FoldingRangeOptions, + "FoldingRangeParams": FoldingRangeParams, + "FoldingRangeRegistrationOptions": FoldingRangeRegistrationOptions, + "FoldingRangeWorkspaceClientCapabilities": FoldingRangeWorkspaceClientCapabilities, + "FormattingOptions": FormattingOptions, + "FullDocumentDiagnosticReport": FullDocumentDiagnosticReport, + "GeneralClientCapabilities": GeneralClientCapabilities, + "GeneralClientCapabilitiesStaleRequestSupportType": GeneralClientCapabilitiesStaleRequestSupportType, + "GlobPattern": GlobPattern, + "Hover": Hover, + "HoverClientCapabilities": HoverClientCapabilities, + "HoverOptions": HoverOptions, + "HoverParams": HoverParams, + "HoverRegistrationOptions": HoverRegistrationOptions, + "ImplementationClientCapabilities": ImplementationClientCapabilities, + "ImplementationOptions": ImplementationOptions, + "ImplementationParams": ImplementationParams, + "ImplementationRegistrationOptions": ImplementationRegistrationOptions, + "InitializeError": InitializeError, + "InitializeParams": InitializeParams, + "InitializeParamsClientInfoType": InitializeParamsClientInfoType, + "InitializeRequest": InitializeRequest, + "InitializeResponse": InitializeResponse, + "InitializeResult": InitializeResult, + "InitializeResultServerInfoType": InitializeResultServerInfoType, + "InitializedNotification": InitializedNotification, + "InitializedParams": InitializedParams, + "InlayHint": InlayHint, + "InlayHintClientCapabilities": InlayHintClientCapabilities, + "InlayHintClientCapabilitiesResolveSupportType": InlayHintClientCapabilitiesResolveSupportType, + "InlayHintKind": InlayHintKind, + "InlayHintLabelPart": InlayHintLabelPart, + "InlayHintOptions": InlayHintOptions, + "InlayHintParams": InlayHintParams, + "InlayHintRegistrationOptions": InlayHintRegistrationOptions, + "InlayHintResolveRequest": InlayHintResolveRequest, + "InlayHintResolveResponse": InlayHintResolveResponse, + "InlayHintWorkspaceClientCapabilities": InlayHintWorkspaceClientCapabilities, + "InlineCompletionClientCapabilities": InlineCompletionClientCapabilities, + "InlineCompletionContext": InlineCompletionContext, + "InlineCompletionItem": InlineCompletionItem, + "InlineCompletionList": InlineCompletionList, + "InlineCompletionOptions": InlineCompletionOptions, + "InlineCompletionParams": InlineCompletionParams, + "InlineCompletionRegistrationOptions": InlineCompletionRegistrationOptions, + "InlineCompletionTriggerKind": InlineCompletionTriggerKind, + "InlineValue": InlineValue, + "InlineValueClientCapabilities": InlineValueClientCapabilities, + "InlineValueContext": InlineValueContext, + "InlineValueEvaluatableExpression": InlineValueEvaluatableExpression, + "InlineValueOptions": InlineValueOptions, + "InlineValueParams": InlineValueParams, + "InlineValueRegistrationOptions": InlineValueRegistrationOptions, + "InlineValueText": InlineValueText, + "InlineValueVariableLookup": InlineValueVariableLookup, + "InlineValueWorkspaceClientCapabilities": InlineValueWorkspaceClientCapabilities, + "InsertReplaceEdit": InsertReplaceEdit, + "InsertTextFormat": InsertTextFormat, + "InsertTextMode": InsertTextMode, + "LSPAny": LSPAny, + "LSPArray": LSPArray, + "LSPErrorCodes": LSPErrorCodes, + "LSPObject": LSPObject, + "LinkedEditingRangeClientCapabilities": LinkedEditingRangeClientCapabilities, + "LinkedEditingRangeOptions": LinkedEditingRangeOptions, + "LinkedEditingRangeParams": LinkedEditingRangeParams, + "LinkedEditingRangeRegistrationOptions": LinkedEditingRangeRegistrationOptions, + "LinkedEditingRanges": LinkedEditingRanges, + "Location": Location, + "LocationLink": LocationLink, + "LogMessageParams": LogMessageParams, + "LogTraceNotification": LogTraceNotification, + "LogTraceParams": LogTraceParams, + "MarkdownClientCapabilities": MarkdownClientCapabilities, + "MarkedString": MarkedString, + "MarkedString_Type1": MarkedString_Type1, + "MarkupContent": MarkupContent, + "MarkupKind": MarkupKind, + "MessageActionItem": MessageActionItem, + "MessageDirection": MessageDirection, + "MessageType": MessageType, + "Moniker": Moniker, + "MonikerClientCapabilities": MonikerClientCapabilities, + "MonikerKind": MonikerKind, + "MonikerOptions": MonikerOptions, + "MonikerParams": MonikerParams, + "MonikerRegistrationOptions": MonikerRegistrationOptions, + "NotebookCell": NotebookCell, + "NotebookCellArrayChange": NotebookCellArrayChange, + "NotebookCellKind": NotebookCellKind, + "NotebookCellTextDocumentFilter": NotebookCellTextDocumentFilter, + "NotebookDocument": NotebookDocument, + "NotebookDocumentChangeEvent": NotebookDocumentChangeEvent, + "NotebookDocumentChangeEventCellsType": NotebookDocumentChangeEventCellsType, + "NotebookDocumentChangeEventCellsTypeStructureType": NotebookDocumentChangeEventCellsTypeStructureType, + "NotebookDocumentChangeEventCellsTypeTextContentType": NotebookDocumentChangeEventCellsTypeTextContentType, + "NotebookDocumentClientCapabilities": NotebookDocumentClientCapabilities, + "NotebookDocumentDidChangeNotification": NotebookDocumentDidChangeNotification, + "NotebookDocumentDidCloseNotification": NotebookDocumentDidCloseNotification, + "NotebookDocumentDidOpenNotification": NotebookDocumentDidOpenNotification, + "NotebookDocumentDidSaveNotification": NotebookDocumentDidSaveNotification, + "NotebookDocumentFilter": NotebookDocumentFilter, + "NotebookDocumentFilter_Type1": NotebookDocumentFilter_Type1, + "NotebookDocumentFilter_Type2": NotebookDocumentFilter_Type2, + "NotebookDocumentFilter_Type3": NotebookDocumentFilter_Type3, + "NotebookDocumentIdentifier": NotebookDocumentIdentifier, + "NotebookDocumentSyncClientCapabilities": NotebookDocumentSyncClientCapabilities, + "NotebookDocumentSyncOptions": NotebookDocumentSyncOptions, + "NotebookDocumentSyncOptionsNotebookSelectorType1": NotebookDocumentSyncOptionsNotebookSelectorType1, + "NotebookDocumentSyncOptionsNotebookSelectorType1CellsType": NotebookDocumentSyncOptionsNotebookSelectorType1CellsType, + "NotebookDocumentSyncOptionsNotebookSelectorType2": NotebookDocumentSyncOptionsNotebookSelectorType2, + "NotebookDocumentSyncOptionsNotebookSelectorType2CellsType": NotebookDocumentSyncOptionsNotebookSelectorType2CellsType, + "NotebookDocumentSyncRegistrationOptions": NotebookDocumentSyncRegistrationOptions, + "NotebookDocumentSyncRegistrationOptionsNotebookSelectorType1": NotebookDocumentSyncRegistrationOptionsNotebookSelectorType1, + "NotebookDocumentSyncRegistrationOptionsNotebookSelectorType1CellsType": NotebookDocumentSyncRegistrationOptionsNotebookSelectorType1CellsType, + "NotebookDocumentSyncRegistrationOptionsNotebookSelectorType2": NotebookDocumentSyncRegistrationOptionsNotebookSelectorType2, + "NotebookDocumentSyncRegistrationOptionsNotebookSelectorType2CellsType": NotebookDocumentSyncRegistrationOptionsNotebookSelectorType2CellsType, + "OptionalVersionedTextDocumentIdentifier": OptionalVersionedTextDocumentIdentifier, + "ParameterInformation": ParameterInformation, + "PartialResultParams": PartialResultParams, + "Pattern": Pattern, + "Position": Position, + "PositionEncodingKind": PositionEncodingKind, + "PrepareRenameParams": PrepareRenameParams, + "PrepareRenameResult": PrepareRenameResult, + "PrepareRenameResult_Type1": PrepareRenameResult_Type1, + "PrepareRenameResult_Type2": PrepareRenameResult_Type2, + "PrepareSupportDefaultBehavior": PrepareSupportDefaultBehavior, + "PreviousResultId": PreviousResultId, + "ProgressNotification": ProgressNotification, + "ProgressParams": ProgressParams, + "ProgressToken": ProgressToken, + "PublishDiagnosticsClientCapabilities": PublishDiagnosticsClientCapabilities, + "PublishDiagnosticsClientCapabilitiesTagSupportType": PublishDiagnosticsClientCapabilitiesTagSupportType, + "PublishDiagnosticsParams": PublishDiagnosticsParams, + "Range": Range, + "ReferenceClientCapabilities": ReferenceClientCapabilities, + "ReferenceContext": ReferenceContext, + "ReferenceOptions": ReferenceOptions, + "ReferenceParams": ReferenceParams, + "ReferenceRegistrationOptions": ReferenceRegistrationOptions, + "Registration": Registration, + "RegistrationParams": RegistrationParams, + "RegularExpressionsClientCapabilities": RegularExpressionsClientCapabilities, + "RelatedFullDocumentDiagnosticReport": RelatedFullDocumentDiagnosticReport, + "RelatedUnchangedDocumentDiagnosticReport": RelatedUnchangedDocumentDiagnosticReport, + "RelativePattern": RelativePattern, + "RenameClientCapabilities": RenameClientCapabilities, + "RenameFile": RenameFile, + "RenameFileOptions": RenameFileOptions, + "RenameFilesParams": RenameFilesParams, + "RenameOptions": RenameOptions, + "RenameParams": RenameParams, + "RenameRegistrationOptions": RenameRegistrationOptions, + "ResourceOperation": ResourceOperation, + "ResourceOperationKind": ResourceOperationKind, + "ResponseError": ResponseError, + "ResponseErrorMessage": ResponseErrorMessage, + "SaveOptions": SaveOptions, + "SelectedCompletionInfo": SelectedCompletionInfo, + "SelectionRange": SelectionRange, + "SelectionRangeClientCapabilities": SelectionRangeClientCapabilities, + "SelectionRangeOptions": SelectionRangeOptions, + "SelectionRangeParams": SelectionRangeParams, + "SelectionRangeRegistrationOptions": SelectionRangeRegistrationOptions, + "SemanticTokenModifiers": SemanticTokenModifiers, + "SemanticTokenTypes": SemanticTokenTypes, + "SemanticTokens": SemanticTokens, + "SemanticTokensClientCapabilities": SemanticTokensClientCapabilities, + "SemanticTokensClientCapabilitiesRequestsType": SemanticTokensClientCapabilitiesRequestsType, + "SemanticTokensClientCapabilitiesRequestsTypeFullType1": SemanticTokensClientCapabilitiesRequestsTypeFullType1, + "SemanticTokensDelta": SemanticTokensDelta, + "SemanticTokensDeltaParams": SemanticTokensDeltaParams, + "SemanticTokensDeltaPartialResult": SemanticTokensDeltaPartialResult, + "SemanticTokensEdit": SemanticTokensEdit, + "SemanticTokensLegend": SemanticTokensLegend, + "SemanticTokensOptions": SemanticTokensOptions, + "SemanticTokensOptionsFullType1": SemanticTokensOptionsFullType1, + "SemanticTokensParams": SemanticTokensParams, + "SemanticTokensPartialResult": SemanticTokensPartialResult, + "SemanticTokensRangeParams": SemanticTokensRangeParams, + "SemanticTokensRegistrationOptions": SemanticTokensRegistrationOptions, + "SemanticTokensRegistrationOptionsFullType1": SemanticTokensRegistrationOptionsFullType1, + "SemanticTokensWorkspaceClientCapabilities": SemanticTokensWorkspaceClientCapabilities, + "ServerCapabilities": ServerCapabilities, + "ServerCapabilitiesWorkspaceType": ServerCapabilitiesWorkspaceType, + "SetTraceNotification": SetTraceNotification, + "SetTraceParams": SetTraceParams, + "ShowDocumentClientCapabilities": ShowDocumentClientCapabilities, + "ShowDocumentParams": ShowDocumentParams, + "ShowDocumentResult": ShowDocumentResult, + "ShowMessageParams": ShowMessageParams, + "ShowMessageRequestClientCapabilities": ShowMessageRequestClientCapabilities, + "ShowMessageRequestClientCapabilitiesMessageActionItemType": ShowMessageRequestClientCapabilitiesMessageActionItemType, + "ShowMessageRequestParams": ShowMessageRequestParams, + "ShutdownRequest": ShutdownRequest, + "ShutdownResponse": ShutdownResponse, + "SignatureHelp": SignatureHelp, + "SignatureHelpClientCapabilities": SignatureHelpClientCapabilities, + "SignatureHelpClientCapabilitiesSignatureInformationType": SignatureHelpClientCapabilitiesSignatureInformationType, + "SignatureHelpClientCapabilitiesSignatureInformationTypeParameterInformationType": SignatureHelpClientCapabilitiesSignatureInformationTypeParameterInformationType, + "SignatureHelpContext": SignatureHelpContext, + "SignatureHelpOptions": SignatureHelpOptions, + "SignatureHelpParams": SignatureHelpParams, + "SignatureHelpRegistrationOptions": SignatureHelpRegistrationOptions, + "SignatureHelpTriggerKind": SignatureHelpTriggerKind, + "SignatureInformation": SignatureInformation, + "StaticRegistrationOptions": StaticRegistrationOptions, + "StringValue": StringValue, + "SymbolInformation": SymbolInformation, + "SymbolKind": SymbolKind, + "SymbolTag": SymbolTag, + "TelemetryEventNotification": TelemetryEventNotification, + "TextDocumentChangeRegistrationOptions": TextDocumentChangeRegistrationOptions, + "TextDocumentClientCapabilities": TextDocumentClientCapabilities, + "TextDocumentCodeActionRequest": TextDocumentCodeActionRequest, + "TextDocumentCodeActionResponse": TextDocumentCodeActionResponse, + "TextDocumentCodeLensRequest": TextDocumentCodeLensRequest, + "TextDocumentCodeLensResponse": TextDocumentCodeLensResponse, + "TextDocumentColorPresentationOptions": TextDocumentColorPresentationOptions, + "TextDocumentColorPresentationRequest": TextDocumentColorPresentationRequest, + "TextDocumentColorPresentationResponse": TextDocumentColorPresentationResponse, + "TextDocumentCompletionRequest": TextDocumentCompletionRequest, + "TextDocumentCompletionResponse": TextDocumentCompletionResponse, + "TextDocumentContentChangeEvent": TextDocumentContentChangeEvent, + "TextDocumentContentChangeEvent_Type1": TextDocumentContentChangeEvent_Type1, + "TextDocumentContentChangeEvent_Type2": TextDocumentContentChangeEvent_Type2, + "TextDocumentDeclarationRequest": TextDocumentDeclarationRequest, + "TextDocumentDeclarationResponse": TextDocumentDeclarationResponse, + "TextDocumentDefinitionRequest": TextDocumentDefinitionRequest, + "TextDocumentDefinitionResponse": TextDocumentDefinitionResponse, + "TextDocumentDiagnosticRequest": TextDocumentDiagnosticRequest, + "TextDocumentDiagnosticResponse": TextDocumentDiagnosticResponse, + "TextDocumentDidChangeNotification": TextDocumentDidChangeNotification, + "TextDocumentDidCloseNotification": TextDocumentDidCloseNotification, + "TextDocumentDidOpenNotification": TextDocumentDidOpenNotification, + "TextDocumentDidSaveNotification": TextDocumentDidSaveNotification, + "TextDocumentDocumentColorRequest": TextDocumentDocumentColorRequest, + "TextDocumentDocumentColorResponse": TextDocumentDocumentColorResponse, + "TextDocumentDocumentHighlightRequest": TextDocumentDocumentHighlightRequest, + "TextDocumentDocumentHighlightResponse": TextDocumentDocumentHighlightResponse, + "TextDocumentDocumentLinkRequest": TextDocumentDocumentLinkRequest, + "TextDocumentDocumentLinkResponse": TextDocumentDocumentLinkResponse, + "TextDocumentDocumentSymbolRequest": TextDocumentDocumentSymbolRequest, + "TextDocumentDocumentSymbolResponse": TextDocumentDocumentSymbolResponse, + "TextDocumentEdit": TextDocumentEdit, + "TextDocumentFilter": TextDocumentFilter, + "TextDocumentFilter_Type1": TextDocumentFilter_Type1, + "TextDocumentFilter_Type2": TextDocumentFilter_Type2, + "TextDocumentFilter_Type3": TextDocumentFilter_Type3, + "TextDocumentFoldingRangeRequest": TextDocumentFoldingRangeRequest, + "TextDocumentFoldingRangeResponse": TextDocumentFoldingRangeResponse, + "TextDocumentFormattingRequest": TextDocumentFormattingRequest, + "TextDocumentFormattingResponse": TextDocumentFormattingResponse, + "TextDocumentHoverRequest": TextDocumentHoverRequest, + "TextDocumentHoverResponse": TextDocumentHoverResponse, + "TextDocumentIdentifier": TextDocumentIdentifier, + "TextDocumentImplementationRequest": TextDocumentImplementationRequest, + "TextDocumentImplementationResponse": TextDocumentImplementationResponse, + "TextDocumentInlayHintRequest": TextDocumentInlayHintRequest, + "TextDocumentInlayHintResponse": TextDocumentInlayHintResponse, + "TextDocumentInlineCompletionRequest": TextDocumentInlineCompletionRequest, + "TextDocumentInlineCompletionResponse": TextDocumentInlineCompletionResponse, + "TextDocumentInlineValueRequest": TextDocumentInlineValueRequest, + "TextDocumentInlineValueResponse": TextDocumentInlineValueResponse, + "TextDocumentItem": TextDocumentItem, + "TextDocumentLinkedEditingRangeRequest": TextDocumentLinkedEditingRangeRequest, + "TextDocumentLinkedEditingRangeResponse": TextDocumentLinkedEditingRangeResponse, + "TextDocumentMonikerRequest": TextDocumentMonikerRequest, + "TextDocumentMonikerResponse": TextDocumentMonikerResponse, + "TextDocumentOnTypeFormattingRequest": TextDocumentOnTypeFormattingRequest, + "TextDocumentOnTypeFormattingResponse": TextDocumentOnTypeFormattingResponse, + "TextDocumentPositionParams": TextDocumentPositionParams, + "TextDocumentPrepareCallHierarchyRequest": TextDocumentPrepareCallHierarchyRequest, + "TextDocumentPrepareCallHierarchyResponse": TextDocumentPrepareCallHierarchyResponse, + "TextDocumentPrepareRenameRequest": TextDocumentPrepareRenameRequest, + "TextDocumentPrepareRenameResponse": TextDocumentPrepareRenameResponse, + "TextDocumentPrepareTypeHierarchyRequest": TextDocumentPrepareTypeHierarchyRequest, + "TextDocumentPrepareTypeHierarchyResponse": TextDocumentPrepareTypeHierarchyResponse, + "TextDocumentPublishDiagnosticsNotification": TextDocumentPublishDiagnosticsNotification, + "TextDocumentRangeFormattingRequest": TextDocumentRangeFormattingRequest, + "TextDocumentRangeFormattingResponse": TextDocumentRangeFormattingResponse, + "TextDocumentRangesFormattingRequest": TextDocumentRangesFormattingRequest, + "TextDocumentRangesFormattingResponse": TextDocumentRangesFormattingResponse, + "TextDocumentReferencesRequest": TextDocumentReferencesRequest, + "TextDocumentReferencesResponse": TextDocumentReferencesResponse, + "TextDocumentRegistrationOptions": TextDocumentRegistrationOptions, + "TextDocumentRenameRequest": TextDocumentRenameRequest, + "TextDocumentRenameResponse": TextDocumentRenameResponse, + "TextDocumentSaveReason": TextDocumentSaveReason, + "TextDocumentSaveRegistrationOptions": TextDocumentSaveRegistrationOptions, + "TextDocumentSelectionRangeRequest": TextDocumentSelectionRangeRequest, + "TextDocumentSelectionRangeResponse": TextDocumentSelectionRangeResponse, + "TextDocumentSemanticTokensFullDeltaRequest": TextDocumentSemanticTokensFullDeltaRequest, + "TextDocumentSemanticTokensFullDeltaResponse": TextDocumentSemanticTokensFullDeltaResponse, + "TextDocumentSemanticTokensFullRequest": TextDocumentSemanticTokensFullRequest, + "TextDocumentSemanticTokensFullResponse": TextDocumentSemanticTokensFullResponse, + "TextDocumentSemanticTokensRangeRequest": TextDocumentSemanticTokensRangeRequest, + "TextDocumentSemanticTokensRangeResponse": TextDocumentSemanticTokensRangeResponse, + "TextDocumentSignatureHelpRequest": TextDocumentSignatureHelpRequest, + "TextDocumentSignatureHelpResponse": TextDocumentSignatureHelpResponse, + "TextDocumentSyncClientCapabilities": TextDocumentSyncClientCapabilities, + "TextDocumentSyncKind": TextDocumentSyncKind, + "TextDocumentSyncOptions": TextDocumentSyncOptions, + "TextDocumentTypeDefinitionRequest": TextDocumentTypeDefinitionRequest, + "TextDocumentTypeDefinitionResponse": TextDocumentTypeDefinitionResponse, + "TextDocumentWillSaveNotification": TextDocumentWillSaveNotification, + "TextDocumentWillSaveWaitUntilRequest": TextDocumentWillSaveWaitUntilRequest, + "TextDocumentWillSaveWaitUntilResponse": TextDocumentWillSaveWaitUntilResponse, + "TextEdit": TextEdit, + "TokenFormat": TokenFormat, + "TraceValues": TraceValues, + "TypeDefinitionClientCapabilities": TypeDefinitionClientCapabilities, + "TypeDefinitionOptions": TypeDefinitionOptions, + "TypeDefinitionParams": TypeDefinitionParams, + "TypeDefinitionRegistrationOptions": TypeDefinitionRegistrationOptions, + "TypeHierarchyClientCapabilities": TypeHierarchyClientCapabilities, + "TypeHierarchyItem": TypeHierarchyItem, + "TypeHierarchyOptions": TypeHierarchyOptions, + "TypeHierarchyPrepareParams": TypeHierarchyPrepareParams, + "TypeHierarchyRegistrationOptions": TypeHierarchyRegistrationOptions, + "TypeHierarchySubtypesParams": TypeHierarchySubtypesParams, + "TypeHierarchySubtypesRequest": TypeHierarchySubtypesRequest, + "TypeHierarchySubtypesResponse": TypeHierarchySubtypesResponse, + "TypeHierarchySupertypesParams": TypeHierarchySupertypesParams, + "TypeHierarchySupertypesRequest": TypeHierarchySupertypesRequest, + "TypeHierarchySupertypesResponse": TypeHierarchySupertypesResponse, + "UnchangedDocumentDiagnosticReport": UnchangedDocumentDiagnosticReport, + "UniquenessLevel": UniquenessLevel, + "Unregistration": Unregistration, + "UnregistrationParams": UnregistrationParams, + "VersionedNotebookDocumentIdentifier": VersionedNotebookDocumentIdentifier, + "VersionedTextDocumentIdentifier": VersionedTextDocumentIdentifier, + "WatchKind": WatchKind, + "WillSaveTextDocumentParams": WillSaveTextDocumentParams, + "WindowClientCapabilities": WindowClientCapabilities, + "WindowLogMessageNotification": WindowLogMessageNotification, + "WindowShowDocumentRequest": WindowShowDocumentRequest, + "WindowShowDocumentResponse": WindowShowDocumentResponse, + "WindowShowMessageNotification": WindowShowMessageNotification, + "WindowShowMessageRequestRequest": WindowShowMessageRequestRequest, + "WindowShowMessageRequestResponse": WindowShowMessageRequestResponse, + "WindowWorkDoneProgressCancelNotification": WindowWorkDoneProgressCancelNotification, + "WindowWorkDoneProgressCreateRequest": WindowWorkDoneProgressCreateRequest, + "WindowWorkDoneProgressCreateResponse": WindowWorkDoneProgressCreateResponse, + "WorkDoneProgressBegin": WorkDoneProgressBegin, + "WorkDoneProgressCancelParams": WorkDoneProgressCancelParams, + "WorkDoneProgressCreateParams": WorkDoneProgressCreateParams, + "WorkDoneProgressEnd": WorkDoneProgressEnd, + "WorkDoneProgressOptions": WorkDoneProgressOptions, + "WorkDoneProgressParams": WorkDoneProgressParams, + "WorkDoneProgressReport": WorkDoneProgressReport, + "WorkspaceApplyEditRequest": WorkspaceApplyEditRequest, + "WorkspaceApplyEditResponse": WorkspaceApplyEditResponse, + "WorkspaceClientCapabilities": WorkspaceClientCapabilities, + "WorkspaceCodeLensRefreshRequest": WorkspaceCodeLensRefreshRequest, + "WorkspaceCodeLensRefreshResponse": WorkspaceCodeLensRefreshResponse, + "WorkspaceConfigurationParams": WorkspaceConfigurationParams, + "WorkspaceConfigurationRequest": WorkspaceConfigurationRequest, + "WorkspaceConfigurationResponse": WorkspaceConfigurationResponse, + "WorkspaceDiagnosticParams": WorkspaceDiagnosticParams, + "WorkspaceDiagnosticRefreshRequest": WorkspaceDiagnosticRefreshRequest, + "WorkspaceDiagnosticRefreshResponse": WorkspaceDiagnosticRefreshResponse, + "WorkspaceDiagnosticReport": WorkspaceDiagnosticReport, + "WorkspaceDiagnosticReportPartialResult": WorkspaceDiagnosticReportPartialResult, + "WorkspaceDiagnosticRequest": WorkspaceDiagnosticRequest, + "WorkspaceDiagnosticResponse": WorkspaceDiagnosticResponse, + "WorkspaceDidChangeConfigurationNotification": WorkspaceDidChangeConfigurationNotification, + "WorkspaceDidChangeWatchedFilesNotification": WorkspaceDidChangeWatchedFilesNotification, + "WorkspaceDidChangeWorkspaceFoldersNotification": WorkspaceDidChangeWorkspaceFoldersNotification, + "WorkspaceDidCreateFilesNotification": WorkspaceDidCreateFilesNotification, + "WorkspaceDidDeleteFilesNotification": WorkspaceDidDeleteFilesNotification, + "WorkspaceDidRenameFilesNotification": WorkspaceDidRenameFilesNotification, + "WorkspaceDocumentDiagnosticReport": WorkspaceDocumentDiagnosticReport, + "WorkspaceEdit": WorkspaceEdit, + "WorkspaceEditClientCapabilities": WorkspaceEditClientCapabilities, + "WorkspaceEditClientCapabilitiesChangeAnnotationSupportType": WorkspaceEditClientCapabilitiesChangeAnnotationSupportType, + "WorkspaceExecuteCommandRequest": WorkspaceExecuteCommandRequest, + "WorkspaceExecuteCommandResponse": WorkspaceExecuteCommandResponse, + "WorkspaceFolder": WorkspaceFolder, + "WorkspaceFoldersChangeEvent": WorkspaceFoldersChangeEvent, + "WorkspaceFoldersInitializeParams": WorkspaceFoldersInitializeParams, + "WorkspaceFoldersServerCapabilities": WorkspaceFoldersServerCapabilities, + "WorkspaceFoldingRangeRefreshRequest": WorkspaceFoldingRangeRefreshRequest, + "WorkspaceFoldingRangeRefreshResponse": WorkspaceFoldingRangeRefreshResponse, + "WorkspaceFullDocumentDiagnosticReport": WorkspaceFullDocumentDiagnosticReport, + "WorkspaceInlayHintRefreshRequest": WorkspaceInlayHintRefreshRequest, + "WorkspaceInlayHintRefreshResponse": WorkspaceInlayHintRefreshResponse, + "WorkspaceInlineValueRefreshRequest": WorkspaceInlineValueRefreshRequest, + "WorkspaceInlineValueRefreshResponse": WorkspaceInlineValueRefreshResponse, + "WorkspaceSemanticTokensRefreshRequest": WorkspaceSemanticTokensRefreshRequest, + "WorkspaceSemanticTokensRefreshResponse": WorkspaceSemanticTokensRefreshResponse, + "WorkspaceSymbol": WorkspaceSymbol, + "WorkspaceSymbolClientCapabilities": WorkspaceSymbolClientCapabilities, + "WorkspaceSymbolClientCapabilitiesResolveSupportType": WorkspaceSymbolClientCapabilitiesResolveSupportType, + "WorkspaceSymbolClientCapabilitiesSymbolKindType": WorkspaceSymbolClientCapabilitiesSymbolKindType, + "WorkspaceSymbolClientCapabilitiesTagSupportType": WorkspaceSymbolClientCapabilitiesTagSupportType, + "WorkspaceSymbolLocationType1": WorkspaceSymbolLocationType1, + "WorkspaceSymbolOptions": WorkspaceSymbolOptions, + "WorkspaceSymbolParams": WorkspaceSymbolParams, + "WorkspaceSymbolRegistrationOptions": WorkspaceSymbolRegistrationOptions, + "WorkspaceSymbolRequest": WorkspaceSymbolRequest, + "WorkspaceSymbolResolveRequest": WorkspaceSymbolResolveRequest, + "WorkspaceSymbolResolveResponse": WorkspaceSymbolResolveResponse, + "WorkspaceSymbolResponse": WorkspaceSymbolResponse, + "WorkspaceUnchangedDocumentDiagnosticReport": WorkspaceUnchangedDocumentDiagnosticReport, + "WorkspaceWillCreateFilesRequest": WorkspaceWillCreateFilesRequest, + "WorkspaceWillCreateFilesResponse": WorkspaceWillCreateFilesResponse, + "WorkspaceWillDeleteFilesRequest": WorkspaceWillDeleteFilesRequest, + "WorkspaceWillDeleteFilesResponse": WorkspaceWillDeleteFilesResponse, + "WorkspaceWillRenameFilesRequest": WorkspaceWillRenameFilesRequest, + "WorkspaceWillRenameFilesResponse": WorkspaceWillRenameFilesResponse, + "WorkspaceWorkspaceFoldersRequest": WorkspaceWorkspaceFoldersRequest, + "WorkspaceWorkspaceFoldersResponse": WorkspaceWorkspaceFoldersResponse, + "_InitializeParams": _InitializeParams, +} + +_MESSAGE_DIRECTION: Dict[str, str] = { + # Request methods + CALL_HIERARCHY_INCOMING_CALLS: "clientToServer", + CALL_HIERARCHY_OUTGOING_CALLS: "clientToServer", + CLIENT_REGISTER_CAPABILITY: "serverToClient", + CLIENT_UNREGISTER_CAPABILITY: "serverToClient", + CODE_ACTION_RESOLVE: "clientToServer", + CODE_LENS_RESOLVE: "clientToServer", + COMPLETION_ITEM_RESOLVE: "clientToServer", + DOCUMENT_LINK_RESOLVE: "clientToServer", + INITIALIZE: "clientToServer", + INLAY_HINT_RESOLVE: "clientToServer", + SHUTDOWN: "clientToServer", + TEXT_DOCUMENT_CODE_ACTION: "clientToServer", + TEXT_DOCUMENT_CODE_LENS: "clientToServer", + TEXT_DOCUMENT_COLOR_PRESENTATION: "clientToServer", + TEXT_DOCUMENT_COMPLETION: "clientToServer", + TEXT_DOCUMENT_DECLARATION: "clientToServer", + TEXT_DOCUMENT_DEFINITION: "clientToServer", + TEXT_DOCUMENT_DIAGNOSTIC: "clientToServer", + TEXT_DOCUMENT_DOCUMENT_COLOR: "clientToServer", + TEXT_DOCUMENT_DOCUMENT_HIGHLIGHT: "clientToServer", + TEXT_DOCUMENT_DOCUMENT_LINK: "clientToServer", + TEXT_DOCUMENT_DOCUMENT_SYMBOL: "clientToServer", + TEXT_DOCUMENT_FOLDING_RANGE: "clientToServer", + TEXT_DOCUMENT_FORMATTING: "clientToServer", + TEXT_DOCUMENT_HOVER: "clientToServer", + TEXT_DOCUMENT_IMPLEMENTATION: "clientToServer", + TEXT_DOCUMENT_INLAY_HINT: "clientToServer", + TEXT_DOCUMENT_INLINE_COMPLETION: "clientToServer", + TEXT_DOCUMENT_INLINE_VALUE: "clientToServer", + TEXT_DOCUMENT_LINKED_EDITING_RANGE: "clientToServer", + TEXT_DOCUMENT_MONIKER: "clientToServer", + TEXT_DOCUMENT_ON_TYPE_FORMATTING: "clientToServer", + TEXT_DOCUMENT_PREPARE_CALL_HIERARCHY: "clientToServer", + TEXT_DOCUMENT_PREPARE_RENAME: "clientToServer", + TEXT_DOCUMENT_PREPARE_TYPE_HIERARCHY: "clientToServer", + TEXT_DOCUMENT_RANGES_FORMATTING: "clientToServer", + TEXT_DOCUMENT_RANGE_FORMATTING: "clientToServer", + TEXT_DOCUMENT_REFERENCES: "clientToServer", + TEXT_DOCUMENT_RENAME: "clientToServer", + TEXT_DOCUMENT_SELECTION_RANGE: "clientToServer", + TEXT_DOCUMENT_SEMANTIC_TOKENS_FULL: "clientToServer", + TEXT_DOCUMENT_SEMANTIC_TOKENS_FULL_DELTA: "clientToServer", + TEXT_DOCUMENT_SEMANTIC_TOKENS_RANGE: "clientToServer", + TEXT_DOCUMENT_SIGNATURE_HELP: "clientToServer", + TEXT_DOCUMENT_TYPE_DEFINITION: "clientToServer", + TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL: "clientToServer", + TYPE_HIERARCHY_SUBTYPES: "clientToServer", + TYPE_HIERARCHY_SUPERTYPES: "clientToServer", + WINDOW_SHOW_DOCUMENT: "serverToClient", + WINDOW_SHOW_MESSAGE_REQUEST: "serverToClient", + WINDOW_WORK_DONE_PROGRESS_CREATE: "serverToClient", + WORKSPACE_APPLY_EDIT: "serverToClient", + WORKSPACE_CODE_LENS_REFRESH: "serverToClient", + WORKSPACE_CONFIGURATION: "serverToClient", + WORKSPACE_DIAGNOSTIC: "clientToServer", + WORKSPACE_DIAGNOSTIC_REFRESH: "serverToClient", + WORKSPACE_EXECUTE_COMMAND: "clientToServer", + WORKSPACE_FOLDING_RANGE_REFRESH: "serverToClient", + WORKSPACE_INLAY_HINT_REFRESH: "serverToClient", + WORKSPACE_INLINE_VALUE_REFRESH: "serverToClient", + WORKSPACE_SEMANTIC_TOKENS_REFRESH: "serverToClient", + WORKSPACE_SYMBOL: "clientToServer", + WORKSPACE_SYMBOL_RESOLVE: "clientToServer", + WORKSPACE_WILL_CREATE_FILES: "clientToServer", + WORKSPACE_WILL_DELETE_FILES: "clientToServer", + WORKSPACE_WILL_RENAME_FILES: "clientToServer", + WORKSPACE_WORKSPACE_FOLDERS: "serverToClient", + # Notification methods + CANCEL_REQUEST: "both", + EXIT: "clientToServer", + INITIALIZED: "clientToServer", + LOG_TRACE: "serverToClient", + NOTEBOOK_DOCUMENT_DID_CHANGE: "clientToServer", + NOTEBOOK_DOCUMENT_DID_CLOSE: "clientToServer", + NOTEBOOK_DOCUMENT_DID_OPEN: "clientToServer", + NOTEBOOK_DOCUMENT_DID_SAVE: "clientToServer", + PROGRESS: "both", + SET_TRACE: "clientToServer", + TELEMETRY_EVENT: "serverToClient", + TEXT_DOCUMENT_DID_CHANGE: "clientToServer", + TEXT_DOCUMENT_DID_CLOSE: "clientToServer", + TEXT_DOCUMENT_DID_OPEN: "clientToServer", + TEXT_DOCUMENT_DID_SAVE: "clientToServer", + TEXT_DOCUMENT_PUBLISH_DIAGNOSTICS: "serverToClient", + TEXT_DOCUMENT_WILL_SAVE: "clientToServer", + WINDOW_LOG_MESSAGE: "serverToClient", + WINDOW_SHOW_MESSAGE: "serverToClient", + WINDOW_WORK_DONE_PROGRESS_CANCEL: "clientToServer", + WORKSPACE_DID_CHANGE_CONFIGURATION: "clientToServer", + WORKSPACE_DID_CHANGE_WATCHED_FILES: "clientToServer", + WORKSPACE_DID_CHANGE_WORKSPACE_FOLDERS: "clientToServer", + WORKSPACE_DID_CREATE_FILES: "clientToServer", + WORKSPACE_DID_DELETE_FILES: "clientToServer", + WORKSPACE_DID_RENAME_FILES: "clientToServer", +} + + +def message_direction(method: str) -> str: + """Returns message direction clientToServer, serverToClient or both.""" + return _MESSAGE_DIRECTION[method] diff --git a/packages/python/lsprotocol/validators.py b/packages/python/lsprotocol/validators.py new file mode 100644 index 0000000..a0f00c7 --- /dev/null +++ b/packages/python/lsprotocol/validators.py @@ -0,0 +1,47 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + + +from typing import TYPE_CHECKING, Any + +if TYPE_CHECKING: + import attrs + +INTEGER_MIN_VALUE = -(2**31) +INTEGER_MAX_VALUE = 2**31 - 1 + + +def integer_validator( + instance: Any, + attribute: "attrs.Attribute[int]", + value: Any, +) -> bool: + """Validates that integer value belongs in the range expected by LSP.""" + if not isinstance(value, int) or not ( + INTEGER_MIN_VALUE <= value <= INTEGER_MAX_VALUE + ): + name = attribute.name if hasattr(attribute, "name") else str(attribute) + raise ValueError( + f"{instance.__class__.__qualname__}.{name} should be in range [{INTEGER_MIN_VALUE}:{INTEGER_MAX_VALUE}], but was {value}." + ) + return True + + +UINTEGER_MIN_VALUE = 0 +UINTEGER_MAX_VALUE = 2**31 - 1 + + +def uinteger_validator( + instance: Any, + attribute: "attrs.Attribute[int]", + value: Any, +) -> bool: + """Validates that unsigned integer value belongs in the range expected by LSP.""" + if not isinstance(value, int) or not ( + UINTEGER_MIN_VALUE <= value <= UINTEGER_MAX_VALUE + ): + name = attribute.name if hasattr(attribute, "name") else str(attribute) + raise ValueError( + f"{instance.__class__.__qualname__}.{name} should be in range [{UINTEGER_MIN_VALUE}:{UINTEGER_MAX_VALUE}], but was {value}." + ) + return True diff --git a/packages/python/pyproject.toml b/packages/python/pyproject.toml new file mode 100644 index 0000000..999d175 --- /dev/null +++ b/packages/python/pyproject.toml @@ -0,0 +1,47 @@ +[build-system] +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + +[project] +name = "lsprotocol" +description = 'Python implementation of the Language Server Protocol.' +version = "2023.0.0" +authors = [ + { name = "Microsoft Corporation", email = "lsprotocol-help@microsoft.com" }, +] +license = { file = "LICENSE" } +readme = { "file" = "README.md", "content-type" = "text/markdown" } +requires-python = ">=3.7" +maintainers = [ + { name = "Brett Cannon", email = "brett@python.org" }, + { name = "Karthik Nadig", email = "kanadig@microsoft.com" }, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] +dependencies = ["attrs>=21.3.0", "cattrs"] + +[project.urls] +Issues = "https://github.com/microsoft/lsprotocol/issues" +Source = "https://github.com/microsoft/lsprotocol" + +[tool.flit.sdist] +include = ["lsprotocol/", "README.md", "LICENSE"] +exclude = ["lsprotocol/__pycache__/", "requirements.in", "requirements.txt"] + +[tool.mypy] +files = "lsprotocol" +show_error_codes = true +strict = true +enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] +enable_recursive_aliases = true diff --git a/packages/python/requirements.in b/packages/python/requirements.in new file mode 100644 index 0000000..cbb28c2 --- /dev/null +++ b/packages/python/requirements.in @@ -0,0 +1,8 @@ +# This file is used to generate requirements.txt. +# To update requirements.txt, run the following commands. +# 1) pip install pip-tools +# 2) pip-compile --generate-hashes --upgrade ./packages/python/requirements.in + +# `lsprotocol` package dependencies +attrs +cattrs diff --git a/packages/python/requirements.txt b/packages/python/requirements.txt new file mode 100644 index 0000000..1475faa --- /dev/null +++ b/packages/python/requirements.txt @@ -0,0 +1,34 @@ +# +# This file is autogenerated by pip-compile with Python 3.7 +# by the following command: +# +# pip-compile --config=pyproject.toml --generate-hashes --resolver=backtracking ./packages/python/requirements.in +# +attrs==23.1.0 \ + --hash=sha256:1f28b4522cdc2fb4256ac1a020c78acf9cba2c6b461ccd2c126f3aa8e8335d04 \ + --hash=sha256:6279836d581513a26f1bf235f9acd333bc9115683f14f7e8fae46c98fc50e015 + # via + # -r ./packages/python/requirements.in + # cattrs +cattrs==23.1.2 \ + --hash=sha256:b2bb14311ac17bed0d58785e5a60f022e5431aca3932e3fc5cc8ed8639de50a4 \ + --hash=sha256:db1c821b8c537382b2c7c66678c3790091ca0275ac486c76f3c8f3920e83c657 + # via -r ./packages/python/requirements.in +exceptiongroup==1.1.3 \ + --hash=sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9 \ + --hash=sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3 + # via cattrs +importlib-metadata==6.7.0 \ + --hash=sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4 \ + --hash=sha256:cb52082e659e97afc5dac71e79de97d8681de3aa07ff18578330904a9d18e5b5 + # via attrs +typing-extensions==4.7.1 \ + --hash=sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36 \ + --hash=sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2 + # via + # cattrs + # importlib-metadata +zipp==3.15.0 \ + --hash=sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b \ + --hash=sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556 + # via importlib-metadata diff --git a/packages/rust/lsprotocol/Cargo.toml b/packages/rust/lsprotocol/Cargo.toml new file mode 100644 index 0000000..4d1ddc9 --- /dev/null +++ b/packages/rust/lsprotocol/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "lsprotocol" +version = "0.1.0" +edition = "2021" +description = "Rust implementation of the Language Server Protocol generated from LSP specification." +authors = ["Microsoft Corporation <lsprotocol-help@microsoft.com>", "Karthik Nadig <kanadig@microsoft.com>"] +license = "MIT" +repository = "https://github.com/microsoft/lsprotocol" +readme = "README.md" + +[dependencies] +serde = {version ="1.0.152", features = ["derive"]} +serde_json = "1.0.93" +serde_repr = "0.1.10" +url = "2.3.1" +rust_decimal = "1.29.1" diff --git a/packages/rust/lsprotocol/LICENSE b/packages/rust/lsprotocol/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/packages/rust/lsprotocol/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/packages/rust/lsprotocol/README.md b/packages/rust/lsprotocol/README.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/packages/rust/lsprotocol/README.md diff --git a/packages/rust/lsprotocol/src/lib.rs b/packages/rust/lsprotocol/src/lib.rs new file mode 100644 index 0000000..d50af4b --- /dev/null +++ b/packages/rust/lsprotocol/src/lib.rs @@ -0,0 +1,10474 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// ****** THIS IS A GENERATED FILE, DO NOT EDIT. ****** +// Steps to generate: +// 1. Checkout https://github.com/microsoft/lsprotocol +// 2. Install nox: `python -m pip install nox` +// 3. Run command: `python -m nox --session build_lsp` + +use rust_decimal::Decimal; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +/// This type allows extending any string enum to support custom values. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum CustomStringEnum<T> { + /// The value is one of the known enum values. + Known(T), + /// The value is custom. + Custom(String), +} + +/// This type allows extending any integer enum to support custom values. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum CustomIntEnum<T> { + /// The value is one of the known enum values. + Known(T), + /// The value is custom. + Custom(i32), +} + +/// This allows a field to have two types. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum OR2<T, U> { + T(T), + U(U), +} + +/// This allows a field to have three types. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum OR3<T, U, V> { + T(T), + U(U), + V(V), +} + +/// This allows a field to have four types. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum OR4<T, U, V, W> { + T(T), + U(U), + V(V), + W(W), +} + +/// This allows a field to have five types. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum OR5<T, U, V, W, X> { + T(T), + U(U), + V(V), + W(W), + X(X), +} + +/// This allows a field to have six types. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum OR6<T, U, V, W, X, Y> { + T(T), + U(U), + V(V), + W(W), + X(X), + Y(Y), +} + +/// This allows a field to have seven types. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum OR7<T, U, V, W, X, Y, Z> { + T(T), + U(U), + V(V), + W(W), + X(X), + Y(Y), + Z(Z), +} + +/// This allows a field to always have null or empty value. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum LSPNull { + None, +} + +/// The LSP any type. +/// Please note that strictly speaking a property with the value `undefined` +/// can't be converted into JSON preserving the property name. However for +/// convenience it is allowed and assumed that all these properties are +/// optional as well. +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum LSPAny { + String(String), + Integer(i32), + UInteger(u32), + Decimal(Decimal), + Boolean(bool), + Object(LSPObject), + Array(LSPArray), + Null, +} + +/// LSP object definition. +/// @since 3.17.0 +type LSPObject = serde_json::Value; + +/// LSP arrays. +/// @since 3.17.0 +type LSPArray = Vec<LSPAny>; + +/// A selection range represents a part of a selection hierarchy. A selection range +/// may have a parent selection range that contains it. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub struct SelectionRange { + /// The [range][Range] of this selection range. + pub range: Range, + + /// The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. + pub parent: Option<Box<SelectionRange>>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum LSPRequestMethods { + #[serde(rename = "textDocument/implementation")] + TextDocumentImplementation, + #[serde(rename = "textDocument/typeDefinition")] + TextDocumentTypeDefinition, + #[serde(rename = "workspace/workspaceFolders")] + WorkspaceWorkspaceFolders, + #[serde(rename = "workspace/configuration")] + WorkspaceConfiguration, + #[serde(rename = "textDocument/documentColor")] + TextDocumentDocumentColor, + #[serde(rename = "textDocument/colorPresentation")] + TextDocumentColorPresentation, + #[serde(rename = "textDocument/foldingRange")] + TextDocumentFoldingRange, + #[serde(rename = "workspace/foldingRange/refresh")] + WorkspaceFoldingRangeRefresh, + #[serde(rename = "textDocument/declaration")] + TextDocumentDeclaration, + #[serde(rename = "textDocument/selectionRange")] + TextDocumentSelectionRange, + #[serde(rename = "window/workDoneProgress/create")] + WindowWorkDoneProgressCreate, + #[serde(rename = "textDocument/prepareCallHierarchy")] + TextDocumentPrepareCallHierarchy, + #[serde(rename = "callHierarchy/incomingCalls")] + CallHierarchyIncomingCalls, + #[serde(rename = "callHierarchy/outgoingCalls")] + CallHierarchyOutgoingCalls, + #[serde(rename = "textDocument/semanticTokens/full")] + TextDocumentSemanticTokensFull, + #[serde(rename = "textDocument/semanticTokens/full/delta")] + TextDocumentSemanticTokensFullDelta, + #[serde(rename = "textDocument/semanticTokens/range")] + TextDocumentSemanticTokensRange, + #[serde(rename = "workspace/semanticTokens/refresh")] + WorkspaceSemanticTokensRefresh, + #[serde(rename = "window/showDocument")] + WindowShowDocument, + #[serde(rename = "textDocument/linkedEditingRange")] + TextDocumentLinkedEditingRange, + #[serde(rename = "workspace/willCreateFiles")] + WorkspaceWillCreateFiles, + #[serde(rename = "workspace/willRenameFiles")] + WorkspaceWillRenameFiles, + #[serde(rename = "workspace/willDeleteFiles")] + WorkspaceWillDeleteFiles, + #[serde(rename = "textDocument/moniker")] + TextDocumentMoniker, + #[serde(rename = "textDocument/prepareTypeHierarchy")] + TextDocumentPrepareTypeHierarchy, + #[serde(rename = "typeHierarchy/supertypes")] + TypeHierarchySupertypes, + #[serde(rename = "typeHierarchy/subtypes")] + TypeHierarchySubtypes, + #[serde(rename = "textDocument/inlineValue")] + TextDocumentInlineValue, + #[serde(rename = "workspace/inlineValue/refresh")] + WorkspaceInlineValueRefresh, + #[serde(rename = "textDocument/inlayHint")] + TextDocumentInlayHint, + #[serde(rename = "inlayHint/resolve")] + InlayHintResolve, + #[serde(rename = "workspace/inlayHint/refresh")] + WorkspaceInlayHintRefresh, + #[serde(rename = "textDocument/diagnostic")] + TextDocumentDiagnostic, + #[serde(rename = "workspace/diagnostic")] + WorkspaceDiagnostic, + #[serde(rename = "workspace/diagnostic/refresh")] + WorkspaceDiagnosticRefresh, + #[serde(rename = "textDocument/inlineCompletion")] + TextDocumentInlineCompletion, + #[serde(rename = "client/registerCapability")] + ClientRegisterCapability, + #[serde(rename = "client/unregisterCapability")] + ClientUnregisterCapability, + #[serde(rename = "initialize")] + Initialize, + #[serde(rename = "shutdown")] + Shutdown, + #[serde(rename = "window/showMessageRequest")] + WindowShowMessageRequest, + #[serde(rename = "textDocument/willSaveWaitUntil")] + TextDocumentWillSaveWaitUntil, + #[serde(rename = "textDocument/completion")] + TextDocumentCompletion, + #[serde(rename = "completionItem/resolve")] + CompletionItemResolve, + #[serde(rename = "textDocument/hover")] + TextDocumentHover, + #[serde(rename = "textDocument/signatureHelp")] + TextDocumentSignatureHelp, + #[serde(rename = "textDocument/definition")] + TextDocumentDefinition, + #[serde(rename = "textDocument/references")] + TextDocumentReferences, + #[serde(rename = "textDocument/documentHighlight")] + TextDocumentDocumentHighlight, + #[serde(rename = "textDocument/documentSymbol")] + TextDocumentDocumentSymbol, + #[serde(rename = "textDocument/codeAction")] + TextDocumentCodeAction, + #[serde(rename = "codeAction/resolve")] + CodeActionResolve, + #[serde(rename = "workspace/symbol")] + WorkspaceSymbol, + #[serde(rename = "workspaceSymbol/resolve")] + WorkspaceSymbolResolve, + #[serde(rename = "textDocument/codeLens")] + TextDocumentCodeLens, + #[serde(rename = "codeLens/resolve")] + CodeLensResolve, + #[serde(rename = "workspace/codeLens/refresh")] + WorkspaceCodeLensRefresh, + #[serde(rename = "textDocument/documentLink")] + TextDocumentDocumentLink, + #[serde(rename = "documentLink/resolve")] + DocumentLinkResolve, + #[serde(rename = "textDocument/formatting")] + TextDocumentFormatting, + #[serde(rename = "textDocument/rangeFormatting")] + TextDocumentRangeFormatting, + #[serde(rename = "textDocument/rangesFormatting")] + TextDocumentRangesFormatting, + #[serde(rename = "textDocument/onTypeFormatting")] + TextDocumentOnTypeFormatting, + #[serde(rename = "textDocument/rename")] + TextDocumentRename, + #[serde(rename = "textDocument/prepareRename")] + TextDocumentPrepareRename, + #[serde(rename = "workspace/executeCommand")] + WorkspaceExecuteCommand, + #[serde(rename = "workspace/applyEdit")] + WorkspaceApplyEdit, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum LSPNotificationMethods { + #[serde(rename = "workspace/didChangeWorkspaceFolders")] + WorkspaceDidChangeWorkspaceFolders, + #[serde(rename = "window/workDoneProgress/cancel")] + WindowWorkDoneProgressCancel, + #[serde(rename = "workspace/didCreateFiles")] + WorkspaceDidCreateFiles, + #[serde(rename = "workspace/didRenameFiles")] + WorkspaceDidRenameFiles, + #[serde(rename = "workspace/didDeleteFiles")] + WorkspaceDidDeleteFiles, + #[serde(rename = "notebookDocument/didOpen")] + NotebookDocumentDidOpen, + #[serde(rename = "notebookDocument/didChange")] + NotebookDocumentDidChange, + #[serde(rename = "notebookDocument/didSave")] + NotebookDocumentDidSave, + #[serde(rename = "notebookDocument/didClose")] + NotebookDocumentDidClose, + #[serde(rename = "initialized")] + Initialized, + #[serde(rename = "exit")] + Exit, + #[serde(rename = "workspace/didChangeConfiguration")] + WorkspaceDidChangeConfiguration, + #[serde(rename = "window/showMessage")] + WindowShowMessage, + #[serde(rename = "window/logMessage")] + WindowLogMessage, + #[serde(rename = "telemetry/event")] + TelemetryEvent, + #[serde(rename = "textDocument/didOpen")] + TextDocumentDidOpen, + #[serde(rename = "textDocument/didChange")] + TextDocumentDidChange, + #[serde(rename = "textDocument/didClose")] + TextDocumentDidClose, + #[serde(rename = "textDocument/didSave")] + TextDocumentDidSave, + #[serde(rename = "textDocument/willSave")] + TextDocumentWillSave, + #[serde(rename = "workspace/didChangeWatchedFiles")] + WorkspaceDidChangeWatchedFiles, + #[serde(rename = "textDocument/publishDiagnostics")] + TextDocumentPublishDiagnostics, + #[serde(rename = "$/setTrace")] + SetTrace, + #[serde(rename = "$/logTrace")] + LogTrace, + #[serde(rename = "$/cancelRequest")] + CancelRequest, + #[serde(rename = "$/progress")] + Progress, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum MessageDirection { + #[serde(rename = "clientToServer")] + ClientToServer, + #[serde(rename = "both")] + Both, + #[serde(rename = "serverToClient")] + ServerToClient, +} + +/// A set of predefined token types. This set is not fixed +/// an clients can specify additional token types via the +/// corresponding client capabilities. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum SemanticTokenTypes { + #[serde(rename = "namespace")] + Namespace, + + /// Represents a generic type. Acts as a fallback for types which can't be mapped to + /// a specific type like class or enum. + #[serde(rename = "type")] + Type, + + #[serde(rename = "class")] + Class, + + #[serde(rename = "enum")] + Enum, + + #[serde(rename = "interface")] + Interface, + + #[serde(rename = "struct")] + Struct, + + #[serde(rename = "typeParameter")] + TypeParameter, + + #[serde(rename = "parameter")] + Parameter, + + #[serde(rename = "variable")] + Variable, + + #[serde(rename = "property")] + Property, + + #[serde(rename = "enumMember")] + EnumMember, + + #[serde(rename = "event")] + Event, + + #[serde(rename = "function")] + Function, + + #[serde(rename = "method")] + Method, + + #[serde(rename = "macro")] + Macro, + + #[serde(rename = "keyword")] + Keyword, + + #[serde(rename = "modifier")] + Modifier, + + #[serde(rename = "comment")] + Comment, + + #[serde(rename = "string")] + String, + + #[serde(rename = "number")] + Number, + + #[serde(rename = "regexp")] + Regexp, + + #[serde(rename = "operator")] + Operator, + + /// @since 3.17.0 + #[serde(rename = "decorator")] + Decorator, +} + +/// A set of predefined token modifiers. This set is not fixed +/// an clients can specify additional token types via the +/// corresponding client capabilities. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum SemanticTokenModifiers { + #[serde(rename = "declaration")] + Declaration, + + #[serde(rename = "definition")] + Definition, + + #[serde(rename = "readonly")] + Readonly, + + #[serde(rename = "static")] + Static, + + #[serde(rename = "deprecated")] + Deprecated, + + #[serde(rename = "abstract")] + Abstract, + + #[serde(rename = "async")] + Async, + + #[serde(rename = "modification")] + Modification, + + #[serde(rename = "documentation")] + Documentation, + + #[serde(rename = "defaultLibrary")] + DefaultLibrary, +} + +/// The document diagnostic report kinds. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum DocumentDiagnosticReportKind { + /// A diagnostic report with a full + /// set of problems. + #[serde(rename = "full")] + Full, + + /// A report indicating that the last + /// returned report is still accurate. + #[serde(rename = "unchanged")] + Unchanged, +} + +/// Predefined error codes. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum ErrorCodes { + ParseError = -32700, + + InvalidRequest = -32600, + + MethodNotFound = -32601, + + InvalidParams = -32602, + + InternalError = -32603, + + /// Error code indicating that a server received a notification or + /// request before the server has received the `initialize` request. + ServerNotInitialized = -32002, + + UnknownErrorCode = -32001, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum LSPErrorCodes { + /// A request failed but it was syntactically correct, e.g the + /// method name was known and the parameters were valid. The error + /// message should contain human readable information about why + /// the request failed. + /// + /// @since 3.17.0 + RequestFailed = -32803, + + /// The server cancelled the request. This error code should + /// only be used for requests that explicitly support being + /// server cancellable. + /// + /// @since 3.17.0 + ServerCancelled = -32802, + + /// The server detected that the content of a document got + /// modified outside normal conditions. A server should + /// NOT send this error code if it detects a content change + /// in it unprocessed messages. The result even computed + /// on an older state might still be useful for the client. + /// + /// If a client decides that a result is not of any use anymore + /// the client should cancel the request. + ContentModified = -32801, + + /// The client has canceled a request and a server as detected + /// the cancel. + RequestCancelled = -32800, +} + +/// A set of predefined range kinds. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum FoldingRangeKind { + /// Folding range for a comment + #[serde(rename = "comment")] + Comment, + + /// Folding range for an import or include + #[serde(rename = "imports")] + Imports, + + /// Folding range for a region (e.g. `#region`) + #[serde(rename = "region")] + Region, +} + +/// A symbol kind. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum SymbolKind { + File = 1, + + Module = 2, + + Namespace = 3, + + Package = 4, + + Class = 5, + + Method = 6, + + Property = 7, + + Field = 8, + + Constructor = 9, + + Enum = 10, + + Interface = 11, + + Function = 12, + + Variable = 13, + + Constant = 14, + + String = 15, + + Number = 16, + + Boolean = 17, + + Array = 18, + + Object = 19, + + Key = 20, + + Null = 21, + + EnumMember = 22, + + Struct = 23, + + Event = 24, + + Operator = 25, + + TypeParameter = 26, +} + +/// Symbol tags are extra annotations that tweak the rendering of a symbol. +/// +/// @since 3.16 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum SymbolTag { + /// Render a symbol as obsolete, usually using a strike-out. + Deprecated = 1, +} + +/// Moniker uniqueness level to define scope of the moniker. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum UniquenessLevel { + /// The moniker is only unique inside a document + #[serde(rename = "document")] + Document, + + /// The moniker is unique inside a project for which a dump got created + #[serde(rename = "project")] + Project, + + /// The moniker is unique inside the group to which a project belongs + #[serde(rename = "group")] + Group, + + /// The moniker is unique inside the moniker scheme. + #[serde(rename = "scheme")] + Scheme, + + /// The moniker is globally unique + #[serde(rename = "global")] + Global, +} + +/// The moniker kind. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum MonikerKind { + /// The moniker represent a symbol that is imported into a project + #[serde(rename = "import")] + Import, + + /// The moniker represents a symbol that is exported from a project + #[serde(rename = "export")] + Export, + + /// The moniker represents a symbol that is local to a project (e.g. a local + /// variable of a function, a class not visible outside the project, ...) + #[serde(rename = "local")] + Local, +} + +/// Inlay hint kinds. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum InlayHintKind { + /// An inlay hint that for a type annotation. + Type = 1, + + /// An inlay hint that is for a parameter. + Parameter = 2, +} + +/// The message type +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum MessageType { + /// An error message. + Error = 1, + + /// A warning message. + Warning = 2, + + /// An information message. + Info = 3, + + /// A log message. + Log = 4, + + /// A debug message. + /// + /// @since 3.18.0 + Debug = 5, +} + +/// Defines how the host (editor) should sync +/// document changes to the language server. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum TextDocumentSyncKind { + /// Documents should not be synced at all. + None = 0, + + /// Documents are synced by always sending the full content + /// of the document. + Full = 1, + + /// Documents are synced by sending the full content on open. + /// After that only incremental updates to the document are + /// send. + Incremental = 2, +} + +/// Represents reasons why a text document is saved. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum TextDocumentSaveReason { + /// Manually triggered, e.g. by the user pressing save, by starting debugging, + /// or by an API call. + Manual = 1, + + /// Automatic after a delay. + AfterDelay = 2, + + /// When the editor lost focus. + FocusOut = 3, +} + +/// The kind of a completion entry. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum CompletionItemKind { + Text = 1, + + Method = 2, + + Function = 3, + + Constructor = 4, + + Field = 5, + + Variable = 6, + + Class = 7, + + Interface = 8, + + Module = 9, + + Property = 10, + + Unit = 11, + + Value = 12, + + Enum = 13, + + Keyword = 14, + + Snippet = 15, + + Color = 16, + + File = 17, + + Reference = 18, + + Folder = 19, + + EnumMember = 20, + + Constant = 21, + + Struct = 22, + + Event = 23, + + Operator = 24, + + TypeParameter = 25, +} + +/// Completion item tags are extra annotations that tweak the rendering of a completion +/// item. +/// +/// @since 3.15.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum CompletionItemTag { + /// Render a completion as obsolete, usually using a strike-out. + Deprecated = 1, +} + +/// Defines whether the insert text in a completion item should be interpreted as +/// plain text or a snippet. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum InsertTextFormat { + /// The primary text to be inserted is treated as a plain string. + PlainText = 1, + + /// The primary text to be inserted is treated as a snippet. + /// + /// A snippet can define tab stops and placeholders with `$1`, `$2` + /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to + /// the end of the snippet. Placeholders with equal identifiers are linked, + /// that is typing in one will update others too. + /// + /// See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax + Snippet = 2, +} + +/// How whitespace and indentation is handled during completion +/// item insertion. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum InsertTextMode { + /// The insertion or replace strings is taken as it is. If the + /// value is multi line the lines below the cursor will be + /// inserted using the indentation defined in the string value. + /// The client will not apply any kind of adjustments to the + /// string. + AsIs = 1, + + /// The editor adjusts leading whitespace of new lines so that + /// they match the indentation up to the cursor of the line for + /// which the item is accepted. + /// + /// Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a + /// multi line completion item is indented using 2 tabs and all + /// following lines inserted will be indented using 2 tabs as well. + AdjustIndentation = 2, +} + +/// A document highlight kind. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum DocumentHighlightKind { + /// A textual occurrence. + Text = 1, + + /// Read-access of a symbol, like reading a variable. + Read = 2, + + /// Write-access of a symbol, like writing to a variable. + Write = 3, +} + +/// A set of predefined code action kinds +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum CodeActionKind { + /// Empty kind. + #[serde(rename = "")] + Empty, + + /// Base kind for quickfix actions: 'quickfix' + #[serde(rename = "quickfix")] + QuickFix, + + /// Base kind for refactoring actions: 'refactor' + #[serde(rename = "refactor")] + Refactor, + + /// Base kind for refactoring extraction actions: 'refactor.extract' + /// + /// Example extract actions: + /// + /// - Extract method + /// - Extract function + /// - Extract variable + /// - Extract interface from class + /// - ... + #[serde(rename = "refactor.extract")] + RefactorExtract, + + /// Base kind for refactoring inline actions: 'refactor.inline' + /// + /// Example inline actions: + /// + /// - Inline function + /// - Inline variable + /// - Inline constant + /// - ... + #[serde(rename = "refactor.inline")] + RefactorInline, + + /// Base kind for refactoring rewrite actions: 'refactor.rewrite' + /// + /// Example rewrite actions: + /// + /// - Convert JavaScript function to class + /// - Add or remove parameter + /// - Encapsulate field + /// - Make method static + /// - Move method to base class + /// - ... + #[serde(rename = "refactor.rewrite")] + RefactorRewrite, + + /// Base kind for source actions: `source` + /// + /// Source code actions apply to the entire file. + #[serde(rename = "source")] + Source, + + /// Base kind for an organize imports source action: `source.organizeImports` + #[serde(rename = "source.organizeImports")] + SourceOrganizeImports, + + /// Base kind for auto-fix source actions: `source.fixAll`. + /// + /// Fix all actions automatically fix errors that have a clear fix that do not require user input. + /// They should not suppress errors or perform unsafe fixes such as generating new types or classes. + /// + /// @since 3.15.0 + #[serde(rename = "source.fixAll")] + SourceFixAll, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum TraceValues { + /// Turn tracing off. + #[serde(rename = "off")] + Off, + + /// Trace messages only. + #[serde(rename = "messages")] + Messages, + + /// Verbose message tracing. + #[serde(rename = "verbose")] + Verbose, +} + +/// Describes the content type that a client supports in various +/// result literals like `Hover`, `ParameterInfo` or `CompletionItem`. +/// +/// Please note that `MarkupKinds` must not start with a `$`. This kinds +/// are reserved for internal usage. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum MarkupKind { + /// Plain text is supported as a content format + #[serde(rename = "plaintext")] + PlainText, + + /// Markdown is supported as a content format + #[serde(rename = "markdown")] + Markdown, +} + +/// Describes how an [inline completion provider][InlineCompletionItemProvider] was triggered. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum InlineCompletionTriggerKind { + /// Completion was triggered explicitly by a user gesture. + Invoked = 0, + + /// Completion was triggered automatically while editing. + Automatic = 1, +} + +/// A set of predefined position encoding kinds. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum PositionEncodingKind { + /// Character offsets count UTF-8 code units (e.g. bytes). + #[serde(rename = "utf-8")] + Utf8, + + /// Character offsets count UTF-16 code units. + /// + /// This is the default and must always be supported + /// by servers + #[serde(rename = "utf-16")] + Utf16, + + /// Character offsets count UTF-32 code units. + /// + /// Implementation note: these are the same as Unicode codepoints, + /// so this `PositionEncodingKind` may also be used for an + /// encoding-agnostic representation of character offsets. + #[serde(rename = "utf-32")] + Utf32, +} + +/// The file event type +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum FileChangeType { + /// The file got created. + Created = 1, + + /// The file got changed. + Changed = 2, + + /// The file got deleted. + Deleted = 3, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum WatchKind { + /// Interested in create events. + Create = 1, + + /// Interested in change events + Change = 2, + + /// Interested in delete events + Delete = 4, +} + +/// The diagnostic's severity. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum DiagnosticSeverity { + /// Reports an error. + Error = 1, + + /// Reports a warning. + Warning = 2, + + /// Reports an information. + Information = 3, + + /// Reports a hint. + Hint = 4, +} + +/// The diagnostic tags. +/// +/// @since 3.15.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum DiagnosticTag { + /// Unused or unnecessary code. + /// + /// Clients are allowed to render diagnostics with this tag faded out instead of having + /// an error squiggle. + Unnecessary = 1, + + /// Deprecated or obsolete code. + /// + /// Clients are allowed to rendered diagnostics with this tag strike through. + Deprecated = 2, +} + +/// How a completion was triggered +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum CompletionTriggerKind { + /// Completion was triggered by typing an identifier (24x7 code + /// complete), manual invocation (e.g Ctrl+Space) or via API. + Invoked = 1, + + /// Completion was triggered by a trigger character specified by + /// the `triggerCharacters` properties of the `CompletionRegistrationOptions`. + TriggerCharacter = 2, + + /// Completion was re-triggered as current completion list is incomplete + TriggerForIncompleteCompletions = 3, +} + +/// How a signature help was triggered. +/// +/// @since 3.15.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum SignatureHelpTriggerKind { + /// Signature help was invoked manually by the user or by a command. + Invoked = 1, + + /// Signature help was triggered by a trigger character. + TriggerCharacter = 2, + + /// Signature help was triggered by the cursor moving or by the document content changing. + ContentChange = 3, +} + +/// The reason why code actions were requested. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum CodeActionTriggerKind { + /// Code actions were explicitly requested by the user or by an extension. + Invoked = 1, + + /// Code actions were requested automatically. + /// + /// This typically happens when current selection in a file changes, but can + /// also be triggered when file content changes. + Automatic = 2, +} + +/// A pattern kind describing if a glob pattern matches a file a folder or +/// both. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum FileOperationPatternKind { + /// The pattern matches a file only. + #[serde(rename = "file")] + File, + + /// The pattern matches a folder only. + #[serde(rename = "folder")] + Folder, +} + +/// A notebook cell kind. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum NotebookCellKind { + /// A markup-cell is formatted source that is used for display. + Markup = 1, + + /// A code-cell is source code. + Code = 2, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum ResourceOperationKind { + /// Supports creating new files and folders. + #[serde(rename = "create")] + Create, + + /// Supports renaming existing files and folders. + #[serde(rename = "rename")] + Rename, + + /// Supports deleting existing files and folders. + #[serde(rename = "delete")] + Delete, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum FailureHandlingKind { + /// Applying the workspace change is simply aborted if one of the changes provided + /// fails. All operations executed before the failing operation stay executed. + #[serde(rename = "abort")] + Abort, + + /// All operations are executed transactional. That means they either all + /// succeed or no changes at all are applied to the workspace. + #[serde(rename = "transactional")] + Transactional, + + /// If the workspace edit contains only textual file changes they are executed transactional. + /// If resource changes (create, rename or delete file) are part of the change the failure + /// handling strategy is abort. + #[serde(rename = "textOnlyTransactional")] + TextOnlyTransactional, + + /// The client tries to undo the operations already executed. But there is no + /// guarantee that this is succeeding. + #[serde(rename = "undo")] + Undo, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum PrepareSupportDefaultBehavior { + /// The client's default behavior is to select the identifier + /// according the to language's syntax rule. + Identifier = 1, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum TokenFormat { + #[serde(rename = "relative")] + Relative, +} + +/// The definition of a symbol represented as one or many [locations][Location]. +/// For most programming languages there is only one location at which a symbol is +/// defined. +/// +/// Servers should prefer returning `DefinitionLink` over `Definition` if supported +/// by the client. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum Definition { + One(Location), + Many(Vec<Location>), +} + +/// Information about where a symbol is defined. +/// +/// Provides additional metadata over normal [location][Location] definitions, including the range of +/// the defining symbol +pub type DefinitionLink = LocationLink; + +/// The declaration of a symbol representation as one or many [locations][Location]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum Declaration { + One(Location), + Many(Vec<Location>), +} + +/// Information about where a symbol is declared. +/// +/// Provides additional metadata over normal [location][Location] declarations, including the range of +/// the declaring symbol. +/// +/// Servers should prefer returning `DeclarationLink` over `Declaration` if supported +/// by the client. +pub type DeclarationLink = LocationLink; + +/// Inline value information can be provided by different means: +/// - directly as a text value (class InlineValueText). +/// - as a name to use for a variable lookup (class InlineValueVariableLookup) +/// - as an evaluatable expression (class InlineValueEvaluatableExpression) +/// The InlineValue types combines all inline value types into one type. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum InlineValue { + Text(InlineValueText), + VariableLookup(InlineValueVariableLookup), + EvaluatableExpression(InlineValueEvaluatableExpression), +} + +/// The result of a document diagnostic pull request. A report can +/// either be a full report containing all diagnostics for the +/// requested document or an unchanged report indicating that nothing +/// has changed in terms of diagnostics in comparison to the last +/// pull request. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum DocumentDiagnosticReport { + Full(RelatedFullDocumentDiagnosticReport), + Unchanged(RelatedUnchangedDocumentDiagnosticReport), +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructPrepareRenameResult { + pub range: Range, + + pub placeholder: String, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructPrepareRenameResultDefault { + pub default_behavior: bool, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum PrepareRenameResult { + Range(Range), + Placeholder(StructPrepareRenameResult), + Default(StructPrepareRenameResultDefault), +} + +/// A document selector is the combination of one or many document filters. +/// +/// @sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`; +/// +/// The use of a string as a document filter is deprecated @since 3.16.0. +pub type DocumentSelector = Vec<DocumentFilter>; + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum ProgressToken { + Int(i32), + String(String), +} + +/// An identifier to refer to a change annotation stored with a workspace edit. +pub type ChangeAnnotationIdentifier = String; + +/// A workspace diagnostic document report. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum WorkspaceDocumentDiagnosticReport { + Full(WorkspaceFullDocumentDiagnosticReport), + Unchanged(WorkspaceUnchangedDocumentDiagnosticReport), +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructTextDocumentContentChangeEvent { + /// The range of the document that changed. + pub range: Range, + + /// The optional length of the range that got replaced. + /// + /// @deprecated use range instead. + pub range_length: Option<u32>, + + /// The new text for the provided range. + pub text: String, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructTextDocumentContentChangeEventText { + /// The new text of the whole document. + pub text: String, +} + +/// An event describing a change to a text document. If only a text is provided +/// it is considered to be the full content of the document. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum TextDocumentContentChangeEvent { + Range(StructTextDocumentContentChangeEvent), + Text(StructTextDocumentContentChangeEventText), +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructMarkedString { + pub language: String, + + pub value: String, +} + +/// MarkedString can be used to render human readable text. It is either a markdown string +/// or a code-block that provides a language and a code snippet. The language identifier +/// is semantically equal to the optional language identifier in fenced code blocks in GitHub +/// issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting +/// +/// The pair of a language and a value is an equivalent to markdown: +/// ```${language} +/// ${value} +/// ``` +/// +/// Note that markdown strings will be sanitized - that means html will be escaped. +/// @deprecated use MarkupContent instead. +#[deprecated] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum MarkedString { + String(String), + MarkedString(StructMarkedString), +} + +/// A document filter describes a top level text document or +/// a notebook cell document. +/// +/// @since 3.17.0 - proposed support for NotebookCellTextDocumentFilter. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum DocumentFilter { + TextDocumentFilter(TextDocumentFilter), + NotebookCell(NotebookCellTextDocumentFilter), +} + +/// The glob pattern. Either a string pattern or a relative pattern. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum GlobPattern { + Pattern(Pattern), + Relative(RelativePattern), +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructTextDocumentFilter { + /// A language id, like `typescript`. + pub language: String, + + /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`. + pub scheme: Option<String>, + + /// A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples. + pub pattern: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructTextDocumentFilterScheme { + /// A language id, like `typescript`. + pub language: Option<String>, + + /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`. + pub scheme: String, + + /// A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples. + pub pattern: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructTextDocumentFilterPattern { + /// A language id, like `typescript`. + pub language: Option<String>, + + /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`. + pub scheme: Option<String>, + + /// A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples. + pub pattern: String, +} + +/// A document filter denotes a document by different properties like +/// the [language][`TextDocument::languageId`], the [scheme][`Uri::scheme`] of +/// its resource, or a glob-pattern that is applied to the [path][`TextDocument::fileName`]. +/// +/// Glob patterns can have the following syntax: +/// - `*` to match one or more characters in a path segment +/// - `?` to match on one character in a path segment +/// - `**` to match any number of path segments, including none +/// - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files) +/// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) +/// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) +/// +/// @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }` +/// @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }` +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum TextDocumentFilter { + Language(StructTextDocumentFilter), + Scheme(StructTextDocumentFilterScheme), + Pattern(StructTextDocumentFilterPattern), +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructNotebookDocumentFilter { + /// The type of the enclosing notebook. + pub notebook_type: String, + + /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`. + pub scheme: Option<String>, + + /// A glob pattern. + pub pattern: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructNotebookDocumentFilterScheme { + /// The type of the enclosing notebook. + pub notebook_type: Option<String>, + + /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`. + pub scheme: String, + + /// A glob pattern. + pub pattern: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructNotebookDocumentFilterPattern { + /// The type of the enclosing notebook. + pub notebook_type: Option<String>, + + /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`. + pub scheme: Option<String>, + + /// A glob pattern. + pub pattern: String, +} + +/// A notebook document filter denotes a notebook document by +/// different properties. The properties will be match +/// against the notebook's URI (same as with documents) +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum NotebookDocumentFilter { + Type(StructNotebookDocumentFilter), + Scheme(StructNotebookDocumentFilterScheme), + Pattern(StructNotebookDocumentFilterPattern), +} + +/// The glob pattern to watch relative to the base path. Glob patterns can have the following syntax: +/// - `*` to match one or more characters in a path segment +/// - `?` to match on one character in a path segment +/// - `**` to match any number of path segments, including none +/// - `{}` to group conditions (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files) +/// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) +/// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) +/// +/// @since 3.17.0 +pub type Pattern = String; + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ImplementationParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Represents a location inside a resource, such as a line +/// inside a text file. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Location { + pub range: Range, + + pub uri: String, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ImplementationRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeDefinitionParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeDefinitionRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, +} + +/// A workspace folder inside a client. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceFolder { + /// The name of the workspace folder. Used to refer to this + /// workspace folder in the user interface. + pub name: String, + + /// The associated URI for this workspace folder. + pub uri: String, +} + +/// The parameters of a `workspace/didChangeWorkspaceFolders` notification. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidChangeWorkspaceFoldersParams { + /// The actual workspace folder change event. + pub event: WorkspaceFoldersChangeEvent, +} + +/// The parameters of a configuration request. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ConfigurationParams { + pub items: Vec<ConfigurationItem>, +} + +/// Parameters for a [DocumentColorRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentColorParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Represents a color range from a document. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ColorInformation { + /// The actual color value for this color range. + pub color: Color, + + /// The range in the document where this color appears. + pub range: Range, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentColorRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, +} + +/// Parameters for a [ColorPresentationRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ColorPresentationParams { + /// The color to request presentations for. + pub color: Color, + + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The range where the color would be inserted. Serves as a context. + pub range: Range, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ColorPresentation { + /// An optional array of additional [text edits][TextEdit] that are applied when + /// selecting this color presentation. Edits must not overlap with the main [edit][`ColorPresentation::textEdit`] nor with themselves. + pub additional_text_edits: Option<Vec<TextEdit>>, + + /// The label of this color presentation. It will be shown on the color + /// picker header. By default this is also the text that is inserted when selecting + /// this color presentation. + pub label: String, + + /// An [edit][TextEdit] which is applied to a document when selecting + /// this presentation for the color. When `falsy` the [label][`ColorPresentation::label`] + /// is used. + pub text_edit: Option<TextEdit>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkDoneProgressOptions { + pub work_done_progress: Option<bool>, +} + +/// General text document registration options. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, +} + +/// Parameters for a [FoldingRangeRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FoldingRangeParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Represents a folding range. To be valid, start and end line must be bigger than zero and smaller +/// than the number of lines in the document. Clients are free to ignore invalid ranges. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FoldingRange { + /// The text that the client should show when the specified range is + /// collapsed. If not defined or not supported by the client, a default + /// will be chosen by the client. + /// + /// @since 3.17.0 + pub collapsed_text: Option<String>, + + /// The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. + pub end_character: Option<u32>, + + /// The zero-based end line of the range to fold. The folded area ends with the line's last character. + /// To be valid, the end must be zero or larger and smaller than the number of lines in the document. + pub end_line: u32, + + /// Describes the kind of the folding range such as `comment' or 'region'. The kind + /// is used to categorize folding ranges and used by commands like 'Fold all comments'. + /// See [FoldingRangeKind] for an enumeration of standardized kinds. + pub kind: Option<CustomStringEnum<FoldingRangeKind>>, + + /// The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. + pub start_character: Option<u32>, + + /// The zero-based start line of the range to fold. The folded area starts after the line's last character. + /// To be valid, the end must be zero or larger and smaller than the number of lines in the document. + pub start_line: u32, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FoldingRangeRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DeclarationParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DeclarationRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, +} + +/// A parameter literal used in selection range requests. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SelectionRangeParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The positions inside the text document. + pub positions: Vec<Position>, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SelectionRangeRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkDoneProgressCreateParams { + /// The token to be used to report progress. + pub token: ProgressToken, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkDoneProgressCancelParams { + /// The token to be used to report progress. + pub token: ProgressToken, +} + +/// The parameter of a `textDocument/prepareCallHierarchy` request. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyPrepareParams { + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Represents programming constructs like functions or constructors in the context +/// of call hierarchy. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyItem { + /// A data entry field that is preserved between a call hierarchy prepare and + /// incoming calls or outgoing calls requests. + pub data: Option<LSPAny>, + + /// More detail for this item, e.g. the signature of a function. + pub detail: Option<String>, + + /// The kind of this item. + pub kind: SymbolKind, + + /// The name of this item. + pub name: String, + + /// The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code. + pub range: Range, + + /// The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. + /// Must be contained by the [`range`][`CallHierarchyItem::range`]. + pub selection_range: Range, + + /// Tags for this item. + pub tags: Option<Vec<SymbolTag>>, + + /// The resource identifier of this item. + pub uri: String, +} + +/// Call hierarchy options used during static or dynamic registration. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, +} + +/// The parameter of a `callHierarchy/incomingCalls` request. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyIncomingCallsParams { + pub item: CallHierarchyItem, + + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Represents an incoming call, e.g. a caller of a method or constructor. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyIncomingCall { + /// The item that makes the call. + pub from: CallHierarchyItem, + + /// The ranges at which the calls appear. This is relative to the caller + /// denoted by [`this.from`][`CallHierarchyIncomingCall::from`]. + pub from_ranges: Vec<Range>, +} + +/// The parameter of a `callHierarchy/outgoingCalls` request. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyOutgoingCallsParams { + pub item: CallHierarchyItem, + + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyOutgoingCall { + /// The range at which this item is called. This is the range relative to the caller, e.g the item + /// passed to [`provideCallHierarchyOutgoingCalls`][`CallHierarchyItemProvider::provideCallHierarchyOutgoingCalls`] + /// and not [`this.to`][`CallHierarchyOutgoingCall::to`]. + pub from_ranges: Vec<Range>, + + /// The item that is called. + pub to: CallHierarchyItem, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokensParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokens { + /// The actual tokens. + pub data: Vec<u32>, + + /// An optional result id. If provided and clients support delta updating + /// the client will include the result id in the next semantic token request. + /// A server can then instead of computing all semantic tokens again simply + /// send a delta. + pub result_id: Option<String>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokensPartialResult { + pub data: Vec<u32>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructOptions { + /// The server supports deltas for full documents. + pub delta: Option<bool>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokensRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// Server supports providing semantic tokens for a full document. + pub full: Option<OR2<bool, StructOptions>>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, + + /// The legend used by the server + pub legend: SemanticTokensLegend, + + /// Server supports providing semantic tokens for a specific range + /// of a document. + pub range: Option<OR2<bool, LSPObject>>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokensDeltaParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The result id of a previous response. The result Id can either point to a full response + /// or a delta response depending on what was received last. + pub previous_result_id: String, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokensDelta { + /// The semantic token edits to transform a previous result into a new result. + pub edits: Vec<SemanticTokensEdit>, + + pub result_id: Option<String>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokensDeltaPartialResult { + pub edits: Vec<SemanticTokensEdit>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokensRangeParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The range the semantic tokens are requested for. + pub range: Range, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Params to show a resource in the UI. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ShowDocumentParams { + /// Indicates to show the resource in an external program. + /// To show, for example, `https://code.visualstudio.com/` + /// in the default WEB browser set `external` to `true`. + pub external: Option<bool>, + + /// An optional selection range if the document is a text + /// document. Clients might ignore the property if an + /// external program is started or the file is not a text + /// file. + pub selection: Option<Range>, + + /// An optional property to indicate whether the editor + /// showing the document should take focus or not. + /// Clients might ignore this property if an external + /// program is started. + pub take_focus: Option<bool>, + + /// The uri to show. + pub uri: String, +} + +/// The result of a showDocument request. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ShowDocumentResult { + /// A boolean indicating if the show was successful. + pub success: bool, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct LinkedEditingRangeParams { + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// The result of a linked editing range request. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct LinkedEditingRanges { + /// A list of ranges that can be edited together. The ranges must have + /// identical length and contain identical text content. The ranges cannot overlap. + pub ranges: Vec<Range>, + + /// An optional word pattern (regular expression) that describes valid contents for + /// the given ranges. If no pattern is provided, the client configuration's word + /// pattern will be used. + pub word_pattern: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct LinkedEditingRangeRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, +} + +/// The parameters sent in notifications/requests for user-initiated creation of +/// files. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CreateFilesParams { + /// An array of all files/folders created in this operation. + pub files: Vec<FileCreate>, +} + +/// A workspace edit represents changes to many resources managed in the workspace. The edit +/// should either provide `changes` or `documentChanges`. If documentChanges are present +/// they are preferred over `changes` if the client can handle versioned document edits. +/// +/// Since version 3.13.0 a workspace edit can contain resource operations as well. If resource +/// operations are present clients need to execute the operations in the order in which they +/// are provided. So a workspace edit for example can consist of the following two changes: +/// (1) a create file a.txt and (2) a text document edit which insert text into file a.txt. +/// +/// An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will +/// cause failure of the operation. How the client recovers from the failure is described by +/// the client capability: `workspace.workspaceEdit.failureHandling` +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceEdit { + /// A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and + /// delete file / folder operations. + /// + /// Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`. + /// + /// @since 3.16.0 + pub change_annotations: Option<HashMap<ChangeAnnotationIdentifier, ChangeAnnotation>>, + + /// Holds changes to existing resources. + pub changes: Option<HashMap<String, Vec<TextEdit>>>, + + /// Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes + /// are either an array of `TextDocumentEdit`s to express changes to n different text documents + /// where each text document edit addresses a specific version of a text document. Or it can contain + /// above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations. + /// + /// Whether a client supports versioned document edits is expressed via + /// `workspace.workspaceEdit.documentChanges` client capability. + /// + /// If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then + /// only plain `TextEdit`s using the `changes` property are supported. + pub document_changes: Option<Vec<OR4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>>, +} + +/// The options to register for file operations. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FileOperationRegistrationOptions { + /// The actual filters. + pub filters: Vec<FileOperationFilter>, +} + +/// The parameters sent in notifications/requests for user-initiated renames of +/// files. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RenameFilesParams { + /// An array of all files/folders renamed in this operation. When a folder is renamed, only + /// the folder will be included, and not its children. + pub files: Vec<FileRename>, +} + +/// The parameters sent in notifications/requests for user-initiated deletes of +/// files. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DeleteFilesParams { + /// An array of all files/folders deleted in this operation. + pub files: Vec<FileDelete>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct MonikerParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Moniker definition to match LSIF 0.5 moniker definition. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Moniker { + /// The identifier of the moniker. The value is opaque in LSIF however + /// schema owners are allowed to define the structure if they want. + pub identifier: String, + + /// The moniker kind if known. + pub kind: Option<MonikerKind>, + + /// The scheme of the moniker. For example tsc or .Net + pub scheme: String, + + /// The scope in which the moniker is unique + pub unique: UniquenessLevel, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct MonikerRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, +} + +/// The parameter of a `textDocument/prepareTypeHierarchy` request. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeHierarchyPrepareParams { + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeHierarchyItem { + /// A data entry field that is preserved between a type hierarchy prepare and + /// supertypes or subtypes requests. It could also be used to identify the + /// type hierarchy in the server, helping improve the performance on + /// resolving supertypes and subtypes. + pub data: Option<LSPAny>, + + /// More detail for this item, e.g. the signature of a function. + pub detail: Option<String>, + + /// The kind of this item. + pub kind: SymbolKind, + + /// The name of this item. + pub name: String, + + /// The range enclosing this symbol not including leading/trailing whitespace + /// but everything else, e.g. comments and code. + pub range: Range, + + /// The range that should be selected and revealed when this symbol is being + /// picked, e.g. the name of a function. Must be contained by the + /// [`range`][`TypeHierarchyItem::range`]. + pub selection_range: Range, + + /// Tags for this item. + pub tags: Option<Vec<SymbolTag>>, + + /// The resource identifier of this item. + pub uri: String, +} + +/// Type hierarchy options used during static or dynamic registration. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeHierarchyRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, +} + +/// The parameter of a `typeHierarchy/supertypes` request. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeHierarchySupertypesParams { + pub item: TypeHierarchyItem, + + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// The parameter of a `typeHierarchy/subtypes` request. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeHierarchySubtypesParams { + pub item: TypeHierarchyItem, + + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// A parameter literal used in inline value requests. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineValueParams { + /// Additional information about the context in which inline values were + /// requested. + pub context: InlineValueContext, + + /// The document range for which inline values should be computed. + pub range: Range, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Inline value options used during static or dynamic registration. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineValueRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, +} + +/// A parameter literal used in inlay hint requests. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlayHintParams { + /// The document range for which inlay hints should be computed. + pub range: Range, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Inlay hint information. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlayHint { + /// A data entry field that is preserved on an inlay hint between + /// a `textDocument/inlayHint` and a `inlayHint/resolve` request. + pub data: Option<LSPAny>, + + /// The kind of this hint. Can be omitted in which case the client + /// should fall back to a reasonable default. + pub kind: Option<InlayHintKind>, + + /// The label of this hint. A human readable string or an array of + /// InlayHintLabelPart label parts. + /// + /// *Note* that neither the string nor the label part can be empty. + pub label: OR2<String, Vec<InlayHintLabelPart>>, + + /// Render padding before the hint. + /// + /// Note: Padding should use the editor's background color, not the + /// background color of the hint itself. That means padding can be used + /// to visually align/separate an inlay hint. + pub padding_left: Option<bool>, + + /// Render padding after the hint. + /// + /// Note: Padding should use the editor's background color, not the + /// background color of the hint itself. That means padding can be used + /// to visually align/separate an inlay hint. + pub padding_right: Option<bool>, + + /// The position of this hint. + pub position: Position, + + /// Optional text edits that are performed when accepting this inlay hint. + /// + /// *Note* that edits are expected to change the document so that the inlay + /// hint (or its nearest variant) is now part of the document and the inlay + /// hint itself is now obsolete. + pub text_edits: Option<Vec<TextEdit>>, + + /// The tooltip text when you hover over this item. + pub tooltip: Option<OR2<String, MarkupContent>>, +} + +/// Inlay hint options used during static or dynamic registration. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlayHintRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, + + /// The server provides support to resolve additional + /// information for an inlay hint item. + pub resolve_provider: Option<bool>, +} + +/// Parameters of the document diagnostic request. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentDiagnosticParams { + /// The additional identifier provided during registration. + pub identifier: Option<String>, + + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The result id of a previous response if provided. + pub previous_result_id: Option<String>, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// A partial result for a document diagnostic report. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentDiagnosticReportPartialResult { + pub related_documents: + HashMap<String, OR2<FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport>>, +} + +/// Cancellation data returned from a diagnostic request. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DiagnosticServerCancellationData { + pub retrigger_request: bool, +} + +/// Diagnostic registration options. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DiagnosticRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, + + /// An optional identifier under which the diagnostics are + /// managed by the client. + pub identifier: Option<String>, + + /// Whether the language has inter file dependencies meaning that + /// editing code in one file can result in a different diagnostic + /// set in another file. Inter file dependencies are common for + /// most programming languages and typically uncommon for linters. + pub inter_file_dependencies: bool, + + /// The server provides support for workspace diagnostics as well. + pub workspace_diagnostics: bool, +} + +/// Parameters of the workspace diagnostic request. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDiagnosticParams { + /// The additional identifier provided during registration. + pub identifier: Option<String>, + + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The currently known diagnostic reports with their + /// previous result ids. + pub previous_result_ids: Vec<PreviousResultId>, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// A workspace diagnostic report. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDiagnosticReport { + pub items: Vec<WorkspaceDocumentDiagnosticReport>, +} + +/// A partial result for a workspace diagnostic report. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDiagnosticReportPartialResult { + pub items: Vec<WorkspaceDocumentDiagnosticReport>, +} + +/// The params sent in an open notebook document notification. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidOpenNotebookDocumentParams { + /// The text documents that represent the content + /// of a notebook cell. + pub cell_text_documents: Vec<TextDocumentItem>, + + /// The notebook document that got opened. + pub notebook_document: NotebookDocument, +} + +/// The params sent in a change notebook document notification. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidChangeNotebookDocumentParams { + /// The actual changes to the notebook document. + /// + /// The changes describe single state changes to the notebook document. + /// So if there are two changes c1 (at array index 0) and c2 (at array + /// index 1) for a notebook in state S then c1 moves the notebook from + /// S to S' and c2 from S' to S''. So c1 is computed on the state S and + /// c2 is computed on the state S'. + /// + /// To mirror the content of a notebook using change events use the following approach: + /// - start with the same initial content + /// - apply the 'notebookDocument/didChange' notifications in the order you receive them. + /// - apply the `NotebookChangeEvent`s in a single notification in the order + /// you receive them. + pub change: NotebookDocumentChangeEvent, + + /// The notebook document that did change. The version number points + /// to the version after all provided changes have been applied. If + /// only the text document content of a cell changes the notebook version + /// doesn't necessarily have to change. + pub notebook_document: VersionedNotebookDocumentIdentifier, +} + +/// The params sent in a save notebook document notification. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidSaveNotebookDocumentParams { + /// The notebook document that got saved. + pub notebook_document: NotebookDocumentIdentifier, +} + +/// The params sent in a close notebook document notification. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidCloseNotebookDocumentParams { + /// The text documents that represent the content + /// of a notebook cell that got closed. + pub cell_text_documents: Vec<TextDocumentIdentifier>, + + /// The notebook document that got closed. + pub notebook_document: NotebookDocumentIdentifier, +} + +/// A parameter literal used in inline completion requests. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineCompletionParams { + /// Additional information about the context in which inline completions were + /// requested. + pub context: InlineCompletionContext, + + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Represents a collection of [inline completion items][InlineCompletionItem] to be presented in the editor. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineCompletionList { + /// The inline completion items + pub items: Vec<InlineCompletionItem>, +} + +/// An inline completion item represents a text snippet that is proposed inline to complete text that is being typed. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineCompletionItem { + /// An optional [Command] that is executed *after* inserting this completion. + pub command: Option<Command>, + + /// A text that is used to decide if this inline completion should be shown. When `falsy` the [`InlineCompletionItem::insertText`] is used. + pub filter_text: Option<String>, + + /// The text to replace the range with. Must be set. + pub insert_text: OR2<String, StringValue>, + + /// The range to replace. Must begin and end on the same line. + pub range: Option<Range>, +} + +/// Inline completion options used during static or dynamic registration. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineCompletionRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RegistrationParams { + pub registrations: Vec<Registration>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct UnregistrationParams { + pub unregisterations: Vec<Unregistration>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructClientInfo { + /// The name of the client as defined by the client. + pub name: String, + + /// The client's version as defined by the client. + pub version: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InitializeParams { + /// The capabilities provided by the client (editor or tool) + pub capabilities: ClientCapabilities, + + /// Information about the client + /// + /// @since 3.15.0 + pub client_info: Option<StructClientInfo>, + + /// User provided initialization options. + pub initialization_options: Option<LSPAny>, + + /// The locale the client is currently showing the user interface + /// in. This must not necessarily be the locale of the operating + /// system. + /// + /// Uses IETF language tags as the value's syntax + /// (See https://en.wikipedia.org/wiki/IETF_language_tag) + /// + /// @since 3.16.0 + pub locale: Option<String>, + + /// The process Id of the parent process that started + /// the server. + /// + /// Is `null` if the process has not been started by another process. + /// If the parent process is not alive then the server should exit. + #[serde(skip_serializing_if = "Option::is_none")] + pub process_id: Option<i32>, + + /// The rootPath of the workspace. Is null + /// if no folder is open. + /// + /// @deprecated in favour of rootUri. + #[deprecated] + pub root_path: Option<String>, + + /// The rootUri of the workspace. Is null if no + /// folder is open. If both `rootPath` and `rootUri` are set + /// `rootUri` wins. + /// + /// @deprecated in favour of workspaceFolders. + #[deprecated] + #[serde(skip_serializing_if = "Option::is_none")] + pub root_uri: Option<String>, + + /// The initial trace setting. If omitted trace is disabled ('off'). + pub trace: Option<TraceValues>, + + /// The workspace folders configured in the client when the server starts. + /// + /// This property is only available if the client supports workspace folders. + /// It can be `null` if the client supports workspace folders but none are + /// configured. + /// + /// @since 3.6.0 + pub workspace_folders: Option<Vec<WorkspaceFolder>>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructServerInfo { + /// The name of the server as defined by the server. + pub name: String, + + /// The server's version as defined by the server. + pub version: Option<String>, +} + +/// The result returned from an initialize request. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InitializeResult { + /// The capabilities the language server provides. + pub capabilities: ServerCapabilities, + + /// Information about the server. + /// + /// @since 3.15.0 + pub server_info: Option<StructServerInfo>, +} + +/// The data type of the ResponseError if the +/// initialize request fails. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InitializeError { + /// Indicates whether the client execute the following retry logic: + /// (1) show the message provided by the ResponseError to the user + /// (2) user selects retry or cancel + /// (3) if user selected retry the initialize method is sent again. + pub retry: bool, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InitializedParams {} + +/// The parameters of a change configuration notification. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidChangeConfigurationParams { + /// The actual changed settings + pub settings: LSPAny, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidChangeConfigurationRegistrationOptions { + pub section: Option<OR2<String, Vec<String>>>, +} + +/// The parameters of a notification message. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ShowMessageParams { + /// The actual message. + pub message: String, + + /// The message type. See [MessageType] + #[serde(rename = "type")] + pub type_: MessageType, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ShowMessageRequestParams { + /// The message action items to present. + pub actions: Option<Vec<MessageActionItem>>, + + /// The actual message. + pub message: String, + + /// The message type. See [MessageType] + #[serde(rename = "type")] + pub type_: MessageType, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct MessageActionItem { + /// A short title like 'Retry', 'Open Log' etc. + pub title: String, +} + +/// The log message parameters. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct LogMessageParams { + /// The actual message. + pub message: String, + + /// The message type. See [MessageType] + #[serde(rename = "type")] + pub type_: MessageType, +} + +/// The parameters sent in an open text document notification +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidOpenTextDocumentParams { + /// The document that was opened. + pub text_document: TextDocumentItem, +} + +/// The change text document notification's parameters. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidChangeTextDocumentParams { + /// The actual content changes. The content changes describe single state changes + /// to the document. So if there are two content changes c1 (at array index 0) and + /// c2 (at array index 1) for a document in state S then c1 moves the document from + /// S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed + /// on the state S'. + /// + /// To mirror the content of a document using change events use the following approach: + /// - start with the same initial content + /// - apply the 'textDocument/didChange' notifications in the order you receive them. + /// - apply the `TextDocumentContentChangeEvent`s in a single notification in the order + /// you receive them. + pub content_changes: Vec<TextDocumentContentChangeEvent>, + + /// The document that did change. The version number points + /// to the version after all provided content changes have + /// been applied. + pub text_document: VersionedTextDocumentIdentifier, +} + +/// Describe options to be used when registered for text document change events. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentChangeRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// How documents are synced to the server. + pub sync_kind: TextDocumentSyncKind, +} + +/// The parameters sent in a close text document notification +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidCloseTextDocumentParams { + /// The document that was closed. + pub text_document: TextDocumentIdentifier, +} + +/// The parameters sent in a save text document notification +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidSaveTextDocumentParams { + /// Optional the content when saved. Depends on the includeText value + /// when the save notification was requested. + pub text: Option<String>, + + /// The document that was saved. + pub text_document: TextDocumentIdentifier, +} + +/// Save registration options. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSaveRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The client is supposed to include the content on save. + pub include_text: Option<bool>, +} + +/// The parameters sent in a will save text document notification. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WillSaveTextDocumentParams { + /// The 'TextDocumentSaveReason'. + pub reason: TextDocumentSaveReason, + + /// The document that will be saved. + pub text_document: TextDocumentIdentifier, +} + +/// A text edit applicable to a text document. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextEdit { + /// The string to be inserted. For delete operations use an + /// empty string. + pub new_text: String, + + /// The range of the text document to be manipulated. To insert + /// text into a document create a range where start === end. + pub range: Range, +} + +/// The watched files change notification's parameters. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidChangeWatchedFilesParams { + /// The actual file events. + pub changes: Vec<FileEvent>, +} + +/// Describe options to be used when registered for text document change events. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidChangeWatchedFilesRegistrationOptions { + /// The watchers to register. + pub watchers: Vec<FileSystemWatcher>, +} + +/// The publish diagnostic notification's parameters. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct PublishDiagnosticsParams { + /// An array of diagnostic information items. + pub diagnostics: Vec<Diagnostic>, + + /// The URI for which diagnostic information is reported. + pub uri: String, + + /// Optional the version number of the document the diagnostics are published for. + /// + /// @since 3.15.0 + pub version: Option<i32>, +} + +/// Completion parameters +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CompletionParams { + /// The completion context. This is only available it the client specifies + /// to send this using the client capability `textDocument.completion.contextSupport === true` + pub context: Option<CompletionContext>, + + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// A completion item represents a text snippet that is +/// proposed to complete text that is being typed. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CompletionItem { + /// An optional array of additional [text edits][TextEdit] that are applied when + /// selecting this completion. Edits must not overlap (including the same insert position) + /// with the main [edit][`CompletionItem::textEdit`] nor with themselves. + /// + /// Additional text edits should be used to change text unrelated to the current cursor position + /// (for example adding an import statement at the top of the file if the completion item will + /// insert an unqualified type). + pub additional_text_edits: Option<Vec<TextEdit>>, + + /// An optional [command][Command] that is executed *after* inserting this completion. *Note* that + /// additional modifications to the current document should be described with the + /// [additionalTextEdits][`CompletionItem::additionalTextEdits`]-property. + pub command: Option<Command>, + + /// An optional set of characters that when pressed while this completion is active will accept it first and + /// then type that character. *Note* that all commit characters should have `length=1` and that superfluous + /// characters will be ignored. + pub commit_characters: Option<Vec<String>>, + + /// A data entry field that is preserved on a completion item between a + /// [CompletionRequest] and a [CompletionResolveRequest]. + pub data: Option<LSPAny>, + + /// Indicates if this item is deprecated. + /// @deprecated Use `tags` instead. + #[deprecated] + pub deprecated: Option<bool>, + + /// A human-readable string with additional information + /// about this item, like type or symbol information. + pub detail: Option<String>, + + /// A human-readable string that represents a doc-comment. + pub documentation: Option<OR2<String, MarkupContent>>, + + /// A string that should be used when filtering a set of + /// completion items. When `falsy` the [label][`CompletionItem::label`] + /// is used. + pub filter_text: Option<String>, + + /// A string that should be inserted into a document when selecting + /// this completion. When `falsy` the [label][`CompletionItem::label`] + /// is used. + /// + /// The `insertText` is subject to interpretation by the client side. + /// Some tools might not take the string literally. For example + /// VS Code when code complete is requested in this example + /// `con<cursor position>` and a completion item with an `insertText` of + /// `console` is provided it will only insert `sole`. Therefore it is + /// recommended to use `textEdit` instead since it avoids additional client + /// side interpretation. + pub insert_text: Option<String>, + + /// The format of the insert text. The format applies to both the + /// `insertText` property and the `newText` property of a provided + /// `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`. + /// + /// Please note that the insertTextFormat doesn't apply to + /// `additionalTextEdits`. + pub insert_text_format: Option<InsertTextFormat>, + + /// How whitespace and indentation is handled during completion + /// item insertion. If not provided the clients default value depends on + /// the `textDocument.completion.insertTextMode` client capability. + /// + /// @since 3.16.0 + pub insert_text_mode: Option<InsertTextMode>, + + /// The kind of this completion item. Based of the kind + /// an icon is chosen by the editor. + pub kind: Option<CompletionItemKind>, + + /// The label of this completion item. + /// + /// The label property is also by default the text that + /// is inserted when selecting this completion. + /// + /// If label details are provided the label itself should + /// be an unqualified name of the completion item. + pub label: String, + + /// Additional details for the label + /// + /// @since 3.17.0 + pub label_details: Option<CompletionItemLabelDetails>, + + /// Select this item when showing. + /// + /// *Note* that only one completion item can be selected and that the + /// tool / client decides which item that is. The rule is that the *first* + /// item of those that match best is selected. + pub preselect: Option<bool>, + + /// A string that should be used when comparing this item + /// with other items. When `falsy` the [label][`CompletionItem::label`] + /// is used. + pub sort_text: Option<String>, + + /// Tags for this completion item. + /// + /// @since 3.15.0 + pub tags: Option<Vec<CompletionItemTag>>, + + /// An [edit][TextEdit] which is applied to a document when selecting + /// this completion. When an edit is provided the value of + /// [insertText][`CompletionItem::insertText`] is ignored. + /// + /// Most editors support two different operations when accepting a completion + /// item. One is to insert a completion text and the other is to replace an + /// existing text with a completion text. Since this can usually not be + /// predetermined by a server it can report both ranges. Clients need to + /// signal support for `InsertReplaceEdits` via the + /// `textDocument.completion.insertReplaceSupport` client capability + /// property. + /// + /// *Note 1:* The text edit's range as well as both ranges from an insert + /// replace edit must be a [single line] and they must contain the position + /// at which completion has been requested. + /// *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range + /// must be a prefix of the edit's replace range, that means it must be + /// contained and starting at the same position. + /// + /// @since 3.16.0 additional type `InsertReplaceEdit` + pub text_edit: Option<OR2<TextEdit, InsertReplaceEdit>>, + + /// The edit text used if the completion item is part of a CompletionList and + /// CompletionList defines an item default for the text edit range. + /// + /// Clients will only honor this property if they opt into completion list + /// item defaults using the capability `completionList.itemDefaults`. + /// + /// If not provided and a list's default range is provided the label + /// property is used as a text. + /// + /// @since 3.17.0 + pub text_edit_text: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructInsert { + pub insert: Range, + + pub replace: Range, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructItemDefaults { + /// A default commit character set. + /// + /// @since 3.17.0 + pub commit_characters: Option<Vec<String>>, + + /// A default edit range. + /// + /// @since 3.17.0 + pub edit_range: Option<OR2<Range, StructInsert>>, + + /// A default insert text format. + /// + /// @since 3.17.0 + pub insert_text_format: Option<InsertTextFormat>, + + /// A default insert text mode. + /// + /// @since 3.17.0 + pub insert_text_mode: Option<InsertTextMode>, + + /// A default data value. + /// + /// @since 3.17.0 + pub data: Option<LSPAny>, +} + +/// Represents a collection of [completion items][CompletionItem] to be presented +/// in the editor. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CompletionList { + /// This list it not complete. Further typing results in recomputing this list. + /// + /// Recomputed lists have all their items replaced (not appended) in the + /// incomplete completion sessions. + pub is_incomplete: bool, + + /// In many cases the items of an actual completion result share the same + /// value for properties like `commitCharacters` or the range of a text + /// edit. A completion list can therefore define item defaults which will + /// be used if a completion item itself doesn't specify the value. + /// + /// If a completion list specifies a default value and a completion item + /// also specifies a corresponding value the one from the item is used. + /// + /// Servers are only allowed to return default values if the client + /// signals support for this via the `completionList.itemDefaults` + /// capability. + /// + /// @since 3.17.0 + pub item_defaults: Option<StructItemDefaults>, + + /// The completion items. + pub items: Vec<CompletionItem>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructCompletionItem { + /// The server has support for completion item label + /// details (see also `CompletionItemLabelDetails`) when + /// receiving a completion item in a resolve call. + /// + /// @since 3.17.0 + pub label_details_support: Option<bool>, +} + +/// Registration options for a [CompletionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CompletionRegistrationOptions { + /// The list of all possible characters that commit a completion. This field can be used + /// if clients don't support individual commit characters per completion item. See + /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` + /// + /// If a server provides both `allCommitCharacters` and commit characters on an individual + /// completion item the ones on the completion item win. + /// + /// @since 3.2.0 + pub all_commit_characters: Option<Vec<String>>, + + /// The server supports the following `CompletionItem` specific + /// capabilities. + /// + /// @since 3.17.0 + pub completion_item: Option<StructCompletionItem>, + + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The server provides support to resolve additional + /// information for a completion item. + pub resolve_provider: Option<bool>, + + /// Most tools trigger completion request automatically without explicitly requesting + /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + /// starts to type an identifier. For example if the user types `c` in a JavaScript file + /// code complete will automatically pop up present `console` besides others as a + /// completion item. Characters that make up identifiers don't need to be listed here. + /// + /// If code complete should automatically be trigger on characters not being valid inside + /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. + pub trigger_characters: Option<Vec<String>>, +} + +/// Parameters for a [HoverRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct HoverParams { + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// The result of a hover request. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Hover { + /// The hover's content + pub contents: OR3<MarkupContent, MarkedString, Vec<MarkedString>>, + + /// An optional range inside the text document that is used to + /// visualize the hover, e.g. by changing the background color. + pub range: Option<Range>, +} + +/// Registration options for a [HoverRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct HoverRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, +} + +/// Parameters for a [SignatureHelpRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SignatureHelpParams { + /// The signature help context. This is only available if the client specifies + /// to send this using the client capability `textDocument.signatureHelp.contextSupport === true` + /// + /// @since 3.15.0 + pub context: Option<SignatureHelpContext>, + + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Signature help represents the signature of something +/// callable. There can be multiple signature but only one +/// active and only one active parameter. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SignatureHelp { + /// The active parameter of the active signature. If omitted or the value + /// lies outside the range of `signatures[activeSignature].parameters` + /// defaults to 0 if the active signature has parameters. If + /// the active signature has no parameters it is ignored. + /// In future version of the protocol this property might become + /// mandatory to better express the active parameter if the + /// active signature does have any. + pub active_parameter: Option<u32>, + + /// The active signature. If omitted or the value lies outside the + /// range of `signatures` the value defaults to zero or is ignored if + /// the `SignatureHelp` has no signatures. + /// + /// Whenever possible implementors should make an active decision about + /// the active signature and shouldn't rely on a default value. + /// + /// In future version of the protocol this property might become + /// mandatory to better express this. + pub active_signature: Option<u32>, + + /// One or more signatures. + pub signatures: Vec<SignatureInformation>, +} + +/// Registration options for a [SignatureHelpRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SignatureHelpRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// List of characters that re-trigger signature help. + /// + /// These trigger characters are only active when signature help is already showing. All trigger characters + /// are also counted as re-trigger characters. + /// + /// @since 3.15.0 + pub retrigger_characters: Option<Vec<String>>, + + /// List of characters that trigger signature help automatically. + pub trigger_characters: Option<Vec<String>>, +} + +/// Parameters for a [DefinitionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DefinitionParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Registration options for a [DefinitionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DefinitionRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, +} + +/// Parameters for a [ReferencesRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ReferenceParams { + pub context: ReferenceContext, + + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Registration options for a [ReferencesRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ReferenceRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, +} + +/// Parameters for a [DocumentHighlightRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentHighlightParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// A document highlight is a range inside a text document which deserves +/// special attention. Usually a document highlight is visualized by changing +/// the background color of its range. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentHighlight { + /// The highlight kind, default is [text][`DocumentHighlightKind::Text`]. + pub kind: Option<DocumentHighlightKind>, + + /// The range this highlight applies to. + pub range: Range, +} + +/// Registration options for a [DocumentHighlightRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentHighlightRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, +} + +/// Parameters for a [DocumentSymbolRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentSymbolParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Represents information about programming constructs like variables, classes, +/// interfaces etc. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SymbolInformation { + /// The name of the symbol containing this symbol. This information is for + /// user interface purposes (e.g. to render a qualifier in the user interface + /// if necessary). It can't be used to re-infer a hierarchy for the document + /// symbols. + pub container_name: Option<String>, + + /// Indicates if this symbol is deprecated. + /// + /// @deprecated Use tags instead + #[deprecated] + pub deprecated: Option<bool>, + + /// The kind of this symbol. + pub kind: SymbolKind, + + /// The location of this symbol. The location's range is used by a tool + /// to reveal the location in the editor. If the symbol is selected in the + /// tool the range's start information is used to position the cursor. So + /// the range usually spans more than the actual symbol's name and does + /// normally include things like visibility modifiers. + /// + /// The range doesn't have to denote a node range in the sense of an abstract + /// syntax tree. It can therefore not be used to re-construct a hierarchy of + /// the symbols. + pub location: Location, + + /// The name of this symbol. + pub name: String, + + /// Tags for this symbol. + /// + /// @since 3.16.0 + pub tags: Option<Vec<SymbolTag>>, +} + +/// Represents programming constructs like variables, classes, interfaces etc. +/// that appear in a document. Document symbols can be hierarchical and they +/// have two ranges: one that encloses its definition and one that points to +/// its most interesting range, e.g. the range of an identifier. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentSymbol { + /// Children of this symbol, e.g. properties of a class. + pub children: Option<Vec<DocumentSymbol>>, + + /// Indicates if this symbol is deprecated. + /// + /// @deprecated Use tags instead + #[deprecated] + pub deprecated: Option<bool>, + + /// More detail for this symbol, e.g the signature of a function. + pub detail: Option<String>, + + /// The kind of this symbol. + pub kind: SymbolKind, + + /// The name of this symbol. Will be displayed in the user interface and therefore must not be + /// an empty string or a string only consisting of white spaces. + pub name: String, + + /// The range enclosing this symbol not including leading/trailing whitespace but everything else + /// like comments. This information is typically used to determine if the clients cursor is + /// inside the symbol to reveal in the symbol in the UI. + pub range: Range, + + /// The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. + /// Must be contained by the `range`. + pub selection_range: Range, + + /// Tags for this document symbol. + /// + /// @since 3.16.0 + pub tags: Option<Vec<SymbolTag>>, +} + +/// Registration options for a [DocumentSymbolRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentSymbolRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// A human-readable string that is shown when multiple outlines trees + /// are shown for the same document. + /// + /// @since 3.16.0 + pub label: Option<String>, +} + +/// The parameters of a [CodeActionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeActionParams { + /// Context carrying additional information. + pub context: CodeActionContext, + + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The range for which the command was invoked. + pub range: Range, + + /// The document in which the command was invoked. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Represents a reference to a command. Provides a title which +/// will be used to represent a command in the UI and, optionally, +/// an array of arguments which will be passed to the command handler +/// function when invoked. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Command { + /// Arguments that the command handler should be + /// invoked with. + pub arguments: Option<Vec<LSPAny>>, + + /// The identifier of the actual command handler. + pub command: String, + + /// Title of the command, like `save`. + pub title: String, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructDisabled { + /// Human readable description of why the code action is currently disabled. + /// + /// This is displayed in the code actions UI. + pub reason: String, +} + +/// A code action represents a change that can be performed in code, e.g. to fix a problem or +/// to refactor code. +/// +/// A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeAction { + /// A command this code action executes. If a code action + /// provides an edit and a command, first the edit is + /// executed and then the command. + pub command: Option<Command>, + + /// A data entry field that is preserved on a code action between + /// a `textDocument/codeAction` and a `codeAction/resolve` request. + /// + /// @since 3.16.0 + pub data: Option<LSPAny>, + + /// The diagnostics that this code action resolves. + pub diagnostics: Option<Vec<Diagnostic>>, + + /// Marks that the code action cannot currently be applied. + /// + /// Clients should follow the following guidelines regarding disabled code actions: + /// + /// - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) + /// code action menus. + /// + /// - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type + /// of code action, such as refactorings. + /// + /// - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions) + /// that auto applies a code action and only disabled code actions are returned, the client should show the user an + /// error message with `reason` in the editor. + /// + /// @since 3.16.0 + pub disabled: Option<StructDisabled>, + + /// The workspace edit this code action performs. + pub edit: Option<WorkspaceEdit>, + + /// Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted + /// by keybindings. + /// + /// A quick fix should be marked preferred if it properly addresses the underlying error. + /// A refactoring should be marked preferred if it is the most reasonable choice of actions to take. + /// + /// @since 3.15.0 + pub is_preferred: Option<bool>, + + /// The kind of the code action. + /// + /// Used to filter code actions. + pub kind: Option<CustomStringEnum<CodeActionKind>>, + + /// A short, human-readable, title for this code action. + pub title: String, +} + +/// Registration options for a [CodeActionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeActionRegistrationOptions { + /// CodeActionKinds that this server may return. + /// + /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + /// may list out every specific kind they provide. + pub code_action_kinds: Option<Vec<CustomStringEnum<CodeActionKind>>>, + + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// The server provides support to resolve additional + /// information for a code action. + /// + /// @since 3.16.0 + pub resolve_provider: Option<bool>, +} + +/// The parameters of a [WorkspaceSymbolRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceSymbolParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// A query string to filter symbols by. Clients may send an empty + /// string here to request all symbols. + pub query: String, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructUri { + pub uri: String, +} + +/// A special workspace symbol that supports locations without a range. +/// +/// See also SymbolInformation. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceSymbol { + /// The name of the symbol containing this symbol. This information is for + /// user interface purposes (e.g. to render a qualifier in the user interface + /// if necessary). It can't be used to re-infer a hierarchy for the document + /// symbols. + pub container_name: Option<String>, + + /// A data entry field that is preserved on a workspace symbol between a + /// workspace symbol request and a workspace symbol resolve request. + pub data: Option<LSPAny>, + + /// The kind of this symbol. + pub kind: SymbolKind, + + /// The location of the symbol. Whether a server is allowed to + /// return a location without a range depends on the client + /// capability `workspace.symbol.resolveSupport`. + /// + /// See SymbolInformation#location for more details. + pub location: OR2<Location, StructUri>, + + /// The name of this symbol. + pub name: String, + + /// Tags for this symbol. + /// + /// @since 3.16.0 + pub tags: Option<Vec<SymbolTag>>, +} + +/// Registration options for a [WorkspaceSymbolRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceSymbolRegistrationOptions { + /// The server provides support to resolve additional + /// information for a workspace symbol. + /// + /// @since 3.17.0 + pub resolve_provider: Option<bool>, +} + +/// The parameters of a [CodeLensRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeLensParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The document to request code lens for. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// A code lens represents a [command][Command] that should be shown along with +/// source text, like the number of references, a way to run tests, etc. +/// +/// A code lens is _unresolved_ when no command is associated to it. For performance +/// reasons the creation of a code lens and resolving should be done in two stages. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeLens { + /// The command this code lens represents. + pub command: Option<Command>, + + /// A data entry field that is preserved on a code lens item between + /// a [CodeLensRequest] and a [CodeLensResolveRequest] + pub data: Option<LSPAny>, + + /// The range in which this code lens is valid. Should only span a single line. + pub range: Range, +} + +/// Registration options for a [CodeLensRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeLensRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// Code lens has a resolve provider as well. + pub resolve_provider: Option<bool>, +} + +/// The parameters of a [DocumentLinkRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentLinkParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, + + /// The document to provide document links for. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// A document link is a range in a text document that links to an internal or external resource, like another +/// text document or a web site. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentLink { + /// A data entry field that is preserved on a document link between a + /// DocumentLinkRequest and a DocumentLinkResolveRequest. + pub data: Option<LSPAny>, + + /// The range this link applies to. + pub range: Range, + + /// The uri this link points to. If missing a resolve request is sent later. + pub target: Option<String>, + + /// The tooltip text when you hover over this link. + /// + /// If a tooltip is provided, is will be displayed in a string that includes instructions on how to + /// trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS, + /// user settings, and localization. + /// + /// @since 3.15.0 + pub tooltip: Option<String>, +} + +/// Registration options for a [DocumentLinkRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentLinkRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// Document links have a resolve provider as well. + pub resolve_provider: Option<bool>, +} + +/// The parameters of a [DocumentFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentFormattingParams { + /// The format options. + pub options: FormattingOptions, + + /// The document to format. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Registration options for a [DocumentFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentFormattingRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, +} + +/// The parameters of a [DocumentRangeFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentRangeFormattingParams { + /// The format options + pub options: FormattingOptions, + + /// The range to format + pub range: Range, + + /// The document to format. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Registration options for a [DocumentRangeFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentRangeFormattingRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// Whether the server supports formatting multiple ranges at once. + /// + /// @since 3.18.0 + /// @proposed + #[cfg(feature = "proposed", since = "3.18.0")] + pub ranges_support: Option<bool>, +} + +/// The parameters of a [DocumentRangesFormattingRequest]. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentRangesFormattingParams { + /// The format options + pub options: FormattingOptions, + + /// The ranges to format + pub ranges: Vec<Range>, + + /// The document to format. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// The parameters of a [DocumentOnTypeFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentOnTypeFormattingParams { + /// The character that has been typed that triggered the formatting + /// on type request. That is not necessarily the last character that + /// got inserted into the document since the client could auto insert + /// characters as well (e.g. like automatic brace completion). + pub ch: String, + + /// The formatting options. + pub options: FormattingOptions, + + /// The position around which the on type formatting should happen. + /// This is not necessarily the exact position where the character denoted + /// by the property `ch` got typed. + pub position: Position, + + /// The document to format. + pub text_document: TextDocumentIdentifier, +} + +/// Registration options for a [DocumentOnTypeFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentOnTypeFormattingRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// A character on which formatting should be triggered, like `{`. + pub first_trigger_character: String, + + /// More trigger characters. + pub more_trigger_character: Option<Vec<String>>, +} + +/// The parameters of a [RenameRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RenameParams { + /// The new name of the symbol. If the given name is not valid the + /// request must return a [ResponseError] with an + /// appropriate message set. + pub new_name: String, + + /// The position at which this request was sent. + pub position: Position, + + /// The document to rename. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Registration options for a [RenameRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RenameRegistrationOptions { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + #[serde(skip_serializing_if = "Option::is_none")] + pub document_selector: Option<DocumentSelector>, + + /// Renames should be checked and tested before being executed. + /// + /// @since version 3.12.0 + pub prepare_provider: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct PrepareRenameParams { + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// The parameters of a [ExecuteCommandRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ExecuteCommandParams { + /// Arguments that the command should be invoked with. + pub arguments: Option<Vec<LSPAny>>, + + /// The identifier of the actual command handler. + pub command: String, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +/// Registration options for a [ExecuteCommandRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ExecuteCommandRegistrationOptions { + /// The commands to be executed on the server + pub commands: Vec<String>, +} + +/// The parameters passed via an apply workspace edit request. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ApplyWorkspaceEditParams { + /// The edits to apply. + pub edit: WorkspaceEdit, + + /// An optional label of the workspace edit. This label is + /// presented in the user interface for example on an undo + /// stack to undo the workspace edit. + pub label: Option<String>, +} + +/// The result returned from the apply workspace edit request. +/// +/// @since 3.17 renamed from ApplyWorkspaceEditResponse +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ApplyWorkspaceEditResult { + /// Indicates whether the edit was applied or not. + pub applied: bool, + + /// Depending on the client's failure handling strategy `failedChange` might + /// contain the index of the change that failed. This property is only available + /// if the client signals a `failureHandlingStrategy` in its client capabilities. + pub failed_change: Option<u32>, + + /// An optional textual description for why the edit was not applied. + /// This may be used by the server for diagnostic logging or to provide + /// a suitable error for a request that triggered the edit. + pub failure_reason: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkDoneProgressBegin { + /// Controls if a cancel button should show to allow the user to cancel the + /// long running operation. Clients that don't support cancellation are allowed + /// to ignore the setting. + pub cancellable: Option<bool>, + + pub kind: String, + + /// Optional, more detailed associated progress message. Contains + /// complementary information to the `title`. + /// + /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". + /// If unset, the previous progress message (if any) is still valid. + pub message: Option<String>, + + /// Optional progress percentage to display (value 100 is considered 100%). + /// If not provided infinite progress is assumed and clients are allowed + /// to ignore the `percentage` value in subsequent in report notifications. + /// + /// The value should be steadily rising. Clients are free to ignore values + /// that are not following this rule. The value range is [0, 100]. + pub percentage: Option<u32>, + + /// Mandatory title of the progress operation. Used to briefly inform about + /// the kind of operation being performed. + /// + /// Examples: "Indexing" or "Linking dependencies". + pub title: String, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkDoneProgressReport { + /// Controls enablement state of a cancel button. + /// + /// Clients that don't support cancellation or don't support controlling the button's + /// enablement state are allowed to ignore the property. + pub cancellable: Option<bool>, + + pub kind: String, + + /// Optional, more detailed associated progress message. Contains + /// complementary information to the `title`. + /// + /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". + /// If unset, the previous progress message (if any) is still valid. + pub message: Option<String>, + + /// Optional progress percentage to display (value 100 is considered 100%). + /// If not provided infinite progress is assumed and clients are allowed + /// to ignore the `percentage` value in subsequent in report notifications. + /// + /// The value should be steadily rising. Clients are free to ignore values + /// that are not following this rule. The value range is [0, 100] + pub percentage: Option<u32>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkDoneProgressEnd { + pub kind: String, + + /// Optional, a final message indicating to for example indicate the outcome + /// of the operation. + pub message: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SetTraceParams { + pub value: TraceValues, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct LogTraceParams { + pub message: String, + + pub verbose: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CancelParams { + /// The request id to cancel. + pub id: OR2<i32, String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ProgressParams { + /// The progress token provided by the client or server. + pub token: ProgressToken, + + /// The progress data. + pub value: LSPAny, +} + +/// A parameter literal used in requests to pass a text document and a position inside that +/// document. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentPositionParams { + /// The position inside the text document. + pub position: Position, + + /// The text document. + pub text_document: TextDocumentIdentifier, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkDoneProgressParams { + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct PartialResultParams { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + pub partial_result_token: Option<ProgressToken>, +} + +/// Represents the connection of two locations. Provides additional metadata over normal [locations][Location], +/// including an origin range. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct LocationLink { + /// Span of the origin of this link. + /// + /// Used as the underlined span for mouse interaction. Defaults to the word range at + /// the definition position. + pub origin_selection_range: Option<Range>, + + /// The full target range of this link. If the target for example is a symbol then target range is the + /// range enclosing this symbol not including leading/trailing whitespace but everything else + /// like comments. This information is typically used to highlight the range in the editor. + pub target_range: Range, + + /// The range that should be selected and revealed when this link is being followed, e.g the name of a function. + /// Must be contained by the `targetRange`. See also `DocumentSymbol#range` + pub target_selection_range: Range, + + /// The target resource identifier of this link. + pub target_uri: String, +} + +/// A range in a text document expressed as (zero-based) start and end positions. +/// +/// If you want to specify a range that contains a line including the line ending +/// character(s) then use an end position denoting the start of the next line. +/// For example: +/// ```ts +/// { +/// start: { line: 5, character: 23 } +/// end : { line 6, character : 0 } +/// } +/// ``` +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Range { + /// The range's end position. + pub end: Position, + + /// The range's start position. + pub start: Position, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ImplementationOptions { + pub work_done_progress: Option<bool>, +} + +/// Static registration options to be returned in the initialize +/// request. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StaticRegistrationOptions { + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeDefinitionOptions { + pub work_done_progress: Option<bool>, +} + +/// The workspace folder change event. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceFoldersChangeEvent { + /// The array of added workspace folders + pub added: Vec<WorkspaceFolder>, + + /// The array of the removed workspace folders + pub removed: Vec<WorkspaceFolder>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ConfigurationItem { + /// The scope to get the configuration section for. + pub scope_uri: Option<String>, + + /// The configuration section asked for. + pub section: Option<String>, +} + +/// A literal to identify a text document in the client. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentIdentifier { + /// The text document's uri. + pub uri: String, +} + +/// Represents a color in RGBA space. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Color { + /// The alpha component of this color in the range [0-1]. + pub alpha: Decimal, + + /// The blue component of this color in the range [0-1]. + pub blue: Decimal, + + /// The green component of this color in the range [0-1]. + pub green: Decimal, + + /// The red component of this color in the range [0-1]. + pub red: Decimal, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentColorOptions { + pub work_done_progress: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FoldingRangeOptions { + pub work_done_progress: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DeclarationOptions { + pub work_done_progress: Option<bool>, +} + +/// Position in a text document expressed as zero-based line and character +/// offset. Prior to 3.17 the offsets were always based on a UTF-16 string +/// representation. So a string of the form `a𐐀b` the character offset of the +/// character `a` is 0, the character offset of `𐐀` is 1 and the character +/// offset of b is 3 since `𐐀` is represented using two code units in UTF-16. +/// Since 3.17 clients and servers can agree on a different string encoding +/// representation (e.g. UTF-8). The client announces it's supported encoding +/// via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities). +/// The value is an array of position encodings the client supports, with +/// decreasing preference (e.g. the encoding at index `0` is the most preferred +/// one). To stay backwards compatible the only mandatory encoding is UTF-16 +/// represented via the string `utf-16`. The server can pick one of the +/// encodings offered by the client and signals that encoding back to the +/// client via the initialize result's property +/// [`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value +/// `utf-16` is missing from the client's capability `general.positionEncodings` +/// servers can safely assume that the client supports UTF-16. If the server +/// omits the position encoding in its initialize result the encoding defaults +/// to the string value `utf-16`. Implementation considerations: since the +/// conversion from one encoding into another requires the content of the +/// file / line the conversion is best done where the file is read which is +/// usually on the server side. +/// +/// Positions are line end character agnostic. So you can not specify a position +/// that denotes `\r|\n` or `\n|` where `|` represents the character offset. +/// +/// @since 3.17.0 - support for negotiated position encoding. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Position { + /// Character offset on a line in a document (zero-based). + /// + /// The meaning of this offset is determined by the negotiated + /// `PositionEncodingKind`. + /// + /// If the character value is greater than the line length it defaults back to the + /// line length. + pub character: u32, + + /// Line position in a document (zero-based). + /// + /// If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. + /// If a line number is negative, it defaults to 0. + pub line: u32, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SelectionRangeOptions { + pub work_done_progress: Option<bool>, +} + +/// Call hierarchy options used during static registration. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyOptions { + pub work_done_progress: Option<bool>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokensOptions { + /// Server supports providing semantic tokens for a full document. + pub full: Option<OR2<bool, StructOptions>>, + + /// The legend used by the server + pub legend: SemanticTokensLegend, + + /// Server supports providing semantic tokens for a specific range + /// of a document. + pub range: Option<OR2<bool, LSPObject>>, + + pub work_done_progress: Option<bool>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokensEdit { + /// The elements to insert. + pub data: Option<Vec<u32>>, + + /// The count of elements to remove. + pub delete_count: u32, + + /// The start offset of the edit. + pub start: u32, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct LinkedEditingRangeOptions { + pub work_done_progress: Option<bool>, +} + +/// Represents information on a file/folder create. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FileCreate { + /// A file:// URI for the location of the file/folder being created. + pub uri: String, +} + +/// Describes textual changes on a text document. A TextDocumentEdit describes all changes +/// on a document version Si and after they are applied move the document to version Si+1. +/// So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any +/// kind of ordering. However the edits must be non overlapping. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentEdit { + /// The edits to be applied. + /// + /// @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a + /// client capability. + pub edits: Vec<OR2<TextEdit, AnnotatedTextEdit>>, + + /// The text document to change. + pub text_document: OptionalVersionedTextDocumentIdentifier, +} + +/// Create file operation. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CreateFile { + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + pub annotation_id: Option<ChangeAnnotationIdentifier>, + + /// A create + pub kind: String, + + /// Additional options + pub options: Option<CreateFileOptions>, + + /// The resource to create. + pub uri: String, +} + +/// Rename file operation +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RenameFile { + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + pub annotation_id: Option<ChangeAnnotationIdentifier>, + + /// A rename + pub kind: String, + + /// The new location. + pub new_uri: String, + + /// The old (existing) location. + pub old_uri: String, + + /// Rename options. + pub options: Option<RenameFileOptions>, +} + +/// Delete file operation +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DeleteFile { + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + pub annotation_id: Option<ChangeAnnotationIdentifier>, + + /// A delete + pub kind: String, + + /// Delete options. + pub options: Option<DeleteFileOptions>, + + /// The file to delete. + pub uri: String, +} + +/// Additional information that describes document changes. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ChangeAnnotation { + /// A human-readable string which is rendered less prominent in + /// the user interface. + pub description: Option<String>, + + /// A human-readable string describing the actual change. The string + /// is rendered prominent in the user interface. + pub label: String, + + /// A flag which indicates that user confirmation is needed + /// before applying the change. + pub needs_confirmation: Option<bool>, +} + +/// A filter to describe in which file operation requests or notifications +/// the server is interested in receiving. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FileOperationFilter { + /// The actual file operation pattern. + pub pattern: FileOperationPattern, + + /// A Uri scheme like `file` or `untitled`. + pub scheme: Option<String>, +} + +/// Represents information on a file/folder rename. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FileRename { + /// A file:// URI for the new location of the file/folder being renamed. + pub new_uri: String, + + /// A file:// URI for the original location of the file/folder being renamed. + pub old_uri: String, +} + +/// Represents information on a file/folder delete. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FileDelete { + /// A file:// URI for the location of the file/folder being deleted. + pub uri: String, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct MonikerOptions { + pub work_done_progress: Option<bool>, +} + +/// Type hierarchy options used during static registration. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeHierarchyOptions { + pub work_done_progress: Option<bool>, +} + +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineValueContext { + /// The stack frame (as a DAP Id) where the execution has stopped. + pub frame_id: i32, + + /// The document range where execution has stopped. + /// Typically the end position of the range denotes the line where the inline values are shown. + pub stopped_location: Range, +} + +/// Provide inline value as text. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineValueText { + /// The document range for which the inline value applies. + pub range: Range, + + /// The text of the inline value. + pub text: String, +} + +/// Provide inline value through a variable lookup. +/// If only a range is specified, the variable name will be extracted from the underlying document. +/// An optional variable name can be used to override the extracted name. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineValueVariableLookup { + /// How to perform the lookup. + pub case_sensitive_lookup: bool, + + /// The document range for which the inline value applies. + /// The range is used to extract the variable name from the underlying document. + pub range: Range, + + /// If specified the name of the variable to look up. + pub variable_name: Option<String>, +} + +/// Provide an inline value through an expression evaluation. +/// If only a range is specified, the expression will be extracted from the underlying document. +/// An optional expression can be used to override the extracted expression. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineValueEvaluatableExpression { + /// If specified the expression overrides the extracted expression. + pub expression: Option<String>, + + /// The document range for which the inline value applies. + /// The range is used to extract the evaluatable expression from the underlying document. + pub range: Range, +} + +/// Inline value options used during static registration. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineValueOptions { + pub work_done_progress: Option<bool>, +} + +/// An inlay hint label part allows for interactive and composite labels +/// of inlay hints. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlayHintLabelPart { + /// An optional command for this label part. + /// + /// Depending on the client capability `inlayHint.resolveSupport` clients + /// might resolve this property late using the resolve request. + pub command: Option<Command>, + + /// An optional source code location that represents this + /// label part. + /// + /// The editor will use this location for the hover and for code navigation + /// features: This part will become a clickable link that resolves to the + /// definition of the symbol at the given location (not necessarily the + /// location itself), it shows the hover that shows at the given location, + /// and it shows a context menu with further code navigation commands. + /// + /// Depending on the client capability `inlayHint.resolveSupport` clients + /// might resolve this property late using the resolve request. + pub location: Option<Location>, + + /// The tooltip text when you hover over this label part. Depending on + /// the client capability `inlayHint.resolveSupport` clients might resolve + /// this property late using the resolve request. + pub tooltip: Option<OR2<String, MarkupContent>>, + + /// The value of this label part. + pub value: String, +} + +/// A `MarkupContent` literal represents a string value which content is interpreted base on its +/// kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds. +/// +/// If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues. +/// See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting +/// +/// Here is an example how such a string can be constructed using JavaScript / TypeScript: +/// ```ts +/// let markdown: MarkdownContent = { +/// kind: MarkupKind.Markdown, +/// value: [ +/// '# Header', +/// 'Some text', +/// '```typescript', +/// 'someCode();', +/// '```' +/// ].join('\n') +/// }; +/// ``` +/// +/// *Please Note* that clients might sanitize the return markdown. A client could decide to +/// remove HTML from the markdown to avoid script execution. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct MarkupContent { + /// The type of the Markup + pub kind: MarkupKind, + + /// The content itself + pub value: String, +} + +/// Inlay hint options used during static registration. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlayHintOptions { + /// The server provides support to resolve additional + /// information for an inlay hint item. + pub resolve_provider: Option<bool>, + + pub work_done_progress: Option<bool>, +} + +/// A full diagnostic report with a set of related documents. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RelatedFullDocumentDiagnosticReport { + /// The actual items. + pub items: Vec<Diagnostic>, + + /// A full document diagnostic report. + pub kind: String, + + /// Diagnostics of related documents. This information is useful + /// in programming languages where code in a file A can generate + /// diagnostics in a file B which A depends on. An example of + /// such a language is C/C++ where marco definitions in a file + /// a.cpp and result in errors in a header file b.hpp. + /// + /// @since 3.17.0 + pub related_documents: Option< + HashMap<String, OR2<FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport>>, + >, + + /// An optional result id. If provided it will + /// be sent on the next diagnostic request for the + /// same document. + pub result_id: Option<String>, +} + +/// An unchanged diagnostic report with a set of related documents. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RelatedUnchangedDocumentDiagnosticReport { + /// A document diagnostic report indicating + /// no changes to the last result. A server can + /// only return `unchanged` if result ids are + /// provided. + pub kind: String, + + /// Diagnostics of related documents. This information is useful + /// in programming languages where code in a file A can generate + /// diagnostics in a file B which A depends on. An example of + /// such a language is C/C++ where marco definitions in a file + /// a.cpp and result in errors in a header file b.hpp. + /// + /// @since 3.17.0 + pub related_documents: Option< + HashMap<String, OR2<FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport>>, + >, + + /// A result id which will be sent on the next + /// diagnostic request for the same document. + pub result_id: String, +} + +/// A diagnostic report with a full set of problems. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FullDocumentDiagnosticReport { + /// The actual items. + pub items: Vec<Diagnostic>, + + /// A full document diagnostic report. + pub kind: String, + + /// An optional result id. If provided it will + /// be sent on the next diagnostic request for the + /// same document. + pub result_id: Option<String>, +} + +/// A diagnostic report indicating that the last returned +/// report is still accurate. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct UnchangedDocumentDiagnosticReport { + /// A document diagnostic report indicating + /// no changes to the last result. A server can + /// only return `unchanged` if result ids are + /// provided. + pub kind: String, + + /// A result id which will be sent on the next + /// diagnostic request for the same document. + pub result_id: String, +} + +/// Diagnostic options. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DiagnosticOptions { + /// An optional identifier under which the diagnostics are + /// managed by the client. + pub identifier: Option<String>, + + /// Whether the language has inter file dependencies meaning that + /// editing code in one file can result in a different diagnostic + /// set in another file. Inter file dependencies are common for + /// most programming languages and typically uncommon for linters. + pub inter_file_dependencies: bool, + + pub work_done_progress: Option<bool>, + + /// The server provides support for workspace diagnostics as well. + pub workspace_diagnostics: bool, +} + +/// A previous result id in a workspace pull request. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct PreviousResultId { + /// The URI for which the client knowns a + /// result id. + pub uri: String, + + /// The value of the previous result id. + pub value: String, +} + +/// A notebook document. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookDocument { + /// The cells of a notebook. + pub cells: Vec<NotebookCell>, + + /// Additional metadata stored with the notebook + /// document. + /// + /// Note: should always be an object literal (e.g. LSPObject) + pub metadata: Option<LSPObject>, + + /// The type of the notebook. + pub notebook_type: String, + + /// The notebook document's uri. + pub uri: String, + + /// The version number of this document (it will increase after each + /// change, including undo/redo). + pub version: i32, +} + +/// An item to transfer a text document from the client to the +/// server. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentItem { + /// The text document's language identifier. + pub language_id: String, + + /// The content of the opened text document. + pub text: String, + + /// The text document's uri. + pub uri: String, + + /// The version number of this document (it will increase after each + /// change, including undo/redo). + pub version: i32, +} + +/// A versioned notebook document identifier. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct VersionedNotebookDocumentIdentifier { + /// The notebook document's uri. + pub uri: String, + + /// The version number of this notebook document. + pub version: i32, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructStructure { + /// The change to the cell array. + pub array: NotebookCellArrayChange, + + /// Additional opened cell text documents. + pub did_open: Option<Vec<TextDocumentItem>>, + + /// Additional closed cell text documents. + pub did_close: Option<Vec<TextDocumentIdentifier>>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructDocument { + pub document: VersionedTextDocumentIdentifier, + + pub changes: Vec<TextDocumentContentChangeEvent>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructCells { + /// Changes to the cell structure to add or + /// remove cells. + pub structure: Option<StructStructure>, + + /// Changes to notebook cells properties like its + /// kind, execution summary or metadata. + pub data: Option<Vec<NotebookCell>>, + + /// Changes to the text content of notebook cells. + pub text_content: Option<Vec<StructDocument>>, +} + +/// A change event for a notebook document. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookDocumentChangeEvent { + /// Changes to cells + pub cells: Option<StructCells>, + + /// The changed meta data if any. + /// + /// Note: should always be an object literal (e.g. LSPObject) + pub metadata: Option<LSPObject>, +} + +/// A literal to identify a notebook document in the client. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookDocumentIdentifier { + /// The notebook document's uri. + pub uri: String, +} + +/// Provides information about the context in which an inline completion was requested. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineCompletionContext { + /// Provides information about the currently selected item in the autocomplete widget if it is visible. + pub selected_completion_info: Option<SelectedCompletionInfo>, + + /// Describes how the inline completion was triggered. + pub trigger_kind: InlineCompletionTriggerKind, +} + +/// A string value used as a snippet is a template which allows to insert text +/// and to control the editor cursor when insertion happens. +/// +/// A snippet can define tab stops and placeholders with `$1`, `$2` +/// and `${3:foo}`. `$0` defines the final tab stop, it defaults to +/// the end of the snippet. Variables are defined with `$name` and +/// `${name:default value}`. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StringValue { + /// The kind of string value. + pub kind: String, + + /// The snippet string. + pub value: String, +} + +/// Inline completion options used during static registration. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineCompletionOptions { + pub work_done_progress: Option<bool>, +} + +/// General parameters to register for a notification or to register a provider. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Registration { + /// The id used to register the request. The id can be used to deregister + /// the request again. + pub id: String, + + /// The method / capability to register for. + pub method: String, + + /// Options necessary for the registration. + pub register_options: Option<LSPAny>, +} + +/// General parameters to unregister a request or notification. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Unregistration { + /// The id used to unregister the request or notification. Usually an id + /// provided during the register request. + pub id: String, + + /// The method to unregister for. + pub method: String, +} + +/// The initialize parameters +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct _InitializeParams { + /// The capabilities provided by the client (editor or tool) + pub capabilities: ClientCapabilities, + + /// Information about the client + /// + /// @since 3.15.0 + pub client_info: Option<StructClientInfo>, + + /// User provided initialization options. + pub initialization_options: Option<LSPAny>, + + /// The locale the client is currently showing the user interface + /// in. This must not necessarily be the locale of the operating + /// system. + /// + /// Uses IETF language tags as the value's syntax + /// (See https://en.wikipedia.org/wiki/IETF_language_tag) + /// + /// @since 3.16.0 + pub locale: Option<String>, + + /// The process Id of the parent process that started + /// the server. + /// + /// Is `null` if the process has not been started by another process. + /// If the parent process is not alive then the server should exit. + #[serde(skip_serializing_if = "Option::is_none")] + pub process_id: Option<i32>, + + /// The rootPath of the workspace. Is null + /// if no folder is open. + /// + /// @deprecated in favour of rootUri. + #[deprecated] + pub root_path: Option<String>, + + /// The rootUri of the workspace. Is null if no + /// folder is open. If both `rootPath` and `rootUri` are set + /// `rootUri` wins. + /// + /// @deprecated in favour of workspaceFolders. + #[deprecated] + #[serde(skip_serializing_if = "Option::is_none")] + pub root_uri: Option<String>, + + /// The initial trace setting. If omitted trace is disabled ('off'). + pub trace: Option<TraceValues>, + + /// An optional token that a server can use to report work done progress. + pub work_done_token: Option<ProgressToken>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceFoldersInitializeParams { + /// The workspace folders configured in the client when the server starts. + /// + /// This property is only available if the client supports workspace folders. + /// It can be `null` if the client supports workspace folders but none are + /// configured. + /// + /// @since 3.6.0 + pub workspace_folders: Option<Vec<WorkspaceFolder>>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructWorkspace { + /// The server supports workspace folder. + /// + /// @since 3.6.0 + pub workspace_folders: Option<WorkspaceFoldersServerCapabilities>, + + /// The server is interested in notifications/requests for operations on files. + /// + /// @since 3.16.0 + pub file_operations: Option<FileOperationOptions>, +} + +/// Defines the capabilities provided by a language +/// server. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ServerCapabilities { + /// The server provides call hierarchy support. + /// + /// @since 3.16.0 + pub call_hierarchy_provider: + Option<OR3<bool, CallHierarchyOptions, CallHierarchyRegistrationOptions>>, + + /// The server provides code actions. CodeActionOptions may only be + /// specified if the client states that it supports + /// `codeActionLiteralSupport` in its initial `initialize` request. + pub code_action_provider: Option<OR2<bool, CodeActionOptions>>, + + /// The server provides code lens. + pub code_lens_provider: Option<CodeLensOptions>, + + /// The server provides color provider support. + pub color_provider: Option<OR3<bool, DocumentColorOptions, DocumentColorRegistrationOptions>>, + + /// The server provides completion support. + pub completion_provider: Option<CompletionOptions>, + + /// The server provides Goto Declaration support. + pub declaration_provider: Option<OR3<bool, DeclarationOptions, DeclarationRegistrationOptions>>, + + /// The server provides goto definition support. + pub definition_provider: Option<OR2<bool, DefinitionOptions>>, + + /// The server has support for pull model diagnostics. + /// + /// @since 3.17.0 + pub diagnostic_provider: Option<OR2<DiagnosticOptions, DiagnosticRegistrationOptions>>, + + /// The server provides document formatting. + pub document_formatting_provider: Option<OR2<bool, DocumentFormattingOptions>>, + + /// The server provides document highlight support. + pub document_highlight_provider: Option<OR2<bool, DocumentHighlightOptions>>, + + /// The server provides document link support. + pub document_link_provider: Option<DocumentLinkOptions>, + + /// The server provides document formatting on typing. + pub document_on_type_formatting_provider: Option<DocumentOnTypeFormattingOptions>, + + /// The server provides document range formatting. + pub document_range_formatting_provider: Option<OR2<bool, DocumentRangeFormattingOptions>>, + + /// The server provides document symbol support. + pub document_symbol_provider: Option<OR2<bool, DocumentSymbolOptions>>, + + /// The server provides execute command support. + pub execute_command_provider: Option<ExecuteCommandOptions>, + + /// Experimental server capabilities. + pub experimental: Option<LSPAny>, + + /// The server provides folding provider support. + pub folding_range_provider: + Option<OR3<bool, FoldingRangeOptions, FoldingRangeRegistrationOptions>>, + + /// The server provides hover support. + pub hover_provider: Option<OR2<bool, HoverOptions>>, + + /// The server provides Goto Implementation support. + pub implementation_provider: + Option<OR3<bool, ImplementationOptions, ImplementationRegistrationOptions>>, + + /// The server provides inlay hints. + /// + /// @since 3.17.0 + pub inlay_hint_provider: Option<OR3<bool, InlayHintOptions, InlayHintRegistrationOptions>>, + + /// Inline completion options used during static registration. + /// + /// @since 3.18.0 + /// @proposed + #[cfg(feature = "proposed", since = "3.18.0")] + pub inline_completion_provider: Option<OR2<bool, InlineCompletionOptions>>, + + /// The server provides inline values. + /// + /// @since 3.17.0 + pub inline_value_provider: + Option<OR3<bool, InlineValueOptions, InlineValueRegistrationOptions>>, + + /// The server provides linked editing range support. + /// + /// @since 3.16.0 + pub linked_editing_range_provider: + Option<OR3<bool, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions>>, + + /// The server provides moniker support. + /// + /// @since 3.16.0 + pub moniker_provider: Option<OR3<bool, MonikerOptions, MonikerRegistrationOptions>>, + + /// Defines how notebook documents are synced. + /// + /// @since 3.17.0 + pub notebook_document_sync: + Option<OR2<NotebookDocumentSyncOptions, NotebookDocumentSyncRegistrationOptions>>, + + /// The position encoding the server picked from the encodings offered + /// by the client via the client capability `general.positionEncodings`. + /// + /// If the client didn't provide any position encodings the only valid + /// value that a server can return is 'utf-16'. + /// + /// If omitted it defaults to 'utf-16'. + /// + /// @since 3.17.0 + pub position_encoding: Option<CustomStringEnum<PositionEncodingKind>>, + + /// The server provides find references support. + pub references_provider: Option<OR2<bool, ReferenceOptions>>, + + /// The server provides rename support. RenameOptions may only be + /// specified if the client states that it supports + /// `prepareSupport` in its initial `initialize` request. + pub rename_provider: Option<OR2<bool, RenameOptions>>, + + /// The server provides selection range support. + pub selection_range_provider: + Option<OR3<bool, SelectionRangeOptions, SelectionRangeRegistrationOptions>>, + + /// The server provides semantic tokens support. + /// + /// @since 3.16.0 + pub semantic_tokens_provider: + Option<OR2<SemanticTokensOptions, SemanticTokensRegistrationOptions>>, + + /// The server provides signature help support. + pub signature_help_provider: Option<SignatureHelpOptions>, + + /// Defines how text documents are synced. Is either a detailed structure + /// defining each notification or for backwards compatibility the + /// TextDocumentSyncKind number. + pub text_document_sync: Option<OR2<TextDocumentSyncOptions, TextDocumentSyncKind>>, + + /// The server provides Goto Type Definition support. + pub type_definition_provider: + Option<OR3<bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions>>, + + /// The server provides type hierarchy support. + /// + /// @since 3.17.0 + pub type_hierarchy_provider: + Option<OR3<bool, TypeHierarchyOptions, TypeHierarchyRegistrationOptions>>, + + /// Workspace specific server capabilities. + pub workspace: Option<StructWorkspace>, + + /// The server provides workspace symbol support. + pub workspace_symbol_provider: Option<OR2<bool, WorkspaceSymbolOptions>>, +} + +/// A text document identifier to denote a specific version of a text document. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct VersionedTextDocumentIdentifier { + /// The text document's uri. + pub uri: String, + + /// The version number of this document. + pub version: i32, +} + +/// Save options. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SaveOptions { + /// The client is supposed to include the content on save. + pub include_text: Option<bool>, +} + +/// An event describing a file change. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FileEvent { + /// The change type. + #[serde(rename = "type")] + pub type_: FileChangeType, + + /// The file's uri. + pub uri: String, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FileSystemWatcher { + /// The glob pattern to watch. See [glob pattern][GlobPattern] for more detail. + /// + /// @since 3.17.0 support for relative patterns. + pub glob_pattern: GlobPattern, + + /// The kind of events of interest. If omitted it defaults + /// to WatchKind.Create | WatchKind.Change | WatchKind.Delete + /// which is 7. + pub kind: Option<CustomIntEnum<WatchKind>>, +} + +/// Represents a diagnostic, such as a compiler error or warning. Diagnostic objects +/// are only valid in the scope of a resource. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Diagnostic { + /// The diagnostic's code, which usually appear in the user interface. + pub code: Option<OR2<i32, String>>, + + /// An optional property to describe the error code. + /// Requires the code field (above) to be present/not null. + /// + /// @since 3.16.0 + pub code_description: Option<CodeDescription>, + + /// A data entry field that is preserved between a `textDocument/publishDiagnostics` + /// notification and `textDocument/codeAction` request. + /// + /// @since 3.16.0 + pub data: Option<LSPAny>, + + /// The diagnostic's message. It usually appears in the user interface + pub message: String, + + /// The range at which the message applies + pub range: Range, + + /// An array of related diagnostic information, e.g. when symbol-names within + /// a scope collide all definitions can be marked via this property. + pub related_information: Option<Vec<DiagnosticRelatedInformation>>, + + /// The diagnostic's severity. Can be omitted. If omitted it is up to the + /// client to interpret diagnostics as error, warning, info or hint. + pub severity: Option<DiagnosticSeverity>, + + /// A human-readable string describing the source of this + /// diagnostic, e.g. 'typescript' or 'super lint'. It usually + /// appears in the user interface. + pub source: Option<String>, + + /// Additional metadata about the diagnostic. + /// + /// @since 3.15.0 + pub tags: Option<Vec<DiagnosticTag>>, +} + +/// Contains additional information about the context in which a completion request is triggered. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CompletionContext { + /// The trigger character (a single character) that has trigger code complete. + /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` + pub trigger_character: Option<String>, + + /// How the completion was triggered. + pub trigger_kind: CompletionTriggerKind, +} + +/// Additional details for a completion item label. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CompletionItemLabelDetails { + /// An optional string which is rendered less prominently after [`CompletionItem::detail`]. Should be used + /// for fully qualified names and file paths. + pub description: Option<String>, + + /// An optional string which is rendered less prominently directly after [label][`CompletionItem::label`], + /// without any spacing. Should be used for function signatures and type annotations. + pub detail: Option<String>, +} + +/// A special text edit to provide an insert and a replace operation. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InsertReplaceEdit { + /// The range if the insert is requested + pub insert: Range, + + /// The string to be inserted. + pub new_text: String, + + /// The range if the replace is requested. + pub replace: Range, +} + +/// Completion options. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CompletionOptions { + /// The list of all possible characters that commit a completion. This field can be used + /// if clients don't support individual commit characters per completion item. See + /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` + /// + /// If a server provides both `allCommitCharacters` and commit characters on an individual + /// completion item the ones on the completion item win. + /// + /// @since 3.2.0 + pub all_commit_characters: Option<Vec<String>>, + + /// The server supports the following `CompletionItem` specific + /// capabilities. + /// + /// @since 3.17.0 + pub completion_item: Option<StructCompletionItem>, + + /// The server provides support to resolve additional + /// information for a completion item. + pub resolve_provider: Option<bool>, + + /// Most tools trigger completion request automatically without explicitly requesting + /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + /// starts to type an identifier. For example if the user types `c` in a JavaScript file + /// code complete will automatically pop up present `console` besides others as a + /// completion item. Characters that make up identifiers don't need to be listed here. + /// + /// If code complete should automatically be trigger on characters not being valid inside + /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. + pub trigger_characters: Option<Vec<String>>, + + pub work_done_progress: Option<bool>, +} + +/// Hover options. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct HoverOptions { + pub work_done_progress: Option<bool>, +} + +/// Additional information about the context in which a signature help request was triggered. +/// +/// @since 3.15.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SignatureHelpContext { + /// The currently active `SignatureHelp`. + /// + /// The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on + /// the user navigating through available signatures. + pub active_signature_help: Option<SignatureHelp>, + + /// `true` if signature help was already showing when it was triggered. + /// + /// Retriggers occurs when the signature help is already active and can be caused by actions such as + /// typing a trigger character, a cursor move, or document content changes. + pub is_retrigger: bool, + + /// Character that caused signature help to be triggered. + /// + /// This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter` + pub trigger_character: Option<String>, + + /// Action that caused signature help to be triggered. + pub trigger_kind: SignatureHelpTriggerKind, +} + +/// Represents the signature of something callable. A signature +/// can have a label, like a function-name, a doc-comment, and +/// a set of parameters. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SignatureInformation { + /// The index of the active parameter. + /// + /// If provided, this is used in place of `SignatureHelp.activeParameter`. + /// + /// @since 3.16.0 + pub active_parameter: Option<u32>, + + /// The human-readable doc-comment of this signature. Will be shown + /// in the UI but can be omitted. + pub documentation: Option<OR2<String, MarkupContent>>, + + /// The label of this signature. Will be shown in + /// the UI. + pub label: String, + + /// The parameters of this signature. + pub parameters: Option<Vec<ParameterInformation>>, +} + +/// Server Capabilities for a [SignatureHelpRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SignatureHelpOptions { + /// List of characters that re-trigger signature help. + /// + /// These trigger characters are only active when signature help is already showing. All trigger characters + /// are also counted as re-trigger characters. + /// + /// @since 3.15.0 + pub retrigger_characters: Option<Vec<String>>, + + /// List of characters that trigger signature help automatically. + pub trigger_characters: Option<Vec<String>>, + + pub work_done_progress: Option<bool>, +} + +/// Server Capabilities for a [DefinitionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DefinitionOptions { + pub work_done_progress: Option<bool>, +} + +/// Value-object that contains additional information when +/// requesting references. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ReferenceContext { + /// Include the declaration of the current symbol. + pub include_declaration: bool, +} + +/// Reference options. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ReferenceOptions { + pub work_done_progress: Option<bool>, +} + +/// Provider options for a [DocumentHighlightRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentHighlightOptions { + pub work_done_progress: Option<bool>, +} + +/// A base for all symbol information. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct BaseSymbolInformation { + /// The name of the symbol containing this symbol. This information is for + /// user interface purposes (e.g. to render a qualifier in the user interface + /// if necessary). It can't be used to re-infer a hierarchy for the document + /// symbols. + pub container_name: Option<String>, + + /// The kind of this symbol. + pub kind: SymbolKind, + + /// The name of this symbol. + pub name: String, + + /// Tags for this symbol. + /// + /// @since 3.16.0 + pub tags: Option<Vec<SymbolTag>>, +} + +/// Provider options for a [DocumentSymbolRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentSymbolOptions { + /// A human-readable string that is shown when multiple outlines trees + /// are shown for the same document. + /// + /// @since 3.16.0 + pub label: Option<String>, + + pub work_done_progress: Option<bool>, +} + +/// Contains additional diagnostic information about the context in which +/// a [code action][`CodeActionProvider::provideCodeActions`] is run. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeActionContext { + /// An array of diagnostics known on the client side overlapping the range provided to the + /// `textDocument/codeAction` request. They are provided so that the server knows which + /// errors are currently presented to the user for the given range. There is no guarantee + /// that these accurately reflect the error state of the resource. The primary parameter + /// to compute code actions is the provided range. + pub diagnostics: Vec<Diagnostic>, + + /// Requested kind of actions to return. + /// + /// Actions not of this kind are filtered out by the client before being shown. So servers + /// can omit computing them. + pub only: Option<Vec<CustomStringEnum<CodeActionKind>>>, + + /// The reason why code actions were requested. + /// + /// @since 3.17.0 + pub trigger_kind: Option<CodeActionTriggerKind>, +} + +/// Provider options for a [CodeActionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeActionOptions { + /// CodeActionKinds that this server may return. + /// + /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + /// may list out every specific kind they provide. + pub code_action_kinds: Option<Vec<CustomStringEnum<CodeActionKind>>>, + + /// The server provides support to resolve additional + /// information for a code action. + /// + /// @since 3.16.0 + pub resolve_provider: Option<bool>, + + pub work_done_progress: Option<bool>, +} + +/// Server capabilities for a [WorkspaceSymbolRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceSymbolOptions { + /// The server provides support to resolve additional + /// information for a workspace symbol. + /// + /// @since 3.17.0 + pub resolve_provider: Option<bool>, + + pub work_done_progress: Option<bool>, +} + +/// Code Lens provider options of a [CodeLensRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeLensOptions { + /// Code lens has a resolve provider as well. + pub resolve_provider: Option<bool>, + + pub work_done_progress: Option<bool>, +} + +/// Provider options for a [DocumentLinkRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentLinkOptions { + /// Document links have a resolve provider as well. + pub resolve_provider: Option<bool>, + + pub work_done_progress: Option<bool>, +} + +/// Value-object describing what options formatting should use. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FormattingOptions { + /// Insert a newline character at the end of the file if one does not exist. + /// + /// @since 3.15.0 + pub insert_final_newline: Option<bool>, + + /// Prefer spaces over tabs. + pub insert_spaces: bool, + + /// Size of a tab in spaces. + pub tab_size: u32, + + /// Trim all newlines after the final newline at the end of the file. + /// + /// @since 3.15.0 + pub trim_final_newlines: Option<bool>, + + /// Trim trailing whitespace on a line. + /// + /// @since 3.15.0 + pub trim_trailing_whitespace: Option<bool>, +} + +/// Provider options for a [DocumentFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentFormattingOptions { + pub work_done_progress: Option<bool>, +} + +/// Provider options for a [DocumentRangeFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentRangeFormattingOptions { + /// Whether the server supports formatting multiple ranges at once. + /// + /// @since 3.18.0 + /// @proposed + #[cfg(feature = "proposed", since = "3.18.0")] + pub ranges_support: Option<bool>, + + pub work_done_progress: Option<bool>, +} + +/// Provider options for a [DocumentOnTypeFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentOnTypeFormattingOptions { + /// A character on which formatting should be triggered, like `{`. + pub first_trigger_character: String, + + /// More trigger characters. + pub more_trigger_character: Option<Vec<String>>, +} + +/// Provider options for a [RenameRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RenameOptions { + /// Renames should be checked and tested before being executed. + /// + /// @since version 3.12.0 + pub prepare_provider: Option<bool>, + + pub work_done_progress: Option<bool>, +} + +/// The server capabilities of a [ExecuteCommandRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ExecuteCommandOptions { + /// The commands to be executed on the server + pub commands: Vec<String>, + + pub work_done_progress: Option<bool>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokensLegend { + /// The token modifiers a server uses. + pub token_modifiers: Vec<String>, + + /// The token types a server uses. + pub token_types: Vec<String>, +} + +/// A text document identifier to optionally denote a specific version of a text document. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct OptionalVersionedTextDocumentIdentifier { + /// The text document's uri. + pub uri: String, + + /// The version number of this document. If a versioned text document identifier + /// is sent from the server to the client and the file is not open in the editor + /// (the server has not received an open notification before) the server can send + /// `null` to indicate that the version is unknown and the content on disk is the + /// truth (as specified with document content ownership). + #[serde(skip_serializing_if = "Option::is_none")] + pub version: Option<i32>, +} + +/// A special text edit with an additional change annotation. +/// +/// @since 3.16.0. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct AnnotatedTextEdit { + /// The actual identifier of the change annotation + pub annotation_id: ChangeAnnotationIdentifier, + + /// The string to be inserted. For delete operations use an + /// empty string. + pub new_text: String, + + /// The range of the text document to be manipulated. To insert + /// text into a document create a range where start === end. + pub range: Range, +} + +/// A generic resource operation. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ResourceOperation { + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + pub annotation_id: Option<ChangeAnnotationIdentifier>, + + /// The resource operation kind. + pub kind: String, +} + +/// Options to create a file. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CreateFileOptions { + /// Ignore if exists. + pub ignore_if_exists: Option<bool>, + + /// Overwrite existing file. Overwrite wins over `ignoreIfExists` + pub overwrite: Option<bool>, +} + +/// Rename file options +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RenameFileOptions { + /// Ignores if target exists. + pub ignore_if_exists: Option<bool>, + + /// Overwrite target if existing. Overwrite wins over `ignoreIfExists` + pub overwrite: Option<bool>, +} + +/// Delete file options +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DeleteFileOptions { + /// Ignore the operation if the file doesn't exist. + pub ignore_if_not_exists: Option<bool>, + + /// Delete the content recursively if a folder is denoted. + pub recursive: Option<bool>, +} + +/// A pattern to describe in which file operation requests or notifications +/// the server is interested in receiving. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FileOperationPattern { + /// The glob pattern to match. Glob patterns can have the following syntax: + /// - `*` to match one or more characters in a path segment + /// - `?` to match on one character in a path segment + /// - `**` to match any number of path segments, including none + /// - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files) + /// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) + /// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) + pub glob: String, + + /// Whether to match files or folders with this pattern. + /// + /// Matches both if undefined. + pub matches: Option<FileOperationPatternKind>, + + /// Additional options used during matching. + pub options: Option<FileOperationPatternOptions>, +} + +/// A full document diagnostic report for a workspace diagnostic result. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceFullDocumentDiagnosticReport { + /// The actual items. + pub items: Vec<Diagnostic>, + + /// A full document diagnostic report. + pub kind: String, + + /// An optional result id. If provided it will + /// be sent on the next diagnostic request for the + /// same document. + pub result_id: Option<String>, + + /// The URI for which diagnostic information is reported. + pub uri: String, + + /// The version number for which the diagnostics are reported. + /// If the document is not marked as open `null` can be provided. + #[serde(skip_serializing_if = "Option::is_none")] + pub version: Option<i32>, +} + +/// An unchanged document diagnostic report for a workspace diagnostic result. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceUnchangedDocumentDiagnosticReport { + /// A document diagnostic report indicating + /// no changes to the last result. A server can + /// only return `unchanged` if result ids are + /// provided. + pub kind: String, + + /// A result id which will be sent on the next + /// diagnostic request for the same document. + pub result_id: String, + + /// The URI for which diagnostic information is reported. + pub uri: String, + + /// The version number for which the diagnostics are reported. + /// If the document is not marked as open `null` can be provided. + #[serde(skip_serializing_if = "Option::is_none")] + pub version: Option<i32>, +} + +/// A notebook cell. +/// +/// A cell's document URI must be unique across ALL notebook +/// cells and can therefore be used to uniquely identify a +/// notebook cell or the cell's text document. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookCell { + /// The URI of the cell's text document + /// content. + pub document: String, + + /// Additional execution summary information + /// if supported by the client. + pub execution_summary: Option<ExecutionSummary>, + + /// The cell's kind + pub kind: NotebookCellKind, + + /// Additional metadata stored with the cell. + /// + /// Note: should always be an object literal (e.g. LSPObject) + pub metadata: Option<LSPObject>, +} + +/// A change describing how to move a `NotebookCell` +/// array from state S to S'. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookCellArrayChange { + /// The new cells, if any + pub cells: Option<Vec<NotebookCell>>, + + /// The deleted cells + pub delete_count: u32, + + /// The start oftest of the cell that changed. + pub start: u32, +} + +/// Describes the currently selected completion item. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SelectedCompletionInfo { + /// The range that will be replaced if this completion item is accepted. + pub range: Range, + + /// The text the range will be replaced with if this completion is accepted. + pub text: String, +} + +/// Defines the capabilities provided by the client. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ClientCapabilities { + /// Experimental client capabilities. + pub experimental: Option<LSPAny>, + + /// General client capabilities. + /// + /// @since 3.16.0 + pub general: Option<GeneralClientCapabilities>, + + /// Capabilities specific to the notebook document support. + /// + /// @since 3.17.0 + pub notebook_document: Option<NotebookDocumentClientCapabilities>, + + /// Text document specific client capabilities. + pub text_document: Option<TextDocumentClientCapabilities>, + + /// Window specific client capabilities. + pub window: Option<WindowClientCapabilities>, + + /// Workspace specific client capabilities. + pub workspace: Option<WorkspaceClientCapabilities>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSyncOptions { + /// Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full + /// and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. + pub change: Option<TextDocumentSyncKind>, + + /// Open and close notifications are sent to the server. If omitted open close notification should not + /// be sent. + pub open_close: Option<bool>, + + /// If present save notifications are sent to the server. If omitted the notification should not be + /// sent. + pub save: Option<OR2<bool, SaveOptions>>, + + /// If present will save notifications are sent to the server. If omitted the notification should not be + /// sent. + pub will_save: Option<bool>, + + /// If present will save wait until requests are sent to the server. If omitted the request should not be + /// sent. + pub will_save_wait_until: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructLanguage { + pub language: String, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructNotebook { + /// The notebook to be synced If a string + /// value is provided it matches against the + /// notebook type. '*' matches every notebook. + pub notebook: OR2<String, NotebookDocumentFilter>, + + /// The cells of the matching notebook to be synced. + pub cells: Option<Vec<StructLanguage>>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructLanguage2 { + pub language: String, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructCells2 { + /// The notebook to be synced If a string + /// value is provided it matches against the + /// notebook type. '*' matches every notebook. + pub notebook: Option<OR2<String, NotebookDocumentFilter>>, + + /// The cells of the matching notebook to be synced. + pub cells: Vec<StructLanguage2>, +} + +/// Options specific to a notebook plus its cells +/// to be synced to the server. +/// +/// If a selector provides a notebook document +/// filter but no cell selector all cells of a +/// matching notebook document will be synced. +/// +/// If a selector provides no notebook document +/// filter but only a cell selector all notebook +/// document that contain at least one matching +/// cell will be synced. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookDocumentSyncOptions { + /// The notebooks to be synced + pub notebook_selector: Vec<OR2<StructNotebook, StructCells2>>, + + /// Whether save notification should be forwarded to + /// the server. Will only be honored if mode === `notebook`. + pub save: Option<bool>, +} + +/// Registration options specific to a notebook. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookDocumentSyncRegistrationOptions { + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + pub id: Option<String>, + + /// The notebooks to be synced + pub notebook_selector: Vec<OR2<StructNotebook, StructCells2>>, + + /// Whether save notification should be forwarded to + /// the server. Will only be honored if mode === `notebook`. + pub save: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceFoldersServerCapabilities { + /// Whether the server wants to receive workspace folder + /// change notifications. + /// + /// If a string is provided the string is treated as an ID + /// under which the notification is registered on the client + /// side. The ID can be used to unregister for these events + /// using the `client/unregisterCapability` request. + pub change_notifications: Option<OR2<String, bool>>, + + /// The server has support for workspace folders + pub supported: Option<bool>, +} + +/// Options for notifications/requests for user operations on files. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FileOperationOptions { + /// The server is interested in receiving didCreateFiles notifications. + pub did_create: Option<FileOperationRegistrationOptions>, + + /// The server is interested in receiving didDeleteFiles file notifications. + pub did_delete: Option<FileOperationRegistrationOptions>, + + /// The server is interested in receiving didRenameFiles notifications. + pub did_rename: Option<FileOperationRegistrationOptions>, + + /// The server is interested in receiving willCreateFiles requests. + pub will_create: Option<FileOperationRegistrationOptions>, + + /// The server is interested in receiving willDeleteFiles file requests. + pub will_delete: Option<FileOperationRegistrationOptions>, + + /// The server is interested in receiving willRenameFiles requests. + pub will_rename: Option<FileOperationRegistrationOptions>, +} + +/// Structure to capture a description for an error code. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeDescription { + /// An URI to open with more information about the diagnostic error. + pub href: String, +} + +/// Represents a related message and source code location for a diagnostic. This should be +/// used to point to code locations that cause or related to a diagnostics, e.g when duplicating +/// a symbol in a scope. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DiagnosticRelatedInformation { + /// The location of this related diagnostic information. + pub location: Location, + + /// The message of this related diagnostic information. + pub message: String, +} + +/// Represents a parameter of a callable-signature. A parameter can +/// have a label and a doc-comment. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ParameterInformation { + /// The human-readable doc-comment of this parameter. Will be shown + /// in the UI but can be omitted. + pub documentation: Option<OR2<String, MarkupContent>>, + + /// The label of this parameter information. + /// + /// Either a string or an inclusive start and exclusive end offsets within its containing + /// signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 + /// string representation as `Position` and `Range` does. + /// + /// *Note*: a label of type string should be a substring of its containing signature label. + /// Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`. + pub label: OR2<String, (u32, u32)>, +} + +/// A notebook cell text document filter denotes a cell text +/// document by different properties. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookCellTextDocumentFilter { + /// A language id like `python`. + /// + /// Will be matched against the language id of the + /// notebook cell document. '*' matches every language. + pub language: Option<String>, + + /// A filter that matches against the notebook + /// containing the notebook cell. If a string + /// value is provided it matches against the + /// notebook type. '*' matches every notebook. + pub notebook: OR2<String, NotebookDocumentFilter>, +} + +/// Matching options for the file operation pattern. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FileOperationPatternOptions { + /// The pattern should be matched ignoring casing. + pub ignore_case: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ExecutionSummary { + /// A strict monotonically increasing value + /// indicating the execution order of a cell + /// inside a notebook. + pub execution_order: u32, + + /// Whether the execution was successful or + /// not if known by the client. + pub success: Option<bool>, +} + +/// Workspace specific client capabilities. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceClientCapabilities { + /// The client supports applying batch edits + /// to the workspace by supporting the request + /// 'workspace/applyEdit' + pub apply_edit: Option<bool>, + + /// Capabilities specific to the code lens requests scoped to the + /// workspace. + /// + /// @since 3.16.0. + pub code_lens: Option<CodeLensWorkspaceClientCapabilities>, + + /// The client supports `workspace/configuration` requests. + /// + /// @since 3.6.0 + pub configuration: Option<bool>, + + /// Capabilities specific to the diagnostic requests scoped to the + /// workspace. + /// + /// @since 3.17.0. + pub diagnostics: Option<DiagnosticWorkspaceClientCapabilities>, + + /// Capabilities specific to the `workspace/didChangeConfiguration` notification. + pub did_change_configuration: Option<DidChangeConfigurationClientCapabilities>, + + /// Capabilities specific to the `workspace/didChangeWatchedFiles` notification. + pub did_change_watched_files: Option<DidChangeWatchedFilesClientCapabilities>, + + /// Capabilities specific to the `workspace/executeCommand` request. + pub execute_command: Option<ExecuteCommandClientCapabilities>, + + /// The client has support for file notifications/requests for user operations on files. + /// + /// Since 3.16.0 + pub file_operations: Option<FileOperationClientCapabilities>, + + /// Capabilities specific to the folding range requests scoped to the workspace. + /// + /// @since 3.18.0 + /// @proposed + #[cfg(feature = "proposed", since = "3.18.0")] + pub folding_range: Option<FoldingRangeWorkspaceClientCapabilities>, + + /// Capabilities specific to the inlay hint requests scoped to the + /// workspace. + /// + /// @since 3.17.0. + pub inlay_hint: Option<InlayHintWorkspaceClientCapabilities>, + + /// Capabilities specific to the inline values requests scoped to the + /// workspace. + /// + /// @since 3.17.0. + pub inline_value: Option<InlineValueWorkspaceClientCapabilities>, + + /// Capabilities specific to the semantic token requests scoped to the + /// workspace. + /// + /// @since 3.16.0. + pub semantic_tokens: Option<SemanticTokensWorkspaceClientCapabilities>, + + /// Capabilities specific to the `workspace/symbol` request. + pub symbol: Option<WorkspaceSymbolClientCapabilities>, + + /// Capabilities specific to `WorkspaceEdit`s. + pub workspace_edit: Option<WorkspaceEditClientCapabilities>, + + /// The client has support for workspace folders. + /// + /// @since 3.6.0 + pub workspace_folders: Option<bool>, +} + +/// Text document specific client capabilities. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentClientCapabilities { + /// Capabilities specific to the various call hierarchy requests. + /// + /// @since 3.16.0 + pub call_hierarchy: Option<CallHierarchyClientCapabilities>, + + /// Capabilities specific to the `textDocument/codeAction` request. + pub code_action: Option<CodeActionClientCapabilities>, + + /// Capabilities specific to the `textDocument/codeLens` request. + pub code_lens: Option<CodeLensClientCapabilities>, + + /// Capabilities specific to the `textDocument/documentColor` and the + /// `textDocument/colorPresentation` request. + /// + /// @since 3.6.0 + pub color_provider: Option<DocumentColorClientCapabilities>, + + /// Capabilities specific to the `textDocument/completion` request. + pub completion: Option<CompletionClientCapabilities>, + + /// Capabilities specific to the `textDocument/declaration` request. + /// + /// @since 3.14.0 + pub declaration: Option<DeclarationClientCapabilities>, + + /// Capabilities specific to the `textDocument/definition` request. + pub definition: Option<DefinitionClientCapabilities>, + + /// Capabilities specific to the diagnostic pull model. + /// + /// @since 3.17.0 + pub diagnostic: Option<DiagnosticClientCapabilities>, + + /// Capabilities specific to the `textDocument/documentHighlight` request. + pub document_highlight: Option<DocumentHighlightClientCapabilities>, + + /// Capabilities specific to the `textDocument/documentLink` request. + pub document_link: Option<DocumentLinkClientCapabilities>, + + /// Capabilities specific to the `textDocument/documentSymbol` request. + pub document_symbol: Option<DocumentSymbolClientCapabilities>, + + /// Capabilities specific to the `textDocument/foldingRange` request. + /// + /// @since 3.10.0 + pub folding_range: Option<FoldingRangeClientCapabilities>, + + /// Capabilities specific to the `textDocument/formatting` request. + pub formatting: Option<DocumentFormattingClientCapabilities>, + + /// Capabilities specific to the `textDocument/hover` request. + pub hover: Option<HoverClientCapabilities>, + + /// Capabilities specific to the `textDocument/implementation` request. + /// + /// @since 3.6.0 + pub implementation: Option<ImplementationClientCapabilities>, + + /// Capabilities specific to the `textDocument/inlayHint` request. + /// + /// @since 3.17.0 + pub inlay_hint: Option<InlayHintClientCapabilities>, + + /// Client capabilities specific to inline completions. + /// + /// @since 3.18.0 + /// @proposed + #[cfg(feature = "proposed", since = "3.18.0")] + pub inline_completion: Option<InlineCompletionClientCapabilities>, + + /// Capabilities specific to the `textDocument/inlineValue` request. + /// + /// @since 3.17.0 + pub inline_value: Option<InlineValueClientCapabilities>, + + /// Capabilities specific to the `textDocument/linkedEditingRange` request. + /// + /// @since 3.16.0 + pub linked_editing_range: Option<LinkedEditingRangeClientCapabilities>, + + /// Client capabilities specific to the `textDocument/moniker` request. + /// + /// @since 3.16.0 + pub moniker: Option<MonikerClientCapabilities>, + + /// Capabilities specific to the `textDocument/onTypeFormatting` request. + pub on_type_formatting: Option<DocumentOnTypeFormattingClientCapabilities>, + + /// Capabilities specific to the `textDocument/publishDiagnostics` notification. + pub publish_diagnostics: Option<PublishDiagnosticsClientCapabilities>, + + /// Capabilities specific to the `textDocument/rangeFormatting` request. + pub range_formatting: Option<DocumentRangeFormattingClientCapabilities>, + + /// Capabilities specific to the `textDocument/references` request. + pub references: Option<ReferenceClientCapabilities>, + + /// Capabilities specific to the `textDocument/rename` request. + pub rename: Option<RenameClientCapabilities>, + + /// Capabilities specific to the `textDocument/selectionRange` request. + /// + /// @since 3.15.0 + pub selection_range: Option<SelectionRangeClientCapabilities>, + + /// Capabilities specific to the various semantic token request. + /// + /// @since 3.16.0 + pub semantic_tokens: Option<SemanticTokensClientCapabilities>, + + /// Capabilities specific to the `textDocument/signatureHelp` request. + pub signature_help: Option<SignatureHelpClientCapabilities>, + + /// Defines which synchronization capabilities the client supports. + pub synchronization: Option<TextDocumentSyncClientCapabilities>, + + /// Capabilities specific to the `textDocument/typeDefinition` request. + /// + /// @since 3.6.0 + pub type_definition: Option<TypeDefinitionClientCapabilities>, + + /// Capabilities specific to the various type hierarchy requests. + /// + /// @since 3.17.0 + pub type_hierarchy: Option<TypeHierarchyClientCapabilities>, +} + +/// Capabilities specific to the notebook document support. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookDocumentClientCapabilities { + /// Capabilities specific to notebook document synchronization + /// + /// @since 3.17.0 + pub synchronization: NotebookDocumentSyncClientCapabilities, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WindowClientCapabilities { + /// Capabilities specific to the showDocument request. + /// + /// @since 3.16.0 + pub show_document: Option<ShowDocumentClientCapabilities>, + + /// Capabilities specific to the showMessage request. + /// + /// @since 3.16.0 + pub show_message: Option<ShowMessageRequestClientCapabilities>, + + /// It indicates whether the client supports server initiated + /// progress using the `window/workDoneProgress/create` request. + /// + /// The capability also controls Whether client supports handling + /// of progress notifications. If set servers are allowed to report a + /// `workDoneProgress` property in the request specific server + /// capabilities. + /// + /// @since 3.15.0 + pub work_done_progress: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructStaleRequestSupport { + /// The client will actively cancel the request. + pub cancel: bool, + + /// The list of requests for which the client + /// will retry the request if it receives a + /// response with error code `ContentModified` + pub retry_on_content_modified: Vec<String>, +} + +/// General client capabilities. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct GeneralClientCapabilities { + /// Client capabilities specific to the client's markdown parser. + /// + /// @since 3.16.0 + pub markdown: Option<MarkdownClientCapabilities>, + + /// The position encodings supported by the client. Client and server + /// have to agree on the same position encoding to ensure that offsets + /// (e.g. character position in a line) are interpreted the same on both + /// sides. + /// + /// To keep the protocol backwards compatible the following applies: if + /// the value 'utf-16' is missing from the array of position encodings + /// servers can assume that the client supports UTF-16. UTF-16 is + /// therefore a mandatory encoding. + /// + /// If omitted it defaults to ['utf-16']. + /// + /// Implementation considerations: since the conversion from one encoding + /// into another requires the content of the file / line the conversion + /// is best done where the file is read which is usually on the server + /// side. + /// + /// @since 3.17.0 + pub position_encodings: Option<Vec<CustomStringEnum<PositionEncodingKind>>>, + + /// Client capabilities specific to regular expressions. + /// + /// @since 3.16.0 + pub regular_expressions: Option<RegularExpressionsClientCapabilities>, + + /// Client capability that signals how the client + /// handles stale requests (e.g. a request + /// for which the client will not process the response + /// anymore since the information is outdated). + /// + /// @since 3.17.0 + pub stale_request_support: Option<StructStaleRequestSupport>, +} + +/// A relative pattern is a helper to construct glob patterns that are matched +/// relatively to a base URI. The common value for a `baseUri` is a workspace +/// folder root, but it can be another absolute URI as well. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RelativePattern { + /// A workspace folder or a base URI to which this pattern will be matched + /// against relatively. + pub base_uri: OR2<WorkspaceFolder, String>, + + /// The actual glob pattern; + pub pattern: Pattern, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructChangeAnnotationSupport { + /// Whether the client groups edits with equal labels into tree nodes, + /// for instance all edits labelled with "Changes in Strings" would + /// be a tree node. + pub groups_on_label: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceEditClientCapabilities { + /// Whether the client in general supports change annotations on text edits, + /// create file, rename file and delete file changes. + /// + /// @since 3.16.0 + pub change_annotation_support: Option<StructChangeAnnotationSupport>, + + /// The client supports versioned document changes in `WorkspaceEdit`s + pub document_changes: Option<bool>, + + /// The failure handling strategy of a client if applying the workspace edit + /// fails. + /// + /// @since 3.13.0 + pub failure_handling: Option<FailureHandlingKind>, + + /// Whether the client normalizes line endings to the client specific + /// setting. + /// If set to `true` the client will normalize line ending characters + /// in a workspace edit to the client-specified new line + /// character. + /// + /// @since 3.16.0 + pub normalizes_line_endings: Option<bool>, + + /// The resource operations the client supports. Clients should at least + /// support 'create', 'rename' and 'delete' files and folders. + /// + /// @since 3.13.0 + pub resource_operations: Option<Vec<ResourceOperationKind>>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidChangeConfigurationClientCapabilities { + /// Did change configuration notification supports dynamic registration. + pub dynamic_registration: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DidChangeWatchedFilesClientCapabilities { + /// Did change watched files notification supports dynamic registration. Please note + /// that the current protocol doesn't support static configuration for file changes + /// from the server side. + pub dynamic_registration: Option<bool>, + + /// Whether the client has support for [relative pattern][RelativePattern] + /// or not. + /// + /// @since 3.17.0 + pub relative_pattern_support: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructResolveSupport { + /// The properties that a client can resolve lazily. Usually + /// `location.range` + pub properties: Vec<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructSymbolKind { + /// The symbol kind values the client supports. When this + /// property exists the client also guarantees that it will + /// handle values outside its set gracefully and falls back + /// to a default value when unknown. + /// + /// If this property is not present the client only supports + /// the symbol kinds from `File` to `Array` as defined in + /// the initial version of the protocol. + pub value_set: Option<Vec<SymbolKind>>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructTagSupport { + /// The tags supported by the client. + pub value_set: Vec<SymbolTag>, +} + +/// Client capabilities for a [WorkspaceSymbolRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceSymbolClientCapabilities { + /// Symbol request supports dynamic registration. + pub dynamic_registration: Option<bool>, + + /// The client support partial workspace symbols. The client will send the + /// request `workspaceSymbol/resolve` to the server to resolve additional + /// properties. + /// + /// @since 3.17.0 + pub resolve_support: Option<StructResolveSupport>, + + /// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. + pub symbol_kind: Option<StructSymbolKind>, + + /// The client supports tags on `SymbolInformation`. + /// Clients supporting tags have to handle unknown tags gracefully. + /// + /// @since 3.16.0 + pub tag_support: Option<StructTagSupport>, +} + +/// The client capabilities of a [ExecuteCommandRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ExecuteCommandClientCapabilities { + /// Execute command supports dynamic registration. + pub dynamic_registration: Option<bool>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokensWorkspaceClientCapabilities { + /// Whether the client implementation supports a refresh request sent from + /// the server to the client. + /// + /// Note that this event is global and will force the client to refresh all + /// semantic tokens currently shown. It should be used with absolute care + /// and is useful for situation where a server for example detects a project + /// wide change that requires such a calculation. + pub refresh_support: Option<bool>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeLensWorkspaceClientCapabilities { + /// Whether the client implementation supports a refresh request sent from the + /// server to the client. + /// + /// Note that this event is global and will force the client to refresh all + /// code lenses currently shown. It should be used with absolute care and is + /// useful for situation where a server for example detect a project wide + /// change that requires such a calculation. + pub refresh_support: Option<bool>, +} + +/// Capabilities relating to events from file operations by the user in the client. +/// +/// These events do not come from the file system, they come from user operations +/// like renaming a file in the UI. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FileOperationClientCapabilities { + /// The client has support for sending didCreateFiles notifications. + pub did_create: Option<bool>, + + /// The client has support for sending didDeleteFiles notifications. + pub did_delete: Option<bool>, + + /// The client has support for sending didRenameFiles notifications. + pub did_rename: Option<bool>, + + /// Whether the client supports dynamic registration for file requests/notifications. + pub dynamic_registration: Option<bool>, + + /// The client has support for sending willCreateFiles requests. + pub will_create: Option<bool>, + + /// The client has support for sending willDeleteFiles requests. + pub will_delete: Option<bool>, + + /// The client has support for sending willRenameFiles requests. + pub will_rename: Option<bool>, +} + +/// Client workspace capabilities specific to inline values. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineValueWorkspaceClientCapabilities { + /// Whether the client implementation supports a refresh request sent from the + /// server to the client. + /// + /// Note that this event is global and will force the client to refresh all + /// inline values currently shown. It should be used with absolute care and is + /// useful for situation where a server for example detects a project wide + /// change that requires such a calculation. + pub refresh_support: Option<bool>, +} + +/// Client workspace capabilities specific to inlay hints. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlayHintWorkspaceClientCapabilities { + /// Whether the client implementation supports a refresh request sent from + /// the server to the client. + /// + /// Note that this event is global and will force the client to refresh all + /// inlay hints currently shown. It should be used with absolute care and + /// is useful for situation where a server for example detects a project wide + /// change that requires such a calculation. + pub refresh_support: Option<bool>, +} + +/// Workspace client capabilities specific to diagnostic pull requests. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DiagnosticWorkspaceClientCapabilities { + /// Whether the client implementation supports a refresh request sent from + /// the server to the client. + /// + /// Note that this event is global and will force the client to refresh all + /// pulled diagnostics currently shown. It should be used with absolute care and + /// is useful for situation where a server for example detects a project wide + /// change that requires such a calculation. + pub refresh_support: Option<bool>, +} + +/// Client workspace capabilities specific to folding ranges +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FoldingRangeWorkspaceClientCapabilities { + /// Whether the client implementation supports a refresh request sent from the + /// server to the client. + /// + /// Note that this event is global and will force the client to refresh all + /// folding ranges currently shown. It should be used with absolute care and is + /// useful for situation where a server for example detects a project wide + /// change that requires such a calculation. + /// + /// @since 3.18.0 + /// @proposed + #[cfg(feature = "proposed", since = "3.18.0")] + pub refresh_support: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSyncClientCapabilities { + /// The client supports did save notifications. + pub did_save: Option<bool>, + + /// Whether text document synchronization supports dynamic registration. + pub dynamic_registration: Option<bool>, + + /// The client supports sending will save notifications. + pub will_save: Option<bool>, + + /// The client supports sending a will save request and + /// waits for a response providing text edits which will + /// be applied to the document before it is saved. + pub will_save_wait_until: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructTagSupportValue { + /// The tags supported by the client. + pub value_set: Vec<CompletionItemTag>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructResolveSupportProperties { + /// The properties that a client can resolve lazily. + pub properties: Vec<String>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructInsertTextModeSupport { + pub value_set: Vec<InsertTextMode>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructCompletionItemOptions { + /// Client supports snippets as insert text. + /// + /// A snippet can define tab stops and placeholders with `$1`, `$2` + /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to + /// the end of the snippet. Placeholders with equal identifiers are linked, + /// that is typing in one will update others too. + pub snippet_support: Option<bool>, + + /// Client supports commit characters on a completion item. + pub commit_characters_support: Option<bool>, + + /// Client supports the following content formats for the documentation + /// property. The order describes the preferred format of the client. + pub documentation_format: Option<Vec<MarkupKind>>, + + /// Client supports the deprecated property on a completion item. + pub deprecated_support: Option<bool>, + + /// Client supports the preselect property on a completion item. + pub preselect_support: Option<bool>, + + /// Client supports the tag property on a completion item. Clients supporting + /// tags have to handle unknown tags gracefully. Clients especially need to + /// preserve unknown tags when sending a completion item back to the server in + /// a resolve call. + /// + /// @since 3.15.0 + pub tag_support: Option<StructTagSupportValue>, + + /// Client support insert replace edit to control different behavior if a + /// completion item is inserted in the text or should replace text. + /// + /// @since 3.16.0 + pub insert_replace_support: Option<bool>, + + /// Indicates which properties a client can resolve lazily on a completion + /// item. Before version 3.16.0 only the predefined properties `documentation` + /// and `details` could be resolved lazily. + /// + /// @since 3.16.0 + pub resolve_support: Option<StructResolveSupportProperties>, + + /// The client supports the `insertTextMode` property on + /// a completion item to override the whitespace handling mode + /// as defined by the client (see `insertTextMode`). + /// + /// @since 3.16.0 + pub insert_text_mode_support: Option<StructInsertTextModeSupport>, + + /// The client has support for completion item label + /// details (see also `CompletionItemLabelDetails`). + /// + /// @since 3.17.0 + pub label_details_support: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructCompletionItemKind { + /// The completion item kind values the client supports. When this + /// property exists the client also guarantees that it will + /// handle values outside its set gracefully and falls back + /// to a default value when unknown. + /// + /// If this property is not present the client only supports + /// the completion items kinds from `Text` to `Reference` as defined in + /// the initial version of the protocol. + pub value_set: Option<Vec<CompletionItemKind>>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructCompletionList { + /// The client supports the following itemDefaults on + /// a completion list. + /// + /// The value lists the supported property names of the + /// `CompletionList.itemDefaults` object. If omitted + /// no properties are supported. + /// + /// @since 3.17.0 + pub item_defaults: Option<Vec<String>>, +} + +/// Completion client capabilities +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CompletionClientCapabilities { + /// The client supports the following `CompletionItem` specific + /// capabilities. + pub completion_item: Option<StructCompletionItemOptions>, + + pub completion_item_kind: Option<StructCompletionItemKind>, + + /// The client supports the following `CompletionList` specific + /// capabilities. + /// + /// @since 3.17.0 + pub completion_list: Option<StructCompletionList>, + + /// The client supports to send additional context information for a + /// `textDocument/completion` request. + pub context_support: Option<bool>, + + /// Whether completion supports dynamic registration. + pub dynamic_registration: Option<bool>, + + /// Defines how the client handles whitespace and indentation + /// when accepting a completion item that uses multi line + /// text in either `insertText` or `textEdit`. + /// + /// @since 3.17.0 + pub insert_text_mode: Option<InsertTextMode>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct HoverClientCapabilities { + /// Client supports the following content formats for the content + /// property. The order describes the preferred format of the client. + pub content_format: Option<Vec<MarkupKind>>, + + /// Whether hover supports dynamic registration. + pub dynamic_registration: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructParameterInformation { + /// The client supports processing label offsets instead of a + /// simple label string. + /// + /// @since 3.14.0 + pub label_offset_support: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructSignatureInformation { + /// Client supports the following content formats for the documentation + /// property. The order describes the preferred format of the client. + pub documentation_format: Option<Vec<MarkupKind>>, + + /// Client capabilities specific to parameter information. + pub parameter_information: Option<StructParameterInformation>, + + /// The client supports the `activeParameter` property on `SignatureInformation` + /// literal. + /// + /// @since 3.16.0 + pub active_parameter_support: Option<bool>, +} + +/// Client Capabilities for a [SignatureHelpRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SignatureHelpClientCapabilities { + /// The client supports to send additional context information for a + /// `textDocument/signatureHelp` request. A client that opts into + /// contextSupport will also support the `retriggerCharacters` on + /// `SignatureHelpOptions`. + /// + /// @since 3.15.0 + pub context_support: Option<bool>, + + /// Whether signature help supports dynamic registration. + pub dynamic_registration: Option<bool>, + + /// The client supports the following `SignatureInformation` + /// specific properties. + pub signature_information: Option<StructSignatureInformation>, +} + +/// @since 3.14.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DeclarationClientCapabilities { + /// Whether declaration supports dynamic registration. If this is set to `true` + /// the client supports the new `DeclarationRegistrationOptions` return value + /// for the corresponding server capability as well. + pub dynamic_registration: Option<bool>, + + /// The client supports additional metadata in the form of declaration links. + pub link_support: Option<bool>, +} + +/// Client Capabilities for a [DefinitionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DefinitionClientCapabilities { + /// Whether definition supports dynamic registration. + pub dynamic_registration: Option<bool>, + + /// The client supports additional metadata in the form of definition links. + /// + /// @since 3.14.0 + pub link_support: Option<bool>, +} + +/// Since 3.6.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeDefinitionClientCapabilities { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `TypeDefinitionRegistrationOptions` return value + /// for the corresponding server capability as well. + pub dynamic_registration: Option<bool>, + + /// The client supports additional metadata in the form of definition links. + /// + /// Since 3.14.0 + pub link_support: Option<bool>, +} + +/// @since 3.6.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ImplementationClientCapabilities { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `ImplementationRegistrationOptions` return value + /// for the corresponding server capability as well. + pub dynamic_registration: Option<bool>, + + /// The client supports additional metadata in the form of definition links. + /// + /// @since 3.14.0 + pub link_support: Option<bool>, +} + +/// Client Capabilities for a [ReferencesRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ReferenceClientCapabilities { + /// Whether references supports dynamic registration. + pub dynamic_registration: Option<bool>, +} + +/// Client Capabilities for a [DocumentHighlightRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentHighlightClientCapabilities { + /// Whether document highlight supports dynamic registration. + pub dynamic_registration: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructSymbolKindOptions { + /// The symbol kind values the client supports. When this + /// property exists the client also guarantees that it will + /// handle values outside its set gracefully and falls back + /// to a default value when unknown. + /// + /// If this property is not present the client only supports + /// the symbol kinds from `File` to `Array` as defined in + /// the initial version of the protocol. + pub value_set: Option<Vec<SymbolKind>>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructTagSupportValueSet { + /// The tags supported by the client. + pub value_set: Vec<SymbolTag>, +} + +/// Client Capabilities for a [DocumentSymbolRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentSymbolClientCapabilities { + /// Whether document symbol supports dynamic registration. + pub dynamic_registration: Option<bool>, + + /// The client supports hierarchical document symbols. + pub hierarchical_document_symbol_support: Option<bool>, + + /// The client supports an additional label presented in the UI when + /// registering a document symbol provider. + /// + /// @since 3.16.0 + pub label_support: Option<bool>, + + /// Specific capabilities for the `SymbolKind` in the + /// `textDocument/documentSymbol` request. + pub symbol_kind: Option<StructSymbolKindOptions>, + + /// The client supports tags on `SymbolInformation`. Tags are supported on + /// `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true. + /// Clients supporting tags have to handle unknown tags gracefully. + /// + /// @since 3.16.0 + pub tag_support: Option<StructTagSupportValueSet>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructCodeActionKind { + /// The code action kind values the client supports. When this + /// property exists the client also guarantees that it will + /// handle values outside its set gracefully and falls back + /// to a default value when unknown. + pub value_set: Vec<CustomStringEnum<CodeActionKind>>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructCodeActionLiteralSupport { + /// The code action kind is support with the following value + /// set. + pub code_action_kind: StructCodeActionKind, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructResolveSupportProperties2 { + /// The properties that a client can resolve lazily. + pub properties: Vec<String>, +} + +/// The Client Capabilities of a [CodeActionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeActionClientCapabilities { + /// The client support code action literals of type `CodeAction` as a valid + /// response of the `textDocument/codeAction` request. If the property is not + /// set the request can only return `Command` literals. + /// + /// @since 3.8.0 + pub code_action_literal_support: Option<StructCodeActionLiteralSupport>, + + /// Whether code action supports the `data` property which is + /// preserved between a `textDocument/codeAction` and a + /// `codeAction/resolve` request. + /// + /// @since 3.16.0 + pub data_support: Option<bool>, + + /// Whether code action supports the `disabled` property. + /// + /// @since 3.16.0 + pub disabled_support: Option<bool>, + + /// Whether code action supports dynamic registration. + pub dynamic_registration: Option<bool>, + + /// Whether the client honors the change annotations in + /// text edits and resource operations returned via the + /// `CodeAction#edit` property by for example presenting + /// the workspace edit in the user interface and asking + /// for confirmation. + /// + /// @since 3.16.0 + pub honors_change_annotations: Option<bool>, + + /// Whether code action supports the `isPreferred` property. + /// + /// @since 3.15.0 + pub is_preferred_support: Option<bool>, + + /// Whether the client supports resolving additional code action + /// properties via a separate `codeAction/resolve` request. + /// + /// @since 3.16.0 + pub resolve_support: Option<StructResolveSupportProperties2>, +} + +/// The client capabilities of a [CodeLensRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeLensClientCapabilities { + /// Whether code lens supports dynamic registration. + pub dynamic_registration: Option<bool>, +} + +/// The client capabilities of a [DocumentLinkRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentLinkClientCapabilities { + /// Whether document link supports dynamic registration. + pub dynamic_registration: Option<bool>, + + /// Whether the client supports the `tooltip` property on `DocumentLink`. + /// + /// @since 3.15.0 + pub tooltip_support: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentColorClientCapabilities { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `DocumentColorRegistrationOptions` return value + /// for the corresponding server capability as well. + pub dynamic_registration: Option<bool>, +} + +/// Client capabilities of a [DocumentFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentFormattingClientCapabilities { + /// Whether formatting supports dynamic registration. + pub dynamic_registration: Option<bool>, +} + +/// Client capabilities of a [DocumentRangeFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentRangeFormattingClientCapabilities { + /// Whether range formatting supports dynamic registration. + pub dynamic_registration: Option<bool>, + + /// Whether the client supports formatting multiple ranges at once. + /// + /// @since 3.18.0 + /// @proposed + #[cfg(feature = "proposed", since = "3.18.0")] + pub ranges_support: Option<bool>, +} + +/// Client capabilities of a [DocumentOnTypeFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentOnTypeFormattingClientCapabilities { + /// Whether on type formatting supports dynamic registration. + pub dynamic_registration: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RenameClientCapabilities { + /// Whether rename supports dynamic registration. + pub dynamic_registration: Option<bool>, + + /// Whether the client honors the change annotations in + /// text edits and resource operations returned via the + /// rename request's workspace edit by for example presenting + /// the workspace edit in the user interface and asking + /// for confirmation. + /// + /// @since 3.16.0 + pub honors_change_annotations: Option<bool>, + + /// Client supports testing for validity of rename operations + /// before execution. + /// + /// @since 3.12.0 + pub prepare_support: Option<bool>, + + /// Client supports the default behavior result. + /// + /// The value indicates the default behavior used by the + /// client. + /// + /// @since 3.16.0 + pub prepare_support_default_behavior: Option<PrepareSupportDefaultBehavior>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructFoldingRange { + /// If set, the client signals that it supports setting collapsedText on + /// folding ranges to display custom labels instead of the default text. + /// + /// @since 3.17.0 + pub collapsed_text: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructFoldingRangeKind { + /// The folding range kind values the client supports. When this + /// property exists the client also guarantees that it will + /// handle values outside its set gracefully and falls back + /// to a default value when unknown. + pub value_set: Option<Vec<CustomStringEnum<FoldingRangeKind>>>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct FoldingRangeClientCapabilities { + /// Whether implementation supports dynamic registration for folding range + /// providers. If this is set to `true` the client supports the new + /// `FoldingRangeRegistrationOptions` return value for the corresponding + /// server capability as well. + pub dynamic_registration: Option<bool>, + + /// Specific options for the folding range. + /// + /// @since 3.17.0 + pub folding_range: Option<StructFoldingRange>, + + /// Specific options for the folding range kind. + /// + /// @since 3.17.0 + pub folding_range_kind: Option<StructFoldingRangeKind>, + + /// If set, the client signals that it only supports folding complete lines. + /// If set, client will ignore specified `startCharacter` and `endCharacter` + /// properties in a FoldingRange. + pub line_folding_only: Option<bool>, + + /// The maximum number of folding ranges that the client prefers to receive + /// per document. The value serves as a hint, servers are free to follow the + /// limit. + pub range_limit: Option<u32>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SelectionRangeClientCapabilities { + /// Whether implementation supports dynamic registration for selection range providers. If this is set to `true` + /// the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server + /// capability as well. + pub dynamic_registration: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructTagSupportValueSet2 { + /// The tags supported by the client. + pub value_set: Vec<DiagnosticTag>, +} + +/// The publish diagnostic client capabilities. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct PublishDiagnosticsClientCapabilities { + /// Client supports a codeDescription property + /// + /// @since 3.16.0 + pub code_description_support: Option<bool>, + + /// Whether code action supports the `data` property which is + /// preserved between a `textDocument/publishDiagnostics` and + /// `textDocument/codeAction` request. + /// + /// @since 3.16.0 + pub data_support: Option<bool>, + + /// Whether the clients accepts diagnostics with related information. + pub related_information: Option<bool>, + + /// Client supports the tag property to provide meta data about a diagnostic. + /// Clients supporting tags have to handle unknown tags gracefully. + /// + /// @since 3.15.0 + pub tag_support: Option<StructTagSupportValueSet2>, + + /// Whether the client interprets the version property of the + /// `textDocument/publishDiagnostics` notification's parameter. + /// + /// @since 3.15.0 + pub version_support: Option<bool>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyClientCapabilities { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + /// return value for the corresponding server capability as well. + pub dynamic_registration: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructOptions2 { + /// The client will send the `textDocument/semanticTokens/full/delta` request if + /// the server provides a corresponding handler. + pub delta: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructRequests { + /// The client will send the `textDocument/semanticTokens/range` request if + /// the server provides a corresponding handler. + pub range: Option<OR2<bool, LSPObject>>, + + /// The client will send the `textDocument/semanticTokens/full` request if + /// the server provides a corresponding handler. + pub full: Option<OR2<bool, StructOptions2>>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SemanticTokensClientCapabilities { + /// Whether the client uses semantic tokens to augment existing + /// syntax tokens. If set to `true` client side created syntax + /// tokens and semantic tokens are both used for colorization. If + /// set to `false` the client only uses the returned semantic tokens + /// for colorization. + /// + /// If the value is `undefined` then the client behavior is not + /// specified. + /// + /// @since 3.17.0 + pub augments_syntax_tokens: Option<bool>, + + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + /// return value for the corresponding server capability as well. + pub dynamic_registration: Option<bool>, + + /// The token formats the clients supports. + pub formats: Vec<TokenFormat>, + + /// Whether the client supports tokens that can span multiple lines. + pub multiline_token_support: Option<bool>, + + /// Whether the client supports tokens that can overlap each other. + pub overlapping_token_support: Option<bool>, + + /// Which requests the client supports and might send to the server + /// depending on the server's capability. Please note that clients might not + /// show semantic tokens or degrade some of the user experience if a range + /// or full request is advertised by the client but not provided by the + /// server. If for example the client capability `requests.full` and + /// `request.range` are both set to true but the server only provides a + /// range provider the client might not render a minimap correctly or might + /// even decide to not show any semantic tokens at all. + pub requests: StructRequests, + + /// Whether the client allows the server to actively cancel a + /// semantic token request, e.g. supports returning + /// LSPErrorCodes.ServerCancelled. If a server does the client + /// needs to retrigger the request. + /// + /// @since 3.17.0 + pub server_cancel_support: Option<bool>, + + /// The token modifiers that the client supports. + pub token_modifiers: Vec<String>, + + /// The token types that the client supports. + pub token_types: Vec<String>, +} + +/// Client capabilities for the linked editing range request. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct LinkedEditingRangeClientCapabilities { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + /// return value for the corresponding server capability as well. + pub dynamic_registration: Option<bool>, +} + +/// Client capabilities specific to the moniker request. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct MonikerClientCapabilities { + /// Whether moniker supports dynamic registration. If this is set to `true` + /// the client supports the new `MonikerRegistrationOptions` return value + /// for the corresponding server capability as well. + pub dynamic_registration: Option<bool>, +} + +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeHierarchyClientCapabilities { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + /// return value for the corresponding server capability as well. + pub dynamic_registration: Option<bool>, +} + +/// Client capabilities specific to inline values. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineValueClientCapabilities { + /// Whether implementation supports dynamic registration for inline value providers. + pub dynamic_registration: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructResolveSupportProperties3 { + /// The properties that a client can resolve lazily. + pub properties: Vec<String>, +} + +/// Inlay hint client capabilities. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlayHintClientCapabilities { + /// Whether inlay hints support dynamic registration. + pub dynamic_registration: Option<bool>, + + /// Indicates which properties a client can resolve lazily on an inlay + /// hint. + pub resolve_support: Option<StructResolveSupportProperties3>, +} + +/// Client capabilities specific to diagnostic pull requests. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DiagnosticClientCapabilities { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + /// return value for the corresponding server capability as well. + pub dynamic_registration: Option<bool>, + + /// Whether the clients supports related documents for document diagnostic pulls. + pub related_document_support: Option<bool>, +} + +/// Client capabilities specific to inline completions. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlineCompletionClientCapabilities { + /// Whether implementation supports dynamic registration for inline completion providers. + pub dynamic_registration: Option<bool>, +} + +/// Notebook specific client capabilities. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookDocumentSyncClientCapabilities { + /// Whether implementation supports dynamic registration. If this is + /// set to `true` the client supports the new + /// `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + /// return value for the corresponding server capability as well. + pub dynamic_registration: Option<bool>, + + /// The client supports sending execution summary data per cell. + pub execution_summary_support: Option<bool>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StructMessageActionItem { + /// Whether the client supports additional attributes which + /// are preserved and send back to the server in the + /// request's response. + pub additional_properties_support: Option<bool>, +} + +/// Show message request client capabilities +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ShowMessageRequestClientCapabilities { + /// Capabilities specific to the `MessageActionItem` type. + pub message_action_item: Option<StructMessageActionItem>, +} + +/// Client capabilities for the showDocument request. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ShowDocumentClientCapabilities { + /// The client has support for the showDocument + /// request. + pub support: bool, +} + +/// Client capabilities specific to regular expressions. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RegularExpressionsClientCapabilities { + /// The engine's name. + pub engine: String, + + /// The engine's version. + pub version: Option<String>, +} + +/// Client capabilities specific to the used markdown parser. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct MarkdownClientCapabilities { + /// A list of HTML tags that the client allows / supports in + /// Markdown. + /// + /// @since 3.17.0 + pub allowed_tags: Option<Vec<String>>, + + /// The name of the parser. + pub parser: String, + + /// The version of the parser. + pub version: Option<String>, +} + +/// The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace +/// folder configuration changes. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDidChangeWorkspaceFoldersNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: DidChangeWorkspaceFoldersParams, +} + +/// The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress +/// initiated on the server side. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WindowWorkDoneProgressCancelNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: WorkDoneProgressCancelParams, +} + +/// The did create files notification is sent from the client to the server when +/// files were created from within the client. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDidCreateFilesNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: CreateFilesParams, +} + +/// The did rename files notification is sent from the client to the server when +/// files were renamed from within the client. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDidRenameFilesNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: RenameFilesParams, +} + +/// The will delete files request is sent from the client to the server before files are actually +/// deleted as long as the deletion is triggered from within the client. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDidDeleteFilesNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: DeleteFilesParams, +} + +/// A notification sent when a notebook opens. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookDocumentDidOpenNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: DidOpenNotebookDocumentParams, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookDocumentDidChangeNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: DidChangeNotebookDocumentParams, +} + +/// A notification sent when a notebook document is saved. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookDocumentDidSaveNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: DidSaveNotebookDocumentParams, +} + +/// A notification sent when a notebook closes. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct NotebookDocumentDidCloseNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: DidCloseNotebookDocumentParams, +} + +/// The initialized notification is sent from the client to the +/// server after the client is fully initialized and the server +/// is allowed to send requests from the server to the client. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InitializedNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: InitializedParams, +} + +/// The exit event is sent from the client to the server to +/// ask the server to exit its process. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ExitNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, +} + +/// The configuration change notification is sent from the client to the server +/// when the client's configuration has changed. The notification contains +/// the changed configuration as defined by the language client. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDidChangeConfigurationNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: DidChangeConfigurationParams, +} + +/// The show message notification is sent from a server to a client to ask +/// the client to display a particular message in the user interface. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WindowShowMessageNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: ShowMessageParams, +} + +/// The log message notification is sent from the server to the client to ask +/// the client to log a particular message. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WindowLogMessageNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: LogMessageParams, +} + +/// The telemetry event notification is sent from the server to the client to ask +/// the client to log telemetry data. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TelemetryEventNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: LSPAny, +} + +/// The document open notification is sent from the client to the server to signal +/// newly opened text documents. The document's truth is now managed by the client +/// and the server must not try to read the document's truth using the document's +/// uri. Open in this sense means it is managed by the client. It doesn't necessarily +/// mean that its content is presented in an editor. An open notification must not +/// be sent more than once without a corresponding close notification send before. +/// This means open and close notification must be balanced and the max open count +/// is one. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDidOpenNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: DidOpenTextDocumentParams, +} + +/// The document change notification is sent from the client to the server to signal +/// changes to a text document. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDidChangeNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: DidChangeTextDocumentParams, +} + +/// The document close notification is sent from the client to the server when +/// the document got closed in the client. The document's truth now exists where +/// the document's uri points to (e.g. if the document's uri is a file uri the +/// truth now exists on disk). As with the open notification the close notification +/// is about managing the document's content. Receiving a close notification +/// doesn't mean that the document was open in an editor before. A close +/// notification requires a previous open notification to be sent. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDidCloseNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: DidCloseTextDocumentParams, +} + +/// The document save notification is sent from the client to the server when +/// the document got saved in the client. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDidSaveNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: DidSaveTextDocumentParams, +} + +/// A document will save notification is sent from the client to the server before +/// the document is actually saved. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentWillSaveNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: WillSaveTextDocumentParams, +} + +/// The watched files notification is sent from the client to the server when +/// the client detects changes to file watched by the language client. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDidChangeWatchedFilesNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: DidChangeWatchedFilesParams, +} + +/// Diagnostics notification are sent from the server to the client to signal +/// results of validation runs. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentPublishDiagnosticsNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: PublishDiagnosticsParams, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SetTraceNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: SetTraceParams, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct LogTraceNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: LogTraceParams, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CancelRequestNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: CancelParams, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ProgressNotification { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPNotificationMethods, + + pub params: ProgressParams, +} + +/// An identifier to denote a specific request. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum LSPId { + Int(i32), + String(String), +} + +/// An identifier to denote a specific response. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(untagged)] +pub enum LSPIdOptional { + Int(i32), + String(String), + None, +} + +/// A request to resolve the implementation locations of a symbol at a given text +/// document position. The request's parameter is of type [TextDocumentPositionParams] +/// the response is of type [Definition] or a Thenable that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentImplementationRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: ImplementationParams, +} + +/// Response to the [TextDocumentImplementationRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentImplementationResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<OR2<Definition, Vec<DefinitionLink>>>, +} + +/// A request to resolve the type definition locations of a symbol at a given text +/// document position. The request's parameter is of type [TextDocumentPositionParams] +/// the response is of type [Definition] or a Thenable that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentTypeDefinitionRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: TypeDefinitionParams, +} + +/// Response to the [TextDocumentTypeDefinitionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentTypeDefinitionResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<OR2<Definition, Vec<DefinitionLink>>>, +} + +/// The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceWorkspaceFoldersRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, +} + +/// Response to the [WorkspaceWorkspaceFoldersRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceWorkspaceFoldersResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<WorkspaceFolder>>, +} + +/// The 'workspace/configuration' request is sent from the server to the client to fetch a certain +/// configuration setting. +/// +/// This pull model replaces the old push model were the client signaled configuration change via an +/// event. If the server still needs to react to configuration changes (since the server caches the +/// result of `workspace/configuration` requests) the server should register for an empty configuration +/// change event and empty the cache if such an event is received. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceConfigurationRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: ConfigurationParams, +} + +/// Response to the [WorkspaceConfigurationRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceConfigurationResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: Vec<LSPAny>, +} + +/// A request to list all color symbols found in a given text document. The request's +/// parameter is of type [DocumentColorParams] the +/// response is of type {@link ColorInformation ColorInformation[]} or a Thenable +/// that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDocumentColorRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DocumentColorParams, +} + +/// Response to the [TextDocumentDocumentColorRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDocumentColorResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: Vec<ColorInformation>, +} + +/// A request to list all presentation for a color. The request's +/// parameter is of type [ColorPresentationParams] the +/// response is of type {@link ColorInformation ColorInformation[]} or a Thenable +/// that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentColorPresentationRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: ColorPresentationParams, +} + +/// Response to the [TextDocumentColorPresentationRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentColorPresentationResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: Vec<ColorPresentation>, +} + +/// A request to provide folding ranges in a document. The request's +/// parameter is of type [FoldingRangeParams], the +/// response is of type [FoldingRangeList] or a Thenable +/// that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentFoldingRangeRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: FoldingRangeParams, +} + +/// Response to the [TextDocumentFoldingRangeRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentFoldingRangeResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<FoldingRange>>, +} + +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceFoldingRangeRefreshRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, +} + +/// Response to the [WorkspaceFoldingRangeRefreshRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceFoldingRangeRefreshResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: LSPNull, +} + +/// A request to resolve the type definition locations of a symbol at a given text +/// document position. The request's parameter is of type [TextDocumentPositionParams] +/// the response is of type [Declaration] or a typed array of [DeclarationLink] +/// or a Thenable that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDeclarationRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DeclarationParams, +} + +/// Response to the [TextDocumentDeclarationRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDeclarationResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<OR2<Declaration, Vec<DeclarationLink>>>, +} + +/// A request to provide selection ranges in a document. The request's +/// parameter is of type [SelectionRangeParams], the +/// response is of type {@link SelectionRange SelectionRange[]} or a Thenable +/// that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSelectionRangeRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: SelectionRangeParams, +} + +/// Response to the [TextDocumentSelectionRangeRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSelectionRangeResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<SelectionRange>>, +} + +/// The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress +/// reporting from the server. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WindowWorkDoneProgressCreateRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: WorkDoneProgressCreateParams, +} + +/// Response to the [WindowWorkDoneProgressCreateRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WindowWorkDoneProgressCreateResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: LSPNull, +} + +/// A request to result a `CallHierarchyItem` in a document at a given position. +/// Can be used as an input to an incoming or outgoing call hierarchy. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentPrepareCallHierarchyRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: CallHierarchyPrepareParams, +} + +/// Response to the [TextDocumentPrepareCallHierarchyRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentPrepareCallHierarchyResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<CallHierarchyItem>>, +} + +/// A request to resolve the incoming calls for a given `CallHierarchyItem`. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyIncomingCallsRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: CallHierarchyIncomingCallsParams, +} + +/// Response to the [CallHierarchyIncomingCallsRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyIncomingCallsResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<CallHierarchyIncomingCall>>, +} + +/// A request to resolve the outgoing calls for a given `CallHierarchyItem`. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyOutgoingCallsRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: CallHierarchyOutgoingCallsParams, +} + +/// Response to the [CallHierarchyOutgoingCallsRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CallHierarchyOutgoingCallsResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<CallHierarchyOutgoingCall>>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSemanticTokensFullRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: SemanticTokensParams, +} + +/// Response to the [TextDocumentSemanticTokensFullRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSemanticTokensFullResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<SemanticTokens>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSemanticTokensFullDeltaRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: SemanticTokensDeltaParams, +} + +/// Response to the [TextDocumentSemanticTokensFullDeltaRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSemanticTokensFullDeltaResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<OR2<SemanticTokens, SemanticTokensDelta>>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSemanticTokensRangeRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: SemanticTokensRangeParams, +} + +/// Response to the [TextDocumentSemanticTokensRangeRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSemanticTokensRangeResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<SemanticTokens>, +} + +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceSemanticTokensRefreshRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, +} + +/// Response to the [WorkspaceSemanticTokensRefreshRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceSemanticTokensRefreshResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: LSPNull, +} + +/// A request to show a document. This request might open an +/// external program depending on the value of the URI to open. +/// For example a request to open `https://code.visualstudio.com/` +/// will very likely open the URI in a WEB browser. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WindowShowDocumentRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: ShowDocumentParams, +} + +/// Response to the [WindowShowDocumentRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WindowShowDocumentResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: ShowDocumentResult, +} + +/// A request to provide ranges that can be edited together. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentLinkedEditingRangeRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: LinkedEditingRangeParams, +} + +/// Response to the [TextDocumentLinkedEditingRangeRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentLinkedEditingRangeResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<LinkedEditingRanges>, +} + +/// The will create files request is sent from the client to the server before files are actually +/// created as long as the creation is triggered from within the client. +/// +/// The request can return a `WorkspaceEdit` which will be applied to workspace before the +/// files are created. Hence the `WorkspaceEdit` can not manipulate the content of the file +/// to be created. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceWillCreateFilesRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: CreateFilesParams, +} + +/// Response to the [WorkspaceWillCreateFilesRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceWillCreateFilesResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<WorkspaceEdit>, +} + +/// The will rename files request is sent from the client to the server before files are actually +/// renamed as long as the rename is triggered from within the client. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceWillRenameFilesRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: RenameFilesParams, +} + +/// Response to the [WorkspaceWillRenameFilesRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceWillRenameFilesResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<WorkspaceEdit>, +} + +/// The did delete files notification is sent from the client to the server when +/// files were deleted from within the client. +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceWillDeleteFilesRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DeleteFilesParams, +} + +/// Response to the [WorkspaceWillDeleteFilesRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceWillDeleteFilesResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<WorkspaceEdit>, +} + +/// A request to get the moniker of a symbol at a given text document position. +/// The request parameter is of type [TextDocumentPositionParams]. +/// The response is of type {@link Moniker Moniker[]} or `null`. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentMonikerRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: MonikerParams, +} + +/// Response to the [TextDocumentMonikerRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentMonikerResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<Moniker>>, +} + +/// A request to result a `TypeHierarchyItem` in a document at a given position. +/// Can be used as an input to a subtypes or supertypes type hierarchy. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentPrepareTypeHierarchyRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: TypeHierarchyPrepareParams, +} + +/// Response to the [TextDocumentPrepareTypeHierarchyRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentPrepareTypeHierarchyResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<TypeHierarchyItem>>, +} + +/// A request to resolve the supertypes for a given `TypeHierarchyItem`. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeHierarchySupertypesRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: TypeHierarchySupertypesParams, +} + +/// Response to the [TypeHierarchySupertypesRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeHierarchySupertypesResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<TypeHierarchyItem>>, +} + +/// A request to resolve the subtypes for a given `TypeHierarchyItem`. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeHierarchySubtypesRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: TypeHierarchySubtypesParams, +} + +/// Response to the [TypeHierarchySubtypesRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TypeHierarchySubtypesResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<TypeHierarchyItem>>, +} + +/// A request to provide inline values in a document. The request's parameter is of +/// type [InlineValueParams], the response is of type +/// {@link InlineValue InlineValue[]} or a Thenable that resolves to such. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentInlineValueRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: InlineValueParams, +} + +/// Response to the [TextDocumentInlineValueRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentInlineValueResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<InlineValue>>, +} + +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceInlineValueRefreshRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, +} + +/// Response to the [WorkspaceInlineValueRefreshRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceInlineValueRefreshResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: LSPNull, +} + +/// A request to provide inlay hints in a document. The request's parameter is of +/// type [InlayHintsParams], the response is of type +/// {@link InlayHint InlayHint[]} or a Thenable that resolves to such. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentInlayHintRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: InlayHintParams, +} + +/// Response to the [TextDocumentInlayHintRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentInlayHintResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<InlayHint>>, +} + +/// A request to resolve additional properties for an inlay hint. +/// The request's parameter is of type [InlayHint], the response is +/// of type [InlayHint] or a Thenable that resolves to such. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlayHintResolveRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: InlayHint, +} + +/// Response to the [InlayHintResolveRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InlayHintResolveResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: InlayHint, +} + +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceInlayHintRefreshRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, +} + +/// Response to the [WorkspaceInlayHintRefreshRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceInlayHintRefreshResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: LSPNull, +} + +/// The document diagnostic request definition. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDiagnosticRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DocumentDiagnosticParams, +} + +/// Response to the [TextDocumentDiagnosticRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDiagnosticResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: DocumentDiagnosticReport, +} + +/// The workspace diagnostic request definition. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDiagnosticRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: WorkspaceDiagnosticParams, +} + +/// Response to the [WorkspaceDiagnosticRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDiagnosticResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: WorkspaceDiagnosticReport, +} + +/// The diagnostic refresh request definition. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDiagnosticRefreshRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, +} + +/// Response to the [WorkspaceDiagnosticRefreshRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceDiagnosticRefreshResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: LSPNull, +} + +/// A request to provide inline completions in a document. The request's parameter is of +/// type [InlineCompletionParams], the response is of type +/// {@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentInlineCompletionRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: InlineCompletionParams, +} + +/// Response to the [TextDocumentInlineCompletionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentInlineCompletionResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<OR2<InlineCompletionList, Vec<InlineCompletionItem>>>, +} + +/// The `client/registerCapability` request is sent from the server to the client to register a new capability +/// handler on the client side. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ClientRegisterCapabilityRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: RegistrationParams, +} + +/// Response to the [ClientRegisterCapabilityRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ClientRegisterCapabilityResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: LSPNull, +} + +/// The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability +/// handler on the client side. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ClientUnregisterCapabilityRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: UnregistrationParams, +} + +/// Response to the [ClientUnregisterCapabilityRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ClientUnregisterCapabilityResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: LSPNull, +} + +/// The initialize request is sent from the client to the server. +/// It is sent once as the request after starting up the server. +/// The requests parameter is of type [InitializeParams] +/// the response if of type [InitializeResult] of a Thenable that +/// resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InitializeRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: InitializeParams, +} + +/// Response to the [InitializeRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct InitializeResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: InitializeResult, +} + +/// A shutdown request is sent from the client to the server. +/// It is sent once when the client decides to shutdown the +/// server. The only notification that is sent after a shutdown request +/// is the exit event. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ShutdownRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, +} + +/// Response to the [ShutdownRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ShutdownResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: LSPNull, +} + +/// The show message request is sent from the server to the client to show a message +/// and a set of options actions to the user. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WindowShowMessageRequestRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: ShowMessageRequestParams, +} + +/// Response to the [WindowShowMessageRequestRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WindowShowMessageRequestResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<MessageActionItem>, +} + +/// A document will save request is sent from the client to the server before +/// the document is actually saved. The request can return an array of TextEdits +/// which will be applied to the text document before it is saved. Please note that +/// clients might drop results if computing the text edits took too long or if a +/// server constantly fails on this request. This is done to keep the save fast and +/// reliable. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentWillSaveWaitUntilRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: WillSaveTextDocumentParams, +} + +/// Response to the [TextDocumentWillSaveWaitUntilRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentWillSaveWaitUntilResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<TextEdit>>, +} + +/// Request to request completion at a given text document position. The request's +/// parameter is of type [TextDocumentPosition] the response +/// is of type {@link CompletionItem CompletionItem[]} or [CompletionList] +/// or a Thenable that resolves to such. +/// +/// The request can delay the computation of the [`detail`][`CompletionItem::detail`] +/// and [`documentation`][`CompletionItem::documentation`] properties to the `completionItem/resolve` +/// request. However, properties that are needed for the initial sorting and filtering, like `sortText`, +/// `filterText`, `insertText`, and `textEdit`, must not be changed during resolve. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentCompletionRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: CompletionParams, +} + +/// Response to the [TextDocumentCompletionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentCompletionResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<OR2<Vec<CompletionItem>, CompletionList>>, +} + +/// Request to resolve additional information for a given completion item.The request's +/// parameter is of type [CompletionItem] the response +/// is of type [CompletionItem] or a Thenable that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CompletionItemResolveRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: CompletionItem, +} + +/// Response to the [CompletionItemResolveRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CompletionItemResolveResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: CompletionItem, +} + +/// Request to request hover information at a given text document position. The request's +/// parameter is of type [TextDocumentPosition] the response is of +/// type [Hover] or a Thenable that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentHoverRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: HoverParams, +} + +/// Response to the [TextDocumentHoverRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentHoverResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Hover>, +} + +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSignatureHelpRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: SignatureHelpParams, +} + +/// Response to the [TextDocumentSignatureHelpRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentSignatureHelpResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<SignatureHelp>, +} + +/// A request to resolve the definition location of a symbol at a given text +/// document position. The request's parameter is of type [TextDocumentPosition] +/// the response is of either type [Definition] or a typed array of +/// [DefinitionLink] or a Thenable that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDefinitionRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DefinitionParams, +} + +/// Response to the [TextDocumentDefinitionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDefinitionResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<OR2<Definition, Vec<DefinitionLink>>>, +} + +/// A request to resolve project-wide references for the symbol denoted +/// by the given text document position. The request's parameter is of +/// type [ReferenceParams] the response is of type +/// {@link Location Location[]} or a Thenable that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentReferencesRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: ReferenceParams, +} + +/// Response to the [TextDocumentReferencesRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentReferencesResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<Location>>, +} + +/// Request to resolve a [DocumentHighlight] for a given +/// text document position. The request's parameter is of type [TextDocumentPosition] +/// the request response is an array of type [DocumentHighlight] +/// or a Thenable that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDocumentHighlightRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DocumentHighlightParams, +} + +/// Response to the [TextDocumentDocumentHighlightRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDocumentHighlightResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<DocumentHighlight>>, +} + +/// A request to list all symbols found in a given text document. The request's +/// parameter is of type [TextDocumentIdentifier] the +/// response is of type {@link SymbolInformation SymbolInformation[]} or a Thenable +/// that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDocumentSymbolRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DocumentSymbolParams, +} + +/// Response to the [TextDocumentDocumentSymbolRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDocumentSymbolResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<OR2<Vec<SymbolInformation>, Vec<DocumentSymbol>>>, +} + +/// A request to provide commands for the given text document and range. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentCodeActionRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: CodeActionParams, +} + +/// Response to the [TextDocumentCodeActionRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentCodeActionResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<OR2<Command, CodeAction>>>, +} + +/// Request to resolve additional information for a given code action.The request's +/// parameter is of type [CodeAction] the response +/// is of type [CodeAction] or a Thenable that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeActionResolveRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: CodeAction, +} + +/// Response to the [CodeActionResolveRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeActionResolveResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: CodeAction, +} + +/// A request to list project-wide symbols matching the query string given +/// by the [WorkspaceSymbolParams]. The response is +/// of type {@link SymbolInformation SymbolInformation[]} or a Thenable that +/// resolves to such. +/// +/// @since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients +/// need to advertise support for WorkspaceSymbols via the client capability +/// `workspace.symbol.resolveSupport`. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceSymbolRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: WorkspaceSymbolParams, +} + +/// Response to the [WorkspaceSymbolRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceSymbolResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<OR2<Vec<SymbolInformation>, Vec<WorkspaceSymbol>>>, +} + +/// A request to resolve the range inside the workspace +/// symbol's location. +/// +/// @since 3.17.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceSymbolResolveRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: WorkspaceSymbol, +} + +/// Response to the [WorkspaceSymbolResolveRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceSymbolResolveResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: WorkspaceSymbol, +} + +/// A request to provide code lens for the given text document. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentCodeLensRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: CodeLensParams, +} + +/// Response to the [TextDocumentCodeLensRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentCodeLensResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<CodeLens>>, +} + +/// A request to resolve a command for a given code lens. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeLensResolveRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: CodeLens, +} + +/// Response to the [CodeLensResolveRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct CodeLensResolveResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: CodeLens, +} + +/// A request to refresh all code actions +/// +/// @since 3.16.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceCodeLensRefreshRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, +} + +/// Response to the [WorkspaceCodeLensRefreshRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceCodeLensRefreshResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: LSPNull, +} + +/// A request to provide document links +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDocumentLinkRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DocumentLinkParams, +} + +/// Response to the [TextDocumentDocumentLinkRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentDocumentLinkResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<DocumentLink>>, +} + +/// Request to resolve additional information for a given document link. The request's +/// parameter is of type [DocumentLink] the response +/// is of type [DocumentLink] or a Thenable that resolves to such. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentLinkResolveRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DocumentLink, +} + +/// Response to the [DocumentLinkResolveRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct DocumentLinkResolveResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: DocumentLink, +} + +/// A request to format a whole document. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentFormattingRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DocumentFormattingParams, +} + +/// Response to the [TextDocumentFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentFormattingResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<TextEdit>>, +} + +/// A request to format a range in a document. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentRangeFormattingRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DocumentRangeFormattingParams, +} + +/// Response to the [TextDocumentRangeFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentRangeFormattingResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<TextEdit>>, +} + +/// A request to format ranges in a document. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed", since = "3.18.0")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentRangesFormattingRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DocumentRangesFormattingParams, +} + +/// Response to the [TextDocumentRangesFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentRangesFormattingResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<TextEdit>>, +} + +/// A request to format a document on type. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentOnTypeFormattingRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: DocumentOnTypeFormattingParams, +} + +/// Response to the [TextDocumentOnTypeFormattingRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentOnTypeFormattingResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<Vec<TextEdit>>, +} + +/// A request to rename a symbol. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentRenameRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: RenameParams, +} + +/// Response to the [TextDocumentRenameRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentRenameResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<WorkspaceEdit>, +} + +/// A request to test and perform the setup necessary for a rename. +/// +/// @since 3.16 - support for default behavior +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentPrepareRenameRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: PrepareRenameParams, +} + +/// Response to the [TextDocumentPrepareRenameRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TextDocumentPrepareRenameResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<PrepareRenameResult>, +} + +/// A request send from the client to the server to execute a command. The request might return +/// a workspace edit which the client will apply to the workspace. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceExecuteCommandRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: ExecuteCommandParams, +} + +/// Response to the [WorkspaceExecuteCommandRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceExecuteCommandResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<LSPAny>, +} + +/// A request sent from the server to the client to modified certain resources. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceApplyEditRequest { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPId, + + pub params: ApplyWorkspaceEditParams, +} + +/// Response to the [WorkspaceApplyEditRequest]. +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct WorkspaceApplyEditResponse { + /// The version of the JSON RPC protocol. + pub jsonrpc: String, + + /// The method to be invoked. + pub method: LSPRequestMethods, + + /// The request id. + pub id: LSPIdOptional, + + pub result: ApplyWorkspaceEditResult, +} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9787c3b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/requirements.in b/requirements.in new file mode 100644 index 0000000..d115049 --- /dev/null +++ b/requirements.in @@ -0,0 +1,11 @@ +# This file is used to generate requirements.txt. +# To update requirements.txt, run the following commands. +# 1) pip install pip-tools +# 2) pip-compile --generate-hashes --upgrade ./requirements.in + +attrs +cattrs +jsonschema +importlib_resources +pytest +PyHamcrest diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2a988d3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,115 @@ +# +# This file is autogenerated by pip-compile with Python 3.7 +# by the following command: +# +# pip-compile --generate-hashes --resolver=backtracking ./requirements.in +# +attrs==23.1.0 \ + --hash=sha256:1f28b4522cdc2fb4256ac1a020c78acf9cba2c6b461ccd2c126f3aa8e8335d04 \ + --hash=sha256:6279836d581513a26f1bf235f9acd333bc9115683f14f7e8fae46c98fc50e015 + # via + # -r ./requirements.in + # cattrs + # jsonschema +cattrs==23.1.2 \ + --hash=sha256:b2bb14311ac17bed0d58785e5a60f022e5431aca3932e3fc5cc8ed8639de50a4 \ + --hash=sha256:db1c821b8c537382b2c7c66678c3790091ca0275ac486c76f3c8f3920e83c657 + # via -r ./requirements.in +colorama==0.4.6 \ + --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ + --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 + # via pytest +exceptiongroup==1.1.3 \ + --hash=sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9 \ + --hash=sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3 + # via + # cattrs + # pytest +importlib-metadata==6.7.0 \ + --hash=sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4 \ + --hash=sha256:cb52082e659e97afc5dac71e79de97d8681de3aa07ff18578330904a9d18e5b5 + # via + # attrs + # jsonschema + # pluggy + # pytest +importlib-resources==5.12.0 \ + --hash=sha256:4be82589bf5c1d7999aedf2a45159d10cb3ca4f19b2271f8792bc8e6da7b22f6 \ + --hash=sha256:7b1deeebbf351c7578e09bf2f63fa2ce8b5ffec296e0d349139d43cca061a81a + # via + # -r ./requirements.in + # jsonschema +iniconfig==2.0.0 \ + --hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \ + --hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374 + # via pytest +jsonschema==4.17.3 \ + --hash=sha256:0f864437ab8b6076ba6707453ef8f98a6a0d512a80e93f8abdb676f737ecb60d \ + --hash=sha256:a870ad254da1a8ca84b6a2905cac29d265f805acc57af304784962a2aa6508f6 + # via -r ./requirements.in +packaging==23.1 \ + --hash=sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61 \ + --hash=sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f + # via pytest +pkgutil-resolve-name==1.3.10 \ + --hash=sha256:357d6c9e6a755653cfd78893817c0853af365dd51ec97f3d358a819373bbd174 \ + --hash=sha256:ca27cc078d25c5ad71a9de0a7a330146c4e014c2462d9af19c6b828280649c5e + # via jsonschema +pluggy==1.2.0 \ + --hash=sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849 \ + --hash=sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3 + # via pytest +pyhamcrest==2.0.4 \ + --hash=sha256:60a41d4783b9d56c9ec8586635d2301db5072b3ea8a51c32dd03c408ae2b0f79 \ + --hash=sha256:b5d9ce6b977696286cf232ce2adf8969b4d0b045975b0936ac9005e84e67e9c1 + # via -r ./requirements.in +pyrsistent==0.19.3 \ + --hash=sha256:016ad1afadf318eb7911baa24b049909f7f3bb2c5b1ed7b6a8f21db21ea3faa8 \ + --hash=sha256:1a2994773706bbb4995c31a97bc94f1418314923bd1048c6d964837040376440 \ + --hash=sha256:20460ac0ea439a3e79caa1dbd560344b64ed75e85d8703943e0b66c2a6150e4a \ + --hash=sha256:3311cb4237a341aa52ab8448c27e3a9931e2ee09561ad150ba94e4cfd3fc888c \ + --hash=sha256:3a8cb235fa6d3fd7aae6a4f1429bbb1fec1577d978098da1252f0489937786f3 \ + --hash=sha256:3ab2204234c0ecd8b9368dbd6a53e83c3d4f3cab10ecaf6d0e772f456c442393 \ + --hash=sha256:42ac0b2f44607eb92ae88609eda931a4f0dfa03038c44c772e07f43e738bcac9 \ + --hash=sha256:49c32f216c17148695ca0e02a5c521e28a4ee6c5089f97e34fe24163113722da \ + --hash=sha256:4b774f9288dda8d425adb6544e5903f1fb6c273ab3128a355c6b972b7df39dcf \ + --hash=sha256:4c18264cb84b5e68e7085a43723f9e4c1fd1d935ab240ce02c0324a8e01ccb64 \ + --hash=sha256:5a474fb80f5e0d6c9394d8db0fc19e90fa540b82ee52dba7d246a7791712f74a \ + --hash=sha256:64220c429e42a7150f4bfd280f6f4bb2850f95956bde93c6fda1b70507af6ef3 \ + --hash=sha256:878433581fc23e906d947a6814336eee031a00e6defba224234169ae3d3d6a98 \ + --hash=sha256:99abb85579e2165bd8522f0c0138864da97847875ecbd45f3e7e2af569bfc6f2 \ + --hash=sha256:a2471f3f8693101975b1ff85ffd19bb7ca7dd7c38f8a81701f67d6b4f97b87d8 \ + --hash=sha256:aeda827381f5e5d65cced3024126529ddc4289d944f75e090572c77ceb19adbf \ + --hash=sha256:b735e538f74ec31378f5a1e3886a26d2ca6351106b4dfde376a26fc32a044edc \ + --hash=sha256:c147257a92374fde8498491f53ffa8f4822cd70c0d85037e09028e478cababb7 \ + --hash=sha256:c4db1bd596fefd66b296a3d5d943c94f4fac5bcd13e99bffe2ba6a759d959a28 \ + --hash=sha256:c74bed51f9b41c48366a286395c67f4e894374306b197e62810e0fdaf2364da2 \ + --hash=sha256:c9bb60a40a0ab9aba40a59f68214eed5a29c6274c83b2cc206a359c4a89fa41b \ + --hash=sha256:cc5d149f31706762c1f8bda2e8c4f8fead6e80312e3692619a75301d3dbb819a \ + --hash=sha256:ccf0d6bd208f8111179f0c26fdf84ed7c3891982f2edaeae7422575f47e66b64 \ + --hash=sha256:e42296a09e83028b3476f7073fcb69ffebac0e66dbbfd1bd847d61f74db30f19 \ + --hash=sha256:e8f2b814a3dc6225964fa03d8582c6e0b6650d68a232df41e3cc1b66a5d2f8d1 \ + --hash=sha256:f0774bf48631f3a20471dd7c5989657b639fd2d285b861237ea9e82c36a415a9 \ + --hash=sha256:f0e7c4b2f77593871e918be000b96c8107da48444d57005b6a6bc61fb4331b2c + # via jsonschema +pytest==7.4.2 \ + --hash=sha256:1d881c6124e08ff0a1bb75ba3ec0bfd8b5354a01c194ddd5a0a870a48d99b002 \ + --hash=sha256:a766259cfab564a2ad52cb1aae1b881a75c3eb7e34ca3779697c23ed47c47069 + # via -r ./requirements.in +tomli==2.0.1 \ + --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ + --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f + # via pytest +typing-extensions==4.7.1 \ + --hash=sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36 \ + --hash=sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2 + # via + # cattrs + # importlib-metadata + # jsonschema +zipp==3.15.0 \ + --hash=sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b \ + --hash=sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556 + # via + # importlib-metadata + # importlib-resources diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 0000000..ebf3e31 --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +python-3.7.16
\ No newline at end of file diff --git a/scripts/onCreateCommand.sh b/scripts/onCreateCommand.sh new file mode 100644 index 0000000..f867da4 --- /dev/null +++ b/scripts/onCreateCommand.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Install pyenv and Python versions here to avoid using shim. +curl https://pyenv.run | bash +echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc +echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc + +export PYENV_ROOT="$HOME/.pyenv" +command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" +# eval "$(pyenv init -)" Comment this out and DO NOT use shim. +source ~/.bashrc + +# Install Rust and Cargo +curl https://sh.rustup.rs -sSf | bash -s -- -y +echo 'source $HOME/.cargo/env' >> ~/.bashrc + +# Install Python via pyenv . +pyenv install 3.8:latest 3.9:latest 3.10:latest 3.11:latest + +# Set default Python version to 3.8 . +pyenv global 3.8.18 + +# Create Virutal environment. +pyenv exec python3.8 -m venv .venv + +# Activate Virtual environment. +source /workspaces/lsprotocol/.venv/bin/activate + diff --git a/scripts/postCreateCommand.sh b/scripts/postCreateCommand.sh new file mode 100644 index 0000000..805c353 --- /dev/null +++ b/scripts/postCreateCommand.sh @@ -0,0 +1,3 @@ +source /workspaces/lsprotocol/.venv/bin/activate +python -m pip install nox +python -m pip install -r ./packages/python/requirements.txt -r ./requirements.txt
\ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..feb9e5e --- /dev/null +++ b/setup.cfg @@ -0,0 +1,35 @@ +[metadata] +name = generator +version = 2023.0.0a3 +author = Microsoft Corporation +author_email = lsprotocol-help@microsoft.com +description = Generates code for the Language Server Protocol types using the LSP specification. +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/microsoft/lsprotocol + +[options] +packages = find: +package_dir = + = . + +install_requires = + attrs + cattrs + jsonschema + importlib_resources + +[options.package_data] +generator = *.json +generator.plugins.dotnet = **/* + +[options.packages.find] +exclude = + tests + packages + azure-pipelines + .devcontainer + .github + .vscode + +include_package_data = true diff --git a/tests/dotnet/lsprotocol_tests/.gitignore b/tests/dotnet/lsprotocol_tests/.gitignore new file mode 100644 index 0000000..cbbd0b5 --- /dev/null +++ b/tests/dotnet/lsprotocol_tests/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/
\ No newline at end of file diff --git a/tests/dotnet/lsprotocol_tests/LSPTests.cs b/tests/dotnet/lsprotocol_tests/LSPTests.cs new file mode 100644 index 0000000..80a19ae --- /dev/null +++ b/tests/dotnet/lsprotocol_tests/LSPTests.cs @@ -0,0 +1,123 @@ + +namespace lsprotocol_tests; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + + +public class LSPTests +{ + public static IEnumerable<object[]> JsonTestData() + { + string folderPath; + // Read test data path from environment variable + if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("LSP_TEST_DATA_PATH"))) + { + folderPath = Environment.GetEnvironmentVariable("LSP_TEST_DATA_PATH"); + } + else + { + throw new Exception("LSP_TEST_DATA_PATH environment variable not set"); + } + + string[] jsonFiles = Directory.GetFiles(folderPath, "*.json"); + foreach (string filePath in jsonFiles) + { + yield return new object[] { filePath }; + } + } + + [Theory] + [MemberData(nameof(JsonTestData))] + public void ValidateLSPTypes(string filePath) + { + string original = File.ReadAllText(filePath); + + // Get the class name from the file name + // format: <class-name>-<valid>-<test-id>.json + // classname => Class name of the type to deserialize to + // valid => true if the file is valid, false if it is invalid + // test-id => unique id for the test + string fileName = Path.GetFileNameWithoutExtension(filePath); + string[] nameParts = fileName.Split('-'); + string className = nameParts[0]; + bool valid = nameParts[1] == "True"; + + Type type = Type.GetType($"Microsoft.LanguageServer.Protocol.{className}, lsprotocol") ?? throw new Exception($"Type {className} not found"); + RunTest(valid, original, type); + } + + private static void RunTest(bool valid, string data, Type type) + { + if (valid) + { + try + { + var settings = new JsonSerializerSettings + { + MissingMemberHandling = MissingMemberHandling.Error + }; + object? deserializedObject = JsonConvert.DeserializeObject(data, type, settings); + string newJson = JsonConvert.SerializeObject(deserializedObject, settings); + + JToken token1 = JToken.Parse(data); + JToken token2 = JToken.Parse(newJson); + RemoveNullProperties(token1); + RemoveNullProperties(token2); + Assert.True(JToken.DeepEquals(token1, token2), $"JSON before and after serialization don't match:\r\nBEFORE:{data}\r\nAFTER:{newJson}"); + } + catch (Exception e) + { + // Explicitly fail the test + Assert.True(false, $"Should not have thrown an exception for [{type.Name}]: {data} \r\n{e}"); + } + } + else + { + try + { + JsonConvert.DeserializeObject(data, type); + // Explicitly fail the test + Assert.True(false, $"Should have thrown an exception for [{type.Name}]: {data}"); + } + catch + { + // Worked as expected. + } + } + } + + private static void RemoveNullProperties(JToken token) + { + if (token.Type == JTokenType.Object) + { + var obj = (JObject)token; + + var propertiesToRemove = obj.Properties() + .Where(p => p.Value.Type == JTokenType.Null) + .ToList(); + + foreach (var property in propertiesToRemove) + { + property.Remove(); + } + + foreach (var property in obj.Properties()) + { + RemoveNullProperties(property.Value); + } + } + else if (token.Type == JTokenType.Array) + { + var array = (JArray)token; + + for (int i = array.Count - 1; i >= 0; i--) + { + RemoveNullProperties(array[i]); + if (array[i].Type == JTokenType.Null) + { + array.RemoveAt(i); + } + } + } + } +}
\ No newline at end of file diff --git a/tests/dotnet/lsprotocol_tests/Usings.cs b/tests/dotnet/lsprotocol_tests/Usings.cs new file mode 100644 index 0000000..5d95411 --- /dev/null +++ b/tests/dotnet/lsprotocol_tests/Usings.cs @@ -0,0 +1,2 @@ +global using Xunit; +global using Microsoft.LanguageServer.Protocol;
\ No newline at end of file diff --git a/tests/dotnet/lsprotocol_tests/lsprotocol_tests.csproj b/tests/dotnet/lsprotocol_tests/lsprotocol_tests.csproj new file mode 100644 index 0000000..194c872 --- /dev/null +++ b/tests/dotnet/lsprotocol_tests/lsprotocol_tests.csproj @@ -0,0 +1,29 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>net6.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + + <IsPackable>false</IsPackable> + <IsTestProject>true</IsTestProject> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" /> + <PackageReference Include="xunit" Version="2.4.2" /> + <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> + <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> + <PrivateAssets>all</PrivateAssets> + </PackageReference> + <PackageReference Include="coverlet.collector" Version="3.2.0"> + <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> + <PrivateAssets>all</PrivateAssets> + </PackageReference> + </ItemGroup> + + <ItemGroup> + <ProjectReference Include="..\..\..\packages\dotnet\lsprotocol\lsprotocol.csproj" /> + </ItemGroup> + +</Project> diff --git a/tests/generator/test_model.py b/tests/generator/test_model.py new file mode 100644 index 0000000..50f2b6e --- /dev/null +++ b/tests/generator/test_model.py @@ -0,0 +1,25 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import json +import pathlib + +import pytest + +import generator.model as model + +lsp_json_path = pathlib.Path(model.__file__).parent / "lsp.json" + + +def test_model_loading(): + json_model = json.loads((lsp_json_path).read_text(encoding="utf-8")) + model.LSPModel(**json_model) + + +def test_model_loading_failure(): + root = pathlib.Path(__file__).parent.parent / "generator" + json_model = json.loads((lsp_json_path).read_text(encoding="utf-8")) + + del json_model["structures"][0]["name"] + with pytest.raises(TypeError): + model.LSPModel(**json_model) diff --git a/tests/generator/test_schema.py b/tests/generator/test_schema.py new file mode 100644 index 0000000..dc24550 --- /dev/null +++ b/tests/generator/test_schema.py @@ -0,0 +1,17 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import json +import pathlib + +import jsonschema + +lsp_json_path = pathlib.Path(__file__).parent.parent.parent / "generator" / "lsp.json" +lsp_schema_path = lsp_json_path.parent / "lsp.schema.json" + + +def test_validate_with_schema(): + model = json.loads((lsp_json_path).read_text(encoding="utf-8")) + schema = json.loads((lsp_schema_path).read_text(encoding="utf-8")) + + jsonschema.validate(model, schema) diff --git a/tests/python/__init__.py b/tests/python/__init__.py new file mode 100644 index 0000000..5b7f7a9 --- /dev/null +++ b/tests/python/__init__.py @@ -0,0 +1,2 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. diff --git a/tests/python/common/jsonrpc.py b/tests/python/common/jsonrpc.py new file mode 100644 index 0000000..79de35f --- /dev/null +++ b/tests/python/common/jsonrpc.py @@ -0,0 +1,52 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import json + +from lsprotocol import converters, types + + +def to_json( + obj: types.MESSAGE_TYPES, + method: str = None, + converter=None, +) -> str: + """Converts a given LSP message object to JSON string using the provided + converter.""" + if not converter: + converter = converters.get_converter() + + if method is None: + method = obj.method if hasattr(obj, "method") else None + + if hasattr(obj, "result"): + if method is None: + raise ValueError(f"`method` must not be None for response type objects.") + obj_type = types.METHOD_TO_TYPES[method][1] + elif hasattr(obj, "error"): + obj_type = types.ResponseErrorMessage + else: + obj_type = types.METHOD_TO_TYPES[method][0] + return json.dumps(converter.unstructure(obj, unstructure_as=obj_type)) + + +def from_json(json_str: str, method: str = None, converter=None) -> types.MESSAGE_TYPES: + """Parses and given JSON string and returns LSP message object using the provided + converter.""" + if not converter: + converter = converters.get_converter() + + obj = json.loads(json_str) + + if method is None: + method = obj.get("method", None) + + if "result" in obj: + if method is None: + raise ValueError(f"`method` must not be None for response type objects.") + obj_type = types.METHOD_TO_TYPES[method][1] + elif "error" in obj: + obj_type = types.ResponseErrorMessage + else: + obj_type = types.METHOD_TO_TYPES[method][0] + return converter.structure(obj, obj_type) diff --git a/tests/python/notifications/test_exit.py b/tests/python/notifications/test_exit.py new file mode 100644 index 0000000..e42a0a9 --- /dev/null +++ b/tests/python/notifications/test_exit.py @@ -0,0 +1,41 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import json + +import hamcrest +import jsonrpc +import pytest +from cattrs.errors import ClassValidationError + + +@pytest.mark.parametrize( + "data, expected", + [ + ( + {"method": "exit", "jsonrpc": "2.0"}, + json.dumps({"method": "exit", "jsonrpc": "2.0"}), + ), + ( + {"method": "exit", "params": None, "jsonrpc": "2.0"}, + json.dumps({"method": "exit", "jsonrpc": "2.0"}), + ), + ], +) +def test_exit_serialization(data, expected): + data_str = json.dumps(data) + parsed = jsonrpc.from_json(data_str) + actual_str = jsonrpc.to_json(parsed) + hamcrest.assert_that(actual_str, hamcrest.is_(expected)) + + +@pytest.mark.parametrize( + "data", + [ + json.dumps({}), # missing method and jsonrpc + json.dumps({"method": "invalid"}), # invalid method type + ], +) +def test_exit_invalid(data): + with pytest.raises((ClassValidationError, KeyError)): + jsonrpc.from_json(data) diff --git a/tests/python/notifications/test_progress.py b/tests/python/notifications/test_progress.py new file mode 100644 index 0000000..3f7e918 --- /dev/null +++ b/tests/python/notifications/test_progress.py @@ -0,0 +1,91 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import json + +import hamcrest +import jsonrpc +import pytest + +from lsprotocol.types import ( + ProgressNotification, + ProgressParams, + WorkDoneProgressBegin, + WorkDoneProgressEnd, + WorkDoneProgressReport, +) + + +@pytest.mark.parametrize( + "obj, expected", + [ + ( + ProgressNotification( + params=ProgressParams( + token="id1", + value=WorkDoneProgressBegin(title="Begin Progress", percentage=0), + ) + ), + json.dumps( + { + "params": { + "token": "id1", + "value": { + "title": "Begin Progress", + "kind": "begin", + "percentage": 0, + }, + }, + "method": "$/progress", + "jsonrpc": "2.0", + } + ), + ), + ( + ProgressNotification( + params=ProgressParams( + token="id1", + value=WorkDoneProgressReport(message="Still going", percentage=50), + ) + ), + json.dumps( + { + "params": { + "token": "id1", + "value": { + "kind": "report", + "message": "Still going", + "percentage": 50, + }, + }, + "method": "$/progress", + "jsonrpc": "2.0", + } + ), + ), + ( + ProgressNotification( + params=ProgressParams( + token="id1", + value=WorkDoneProgressEnd(message="Finished"), + ) + ), + json.dumps( + { + "params": { + "token": "id1", + "value": { + "kind": "end", + "message": "Finished", + }, + }, + "method": "$/progress", + "jsonrpc": "2.0", + } + ), + ), + ], +) +def test_exit_serialization(obj, expected): + actual_str = jsonrpc.to_json(obj) + hamcrest.assert_that(actual_str, hamcrest.is_(expected)) diff --git a/tests/python/requests/test_initilize_request.py b/tests/python/requests/test_initilize_request.py new file mode 100644 index 0000000..1dc259c --- /dev/null +++ b/tests/python/requests/test_initilize_request.py @@ -0,0 +1,406 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import json +import uuid + +import hamcrest +import jsonrpc +import pytest + +ID = str(uuid.uuid4()) +INITIALIZE_PARAMS = { + "processId": 1105947, + "rootPath": "/home/user/src/Personal/jedi-language-server", + "rootUri": "file:///home/user/src/Personal/jedi-language-server", + "capabilities": { + "workspace": { + "applyEdit": True, + "workspaceEdit": { + "documentChanges": True, + "resourceOperations": ["create", "rename", "delete"], + "failureHandling": "undo", + "normalizesLineEndings": True, + "changeAnnotationSupport": {"groupsOnLabel": False}, + }, + "didChangeConfiguration": {"dynamicRegistration": True}, + "didChangeWatchedFiles": { + "dynamicRegistration": True, + "relativePatternSupport": True, + }, + "codeLens": {"refreshSupport": True}, + "executeCommand": {"dynamicRegistration": True}, + "configuration": True, + "fileOperations": { + "dynamicRegistration": True, + "didCreate": True, + "didRename": True, + "didDelete": True, + "willCreate": True, + "willRename": True, + "willDelete": True, + }, + "semanticTokens": {"refreshSupport": True}, + "inlayHint": {"refreshSupport": True}, + "inlineValue": {"refreshSupport": True}, + "diagnostics": {"refreshSupport": True}, + "symbol": { + "dynamicRegistration": True, + "symbolKind": { + "valueSet": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + ] + }, + "tagSupport": {"valueSet": [1]}, + "resolveSupport": {"properties": ["location.range"]}, + }, + "workspaceFolders": True, + }, + "textDocument": { + "publishDiagnostics": { + "relatedInformation": True, + "versionSupport": True, + "tagSupport": {"valueSet": [1, 2]}, + "codeDescriptionSupport": True, + "dataSupport": True, + }, + "synchronization": { + "dynamicRegistration": True, + "willSave": True, + "willSaveWaitUntil": True, + "didSave": True, + }, + "completion": { + "dynamicRegistration": True, + "contextSupport": True, + "completionItem": { + "snippetSupport": True, + "commitCharactersSupport": True, + "documentationFormat": ["markdown", "plaintext"], + "deprecatedSupport": True, + "preselectSupport": True, + "insertReplaceSupport": True, + "tagSupport": {"valueSet": [1]}, + "resolveSupport": { + "properties": ["documentation", "detail", "additionalTextEdits"] + }, + "labelDetailsSupport": True, + "insertTextModeSupport": {"valueSet": [1, 2]}, + }, + "completionItemKind": { + "valueSet": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + ] + }, + "insertTextMode": 2, + "completionList": { + "itemDefaults": [ + "commitCharacters", + "editRange", + "insertTextFormat", + "insertTextMode", + ] + }, + }, + "hover": { + "dynamicRegistration": True, + "contentFormat": ["markdown", "plaintext"], + }, + "signatureHelp": { + "dynamicRegistration": True, + "contextSupport": True, + "signatureInformation": { + "documentationFormat": ["markdown", "plaintext"], + "activeParameterSupport": True, + "parameterInformation": {"labelOffsetSupport": True}, + }, + }, + "references": {"dynamicRegistration": True}, + "definition": {"dynamicRegistration": True, "linkSupport": True}, + "documentHighlight": {"dynamicRegistration": True}, + "documentSymbol": { + "dynamicRegistration": True, + "symbolKind": { + "valueSet": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + ] + }, + "hierarchicalDocumentSymbolSupport": True, + "tagSupport": {"valueSet": [1]}, + "labelSupport": True, + }, + "codeAction": { + "dynamicRegistration": True, + "isPreferredSupport": True, + "disabledSupport": True, + "dataSupport": True, + "honorsChangeAnnotations": False, + "resolveSupport": {"properties": ["edit"]}, + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "", + "quickfix", + "refactor", + "refactor.extract", + "refactor.inline", + "refactor.rewrite", + "source", + "source.organizeImports", + ] + } + }, + }, + "codeLens": {"dynamicRegistration": True}, + "formatting": {"dynamicRegistration": True}, + "rangeFormatting": {"dynamicRegistration": True}, + "onTypeFormatting": {"dynamicRegistration": True}, + "rename": { + "dynamicRegistration": True, + "prepareSupport": True, + "honorsChangeAnnotations": True, + "prepareSupportDefaultBehavior": 1, + }, + "documentLink": {"dynamicRegistration": True, "tooltipSupport": True}, + "typeDefinition": {"dynamicRegistration": True, "linkSupport": True}, + "implementation": {"dynamicRegistration": True, "linkSupport": True}, + "declaration": {"dynamicRegistration": True, "linkSupport": True}, + "colorProvider": {"dynamicRegistration": True}, + "foldingRange": { + "dynamicRegistration": True, + "rangeLimit": 5000, + "lineFoldingOnly": True, + "foldingRangeKind": {"valueSet": ["comment", "imports", "region"]}, + "foldingRange": {"collapsedText": False}, + }, + "selectionRange": {"dynamicRegistration": True}, + "callHierarchy": {"dynamicRegistration": True}, + "linkedEditingRange": {"dynamicRegistration": True}, + "semanticTokens": { + "dynamicRegistration": True, + "tokenTypes": [ + "namespace", + "type", + "class", + "enum", + "interface", + "struct", + "typeParameter", + "parameter", + "variable", + "property", + "enumMember", + "event", + "function", + "method", + "macro", + "keyword", + "modifier", + "comment", + "string", + "number", + "regexp", + "decorator", + "operator", + ], + "tokenModifiers": [ + "declaration", + "definition", + "readonly", + "static", + "deprecated", + "abstract", + "async", + "modification", + "documentation", + "defaultLibrary", + ], + "formats": ["relative"], + "requests": {"range": True, "full": {"delta": True}}, + "multilineTokenSupport": False, + "overlappingTokenSupport": False, + "serverCancelSupport": True, + "augmentsSyntaxTokens": True, + }, + "inlayHint": { + "dynamicRegistration": True, + "resolveSupport": { + "properties": [ + "tooltip", + "textEdits", + "label.tooltip", + "label.location", + "label.command", + ] + }, + }, + "inlineValue": {"dynamicRegistration": True}, + "diagnostic": {"dynamicRegistration": True, "relatedDocumentSupport": True}, + "typeHierarchy": {"dynamicRegistration": True}, + }, + "window": { + "showMessage": {"messageActionItem": {"additionalPropertiesSupport": True}}, + "showDocument": {"support": True}, + "workDoneProgress": True, + }, + "general": { + "regularExpressions": {"engine": "ECMAScript", "version": "ES2020"}, + "markdown": {"parser": "marked", "version": "4.0.10"}, + "positionEncodings": ["utf-16"], + "staleRequestSupport": { + "cancel": True, + "retryOnContentModified": [ + "textDocument/inlayHint", + "textDocument/semanticTokens/full", + "textDocument/semanticTokens/range", + "textDocument/semanticTokens/full/delta", + ], + }, + }, + }, + "initializationOptions": { + "enable": True, + "startupMessage": False, + "trace": {"server": "verbose"}, + "jediSettings": { + "autoImportModules": ["pygls"], + "caseInsensitiveCompletion": True, + "debug": False, + }, + "executable": {"args": [], "command": "jedi-language-server"}, + "codeAction": { + "nameExtractFunction": "jls_extract_def", + "nameExtractVariable": "jls_extract_var", + }, + "completion": { + "disableSnippets": False, + "resolveEagerly": False, + "ignorePatterns": [], + }, + "diagnostics": { + "enable": True, + "didOpen": True, + "didChange": True, + "didSave": True, + }, + "hover": { + "enable": True, + "disable": { + "class": {"all": False, "names": [], "fullNames": []}, + "function": {"all": False, "names": [], "fullNames": []}, + "instance": {"all": False, "names": [], "fullNames": []}, + "keyword": {"all": False, "names": [], "fullNames": []}, + "module": {"all": False, "names": [], "fullNames": []}, + "param": {"all": False, "names": [], "fullNames": []}, + "path": {"all": False, "names": [], "fullNames": []}, + "property": {"all": False, "names": [], "fullNames": []}, + "statement": {"all": False, "names": [], "fullNames": []}, + }, + }, + "workspace": { + "extraPaths": [], + "symbols": { + "maxSymbols": 20, + "ignoreFolders": [".nox", ".tox", ".venv", "__pycache__", "venv"], + }, + }, + }, + "trace": "verbose", + "workspaceFolders": [ + { + "uri": "file:///home/user/src/Personal/jedi-language-server", + "name": "jedi-language-server", + } + ], + "locale": "en_US", + "clientInfo": {"name": "coc.nvim", "version": "0.0.82"}, +} + + +TEST_DATA = [ + {"id": ID, "params": INITIALIZE_PARAMS, "method": "initialize", "jsonrpc": "2.0"}, +] + + +@pytest.mark.parametrize("index", list(range(0, len(TEST_DATA)))) +def test_initialize_request_params(index): + data = TEST_DATA[index] + data_str = json.dumps(data) + parsed = jsonrpc.from_json(data_str) + actual_str = jsonrpc.to_json(parsed) + actual_data = json.loads(actual_str) + hamcrest.assert_that(actual_data, hamcrest.is_(data)) diff --git a/tests/python/requests/test_inlay_hint_resolve_request.py b/tests/python/requests/test_inlay_hint_resolve_request.py new file mode 100644 index 0000000..6dc9f42 --- /dev/null +++ b/tests/python/requests/test_inlay_hint_resolve_request.py @@ -0,0 +1,86 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import json +import uuid + +import hamcrest +import jsonrpc +import pytest +from cattrs.errors import ClassValidationError + +ID = str(uuid.uuid4()) + +TEST_DATA = [ + ( + { + "id": ID, + "method": "inlayHint/resolve", + "params": { + "position": {"line": 6, "character": 5}, + "label": "a label", + "kind": 1, + "paddingLeft": False, + "paddingRight": True, + }, + "jsonrpc": "2.0", + }, + json.dumps( + { + "id": ID, + "params": { + "position": {"line": 6, "character": 5}, + "label": "a label", + "kind": 1, + "paddingLeft": False, + "paddingRight": True, + }, + "method": "inlayHint/resolve", + "jsonrpc": "2.0", + } + ), + ), + ( + { + "id": ID, + "method": "inlayHint/resolve", + "params": { + "position": {"line": 6, "character": 5}, + "label": [ + {"value": "part 1"}, + {"value": "part 2", "tooltip": "a tooltip"}, + ], + "kind": 1, + "paddingLeft": False, + "paddingRight": True, + }, + "jsonrpc": "2.0", + }, + json.dumps( + { + "id": ID, + "params": { + "position": {"line": 6, "character": 5}, + "label": [ + {"value": "part 1"}, + {"value": "part 2", "tooltip": "a tooltip"}, + ], + "kind": 1, + "paddingLeft": False, + "paddingRight": True, + }, + "method": "inlayHint/resolve", + "jsonrpc": "2.0", + } + ), + ), +] + + +@pytest.mark.parametrize("index", list(range(0, len(TEST_DATA)))) +def test_inlay_hint_resolve_request_serialization(index): + data, expected = TEST_DATA[index] + data_str = json.dumps(data) + parsed = jsonrpc.from_json(data_str) + actual_str = jsonrpc.to_json(parsed) + hamcrest.assert_that(actual_str, hamcrest.is_(expected)) diff --git a/tests/python/requests/test_workspace_sematic_tokens_refresh.py b/tests/python/requests/test_workspace_sematic_tokens_refresh.py new file mode 100644 index 0000000..fd1c64a --- /dev/null +++ b/tests/python/requests/test_workspace_sematic_tokens_refresh.py @@ -0,0 +1,53 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import json +import uuid + +import hamcrest +import jsonrpc +import pytest +from cattrs.errors import ClassValidationError + +ID = str(uuid.uuid4()) + +TEST_DATA = [ + ( + {"id": ID, "method": "workspace/semanticTokens/refresh", "jsonrpc": "2.0"}, + json.dumps( + {"id": ID, "method": "workspace/semanticTokens/refresh", "jsonrpc": "2.0"} + ), + ), + ( + { + "id": ID, + "method": "workspace/semanticTokens/refresh", + "params": None, + "jsonrpc": "2.0", + }, + json.dumps( + {"id": ID, "method": "workspace/semanticTokens/refresh", "jsonrpc": "2.0"} + ), + ), +] + + +@pytest.mark.parametrize("index", list(range(0, len(TEST_DATA)))) +def test_workspace_sematic_tokens_refresh_request_serialization(index): + data, expected = TEST_DATA[index] + data_str = json.dumps(data) + parsed = jsonrpc.from_json(data_str) + actual_str = jsonrpc.to_json(parsed) + hamcrest.assert_that(actual_str, hamcrest.is_(expected)) + + +@pytest.mark.parametrize( + "data", + [ + json.dumps({}), # missing method and jsonrpc + json.dumps({"method": "invalid"}), # invalid method type + ], +) +def test_workspace_sematic_tokens_refresh_request_invalid(data): + with pytest.raises((ClassValidationError, KeyError)): + jsonrpc.from_json(data) diff --git a/tests/python/test_cattrs_special_cases.py b/tests/python/test_cattrs_special_cases.py new file mode 100644 index 0000000..c5e0e9c --- /dev/null +++ b/tests/python/test_cattrs_special_cases.py @@ -0,0 +1,306 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from typing import Optional, Union + +import attrs +import hamcrest +import pytest +from cattrs.errors import ClassValidationError + +from lsprotocol import converters as cv +from lsprotocol import types as lsp + + +def test_simple(): + """Ensure that simple LSP types are serializable.""" + data = { + "range": { + "start": {"line": 0, "character": 0}, + "end": {"line": 0, "character": 0}, + }, + "message": "Missing module docstring", + "severity": 3, + "code": "C0114:missing-module-docstring", + "source": "my_lint", + } + converter = cv.get_converter() + obj = converter.structure(data, lsp.Diagnostic) + hamcrest.assert_that(obj, hamcrest.instance_of(lsp.Diagnostic)) + + +def test_numeric_validation(): + """Ensure that out of range numbers raise exception.""" + data = {"line": -1, "character": 0} + converter = cv.get_converter() + with pytest.raises((ClassValidationError, ValueError)): + converter.structure(data, lsp.Position) + + +def test_forward_refs(): + """Test that forward references are handled correctly by cattrs converter.""" + data = { + "uri": "something.py", + "diagnostics": [ + { + "range": { + "start": {"line": 0, "character": 0}, + "end": {"line": 0, "character": 0}, + }, + "message": "Missing module docstring", + "severity": 3, + "code": "C0114:missing-module-docstring", + "source": "my_lint", + }, + { + "range": { + "start": {"line": 2, "character": 6}, + "end": { + "line": 2, + "character": 7, + }, + }, + "message": "Undefined variable 'x'", + "severity": 1, + "code": "E0602:undefined-variable", + "source": "my_lint", + }, + { + "range": { + "start": {"line": 0, "character": 0}, + "end": { + "line": 0, + "character": 10, + }, + }, + "message": "Unused import sys", + "severity": 2, + "code": "W0611:unused-import", + "source": "my_lint", + }, + ], + } + converter = cv.get_converter() + obj = converter.structure(data, lsp.PublishDiagnosticsParams) + hamcrest.assert_that(obj, hamcrest.instance_of(lsp.PublishDiagnosticsParams)) + + +@pytest.mark.parametrize( + "data", + [ + {}, # No properties provided + {"documentSelector": None}, + {"documentSelector": []}, + {"documentSelector": [{"pattern": "something/**"}]}, + {"documentSelector": [{"language": "python"}]}, + {"documentSelector": [{"scheme": "file"}]}, + {"documentSelector": [{"notebook": "jupyter"}]}, + {"documentSelector": [{"language": "python"}]}, + {"documentSelector": [{"notebook": {"notebookType": "jupyter-notebook"}}]}, + {"documentSelector": [{"notebook": {"scheme": "file"}}]}, + {"documentSelector": [{"notebook": {"pattern": "something/**"}}]}, + { + "documentSelector": [ + {"pattern": "something/**"}, + {"language": "python"}, + {"scheme": "file"}, + {"scheme": "untitled", "language": "python"}, + {"notebook": {"pattern": "something/**"}}, + {"notebook": {"scheme": "untitled"}}, + {"notebook": {"notebookType": "jupyter-notebook"}}, + { + "notebook": {"notebookType": "jupyter-notebook"}, + "language": "jupyter", + }, + ] + }, + ], +) +def test_union_with_complex_type(data): + """Ensure types with multiple possible resolutions are handled correctly.""" + converter = cv.get_converter() + obj = converter.structure(data, lsp.TextDocumentRegistrationOptions) + hamcrest.assert_that(obj, hamcrest.instance_of(lsp.TextDocumentRegistrationOptions)) + + +def test_keyword_field(): + """Ensure that fields same names as keywords are handled correctly.""" + data = { + "from": { + "name": "something", + "kind": 5, + "uri": "something.py", + "range": { + "start": {"line": 0, "character": 0}, + "end": { + "line": 0, + "character": 10, + }, + }, + "selectionRange": { + "start": {"line": 0, "character": 2}, + "end": { + "line": 0, + "character": 8, + }, + }, + "data": {"something": "some other"}, + }, + "fromRanges": [ + { + "start": {"line": 0, "character": 0}, + "end": { + "line": 0, + "character": 10, + }, + }, + { + "start": {"line": 12, "character": 0}, + "end": { + "line": 13, + "character": 0, + }, + }, + ], + } + + converter = cv.get_converter() + obj = converter.structure(data, lsp.CallHierarchyIncomingCall) + hamcrest.assert_that(obj, hamcrest.instance_of(lsp.CallHierarchyIncomingCall)) + rev = converter.unstructure(obj, lsp.CallHierarchyIncomingCall) + hamcrest.assert_that(rev, hamcrest.is_(data)) + + +@pytest.mark.parametrize( + "data", + [ + {"settings": None}, + {"settings": 100000}, + {"settings": 1.23456}, + {"settings": True}, + {"settings": "something"}, + {"settings": {"something": "something"}}, + {"settings": []}, + {"settings": [None, None]}, + {"settings": [None, 1, 1.23, True]}, + ], +) +def test_LSPAny(data): + """Ensure that broad primitive and custom type alias is handled correctly.""" + converter = cv.get_converter() + obj = converter.structure(data, lsp.DidChangeConfigurationParams) + hamcrest.assert_that(obj, hamcrest.instance_of(lsp.DidChangeConfigurationParams)) + hamcrest.assert_that( + converter.unstructure(obj, lsp.DidChangeConfigurationParams), + hamcrest.is_(data), + ) + + +@pytest.mark.parametrize( + "data", + [ + {"label": "hi"}, + {"label": [0, 42]}, + ], +) +def test_ParameterInformation(data): + converter = cv.get_converter() + obj = converter.structure(data, lsp.ParameterInformation) + hamcrest.assert_that(obj, hamcrest.instance_of(lsp.ParameterInformation)) + hamcrest.assert_that( + converter.unstructure(obj, lsp.ParameterInformation), + hamcrest.is_(data), + ) + + +def test_completion_item(): + data = dict(label="example", documentation="This is documented") + converter = cv.get_converter() + obj = converter.structure(data, lsp.CompletionItem) + hamcrest.assert_that(obj, hamcrest.instance_of(lsp.CompletionItem)) + hamcrest.assert_that( + converter.unstructure(obj, lsp.CompletionItem), + hamcrest.is_(data), + ) + + +def test_notebook_change_event(): + data = { + "notebookDocument": { + "uri": "untitled:Untitled-1.ipynb?jupyter-notebook", + "notebookType": "jupyter-notebook", + "version": 0, + "cells": [ + { + "kind": 2, + "document": "vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D", + "metadata": {"custom": {"metadata": {}}}, + } + ], + "metadata": { + "custom": { + "cells": [], + "metadata": { + "orig_nbformat": 4, + "language_info": {"name": "python"}, + }, + }, + "indentAmount": " ", + }, + }, + "cellTextDocuments": [ + { + "uri": "vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D", + "languageId": "python", + "version": 1, + "text": "", + } + ], + } + + converter = cv.get_converter() + obj = converter.structure(data, lsp.DidOpenNotebookDocumentParams) + hamcrest.assert_that(obj, hamcrest.instance_of(lsp.DidOpenNotebookDocumentParams)) + hamcrest.assert_that( + converter.unstructure(obj, lsp.DidOpenNotebookDocumentParams), + hamcrest.is_(data), + ) + + +def test_notebook_sync_options(): + data = {"notebookSelector": [{"cells": [{"language": "python"}]}]} + + converter = cv.get_converter() + obj = converter.structure(data, lsp.NotebookDocumentSyncOptions) + hamcrest.assert_that(obj, hamcrest.instance_of(lsp.NotebookDocumentSyncOptions)) + hamcrest.assert_that( + converter.unstructure(obj, lsp.NotebookDocumentSyncOptions), + hamcrest.is_(data), + ) + + +@attrs.define +class TestPosEncoding: + """Defines the capabilities provided by a language + server.""" + + position_encoding: Optional[Union[lsp.PositionEncodingKind, str]] = attrs.field( + default=None + ) + + +@pytest.mark.parametrize("e", [None, "utf-8", "utf-16", "utf-32", "something"]) +def test_position_encoding_kind(e): + data = {"positionEncoding": e} + converter = cv.get_converter() + obj = converter.structure(data, TestPosEncoding) + hamcrest.assert_that(obj, hamcrest.instance_of(TestPosEncoding)) + + if e is None: + hamcrest.assert_that( + converter.unstructure(obj, TestPosEncoding), hamcrest.is_({}) + ) + else: + hamcrest.assert_that( + converter.unstructure(obj, TestPosEncoding), hamcrest.is_(data) + ) diff --git a/tests/python/test_custom_validators.py b/tests/python/test_custom_validators.py new file mode 100644 index 0000000..c7fe1bd --- /dev/null +++ b/tests/python/test_custom_validators.py @@ -0,0 +1,33 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import pytest + +import lsprotocol.types as lsp +import lsprotocol.validators as v + + +@pytest.mark.parametrize( + "number", [v.INTEGER_MIN_VALUE, v.INTEGER_MAX_VALUE, 0, 1, -1, 1000, -1000] +) +def test_integer_validator_basic(number): + lsp.VersionedTextDocumentIdentifier(version=number, uri="") + + +@pytest.mark.parametrize("number", [v.INTEGER_MIN_VALUE - 1, v.INTEGER_MAX_VALUE + 1]) +def test_integer_validator_out_of_range(number): + with pytest.raises(Exception): + lsp.VersionedTextDocumentIdentifier(version=number, uri="") + + +@pytest.mark.parametrize( + "number", [v.UINTEGER_MIN_VALUE, v.UINTEGER_MAX_VALUE, 0, 1, 1000, 10000] +) +def test_uinteger_validator_basic(number): + lsp.Position(line=number, character=0) + + +@pytest.mark.parametrize("number", [v.UINTEGER_MIN_VALUE - 1, v.UINTEGER_MAX_VALUE + 1]) +def test_uinteger_validator_out_of_range(number): + with pytest.raises(Exception): + lsp.Position(line=number, character=0) diff --git a/tests/python/test_enums.py b/tests/python/test_enums.py new file mode 100644 index 0000000..3db64c1 --- /dev/null +++ b/tests/python/test_enums.py @@ -0,0 +1,35 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import hamcrest +import pytest + +from lsprotocol import types as lsp + + +@pytest.mark.parametrize( + ("value", "expected"), + [ + ("refactor", lsp.CodeActionKind.Refactor), + (lsp.CodeActionKind.Refactor, lsp.CodeActionKind.Refactor), + ("namespace", lsp.SemanticTokenTypes.Namespace), + (lsp.SemanticTokenTypes.Namespace, lsp.SemanticTokenTypes.Namespace), + ("declaration", lsp.SemanticTokenModifiers.Declaration), + ( + lsp.SemanticTokenModifiers.Declaration, + lsp.SemanticTokenModifiers.Declaration, + ), + ("comment", lsp.FoldingRangeKind.Comment), + (lsp.FoldingRangeKind.Comment, lsp.FoldingRangeKind.Comment), + ("utf-8", lsp.PositionEncodingKind.Utf8), + (lsp.PositionEncodingKind.Utf8, lsp.PositionEncodingKind.Utf8), + (1, lsp.WatchKind.Create), + (lsp.WatchKind.Create, lsp.WatchKind.Create), + (-32700, lsp.ErrorCodes.ParseError), + (lsp.ErrorCodes.ParseError, lsp.ErrorCodes.ParseError), + (-32803, lsp.LSPErrorCodes.RequestFailed), + (lsp.LSPErrorCodes.RequestFailed, lsp.LSPErrorCodes.RequestFailed), + ], +) +def test_custom_enum_types(value, expected): + hamcrest.assert_that(value, hamcrest.is_(expected)) diff --git a/tests/python/test_generated_data.py b/tests/python/test_generated_data.py new file mode 100644 index 0000000..0ecee3c --- /dev/null +++ b/tests/python/test_generated_data.py @@ -0,0 +1,34 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import json +import pathlib +from typing import Generator, List, Union + +import pytest + +import lsprotocol.converters as cv +import lsprotocol.types as lsp + +TEST_DATA_ROOT = pathlib.Path(__file__).parent.parent.parent / "packages" / "testdata" + + +def get_all_json_files(root: Union[pathlib.Path, str]) -> List[pathlib.Path]: + root_path = pathlib.Path(root) + return list(root_path.glob("**/*.json")) + + +converter = cv.get_converter() + + +@pytest.mark.parametrize("json_file", get_all_json_files(TEST_DATA_ROOT)) +def test_generated_data(json_file: str) -> None: + type_name, result_type, _ = json_file.name.split("-", 2) + lsp_type = getattr(lsp, type_name) + data = json.loads(json_file.read_text(encoding="utf-8")) + + try: + converter.structure(data, lsp_type) + assert result_type == "True", "Expected error, but succeeded structuring" + except Exception as e: + assert result_type == "False", "Expected success, but failed structuring" diff --git a/tests/python/test_import.py b/tests/python/test_import.py new file mode 100644 index 0000000..db12729 --- /dev/null +++ b/tests/python/test_import.py @@ -0,0 +1,11 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import hamcrest + + +def test_import(): + """Ensure that LSP types are importable.""" + import lsprotocol.types as lsp + + hamcrest.assert_that(lsp.MarkupKind.Markdown.value, hamcrest.is_("markdown")) diff --git a/tests/python/test_location.py b/tests/python/test_location.py new file mode 100644 index 0000000..1a8cd8f --- /dev/null +++ b/tests/python/test_location.py @@ -0,0 +1,48 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import hamcrest +import pytest + +from lsprotocol import types as lsp + + +@pytest.mark.parametrize( + ("a", "b", "expected"), + [ + ( + lsp.Location( + "some_path", lsp.Range(lsp.Position(1, 23), lsp.Position(4, 56)) + ), + lsp.Location( + "some_path", lsp.Range(lsp.Position(1, 23), lsp.Position(4, 56)) + ), + True, + ), + ( + lsp.Location( + "some_path", lsp.Range(lsp.Position(1, 23), lsp.Position(4, 56)) + ), + lsp.Location( + "some_path2", lsp.Range(lsp.Position(1, 23), lsp.Position(4, 56)) + ), + False, + ), + ( + lsp.Location( + "some_path", lsp.Range(lsp.Position(1, 23), lsp.Position(4, 56)) + ), + lsp.Location( + "some_path", lsp.Range(lsp.Position(1, 23), lsp.Position(8, 91)) + ), + False, + ), + ], +) +def test_location_equality(a, b, expected): + hamcrest.assert_that(a == b, hamcrest.is_(expected)) + + +def test_location_repr(): + a = lsp.Location("some_path", lsp.Range(lsp.Position(1, 23), lsp.Position(4, 56))) + hamcrest.assert_that(f"{a!r}", hamcrest.is_("some_path:1:23-4:56")) diff --git a/tests/python/test_position.py b/tests/python/test_position.py new file mode 100644 index 0000000..67bff8b --- /dev/null +++ b/tests/python/test_position.py @@ -0,0 +1,49 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import hamcrest +import pytest + +from lsprotocol import types as lsp + + +@pytest.mark.parametrize( + ("a", "b", "comp", "expected"), + [ + (lsp.Position(1, 10), lsp.Position(1, 10), "==", True), + (lsp.Position(1, 10), lsp.Position(1, 11), "==", False), + (lsp.Position(1, 10), lsp.Position(1, 11), "!=", True), + (lsp.Position(1, 10), lsp.Position(2, 20), "!=", True), + (lsp.Position(2, 10), lsp.Position(1, 10), ">", True), + (lsp.Position(2, 10), lsp.Position(1, 10), ">=", True), + (lsp.Position(1, 11), lsp.Position(1, 10), ">", True), + (lsp.Position(1, 11), lsp.Position(1, 10), ">=", True), + (lsp.Position(1, 10), lsp.Position(1, 10), ">=", True), + (lsp.Position(1, 10), lsp.Position(2, 10), "<", True), + (lsp.Position(1, 10), lsp.Position(2, 10), "<=", True), + (lsp.Position(1, 10), lsp.Position(1, 10), "<=", True), + (lsp.Position(1, 10), lsp.Position(1, 11), "<", True), + (lsp.Position(1, 10), lsp.Position(1, 11), "<=", True), + ], +) +def test_position_comparison( + a: lsp.Position, b: lsp.Position, comp: str, expected: bool +): + if comp == "==": + result = a == b + elif comp == "!=": + result = a != b + elif comp == "<": + result = a < b + elif comp == "<=": + result = a <= b + elif comp == ">": + result = a > b + elif comp == ">=": + result = a >= b + hamcrest.assert_that(result, hamcrest.is_(expected)) + + +def test_position_repr(): + p = lsp.Position(1, 23) + hamcrest.assert_that(f"{p!r}", hamcrest.is_("1:23")) diff --git a/tests/python/test_range.py b/tests/python/test_range.py new file mode 100644 index 0000000..9977e95 --- /dev/null +++ b/tests/python/test_range.py @@ -0,0 +1,36 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import hamcrest +import pytest + +from lsprotocol import types as lsp + + +@pytest.mark.parametrize( + ("a", "b", "expected"), + [ + ( + lsp.Range(lsp.Position(1, 23), lsp.Position(4, 56)), + lsp.Range(lsp.Position(1, 23), lsp.Position(4, 56)), + True, + ), + ( + lsp.Range(lsp.Position(1, 23), lsp.Position(4, 56)), + lsp.Range(lsp.Position(1, 23), lsp.Position(4, 57)), + False, + ), + ( + lsp.Range(lsp.Position(1, 23), lsp.Position(4, 56)), + lsp.Range(lsp.Position(1, 23), lsp.Position(7, 56)), + False, + ), + ], +) +def test_range_equality(a, b, expected): + hamcrest.assert_that(a == b, hamcrest.is_(expected)) + + +def test_range_repr(): + a = lsp.Range(lsp.Position(1, 23), lsp.Position(4, 56)) + hamcrest.assert_that(f"{a!r}", hamcrest.is_("1:23-4:56")) |