pax_global_header00006660000000000000000000000064150240745600014515gustar00rootroot0000000000000052 comment=b71110640e0f1dbe535ddeb98a0e649bec0058b4 microsoft-lsprotocol-b6edfbf/000077500000000000000000000000001502407456000165605ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/.devcontainer/000077500000000000000000000000001502407456000213175ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/.devcontainer/Dockerfile000066400000000000000000000004411502407456000233100ustar00rootroot00000000000000FROM 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 -ymicrosoft-lsprotocol-b6edfbf/.devcontainer/devcontainer.json000066400000000000000000000011421502407456000246710ustar00rootroot00000000000000{ "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" }microsoft-lsprotocol-b6edfbf/.github/000077500000000000000000000000001502407456000201205ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/.github/dependabot.yml000066400000000000000000000015621502407456000227540ustar00rootroot00000000000000version: 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' microsoft-lsprotocol-b6edfbf/.github/release.yml000066400000000000000000000003731502407456000222660ustar00rootroot00000000000000changelog: exclude: labels: - "no-changelog" categories: - title: Enhancements labels: - "feature-request" - title: Bug Fixes labels: - "bug" - title: Code Health labels: - "debt" microsoft-lsprotocol-b6edfbf/.github/workflows/000077500000000000000000000000001502407456000221555ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/.github/workflows/codeql-analysis.yml000066400000000000000000000045121502407456000257720ustar00rootroot00000000000000# 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@v3 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@v3 # â„šī¸ 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@v3 microsoft-lsprotocol-b6edfbf/.github/workflows/dep-bot-auto-merge.yml000066400000000000000000000012251502407456000262750ustar00rootroot00000000000000name: Dependabot auto-merge on: pull_request permissions: contents: write pull-requests: write jobs: dependabot: runs-on: ubuntu-latest if: github.actor == 'dependabot[bot]' steps: - name: Dependabot metadata id: metadata uses: dependabot/fetch-metadata@v2 with: github-token: '${{ secrets.GITHUB_TOKEN }}' - name: Enable auto-merge for Dependabot PRs if: contains(steps.metadata.outputs.update-type, 'version-update') run: gh pr merge --auto --squash "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GH_TOKEN: ${{secrets.GITHUB_TOKEN}} microsoft-lsprotocol-b6edfbf/.github/workflows/issue-labels.yml000066400000000000000000000024161502407456000252730ustar00rootroot00000000000000name: 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@v7 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.') } microsoft-lsprotocol-b6edfbf/.github/workflows/lsp_updater.py000066400000000000000000000100411502407456000250450ustar00rootroot00000000000000# 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() microsoft-lsprotocol-b6edfbf/.github/workflows/pr-check.yml000066400000000000000000000165551502407456000244100ustar00rootroot00000000000000name: 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.8 uses: actions/setup-python@v5 with: python-version: 3.8 - name: Pip cache uses: actions/cache@v4 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 pypi package run: python -m nox --session build_python_package shell: bash - name: Upload Python Packages to Artifacts uses: actions/upload-artifact@v4 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@v5 with: python-version: '3.x' - name: Pip cache uses: actions/cache@v4 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@v4 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.8', '3.9', '3.10', '3.11', '3.12', '3.13-dev'] steps: - name: Checkout uses: actions/checkout@v4 - name: Use Python ${{ matrix.python }} uses: actions/setup-python@v5 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 python-coverage: name: Python Coverage runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Use Python 3.x uses: actions/setup-python@v5 with: python-version: '3.x' - name: Update pip, install wheel and nox run: python -m pip install -U pip wheel nox shell: bash - name: Run coverage run: python -m nox --session coverage shell: bash rust-tests: name: 'Rust 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@v5 with: python-version: '3.x' - name: Rust Tool Chain setup uses: dtolnay/rust-toolchain@stable - name: Install Generator run: python -m pip install -r ./requirements.txt - name: Generate Test Data run: python -m generator --plugin testdata - name: Rust Run Tests run: cargo test --manifest-path tests/rust/Cargo.toml shell: bash env: LSP_TEST_DATA_PATH: ${{ github.workspace }}/packages/testdata 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@v5 with: python-version: '3.x' - name: Dotnet Tool Chain setup uses: actions/setup-dotnet@v4 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@v5 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@v4 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.8', '3.9', '3.10', '3.11', '3.12'] # 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@v5 # 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 microsoft-lsprotocol-b6edfbf/.github/workflows/pr-labels.yml000066400000000000000000000007001502407456000245560ustar00rootroot00000000000000name: "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" microsoft-lsprotocol-b6edfbf/.github/workflows/push-check.yml000066400000000000000000000127671502407456000247470ustar00rootroot00000000000000name: 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.8 uses: actions/setup-python@v5 with: python-version: 3.8 - name: Pip cache uses: actions/cache@v4 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_python_package shell: bash - name: Upload Python Packages to Artifacts uses: actions/upload-artifact@v4 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@v5 with: python-version: '3.x' - name: Pip cache uses: actions/cache@v4 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@v4 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.8', '3.9', '3.10', '3.11', '3.12', '3.13-dev'] steps: - name: Checkout uses: actions/checkout@v4 - name: Use Python ${{ matrix.python }} uses: actions/setup-python@v5 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 rust-tests: name: 'Rust 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@v5 with: python-version: '3.x' - name: Rust Tool Chain setup uses: dtolnay/rust-toolchain@stable - name: Install Generator run: python -m pip install -r ./requirements.txt - name: Generate Test Data run: python -m generator --plugin testdata - name: Rust Run Tests run: cargo test --manifest-path tests/rust/Cargo.toml shell: bash env: LSP_TEST_DATA_PATH: ${{ github.workspace }}/packages/testdata 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@v5 with: python-version: '3.x' - name: Dotnet Tool Chain setup uses: actions/setup-dotnet@v4 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@v5 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@v4 with: name: dotnet-project path: | packages/dotnet/lsprotocol/*.csproj packages/dotnet/lsprotocol/*.cs if-no-files-found: error retention-days: 7 microsoft-lsprotocol-b6edfbf/.github/workflows/updater.yml000066400000000000000000000012721502407456000243460ustar00rootroot00000000000000name: 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@v5 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 }} microsoft-lsprotocol-b6edfbf/.github/workflows/version-check.yml000066400000000000000000000006441502407456000254440ustar00rootroot00000000000000name: 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@v5 with: python-version: "3.x" - name: Version Check run: python ./.github/workflows/version_check.py shell: bash microsoft-lsprotocol-b6edfbf/.github/workflows/version_check.py000066400000000000000000000013401502407456000253470ustar00rootroot00000000000000# 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) not in [today.year - 1, today.year, today.year + 1]: print(f"Version {version} year should be {today.year} or {today.year + 1}") sys.exit(1) print("Version check passed") microsoft-lsprotocol-b6edfbf/.gitignore000066400000000000000000000003601502407456000205470ustar00rootroot00000000000000out dist .venv*/ .nox/ **/__pycache__ **/.pytest_cache **/.vs **/.mypy_cache packages/rust/**/target/ packages/rust/**/Cargo.lock packages/dotnet/lsprotocol/bin/ packages/dotnet/lsprotocol/obj/ tests/rust/**/target/ tests/rust/**/Cargo.lockmicrosoft-lsprotocol-b6edfbf/.prettierrc.js000066400000000000000000000004301502407456000213540ustar00rootroot00000000000000module.exports = { singleQuote: true, printWidth: 120, tabWidth: 4, endOfLine: 'auto', trailingComma: 'all', overrides: [ { files: ['*.yml', '*.yaml'], options: { tabWidth: 2 } } ] }; microsoft-lsprotocol-b6edfbf/.vscode/000077500000000000000000000000001502407456000201215ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/.vscode/extensions.json000066400000000000000000000001741502407456000232150ustar00rootroot00000000000000{ "recommendations": ["esbenp.prettier-vscode", "ms-python.python", "ms-python.vscode-pylance", "charliermarsh.ruff"] } microsoft-lsprotocol-b6edfbf/.vscode/launch.json000066400000000000000000000016751502407456000222770ustar00rootroot00000000000000{ "version": "0.2.0", "configurations": [ { "name": "Run Generator", "type": "debugpy", "request": "launch", "module": "generator", "console": "integratedTerminal", "justMyCode": true, "args": ["--plugin", "${input:plugin}"] }, { "name": "DON'T SELECT (test debug config)", "type": "debugpy", "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"] } ] } microsoft-lsprotocol-b6edfbf/.vscode/settings.json000066400000000000000000000014771502407456000226650ustar00rootroot00000000000000{ "files.exclude": { "**/.git": true, "**/__pycache__": true, "**/.mypy_cache": true, "**/.pytest_cache": true, "**/.nox": true }, "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.organizeImports": "explicit" }, "[python]": { "editor.defaultFormatter": "charliermarsh.ruff", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.organizeImports.ruff": "explicit" } }, "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", "tests/rust/Cargo.toml"] } microsoft-lsprotocol-b6edfbf/CODE_OF_CONDUCT.md000066400000000000000000000006741502407456000213660ustar00rootroot00000000000000# 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 microsoft-lsprotocol-b6edfbf/LICENSE000066400000000000000000000021651502407456000175710ustar00rootroot00000000000000 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 microsoft-lsprotocol-b6edfbf/README.md000066400000000000000000000131401502407456000200360ustar00rootroot00000000000000# Language Server Protocol types code generator & packages This repository contains packages and tools to generate code for [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) types and classes. It simplifies the creation of language servers for different programming languages by providing a robust and easy-to-use type generation system. âžĄī¸ For instructions on how to use the **code generator**, refer to the [Usage](#code-generator-usage) section. âžĄī¸ For instructions on existing **plugins and packages** for different languages, refer to the table in the [Existing packages/plugins](#existing-packagesplugins) section. âžĄī¸ For instructions on how to **create additional plugins** to support more languages, refer to the [Contributing plugins](#contributing-plugins) section. # Code Generator Usage You will need a Python environment to run the generator. Here are the steps: 1. Create a Python environment: `python -m venv .venv` > **Note**: Python 3.8 is the minimum supported version 2. Activate the environment: `.venv\Scripts\activate` (Windows) or `source .venv/bin/activate` (Linux/macOS) 3. Install this repo's tool: `python -m pip install git+https://github.com/microsoft/lsprotocol.git` 4. Run your plugin. You can use the [command line](#command-line) or [Nox](#using-nox) to run the generator. ## Command line Clone this repository and run `generator` as a Python module. For example: `python -m generator --plugin dotnet --output-dir ./code` ```console > python -m generator --help usage: __main__.py [-h] [--model [MODEL ...]] --plugin PLUGIN [--output-dir OUTPUT_DIR] [--test-dir TEST_DIR] Generate types from LSP JSON model. options: -h, --help show this help message and exit --model [MODEL ...], -m [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 written. --test-dir TEST_DIR, -t TEST_DIR Path to a directory where the generated tests are written. ``` ## Using Nox This project uses Nox as a task runner to run the code generator. You can install Nox and run a `build_lsp` session to generate code from the spec available in this repo. ```console > python -m pip install nox > nox --session build_lsp ``` You can also use Nox to format code, run tests and run various tasks. Run `nox --list` to see all available tasks. # Contributing plugins ## Adding a new plugin Follow these steps to generate boilerplate code for a new plugin: 1. Create a virtual environment for Python using Python >= 3.8 and activate that environment. 1. If you are using the Python extension for VS Code, you can just run the **Python: Create Environment** command from the Command Palette. Be sure to select all the `requirements.txt` files in the repo. This command will install all packages needed and select the newly created environment for you. 1. Ensure `nox` is installed. 1. Run `nox --list` in the terminal. If Nox is installed, you should see a list of all available sessions. Otherwise, run `python -m pip install nox` in the activated 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. ``` # Existing packages/plugins Below is the list of plugins already created using this package, with their respective package links. | Language | Plugin Module | Package | Status | Documentation | | -------- | ------------------------ | --------------------------------------------------------------------------------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------- | | Python | generator.plugins.python | [![PyPI](https://img.shields.io/pypi/v/lsprotocol?label=lsprotocol)](https://pypi.org/p/lsprotocol) | Active | [Python package README](./packages/python/README.md) | | Rust | generator.plugins.rust | [![Crates](https://img.shields.io/crates/v/lsprotocol)](https://crates.io/crates/lsprotocol) | Active | [Rust package README](./packages/rust/lsprotocol/README.md) | | Dotnet | generator.plugins.dotnet | | Under development | | | Crystal | | [nobodywasishere/lsprotocol-crystal](https://github.com/nobodywasishere/lsprotocol-crystal) | Active | [CrystalDoc.info](https://crystaldoc.info/github/nobodywasishere/lsprotocol-crystal/main/index.html) | | Golang | | [myleshyson/lsprotocol-go](https://github.com/myleshyson/lsprotocol-go) | Active | [myleshyson/lsprotocol-go](https://github.com/myleshyson/lsprotocol-go) | microsoft-lsprotocol-b6edfbf/RELEASE.md000066400000000000000000000037241502407456000201700ustar00rootroot00000000000000# How to ship a release 1. Ensure that the project version number in [`packages/python/pyproject.toml`](packages/python/pyproject.toml) has been updated. Historically we have sometimes done this before the release. If not, change it now. Our versioning scheme is: | Release type | Version format | Notes | |--------------|----------------|-------| | Stable | YYYY.0.N | `N` starts at `0` and increments with each release during the year | | Release candidate | YYYY.0.NrcX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each RC | | Beta | YYYY.0.NbX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each beta release | | Alpha | YYYY.0.NaX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each alpha release | 1. Run the [`lsprotocol-Release` pipeline](https://dev.azure.com/devdiv/DevDiv/_build?definitionId=26767) against the `main` branch and check the `🚀 Publish Package` checkbox. 1. Wait for the pipeline to reach the `WaitForValidation` stage. 1. Run the `pygls` tests against the new release: 1. `git clone https://github.com/openlawlibrary/pygls` 1. `cd pygls` 1. `poetry install --all-extras` -- Save the path to the generated virtualenv 1. `poetry run poe test` -- Baseline. Note which tests fail, if any. Don't run their `test-pyodide` tests. 1. Download the `lsprotocol-*.tar.gz` file from the Github Release created by the pipeline. 1. Remove the `lsprotocol` directory in the Poetry virtualenv and create a new one using the `lsprotocol` directory within the `tar.gz`. 1. Rerun the tests -- Compare against baseline. 1. Once you're satisfied with the release, publish it by going to the `lsprotocol-Release` pipeline run that you started earlier and pressing the blue `Review` button and then pressing the blue `Resume` button to initiate publishing. 1. Publish the GitHub release (it was created as a draft). microsoft-lsprotocol-b6edfbf/SECURITY.md000066400000000000000000000053051502407456000203540ustar00rootroot00000000000000 ## 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). microsoft-lsprotocol-b6edfbf/SUPPORT.md000066400000000000000000000007261502407456000202630ustar00rootroot00000000000000# 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. microsoft-lsprotocol-b6edfbf/azure-pipelines/000077500000000000000000000000001502407456000216745ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/azure-pipelines/release-pypi.yml000066400000000000000000000144651502407456000250300ustar00rootroot00000000000000name: Release trigger: none pr: none resources: repositories: - repository: MicroBuildTemplate type: git name: 1ESPipelineTemplates/MicroBuildTemplate ref: refs/tags/release parameters: - name: publishPackage displayName: 🚀 Publish Package type: boolean default: false variables: ARTIFACT_NAME_WHEEL: wheel architecture: x64 python.version: '3.8' TeamName: lsprotocol extends: template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate parameters: sdl: sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES pool: name: AzurePipelines-EO demands: - ImageOverride -equals 1ESPT-Ubuntu22.04 os: Linux customBuildTags: - ES365AIMigrationTooling stages: - stage: Build displayName: Build jobs: - job: Build templateContext: outputs: - output: pipelineArtifact targetPath: $(Build.StagingDirectory)/dist sbomBuildDropPath: $(Build.StagingDirectory)/dist artifactName: $(ARTIFACT_NAME_WHEEL) steps: - checkout: self fetchDepth: 1 fetchTags: false - task: UsePythonVersion@0 inputs: versionSpec: '$(python.version)' architecture: '$(architecture)' displayName: 'Use Python $(python.version) $(architecture)' - script: python -m pip install nox displayName: Install nox - script: python -m nox --session build_python_package displayName: Build package (sdist and wheels) - powershell: | python -m pip install toml-cli $releaseVersion = & toml get --toml-path packages/python/pyproject.toml project.version echo "releaseVersion: $releaseVersion" echo "##vso[task.setvariable variable=releaseVersion;isOutput=true]$releaseVersion" displayName: Get release version name: getReleaseVersionStep - script: ls -al packages/python/dist - task: CopyFiles@2 displayName: Copy wheel and tarball inputs: sourceFolder: packages/python/dist targetFolder: $(Build.StagingDirectory)/dist contents: | lsprotocol-$(getReleaseVersionStep.releaseVersion)-py3-none-any.whl lsprotocol-$(getReleaseVersionStep.releaseVersion).tar.gz - stage: CreateTag displayName: Create Tag dependsOn: Build variables: releaseVersion: $[ stageDependencies.Build.Build.outputs['getReleaseVersionStep.releaseVersion'] ] jobs: - job: CreateTag steps: - checkout: self fetchDepth: 1 fetchTags: false persistCredentials: true - script: | git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.name "Azure Piplines" git fetch --depth 1 origin $(Build.SourceBranchName) git tag -a $(releaseVersion) -m "Release $(releaseVersion)" origin/$(Build.SourceBranchName) git push origin $(releaseVersion) displayName: Create git tag - stage: CreateRelease displayName: Create GitHub Release dependsOn: - Build - CreateTag variables: releaseVersion: $[ stageDependencies.Build.Build.outputs['getReleaseVersionStep.releaseVersion'] ] jobs: - job: CreateRelease templateContext: type: releaseJob isProduction: true inputs: - input: pipelineArtifact artifactName: $(ARTIFACT_NAME_WHEEL) targetPath: $(Build.StagingDirectory)/dist steps: - task: GitHubRelease@1 #https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/github-release-v1?view=azure-pipelines displayName: Create GitHub Release inputs: gitHubConnection: GitHub-lsprotocol repositoryName: microsoft/lsprotocol action: create target: $(Build.SourceBranchName) title: $(releaseVersion) tag: $(releaseVersion) tagSource: userSpecifiedTag isDraft: true addChangeLog: false assets: $(Build.StagingDirectory)/dist/* - stage: WaitForValidation dependsOn: CreateRelease condition: and(succeeded(), ${{ parameters.publishPackage }}) jobs: - job: wait_for_validation displayName: Wait for manual validation pool: server steps: - task: ManualValidation@0 timeoutInMinutes: 1440 # task times out in 1 day inputs: notifyUsers: erikd@microsoft.com instructions: Please test the latest draft release and then publish it. onTimeout: reject - stage: Release dependsOn: WaitForValidation jobs: - job: PublishToPyPi displayName: Release to PyPi pool: name: VSEngSS-MicroBuild2022-1ES # This pool is required to have the certs needed to publish to PyPi using ESRP. os: windows image: server2022-microbuildVS2022-1es templateContext: type: releaseJob isProduction: true inputs: - input: pipelineArtifact artifactName: $(ARTIFACT_NAME_WHEEL) targetPath: $(Build.StagingDirectory)/dist steps: - template: MicroBuild.Publish.yml@MicroBuildTemplate parameters: intent: PackageDistribution contentType: PyPi contentSource: Folder folderLocation: $(Build.StagingDirectory)/dist waitForReleaseCompletion: true owners: erikd@microsoft.com approvers: grwheele@microsoft.com microsoft-lsprotocol-b6edfbf/azure-pipelines/source_scan.yml000066400000000000000000000002621502407456000247230ustar00rootroot00000000000000trigger: - main variables: Codeql.Enabled: true stages: - stage: pre_build displayName: Pre-build validation jobs: - template: template/static_analysis.yml microsoft-lsprotocol-b6edfbf/azure-pipelines/template/000077500000000000000000000000001502407456000235075ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/azure-pipelines/template/static_analysis.yml000066400000000000000000000042661502407456000274340ustar00rootroot00000000000000jobs: - 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 microsoft-lsprotocol-b6edfbf/conftest.py000066400000000000000000000004661502407456000207650ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os import pathlib import sys sys.path.append(os.fspath(pathlib.Path(__file__).parent / "packages" / "python")) sys.path.append( os.fspath(pathlib.Path(__file__).parent / "tests" / "python" / "common") ) microsoft-lsprotocol-b6edfbf/generator/000077500000000000000000000000001502407456000205465ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/generator/__init__.py000066400000000000000000000001361502407456000226570ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. microsoft-lsprotocol-b6edfbf/generator/__main__.py000066400000000000000000000065471502407456000226540ustar00rootroot00000000000000# 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" TESTS_ROOT = pathlib.Path(__file__).parent.parent / "tests" 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, ) parser.add_argument( "--test-dir", "-t", help="Path to a directory where the generated tests are written.", type=str, ) return parser def custom_plugin(plugin: str) -> None: LOGGER.info(f"Loading plugin: {plugin}.") try: plugin_module = importlib.import_module(plugin) except ImportError: LOGGER.info(f"Loading plugin: generator.plugins.{plugin}.") plugin_module = importlib.import_module(f"generator.plugins.{plugin}") return plugin_module 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) test_dir = args.test_dir or os.fspath(TESTS_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: plugin_module = custom_plugin(plugin) LOGGER.info(f"Running plugin: {plugin}.") plugin_module.generate(spec, output_dir, test_dir) LOGGER.info(f"Plugin {plugin} completed.") except Exception as e: LOGGER.error(f"Error running plugin {plugin}:", exc_info=e) raise e if __name__ == "__main__": setup_logging() main(sys.argv[1:]) microsoft-lsprotocol-b6edfbf/generator/lsp.json000066400000000000000000023647321502407456000222600ustar00rootroot00000000000000{ "metaData": { "version": "3.17.0" }, "requests": [ { "method": "textDocument/implementation", "typeName": "ImplementationRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "Definition" }, { "kind": "array", "element": { "kind": "reference", "name": "DefinitionLink" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.implementation", "serverCapability": "implementationProvider", "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", "typeName": "TypeDefinitionRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "Definition" }, { "kind": "array", "element": { "kind": "reference", "name": "DefinitionLink" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.typeDefinition", "serverCapability": "typeDefinitionProvider", "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", "typeName": "WorkspaceFoldersRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "WorkspaceFolder" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "serverToClient", "clientCapability": "workspace.workspaceFolders", "serverCapability": "workspace.workspaceFolders", "documentation": "The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders." }, { "method": "workspace/configuration", "typeName": "ConfigurationRequest", "result": { "kind": "array", "element": { "kind": "reference", "name": "LSPAny" } }, "messageDirection": "serverToClient", "clientCapability": "workspace.configuration", "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", "typeName": "DocumentColorRequest", "result": { "kind": "array", "element": { "kind": "reference", "name": "ColorInformation" } }, "messageDirection": "clientToServer", "clientCapability": "textDocument.colorProvider", "serverCapability": "colorProvider", "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", "typeName": "ColorPresentationRequest", "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", "typeName": "FoldingRangeRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "FoldingRange" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.foldingRange", "serverCapability": "foldingRangeProvider", "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", "typeName": "FoldingRangeRefreshRequest", "result": { "kind": "base", "name": "null" }, "messageDirection": "serverToClient", "clientCapability": "workspace.foldingRange.refreshSupport", "documentation": "@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "method": "textDocument/declaration", "typeName": "DeclarationRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "Declaration" }, { "kind": "array", "element": { "kind": "reference", "name": "DeclarationLink" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.declaration", "serverCapability": "declarationProvider", "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", "typeName": "SelectionRangeRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "SelectionRange" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.selectionRange", "serverCapability": "selectionRangeProvider", "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", "typeName": "WorkDoneProgressCreateRequest", "result": { "kind": "base", "name": "null" }, "messageDirection": "serverToClient", "clientCapability": "window.workDoneProgress", "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", "typeName": "CallHierarchyPrepareRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "CallHierarchyItem" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.callHierarchy", "serverCapability": "callHierarchyProvider", "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", "typeName": "CallHierarchyIncomingCallsRequest", "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", "typeName": "CallHierarchyOutgoingCallsRequest", "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", "typeName": "SemanticTokensRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "SemanticTokens" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.semanticTokens", "serverCapability": "semanticTokensProvider", "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", "typeName": "SemanticTokensDeltaRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "SemanticTokens" }, { "kind": "reference", "name": "SemanticTokensDelta" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.semanticTokens.requests.full.delta", "serverCapability": "semanticTokensProvider.full.delta", "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", "typeName": "SemanticTokensRangeRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "SemanticTokens" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.semanticTokens.requests.range", "serverCapability": "semanticTokensProvider.range", "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", "typeName": "SemanticTokensRefreshRequest", "result": { "kind": "base", "name": "null" }, "messageDirection": "serverToClient", "clientCapability": "workspace.semanticTokens.refreshSupport", "documentation": "@since 3.16.0", "since": "3.16.0" }, { "method": "window/showDocument", "typeName": "ShowDocumentRequest", "result": { "kind": "reference", "name": "ShowDocumentResult" }, "messageDirection": "serverToClient", "clientCapability": "window.showDocument.support", "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", "typeName": "LinkedEditingRangeRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "LinkedEditingRanges" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.linkedEditingRange", "serverCapability": "linkedEditingRangeProvider", "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", "typeName": "WillCreateFilesRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "WorkspaceEdit" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "workspace.fileOperations.willCreate", "serverCapability": "workspace.fileOperations.willCreate", "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", "typeName": "WillRenameFilesRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "WorkspaceEdit" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "workspace.fileOperations.willRename", "serverCapability": "workspace.fileOperations.willRename", "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", "typeName": "WillDeleteFilesRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "WorkspaceEdit" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "workspace.fileOperations.willDelete", "serverCapability": "workspace.fileOperations.willDelete", "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", "typeName": "MonikerRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "Moniker" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.moniker", "serverCapability": "monikerProvider", "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", "typeName": "TypeHierarchyPrepareRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "TypeHierarchyItem" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.typeHierarchy", "serverCapability": "typeHierarchyProvider", "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", "typeName": "TypeHierarchySupertypesRequest", "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", "typeName": "TypeHierarchySubtypesRequest", "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", "typeName": "InlineValueRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "InlineValue" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.inlineValue", "serverCapability": "inlineValueProvider", "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", "typeName": "InlineValueRefreshRequest", "result": { "kind": "base", "name": "null" }, "messageDirection": "serverToClient", "clientCapability": "workspace.inlineValue.refreshSupport", "documentation": "@since 3.17.0", "since": "3.17.0" }, { "method": "textDocument/inlayHint", "typeName": "InlayHintRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "InlayHint" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.inlayHint", "serverCapability": "inlayHintProvider", "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", "typeName": "InlayHintResolveRequest", "result": { "kind": "reference", "name": "InlayHint" }, "messageDirection": "clientToServer", "clientCapability": "textDocument.inlayHint.resolveSupport", "serverCapability": "inlayHintProvider.resolveProvider", "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", "typeName": "InlayHintRefreshRequest", "result": { "kind": "base", "name": "null" }, "messageDirection": "serverToClient", "clientCapability": "workspace.inlayHint.refreshSupport", "documentation": "@since 3.17.0", "since": "3.17.0" }, { "method": "textDocument/diagnostic", "typeName": "DocumentDiagnosticRequest", "result": { "kind": "reference", "name": "DocumentDiagnosticReport" }, "messageDirection": "clientToServer", "clientCapability": "textDocument.diagnostic", "serverCapability": "diagnosticProvider", "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", "typeName": "WorkspaceDiagnosticRequest", "result": { "kind": "reference", "name": "WorkspaceDiagnosticReport" }, "messageDirection": "clientToServer", "clientCapability": "workspace.diagnostics", "serverCapability": "diagnosticProvider.workspaceDiagnostics", "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", "typeName": "DiagnosticRefreshRequest", "result": { "kind": "base", "name": "null" }, "messageDirection": "serverToClient", "clientCapability": "workspace.diagnostics.refreshSupport", "documentation": "The diagnostic refresh request definition.\n\n@since 3.17.0", "since": "3.17.0" }, { "method": "textDocument/inlineCompletion", "typeName": "InlineCompletionRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "InlineCompletionList" }, { "kind": "array", "element": { "kind": "reference", "name": "InlineCompletionItem" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.inlineCompletion", "serverCapability": "inlineCompletionProvider", "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": "workspace/textDocumentContent", "typeName": "TextDocumentContentRequest", "result": { "kind": "reference", "name": "TextDocumentContentResult" }, "messageDirection": "clientToServer", "clientCapability": "workspace.textDocumentContent", "serverCapability": "workspace.textDocumentContent", "params": { "kind": "reference", "name": "TextDocumentContentParams" }, "registrationOptions": { "kind": "reference", "name": "TextDocumentContentRegistrationOptions" }, "documentation": "The `workspace/textDocumentContent` request is sent from the client to the\nserver to request the content of a text document.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "method": "workspace/textDocumentContent/refresh", "typeName": "TextDocumentContentRefreshRequest", "result": { "kind": "base", "name": "null" }, "messageDirection": "serverToClient", "params": { "kind": "reference", "name": "TextDocumentContentRefreshParams" }, "documentation": "The `workspace/textDocumentContent` request is sent from the server to the client to refresh\nthe content of a specific text document.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "method": "client/registerCapability", "typeName": "RegistrationRequest", "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", "typeName": "UnregistrationRequest", "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", "typeName": "InitializeRequest", "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", "typeName": "ShutdownRequest", "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", "typeName": "ShowMessageRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "MessageActionItem" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "serverToClient", "clientCapability": "window.showMessage", "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", "typeName": "WillSaveTextDocumentWaitUntilRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "TextEdit" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.synchronization.willSaveWaitUntil", "serverCapability": "textDocumentSync.willSaveWaitUntil", "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", "typeName": "CompletionRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "CompletionItem" } }, { "kind": "reference", "name": "CompletionList" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.completion", "serverCapability": "completionProvider", "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", "typeName": "CompletionResolveRequest", "result": { "kind": "reference", "name": "CompletionItem" }, "messageDirection": "clientToServer", "clientCapability": "textDocument.completion.completionItem.resolveSupport", "serverCapability": "completionProvider.resolveProvider", "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", "typeName": "HoverRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "Hover" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.hover", "serverCapability": "hoverProvider", "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", "typeName": "SignatureHelpRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "SignatureHelp" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.signatureHelp", "serverCapability": "signatureHelpProvider", "params": { "kind": "reference", "name": "SignatureHelpParams" }, "registrationOptions": { "kind": "reference", "name": "SignatureHelpRegistrationOptions" } }, { "method": "textDocument/definition", "typeName": "DefinitionRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "Definition" }, { "kind": "array", "element": { "kind": "reference", "name": "DefinitionLink" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.definition", "serverCapability": "definitionProvider", "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", "typeName": "ReferencesRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "Location" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.references", "serverCapability": "referencesProvider", "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", "typeName": "DocumentHighlightRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "DocumentHighlight" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.documentHighlight", "serverCapability": "documentHighlightProvider", "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", "typeName": "DocumentSymbolRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "SymbolInformation" } }, { "kind": "array", "element": { "kind": "reference", "name": "DocumentSymbol" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.documentSymbol", "serverCapability": "documentSymbolProvider", "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", "typeName": "CodeActionRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "or", "items": [ { "kind": "reference", "name": "Command" }, { "kind": "reference", "name": "CodeAction" } ] } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.codeAction", "serverCapability": "codeActionProvider", "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", "typeName": "CodeActionResolveRequest", "result": { "kind": "reference", "name": "CodeAction" }, "messageDirection": "clientToServer", "clientCapability": "textDocument.codeAction.resolveSupport", "serverCapability": "codeActionProvider.resolveProvider", "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", "typeName": "WorkspaceSymbolRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "SymbolInformation" } }, { "kind": "array", "element": { "kind": "reference", "name": "WorkspaceSymbol" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "workspace.symbol", "serverCapability": "workspaceSymbolProvider", "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", "typeName": "WorkspaceSymbolResolveRequest", "result": { "kind": "reference", "name": "WorkspaceSymbol" }, "messageDirection": "clientToServer", "clientCapability": "workspace.symbol.resolveSupport", "serverCapability": "workspaceSymbolProvider.resolveProvider", "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", "typeName": "CodeLensRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "CodeLens" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.codeLens", "serverCapability": "codeLensProvider", "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", "typeName": "CodeLensResolveRequest", "result": { "kind": "reference", "name": "CodeLens" }, "messageDirection": "clientToServer", "clientCapability": "textDocument.codeLens.resolveSupport", "serverCapability": "codeLensProvider.resolveProvider", "params": { "kind": "reference", "name": "CodeLens" }, "documentation": "A request to resolve a command for a given code lens." }, { "method": "workspace/codeLens/refresh", "typeName": "CodeLensRefreshRequest", "result": { "kind": "base", "name": "null" }, "messageDirection": "serverToClient", "clientCapability": "workspace.codeLens", "documentation": "A request to refresh all code actions\n\n@since 3.16.0", "since": "3.16.0" }, { "method": "textDocument/documentLink", "typeName": "DocumentLinkRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "DocumentLink" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.documentLink", "serverCapability": "documentLinkProvider", "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", "typeName": "DocumentLinkResolveRequest", "result": { "kind": "reference", "name": "DocumentLink" }, "messageDirection": "clientToServer", "clientCapability": "textDocument.documentLink", "serverCapability": "documentLinkProvider.resolveProvider", "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", "typeName": "DocumentFormattingRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "TextEdit" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.formatting", "serverCapability": "documentFormattingProvider", "params": { "kind": "reference", "name": "DocumentFormattingParams" }, "registrationOptions": { "kind": "reference", "name": "DocumentFormattingRegistrationOptions" }, "documentation": "A request to format a whole document." }, { "method": "textDocument/rangeFormatting", "typeName": "DocumentRangeFormattingRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "TextEdit" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.rangeFormatting", "serverCapability": "documentRangeFormattingProvider", "params": { "kind": "reference", "name": "DocumentRangeFormattingParams" }, "registrationOptions": { "kind": "reference", "name": "DocumentRangeFormattingRegistrationOptions" }, "documentation": "A request to format a range in a document." }, { "method": "textDocument/rangesFormatting", "typeName": "DocumentRangesFormattingRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "TextEdit" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.rangeFormatting.rangesSupport", "serverCapability": "documentRangeFormattingProvider.rangesSupport", "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", "typeName": "DocumentOnTypeFormattingRequest", "result": { "kind": "or", "items": [ { "kind": "array", "element": { "kind": "reference", "name": "TextEdit" } }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.onTypeFormatting", "serverCapability": "documentOnTypeFormattingProvider", "params": { "kind": "reference", "name": "DocumentOnTypeFormattingParams" }, "registrationOptions": { "kind": "reference", "name": "DocumentOnTypeFormattingRegistrationOptions" }, "documentation": "A request to format a document on type." }, { "method": "textDocument/rename", "typeName": "RenameRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "WorkspaceEdit" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.rename", "serverCapability": "renameProvider", "params": { "kind": "reference", "name": "RenameParams" }, "registrationOptions": { "kind": "reference", "name": "RenameRegistrationOptions" }, "documentation": "A request to rename a symbol." }, { "method": "textDocument/prepareRename", "typeName": "PrepareRenameRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "PrepareRenameResult" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "textDocument.rename.prepareSupport", "serverCapability": "renameProvider.prepareProvider", "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", "typeName": "ExecuteCommandRequest", "result": { "kind": "or", "items": [ { "kind": "reference", "name": "LSPAny" }, { "kind": "base", "name": "null" } ] }, "messageDirection": "clientToServer", "clientCapability": "workspace.executeCommand", "serverCapability": "executeCommandProvider", "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", "typeName": "ApplyWorkspaceEditRequest", "result": { "kind": "reference", "name": "ApplyWorkspaceEditResult" }, "messageDirection": "serverToClient", "clientCapability": "workspace.applyEdit", "params": { "kind": "reference", "name": "ApplyWorkspaceEditParams" }, "documentation": "A request sent from the server to the client to modified certain resources." } ], "notifications": [ { "method": "workspace/didChangeWorkspaceFolders", "typeName": "DidChangeWorkspaceFoldersNotification", "messageDirection": "clientToServer", "serverCapability": "workspace.workspaceFolders.changeNotifications", "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", "typeName": "WorkDoneProgressCancelNotification", "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", "typeName": "DidCreateFilesNotification", "messageDirection": "clientToServer", "clientCapability": "workspace.fileOperations.didCreate", "serverCapability": "workspace.fileOperations.didCreate", "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", "typeName": "DidRenameFilesNotification", "messageDirection": "clientToServer", "clientCapability": "workspace.fileOperations.didRename", "serverCapability": "workspace.fileOperations.didRename", "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", "typeName": "DidDeleteFilesNotification", "messageDirection": "clientToServer", "clientCapability": "workspace.fileOperations.didDelete", "serverCapability": "workspace.fileOperations.didDelete", "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", "typeName": "DidOpenNotebookDocumentNotification", "messageDirection": "clientToServer", "params": { "kind": "reference", "name": "DidOpenNotebookDocumentParams" }, "registrationMethod": "notebookDocument/sync", "registrationOptions": { "kind": "reference", "name": "NotebookDocumentSyncRegistrationOptions" }, "documentation": "A notification sent when a notebook opens.\n\n@since 3.17.0", "since": "3.17.0" }, { "method": "notebookDocument/didChange", "typeName": "DidChangeNotebookDocumentNotification", "messageDirection": "clientToServer", "params": { "kind": "reference", "name": "DidChangeNotebookDocumentParams" }, "registrationMethod": "notebookDocument/sync", "registrationOptions": { "kind": "reference", "name": "NotebookDocumentSyncRegistrationOptions" } }, { "method": "notebookDocument/didSave", "typeName": "DidSaveNotebookDocumentNotification", "messageDirection": "clientToServer", "params": { "kind": "reference", "name": "DidSaveNotebookDocumentParams" }, "registrationMethod": "notebookDocument/sync", "registrationOptions": { "kind": "reference", "name": "NotebookDocumentSyncRegistrationOptions" }, "documentation": "A notification sent when a notebook document is saved.\n\n@since 3.17.0", "since": "3.17.0" }, { "method": "notebookDocument/didClose", "typeName": "DidCloseNotebookDocumentNotification", "messageDirection": "clientToServer", "params": { "kind": "reference", "name": "DidCloseNotebookDocumentParams" }, "registrationMethod": "notebookDocument/sync", "registrationOptions": { "kind": "reference", "name": "NotebookDocumentSyncRegistrationOptions" }, "documentation": "A notification sent when a notebook closes.\n\n@since 3.17.0", "since": "3.17.0" }, { "method": "initialized", "typeName": "InitializedNotification", "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", "typeName": "ExitNotification", "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", "typeName": "DidChangeConfigurationNotification", "messageDirection": "clientToServer", "clientCapability": "workspace.didChangeConfiguration", "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", "typeName": "ShowMessageNotification", "messageDirection": "serverToClient", "clientCapability": "window.showMessage", "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", "typeName": "LogMessageNotification", "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", "typeName": "TelemetryEventNotification", "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", "typeName": "DidOpenTextDocumentNotification", "messageDirection": "clientToServer", "clientCapability": "textDocument.synchronization", "serverCapability": "textDocumentSync.openClose", "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", "typeName": "DidChangeTextDocumentNotification", "messageDirection": "clientToServer", "clientCapability": "textDocument.synchronization", "serverCapability": "textDocumentSync", "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", "typeName": "DidCloseTextDocumentNotification", "messageDirection": "clientToServer", "clientCapability": "textDocument.synchronization", "serverCapability": "textDocumentSync.openClose", "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", "typeName": "DidSaveTextDocumentNotification", "messageDirection": "clientToServer", "clientCapability": "textDocument.synchronization.didSave", "serverCapability": "textDocumentSync.save", "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", "typeName": "WillSaveTextDocumentNotification", "messageDirection": "clientToServer", "clientCapability": "textDocument.synchronization.willSave", "serverCapability": "textDocumentSync.willSave", "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", "typeName": "DidChangeWatchedFilesNotification", "messageDirection": "clientToServer", "clientCapability": "workspace.didChangeWatchedFiles", "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", "typeName": "PublishDiagnosticsNotification", "messageDirection": "serverToClient", "clientCapability": "textDocument.publishDiagnostics", "params": { "kind": "reference", "name": "PublishDiagnosticsParams" }, "documentation": "Diagnostics notification are sent from the server to the client to signal\nresults of validation runs." }, { "method": "$/setTrace", "typeName": "SetTraceNotification", "messageDirection": "clientToServer", "params": { "kind": "reference", "name": "SetTraceParams" } }, { "method": "$/logTrace", "typeName": "LogTraceNotification", "messageDirection": "serverToClient", "params": { "kind": "reference", "name": "LogTraceParams" } }, { "method": "$/cancelRequest", "typeName": "CancelNotification", "messageDirection": "both", "params": { "kind": "reference", "name": "CancelParams" } }, { "method": "$/progress", "typeName": "ProgressNotification", "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.\n\nIf multiple hints have the same position, they will be shown in the order\nthey appear in the response." }, { "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": "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": "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": "TextDocumentContentParams", "properties": [ { "name": "uri", "type": { "kind": "base", "name": "DocumentUri" }, "documentation": "The uri of the text document." } ], "documentation": "Parameters for the `workspace/textDocumentContent` request.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "name": "TextDocumentContentResult", "properties": [ { "name": "text", "type": { "kind": "base", "name": "string" }, "documentation": "The text content of the text document. Please note, that the content of\nany subsequent open notifications for the text document might differ\nfrom the returned content due to whitespace and line ending\nnormalizations done on the client" } ], "documentation": "Result of the `workspace/textDocumentContent` request.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "name": "TextDocumentContentRegistrationOptions", "properties": [], "extends": [ { "kind": "reference", "name": "TextDocumentContentOptions" } ], "mixins": [ { "kind": "reference", "name": "StaticRegistrationOptions" } ], "documentation": "Text document content provider registration options.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "name": "TextDocumentContentRefreshParams", "properties": [ { "name": "uri", "type": { "kind": "base", "name": "DocumentUri" }, "documentation": "The uri of the text document to refresh." } ], "documentation": "Parameters for the `workspace/textDocumentContent/refresh` request.\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": "reference", "name": "ServerInfo" }, "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` 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": "reference", "name": "CompletionItemDefaults" }, "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 rules for combining these are\ndefined by `applyKinds` (if the client supports it), defaulting to\nApplyKind.Replace.\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": "applyKind", "type": { "kind": "reference", "name": "CompletionItemApplyKinds" }, "optional": true, "documentation": "Specifies how fields from a completion item should be combined with those\nfrom `completionList.itemDefaults`.\n\nIf unspecified, all fields will be treated as ApplyKind.Replace.\n\nIf a field's value is ApplyKind.Replace, the value from a completion item\n(if provided and not `null`) will always be used instead of the value\nfrom `completionItem.itemDefaults`.\n\nIf a field's value is ApplyKind.Merge, the values will be merged using\nthe rules defined against each field below.\n\nServers are only allowed to return `applyKind` if the client\nsignals support for this via the `completionList.applyKindSupport`\ncapability.\n\n@since 3.18.0", "since": "3.18.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": "or", "items": [ { "kind": "base", "name": "uinteger" }, { "kind": "base", "name": "null" } ] }, "optional": true, "documentation": "The active parameter of the active signature.\n\nIf `null`, no parameter of the signature is active (for example a named\nargument that does not match any declared parameters). This is only valid\nif the client specifies the client capability\n`textDocument.signatureHelp.noActiveParameterSupport === true`\n\nIf omitted or the value lies outside the range of\n`signatures[activeSignature].parameters` defaults to 0 if the active\nsignature has parameters.\n\nIf the active signature has no parameters it is ignored.\n\nIn future version of the protocol this property might become\nmandatory (but still nullable) to better express the active parameter if\nthe active 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": "tooltip", "type": { "kind": "base", "name": "string" }, "optional": true, "documentation": "An optional tooltip.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "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": "reference", "name": "CodeActionDisabled" }, "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" }, { "name": "tags", "type": { "kind": "array", "element": { "kind": "reference", "name": "CodeActionTag" } }, "optional": true, "documentation": "Tags for this code action.\n\n@since 3.18.0 - proposed", "since": "3.18.0 - proposed" } ], "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.\n\nThe `query`-parameter should be interpreted in a *relaxed way* as editors\nwill apply their own highlighting and scoring on the results. A good rule\nof thumb is to match case-insensitive and to simply check that the\ncharacters of *query* appear in their order in a candidate symbol.\nServers shouldn't use prefix, substring, or similar strict matching." } ], "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": "reference", "name": "LocationUriOnly" } ] }, "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." }, { "name": "metadata", "type": { "kind": "reference", "name": "WorkspaceEditMetadata" }, "optional": true, "documentation": "Additional data about the edit.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true } ], "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": "TraceValue" } } ] }, { "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)." }, { "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`." } ], "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": "reference", "name": "SemanticTokensFullDelta" } ] }, "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" }, { "kind": "reference", "name": "SnippetTextEdit" } ] } }, "documentation": "The edits to be applied.\n\n@since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a\nclient capability.\n\n@since 3.18.0 - support for SnippetTextEdit. This is guarded using a\nclient capability.", "since": "3.18.0 - support for SnippetTextEdit. This is guarded using a\nclient capability.", "sinceTags": [ "3.16.0 - support for AnnotatedTextEdit. This is guarded using a\nclient capability.", "3.18.0 - support for SnippetTextEdit. 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": "reference", "name": "LanguageKind" }, "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": "NotebookDocumentSyncOptions", "properties": [ { "name": "notebookSelector", "type": { "kind": "array", "element": { "kind": "or", "items": [ { "kind": "reference", "name": "NotebookDocumentFilterWithNotebook" }, { "kind": "reference", "name": "NotebookDocumentFilterWithCells" } ] } }, "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": "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": "reference", "name": "NotebookDocumentCellChanges" }, "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": "TextDocumentContentOptions", "properties": [ { "name": "schemes", "type": { "kind": "array", "element": { "kind": "base", "name": "string" } }, "documentation": "The schemes for which the server provides content." } ], "documentation": "Text document content provider options.\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": "reference", "name": "ClientInfo" }, "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": "TraceValue" }, "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": "reference", "name": "WorkspaceOptions" }, "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": "ServerInfo", "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." } ], "documentation": "Information about the server\n\n@since 3.15.0\n@since 3.18.0 ServerInfo type name added.", "since": "3.18.0 ServerInfo type name added.", "sinceTags": [ "3.15.0", "3.18.0 ServerInfo type name added." ] }, { "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. To avoid interpretation mismatches when a\nserver is used with different clients it is highly recommended that servers\nalways provide a severity value." }, { "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": "CompletionItemDefaults", "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": "reference", "name": "EditRangeWithInsertReplace" } ] }, "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" } ], "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 rules for combining these are\ndefined by `applyKinds` (if the client supports it), defaulting to\nApplyKind.Replace.\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": "CompletionItemApplyKinds", "properties": [ { "name": "commitCharacters", "type": { "kind": "reference", "name": "ApplyKind" }, "optional": true, "documentation": "Specifies whether commitCharacters on a completion will replace or be\nmerged with those in `completionList.itemDefaults.commitCharacters`.\n\nIf ApplyKind.Replace, the commit characters from the completion item will\nalways be used unless not provided, in which case those from\n`completionList.itemDefaults.commitCharacters` will be used. An\nempty list can be used if a completion item does not have any commit\ncharacters and also should not use those from\n`completionList.itemDefaults.commitCharacters`.\n\nIf ApplyKind.Merge the commitCharacters for the completion will be the\nunion of all values in both `completionList.itemDefaults.commitCharacters`\nand the completion's own `commitCharacters`.\n\n@since 3.18.0", "since": "3.18.0" }, { "name": "data", "type": { "kind": "reference", "name": "ApplyKind" }, "optional": true, "documentation": "Specifies whether the `data` field on a completion will replace or\nbe merged with data from `completionList.itemDefaults.data`.\n\nIf ApplyKind.Replace, the data from the completion item will be used if\nprovided (and not `null`), otherwise\n`completionList.itemDefaults.data` will be used. An empty object can\nbe used if a completion item does not have any data but also should\nnot use the value from `completionList.itemDefaults.data`.\n\nIf ApplyKind.Merge, a shallow merge will be performed between\n`completionList.itemDefaults.data` and the completion's own data\nusing the following rules:\n\n- If a completion's `data` field is not provided (or `null`), the\n entire `data` field from `completionList.itemDefaults.data` will be\n used as-is.\n- If a completion's `data` field is provided, each field will\n overwrite the field of the same name in\n `completionList.itemDefaults.data` but no merging of nested fields\n within that value will occur.\n\n@since 3.18.0", "since": "3.18.0" } ], "documentation": "Specifies how fields from a completion item should be combined with those\nfrom `completionList.itemDefaults`.\n\nIf unspecified, all fields will be treated as ApplyKind.Replace.\n\nIf a field's value is ApplyKind.Replace, the value from a completion item (if\nprovided and not `null`) will always be used instead of the value from\n`completionItem.itemDefaults`.\n\nIf a field's value is ApplyKind.Merge, the values will be merged using the rules\ndefined against each field below.\n\nServers are only allowed to return `applyKind` if the client\nsignals support for this via the `completionList.applyKindSupport`\ncapability.\n\n@since 3.18.0", "since": "3.18.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": "reference", "name": "ServerCompletionItemOptions" }, "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": "or", "items": [ { "kind": "base", "name": "uinteger" }, { "kind": "base", "name": "null" } ] }, "optional": true, "documentation": "The index of the active parameter.\n\nIf `null`, no parameter of the signature is active (for example a named\nargument that does not match any declared parameters). This is only valid\nif the client specifies the client capability\n`textDocument.signatureHelp.noActiveParameterSupport === true`\n\nIf provided (or `null`), this is used in place of\n`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": "CodeActionDisabled", "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." } ], "documentation": "Captures why the code action is currently disabled.\n\n@since 3.18.0", "since": "3.18.0" }, { "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": "documentation", "type": { "kind": "array", "element": { "kind": "reference", "name": "CodeActionKindDocumentation" } }, "optional": true, "documentation": "Static documentation for a class of code actions.\n\nDocumentation from the provider should be shown in the code actions menu if either:\n\n- Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that\n most closely matches the requested code action kind. For example, if a provider has documentation for\n both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`,\n the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`.\n\n- Any code actions of `kind` are returned by the provider.\n\nAt most one documentation entry should be shown per provider.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "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": "LocationUriOnly", "properties": [ { "name": "uri", "type": { "kind": "base", "name": "DocumentUri" } } ], "documentation": "Location with only uri and does not include range.\n\n@since 3.18.0", "since": "3.18.0" }, { "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": "PrepareRenamePlaceholder", "properties": [ { "name": "range", "type": { "kind": "reference", "name": "Range" } }, { "name": "placeholder", "type": { "kind": "base", "name": "string" } } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "PrepareRenameDefaultBehavior", "properties": [ { "name": "defaultBehavior", "type": { "kind": "base", "name": "boolean" } } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "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": "WorkspaceEditMetadata", "properties": [ { "name": "isRefactoring", "type": { "kind": "base", "name": "boolean" }, "optional": true, "documentation": "Signal to the editor that this edit is a refactoring." } ], "documentation": "Additional data about a workspace edit.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "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": "SemanticTokensFullDelta", "properties": [ { "name": "delta", "type": { "kind": "base", "name": "boolean" }, "optional": true, "documentation": "The server supports deltas for full documents." } ], "documentation": "Semantic tokens options to support deltas for full documents\n\n@since 3.18.0", "since": "3.18.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": "SnippetTextEdit", "properties": [ { "name": "range", "type": { "kind": "reference", "name": "Range" }, "documentation": "The range of the text document to be manipulated." }, { "name": "snippet", "type": { "kind": "reference", "name": "StringValue" }, "documentation": "The snippet to be inserted." }, { "name": "annotationId", "type": { "kind": "reference", "name": "ChangeAnnotationIdentifier" }, "optional": true, "documentation": "The actual identifier of the snippet edit." } ], "documentation": "An interactive text edit.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "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": "NotebookDocumentFilterWithNotebook", "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": "reference", "name": "NotebookCellLanguage" } }, "optional": true, "documentation": "The cells of the matching notebook to be synced." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "NotebookDocumentFilterWithCells", "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": "reference", "name": "NotebookCellLanguage" } }, "documentation": "The cells of the matching notebook to be synced." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "NotebookDocumentCellChanges", "properties": [ { "name": "structure", "type": { "kind": "reference", "name": "NotebookDocumentCellChangeStructure" }, "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": "reference", "name": "NotebookDocumentCellContentChanges" } }, "optional": true, "documentation": "Changes to the text content of notebook cells." } ], "documentation": "Cell changes to a notebook document.\n\n@since 3.18.0", "since": "3.18.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": "ClientInfo", "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." } ], "documentation": "Information about the client\n\n@since 3.15.0\n@since 3.18.0 ClientInfo type name added.", "since": "3.18.0 ClientInfo type name added.", "sinceTags": [ "3.15.0", "3.18.0 ClientInfo type name added." ] }, { "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": "WorkspaceOptions", "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" }, { "name": "textDocumentContent", "type": { "kind": "or", "items": [ { "kind": "reference", "name": "TextDocumentContentOptions" }, { "kind": "reference", "name": "TextDocumentContentRegistrationOptions" } ] }, "optional": true, "documentation": "The server supports the `workspace/textDocumentContent` request.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true } ], "documentation": "Defines workspace specific capabilities of the server.\n\n@since 3.18.0", "since": "3.18.0" }, { "name": "TextDocumentContentChangePartial", "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.", "deprecated": "use range instead." }, { "name": "text", "type": { "kind": "base", "name": "string" }, "documentation": "The new text for the provided range." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "TextDocumentContentChangeWholeDocument", "properties": [ { "name": "text", "type": { "kind": "base", "name": "string" }, "documentation": "The new text of the whole document." } ], "documentation": "@since 3.18.0", "since": "3.18.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": "EditRangeWithInsertReplace", "properties": [ { "name": "insert", "type": { "kind": "reference", "name": "Range" } }, { "name": "replace", "type": { "kind": "reference", "name": "Range" } } ], "documentation": "Edit range variant that includes ranges for insert and replace operations.\n\n@since 3.18.0", "since": "3.18.0" }, { "name": "ServerCompletionItemOptions", "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" } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "MarkedStringWithLanguage", "properties": [ { "name": "language", "type": { "kind": "base", "name": "string" } }, { "name": "value", "type": { "kind": "base", "name": "string" } } ], "documentation": "@since 3.18.0\n@deprecated use MarkupContent instead.", "since": "3.18.0", "deprecated": "use MarkupContent instead." }, { "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\nTo avoid ambiguities a server should use the [start, end] offset value instead of using\na substring. Whether a client support this is controlled via `labelOffsetSupport` client\ncapability.\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": "CodeActionKindDocumentation", "properties": [ { "name": "kind", "type": { "kind": "reference", "name": "CodeActionKind" }, "documentation": "The kind of the code action being documented.\n\nIf the kind is generic, such as `CodeActionKind.Refactor`, the documentation will be shown whenever any\nrefactorings are returned. If the kind if more specific, such as `CodeActionKind.RefactorExtract`, the\ndocumentation will only be shown when extract refactoring code actions are returned." }, { "name": "command", "type": { "kind": "reference", "name": "Command" }, "documentation": "Command that is ued to display the documentation to the user.\n\nThe title of this documentation code action is taken from {@linkcode Command.title}" } ], "documentation": "Documentation for a class of code actions.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "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": "NotebookCellLanguage", "properties": [ { "name": "language", "type": { "kind": "base", "name": "string" } } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "NotebookDocumentCellChangeStructure", "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." } ], "documentation": "Structural changes to cells in a notebook document.\n\n@since 3.18.0", "since": "3.18.0" }, { "name": "NotebookDocumentCellContentChanges", "properties": [ { "name": "document", "type": { "kind": "reference", "name": "VersionedTextDocumentIdentifier" } }, { "name": "changes", "type": { "kind": "array", "element": { "kind": "reference", "name": "TextDocumentContentChangeEvent" } } } ], "documentation": "Content changes to a cell in a notebook document.\n\n@since 3.18.0", "since": "3.18.0" }, { "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 }, { "name": "textDocumentContent", "type": { "kind": "reference", "name": "TextDocumentContentClientCapabilities" }, "optional": true, "documentation": "Capabilities specific to the `workspace/textDocumentContent` request.\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": "filters", "type": { "kind": "reference", "name": "TextDocumentFilterClientCapabilities" }, "optional": true, "documentation": "Defines which filters the client supports.\n\n@since 3.18.0", "since": "3.18.0" }, { "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": "reference", "name": "StaleRequestSupportOptions" }, "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": "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": "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": "TextDocumentFilterLanguage", "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": "reference", "name": "GlobPattern" }, "optional": true, "documentation": "A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.\n\n@since 3.18.0 - support for relative patterns. Whether clients support\nrelative patterns depends on the client capability\n`textDocuments.filters.relativePatternSupport`.", "since": "3.18.0 - support for relative patterns. Whether clients support\nrelative patterns depends on the client capability\n`textDocuments.filters.relativePatternSupport`." } ], "documentation": "A document filter where `language` is required field.\n\n@since 3.18.0", "since": "3.18.0" }, { "name": "TextDocumentFilterScheme", "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": "reference", "name": "GlobPattern" }, "optional": true, "documentation": "A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.\n\n@since 3.18.0 - support for relative patterns. Whether clients support\nrelative patterns depends on the client capability\n`textDocuments.filters.relativePatternSupport`.", "since": "3.18.0 - support for relative patterns. Whether clients support\nrelative patterns depends on the client capability\n`textDocuments.filters.relativePatternSupport`." } ], "documentation": "A document filter where `scheme` is required field.\n\n@since 3.18.0", "since": "3.18.0" }, { "name": "TextDocumentFilterPattern", "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": "reference", "name": "GlobPattern" }, "documentation": "A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.\n\n@since 3.18.0 - support for relative patterns. Whether clients support\nrelative patterns depends on the client capability\n`textDocuments.filters.relativePatternSupport`.", "since": "3.18.0 - support for relative patterns. Whether clients support\nrelative patterns depends on the client capability\n`textDocuments.filters.relativePatternSupport`." } ], "documentation": "A document filter where `pattern` is required field.\n\n@since 3.18.0", "since": "3.18.0" }, { "name": "NotebookDocumentFilterNotebookType", "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": "reference", "name": "GlobPattern" }, "optional": true, "documentation": "A glob pattern." } ], "documentation": "A notebook document filter where `notebookType` is required field.\n\n@since 3.18.0", "since": "3.18.0" }, { "name": "NotebookDocumentFilterScheme", "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": "reference", "name": "GlobPattern" }, "optional": true, "documentation": "A glob pattern." } ], "documentation": "A notebook document filter where `scheme` is required field.\n\n@since 3.18.0", "since": "3.18.0" }, { "name": "NotebookDocumentFilterPattern", "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": "reference", "name": "GlobPattern" }, "documentation": "A glob pattern." } ], "documentation": "A notebook document filter where `pattern` is required field.\n\n@since 3.18.0", "since": "3.18.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": "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": "reference", "name": "ChangeAnnotationsSupportOptions" }, "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": "metadataSupport", "type": { "kind": "base", "name": "boolean" }, "optional": true, "documentation": "Whether the client supports `WorkspaceEditMetadata` in `WorkspaceEdit`s.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "name": "snippetEditSupport", "type": { "kind": "base", "name": "boolean" }, "optional": true, "documentation": "Whether the client supports snippets as text edits.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true } ] }, { "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": "reference", "name": "ClientSymbolKindOptions" }, "optional": true, "documentation": "Specific capabilities for the `SymbolKind` in the `workspace/symbol` request." }, { "name": "tagSupport", "type": { "kind": "reference", "name": "ClientSymbolTagOptions" }, "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": "reference", "name": "ClientSymbolResolveOptions" }, "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": "TextDocumentContentClientCapabilities", "properties": [ { "name": "dynamicRegistration", "type": { "kind": "base", "name": "boolean" }, "optional": true, "documentation": "Text document content provider supports dynamic registration." } ], "documentation": "Client capabilities for a text document content provider.\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": "TextDocumentFilterClientCapabilities", "properties": [ { "name": "relativePatternSupport", "type": { "kind": "base", "name": "boolean" }, "optional": true, "documentation": "The client supports Relative Patterns.\n\n@since 3.18.0", "since": "3.18.0" } ] }, { "name": "CompletionClientCapabilities", "properties": [ { "name": "dynamicRegistration", "type": { "kind": "base", "name": "boolean" }, "optional": true, "documentation": "Whether completion supports dynamic registration." }, { "name": "completionItem", "type": { "kind": "reference", "name": "ClientCompletionItemOptions" }, "optional": true, "documentation": "The client supports the following `CompletionItem` specific\ncapabilities." }, { "name": "completionItemKind", "type": { "kind": "reference", "name": "ClientCompletionItemOptionsKind" }, "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": "reference", "name": "CompletionListCapabilities" }, "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": "reference", "name": "ClientSignatureInformationOptions" }, "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": "reference", "name": "ClientSymbolKindOptions" }, "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": "reference", "name": "ClientSymbolTagOptions" }, "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": "reference", "name": "ClientCodeActionLiteralOptions" }, "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": "reference", "name": "ClientCodeActionResolveOptions" }, "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" }, { "name": "documentationSupport", "type": { "kind": "base", "name": "boolean" }, "optional": true, "documentation": "Whether the client supports documentation for a class of\ncode actions.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "name": "tagSupport", "type": { "kind": "reference", "name": "CodeActionTagOptions" }, "optional": true, "documentation": "Client supports the tag property on a code action. Clients\nsupporting tags have to handle unknown tags gracefully.\n\n@since 3.18.0 - proposed", "since": "3.18.0 - proposed" } ], "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." }, { "name": "resolveSupport", "type": { "kind": "reference", "name": "ClientCodeLensResolveOptions" }, "optional": true, "documentation": "Whether the client supports resolving additional code lens\nproperties via a separate `codeLens/resolve` request.\n\n@since 3.18.0", "since": "3.18.0" } ], "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": "reference", "name": "ClientFoldingRangeKindOptions" }, "optional": true, "documentation": "Specific options for the folding range kind.\n\n@since 3.17.0", "since": "3.17.0" }, { "name": "foldingRange", "type": { "kind": "reference", "name": "ClientFoldingRangeOptions" }, "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": "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" } ], "extends": [ { "kind": "reference", "name": "DiagnosticsCapabilities" } ], "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": "reference", "name": "ClientSemanticTokensRequestOptions" }, "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": "reference", "name": "ClientInlayHintResolveOptions" }, "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." } ], "extends": [ { "kind": "reference", "name": "DiagnosticsCapabilities" } ], "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": "reference", "name": "ClientShowMessageActionItemOptions" }, "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": "StaleRequestSupportOptions", "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`" } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "RegularExpressionsClientCapabilities", "properties": [ { "name": "engine", "type": { "kind": "reference", "name": "RegularExpressionEngineKind" }, "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" }, { "name": "ChangeAnnotationsSupportOptions", "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." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientSymbolKindOptions", "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." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientSymbolTagOptions", "properties": [ { "name": "valueSet", "type": { "kind": "array", "element": { "kind": "reference", "name": "SymbolTag" } }, "documentation": "The tags supported by the client." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientSymbolResolveOptions", "properties": [ { "name": "properties", "type": { "kind": "array", "element": { "kind": "base", "name": "string" } }, "documentation": "The properties that a client can resolve lazily. Usually\n`location.range`" } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientCompletionItemOptions", "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": "reference", "name": "CompletionItemTagOptions" }, "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": "reference", "name": "ClientCompletionItemResolveOptions" }, "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": "reference", "name": "ClientCompletionItemInsertTextModeOptions" }, "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" } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientCompletionItemOptionsKind", "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." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "CompletionListCapabilities", "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" }, { "name": "applyKindSupport", "type": { "kind": "base", "name": "boolean" }, "optional": true, "documentation": "Specifies whether the client supports `CompletionList.applyKind` to\nindicate how supported values from `completionList.itemDefaults`\nand `completion` will be combined.\n\nIf a client supports `applyKind` it must support it for all fields\nthat it supports that are listed in `CompletionList.applyKind`. This\nmeans when clients add support for new/future fields in completion\nitems the MUST also support merge for them if those fields are\ndefined in `CompletionList.applyKind`.\n\n@since 3.18.0", "since": "3.18.0" } ], "documentation": "The client supports the following `CompletionList` specific\ncapabilities.\n\n@since 3.17.0", "since": "3.17.0" }, { "name": "ClientSignatureInformationOptions", "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": "reference", "name": "ClientSignatureParameterInformationOptions" }, "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" }, { "name": "noActiveParameterSupport", "type": { "kind": "base", "name": "boolean" }, "optional": true, "documentation": "The client supports the `activeParameter` property on\n`SignatureHelp`/`SignatureInformation` being set to `null` to\nindicate that no parameter should be active.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientCodeActionLiteralOptions", "properties": [ { "name": "codeActionKind", "type": { "kind": "reference", "name": "ClientCodeActionKindOptions" }, "documentation": "The code action kind is support with the following value\nset." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientCodeActionResolveOptions", "properties": [ { "name": "properties", "type": { "kind": "array", "element": { "kind": "base", "name": "string" } }, "documentation": "The properties that a client can resolve lazily." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "CodeActionTagOptions", "properties": [ { "name": "valueSet", "type": { "kind": "array", "element": { "kind": "reference", "name": "CodeActionTag" } }, "documentation": "The tags supported by the client." } ], "documentation": "@since 3.18.0 - proposed", "since": "3.18.0 - proposed" }, { "name": "ClientCodeLensResolveOptions", "properties": [ { "name": "properties", "type": { "kind": "array", "element": { "kind": "base", "name": "string" } }, "documentation": "The properties that a client can resolve lazily." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientFoldingRangeKindOptions", "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." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientFoldingRangeOptions", "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" } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "DiagnosticsCapabilities", "properties": [ { "name": "relatedInformation", "type": { "kind": "base", "name": "boolean" }, "optional": true, "documentation": "Whether the clients accepts diagnostics with related information." }, { "name": "tagSupport", "type": { "kind": "reference", "name": "ClientDiagnosticsTagOptions" }, "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": "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": "General diagnostics capabilities for pull and push model." }, { "name": "ClientSemanticTokensRequestOptions", "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": "reference", "name": "ClientSemanticTokensRequestFullDelta" } ] }, "optional": true, "documentation": "The client will send the `textDocument/semanticTokens/full` request if\nthe server provides a corresponding handler." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientInlayHintResolveOptions", "properties": [ { "name": "properties", "type": { "kind": "array", "element": { "kind": "base", "name": "string" } }, "documentation": "The properties that a client can resolve lazily." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientShowMessageActionItemOptions", "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." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "CompletionItemTagOptions", "properties": [ { "name": "valueSet", "type": { "kind": "array", "element": { "kind": "reference", "name": "CompletionItemTag" } }, "documentation": "The tags supported by the client." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientCompletionItemResolveOptions", "properties": [ { "name": "properties", "type": { "kind": "array", "element": { "kind": "base", "name": "string" } }, "documentation": "The properties that a client can resolve lazily." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientCompletionItemInsertTextModeOptions", "properties": [ { "name": "valueSet", "type": { "kind": "array", "element": { "kind": "reference", "name": "InsertTextMode" } } } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientSignatureParameterInformationOptions", "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" } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientCodeActionKindOptions", "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": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientDiagnosticsTagOptions", "properties": [ { "name": "valueSet", "type": { "kind": "array", "element": { "kind": "reference", "name": "DiagnosticTag" } }, "documentation": "The tags supported by the client." } ], "documentation": "@since 3.18.0", "since": "3.18.0" }, { "name": "ClientSemanticTokensRequestFullDelta", "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." } ], "documentation": "@since 3.18.0", "since": "3.18.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" }, { "name": "label", "value": "label", "documentation": "@since 3.18.0", "since": "3.18.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 has 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\n@proposed", "since": "3.18.0", "proposed": true } ], "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><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": "RefactorMove", "value": "refactor.move", "documentation": "Base kind for refactoring move actions: `refactor.move`\n\nExample move actions:\n\n- Move a function to a new file\n- Move a property between classes\n- Move method to base class\n- ...\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "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" }, { "name": "Notebook", "value": "notebook", "documentation": "Base kind for all code actions applying to the entire notebook's scope. CodeActionKinds using\nthis should always begin with `notebook.`\n\n@since 3.18.0", "since": "3.18.0" } ], "supportsCustomValues": true, "documentation": "A set of predefined code action kinds" }, { "name": "CodeActionTag", "type": { "kind": "base", "name": "uinteger" }, "values": [ { "name": "LLMGenerated", "value": 1, "documentation": "Marks the code action as LLM-generated." } ], "documentation": "Code action tags are extra annotations that tweak the behavior of a code action.\n\n@since 3.18.0 - proposed", "since": "3.18.0 - proposed" }, { "name": "TraceValue", "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": "LanguageKind", "type": { "kind": "base", "name": "string" }, "values": [ { "name": "ABAP", "value": "abap" }, { "name": "WindowsBat", "value": "bat" }, { "name": "BibTeX", "value": "bibtex" }, { "name": "Clojure", "value": "clojure" }, { "name": "Coffeescript", "value": "coffeescript" }, { "name": "C", "value": "c" }, { "name": "CPP", "value": "cpp" }, { "name": "CSharp", "value": "csharp" }, { "name": "CSS", "value": "css" }, { "name": "D", "value": "d", "documentation": "@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "name": "Delphi", "value": "pascal", "documentation": "@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "name": "Diff", "value": "diff" }, { "name": "Dart", "value": "dart" }, { "name": "Dockerfile", "value": "dockerfile" }, { "name": "Elixir", "value": "elixir" }, { "name": "Erlang", "value": "erlang" }, { "name": "FSharp", "value": "fsharp" }, { "name": "GitCommit", "value": "git-commit" }, { "name": "GitRebase", "value": "rebase" }, { "name": "Go", "value": "go" }, { "name": "Groovy", "value": "groovy" }, { "name": "Handlebars", "value": "handlebars" }, { "name": "Haskell", "value": "haskell" }, { "name": "HTML", "value": "html" }, { "name": "Ini", "value": "ini" }, { "name": "Java", "value": "java" }, { "name": "JavaScript", "value": "javascript" }, { "name": "JavaScriptReact", "value": "javascriptreact" }, { "name": "JSON", "value": "json" }, { "name": "LaTeX", "value": "latex" }, { "name": "Less", "value": "less" }, { "name": "Lua", "value": "lua" }, { "name": "Makefile", "value": "makefile" }, { "name": "Markdown", "value": "markdown" }, { "name": "ObjectiveC", "value": "objective-c" }, { "name": "ObjectiveCPP", "value": "objective-cpp" }, { "name": "Pascal", "value": "pascal", "documentation": "@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true }, { "name": "Perl", "value": "perl" }, { "name": "Perl6", "value": "perl6" }, { "name": "PHP", "value": "php" }, { "name": "Powershell", "value": "powershell" }, { "name": "Pug", "value": "jade" }, { "name": "Python", "value": "python" }, { "name": "R", "value": "r" }, { "name": "Razor", "value": "razor" }, { "name": "Ruby", "value": "ruby" }, { "name": "Rust", "value": "rust" }, { "name": "SCSS", "value": "scss" }, { "name": "SASS", "value": "sass" }, { "name": "Scala", "value": "scala" }, { "name": "ShaderLab", "value": "shaderlab" }, { "name": "ShellScript", "value": "shellscript" }, { "name": "SQL", "value": "sql" }, { "name": "Swift", "value": "swift" }, { "name": "TypeScript", "value": "typescript" }, { "name": "TypeScriptReact", "value": "typescriptreact" }, { "name": "TeX", "value": "tex" }, { "name": "VisualBasic", "value": "vb" }, { "name": "XML", "value": "xml" }, { "name": "XSL", "value": "xsl" }, { "name": "YAML", "value": "yaml" } ], "supportsCustomValues": true, "documentation": "Predefined Language kinds\n@since 3.18.0", "since": "3.18.0" }, { "name": "InlineCompletionTriggerKind", "type": { "kind": "base", "name": "uinteger" }, "values": [ { "name": "Invoked", "value": 1, "documentation": "Completion was triggered explicitly by a user gesture." }, { "name": "Automatic", "value": 2, "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": "ApplyKind", "type": { "kind": "base", "name": "uinteger" }, "values": [ { "name": "Replace", "value": 1, "documentation": "The value from the individual item (if provided and not `null`) will be\nused instead of the default." }, { "name": "Merge", "value": 2, "documentation": "The value from the item will be merged with the default.\n\nThe specific rules for mergeing values are defined against each field\nthat supports merging." } ], "documentation": "Defines how values from a set of defaults and an individual item will be\nmerged.\n\n@since 3.18.0", "since": "3.18.0" }, { "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": "reference", "name": "PrepareRenamePlaceholder" }, { "kind": "reference", "name": "PrepareRenameDefaultBehavior" } ] } }, { "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": "reference", "name": "TextDocumentContentChangePartial" }, { "kind": "reference", "name": "TextDocumentContentChangeWholeDocument" } ] }, "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": "reference", "name": "MarkedStringWithLanguage" } ] }, "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 - support for NotebookCellTextDocumentFilter.", "since": "3.17.0 - 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": "reference", "name": "TextDocumentFilterLanguage" }, { "kind": "reference", "name": "TextDocumentFilterScheme" }, { "kind": "reference", "name": "TextDocumentFilterPattern" } ] }, "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": "reference", "name": "NotebookDocumentFilterNotebookType" }, { "kind": "reference", "name": "NotebookDocumentFilterScheme" }, { "kind": "reference", "name": "NotebookDocumentFilterPattern" } ] }, "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" }, { "name": "RegularExpressionEngineKind", "type": { "kind": "base", "name": "string" } } ] } microsoft-lsprotocol-b6edfbf/generator/lsp.schema.json000066400000000000000000000755661502407456000235210ustar00rootroot00000000000000{ "$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" }, "sinceTags": { "description": "All since tags in case there was more than one tag. Is undefined if not known.", "items": { "type": "string" }, "type": "array" }, "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" }, "sinceTags": { "description": "All since tags in case there was more than one tag. Is undefined if not known.", "items": { "type": "string" }, "type": "array" }, "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 { [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": { "clientCapability": { "description": "The client capability property path if any.", "type": "string" }, "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 notifications'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 notifications's method.", "type": "string" }, "registrationOptions": { "$ref": "#/definitions/Type", "description": "Optional registration options if the notification supports dynamic registration." }, "serverCapability": { "description": "The server capability property path if any.", "type": "string" }, "since": { "description": "Since when (release number) this notification is available. Is undefined if not known.", "type": "string" }, "sinceTags": { "description": "All since tags in case there was more than one tag. Is undefined if not known.", "items": { "type": "string" }, "type": "array" }, "typeName": { "description": "The type name of the notifications if any.", "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" }, "sinceTags": { "description": "All since tags in case there was more than one tag. Is undefined if not known.", "items": { "type": "string" }, "type": "array" }, "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": { "clientCapability": { "description": "The client capability property path if any.", "type": "string" }, "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." }, "serverCapability": { "description": "The server capability property path if any.", "type": "string" }, "since": { "description": "Since when (release number) this request is available. Is undefined if not known.", "type": "string" }, "sinceTags": { "description": "All since tags in case there was more than one tag. Is undefined if not known.", "items": { "type": "string" }, "type": "array" }, "typeName": { "description": "The type name of the request if any.", "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" }, "sinceTags": { "description": "All since tags in case there was more than one tag. Is undefined if not known.", "items": { "type": "string" }, "type": "array" } }, "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" }, "sinceTags": { "description": "All since tags in case there was more than one tag. Is undefined if not known.", "items": { "type": "string" }, "type": "array" } }, "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" }, "sinceTags": { "description": "All since tags in case there was more than one tag. Is undefined if not known.", "items": { "type": "string" }, "type": "array" }, "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" } } } microsoft-lsprotocol-b6edfbf/generator/model.py000066400000000000000000000754421502407456000222340ustar00rootroot00000000000000# 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, 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, ) sinceTags: Optional[List[str]] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(list)), 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, ) sinceTags: Optional[List[str]] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(list)), 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, ) sinceTags: Optional[List[str]] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(list)), 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, ) sinceTags: Optional[List[str]] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(list)), 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, ) sinceTags: Optional[List[str]] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(list)), 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, ) sinceTags: Optional[List[str]] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(list)), 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, ) clientCapability: Optional[str] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(str)), default=None, ) serverCapability: 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, ) sinceTags: Optional[List[str]] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(list)), default=None, ) typeName: 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, ) clientCapability: Optional[str] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(str)), default=None, ) serverCapability: 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, ) sinceTags: Optional[List[str]] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(list)), default=None, ) typeName: 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 microsoft-lsprotocol-b6edfbf/generator/plugins/000077500000000000000000000000001502407456000222275ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/generator/plugins/__init__.py000066400000000000000000000001361502407456000243400ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/000077500000000000000000000000001502407456000235245ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/__init__.py000066400000000000000000000002461502407456000256370ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from .dotnet_utils import generate_from_spec as generate # noqa: F401 microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/000077500000000000000000000000001502407456000250365ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/CustomArrayConverter.cs000066400000000000000000000022251502407456000315270ustar00rootroot00000000000000using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Collections.Immutable; public class CustomArrayConverter : JsonConverter> { public override ImmutableArray ReadJson(JsonReader reader, Type objectType, ImmutableArray existingValue, bool hasExistingValue, JsonSerializer serializer) { if (reader.TokenType == JsonToken.Null) { return default(ImmutableArray); } JArray array = JArray.Load(reader); ImmutableArray.Builder builder = ImmutableArray.CreateBuilder(); 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 value, JsonSerializer serializer) { if (value.IsDefault) { writer.WriteNull(); } else { writer.WriteStartArray(); foreach (var item in value) { serializer.Serialize(writer, item); } writer.WriteEndArray(); } } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/CustomObjectConverter.cs000066400000000000000000000021441502407456000316570ustar00rootroot00000000000000using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; class CustomObjectConverter : JsonConverter where T : Dictionary { public override T ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer) { if (reader.TokenType == JsonToken.Null) { return default(T)!; } Dictionary? o = serializer.Deserialize>(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(); } } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/CustomStringConverter.cs000066400000000000000000000022471502407456000317230ustar00rootroot00000000000000using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; public class CustomStringConverter : JsonConverter 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)}."); } } } microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/Direction.cs000066400000000000000000000004601502407456000273050ustar00rootroot00000000000000using System; [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Enum)] public class DirectionAttribute : Attribute { public DirectionAttribute(MessageDirection direction) { Direction = direction; } public MessageDirection Direction { get; } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/DocumentSelectorConverter.cs000066400000000000000000000020401502407456000325300ustar00rootroot00000000000000using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; public class DocumentSelectorConverter : JsonConverter { 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(serializer); return new DocumentSelector(filters ?? Array.Empty()); } throw new JsonSerializationException("Invalid JSON for DocumentSelector"); } } microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/IMessage.cs000066400000000000000000000000711502407456000270600ustar00rootroot00000000000000public interface IMessage { string JsonRPC { get; } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/INotification.cs000066400000000000000000000001571502407456000301270ustar00rootroot00000000000000public interface INotification : IMessage { string Method { get; } TParams? Params { get; } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/IOrType.cs000066400000000000000000000000761502407456000267230ustar00rootroot00000000000000public interface IOrType { public object? Value { get; } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/IPartialResultParams.cs000066400000000000000000000012461502407456000314400ustar00rootroot00000000000000using System; /// /// Interface to describe parameters for requests that support streaming results. /// /// See the Language Server Protocol specification for additional information. /// /// The type to be reported by . public interface IPartialResultParams { /// /// An optional token that a server can use to report partial results (e.g. streaming) to the client. /// public ProgressToken? PartialResultToken { get; set; } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/IRequest.cs000066400000000000000000000002171502407456000271260ustar00rootroot00000000000000public interface IRequest : IMessage { OrType Id { get; } string Method { get; } TParams Params { get; } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/IResponse.cs000066400000000000000000000002341502407456000272730ustar00rootroot00000000000000public interface IResponse : IMessage { OrType Id { get; } TResponse? Result { get; } ResponseError? Error { get; } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/LSPAnyConverter.cs000066400000000000000000000036331502407456000303700ustar00rootroot00000000000000using 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(reader)); case JsonToken.Float: return new LSPAny(serializer.Deserialize(reader)); case JsonToken.Boolean: return new LSPAny(serializer.Deserialize(reader)); case JsonToken.String: return new LSPAny(serializer.Deserialize(reader)); case JsonToken.StartArray: List? l = serializer.Deserialize>(reader); if (l == null) { return null; } return new LSPAny(new LSPArray(l)); case JsonToken.StartObject: Dictionary? o = serializer.Deserialize>(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); } } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/LSPRequest.cs000066400000000000000000000010271502407456000273740ustar00rootroot00000000000000using 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; } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/LSPResponse.cs000066400000000000000000000003411502407456000275400ustar00rootroot00000000000000using System; [AttributeUsage(AttributeTargets.Class)] public class LSPResponseAttribute : Attribute { public LSPResponseAttribute(Type request) { Request = request; } public Type Request { get; } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/MessageDirection.cs000066400000000000000000000003421502407456000306110ustar00rootroot00000000000000using System.Runtime.Serialization; public enum MessageDirection { [EnumMember(Value = "serverToClient")] ServerToClient, [EnumMember(Value = "clientToServer")] ClientToServer, [EnumMember(Value = "both")] Both, }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/OrType.cs000066400000000000000000000066721502407456000266220ustar00rootroot00000000000000using System; public record OrType : 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 obj) { return obj.Value is U x ? x : default; } public static explicit operator T?(OrType obj) { return obj.Value is T x ? x : default; } public static explicit operator OrType(U obj) => obj is null ? null! : new OrType(obj); public static explicit operator OrType(T obj) => obj is null ? null! : new OrType(obj); public override string ToString() { return Value?.ToString()!; } } public record OrType : 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 obj) { return obj.Value is U x ? x : default; } public static explicit operator T?(OrType obj) { return obj.Value is T x ? x : default; } public static explicit operator V?(OrType obj) { return obj.Value is V x ? x : default; } public static explicit operator OrType(U obj) => obj is null ? null! : new OrType(obj); public static explicit operator OrType(T obj) => obj is null ? null! : new OrType(obj); public static explicit operator OrType(V obj) => obj is null ? null! : new OrType(obj); public override string ToString() { return Value?.ToString()!; } } public record OrType : 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 obj) { return obj.Value is U x ? x : default; } public static explicit operator T?(OrType obj) { return obj.Value is T x ? x : default; } public static explicit operator V?(OrType obj) { return obj.Value is V x ? x : default; } public static explicit operator W?(OrType obj) { return obj.Value is W x ? x : default; } public static explicit operator OrType(U obj) => obj is null ? null! : new OrType(obj); public static explicit operator OrType(T obj) => obj is null ? null! : new OrType(obj); public static explicit operator OrType(V obj) => obj is null ? null! : new OrType(obj); public static explicit operator OrType(W obj) => obj is null ? null! : new OrType(obj); public override string ToString() { return Value?.ToString()!; } } microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/OrTypeArrayConverter.cs000066400000000000000000000104351502407456000315010ustar00rootroot00000000000000using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Immutable; public class OrTypeArrayConverter : JsonConverter>> { private OrTypeConverter _converter; public OrTypeArrayConverter() { _converter = new OrTypeConverter(); } public override ImmutableArray> ReadJson(JsonReader reader, Type objectType, ImmutableArray> existingValue, bool hasExistingValue, JsonSerializer serializer) { if (reader.TokenType == JsonToken.Null) { return default(ImmutableArray>); } JArray array = JArray.Load(reader); ImmutableArray>.Builder builder = ImmutableArray.CreateBuilder>(); for (int i = 0; i < array.Count; i++) { builder.Add((OrType)_converter.ReadJson(array[i].CreateReader(), typeof(OrType), null, serializer)!); } return builder.ToImmutable(); } public override void WriteJson(JsonWriter writer, ImmutableArray> 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 : JsonConverter>> { private OrTypeConverter _converter; public OrTypeArrayConverter() { _converter = new OrTypeConverter(); } public override ImmutableArray> ReadJson(JsonReader reader, Type objectType, ImmutableArray> existingValue, bool hasExistingValue, JsonSerializer serializer) { if (reader.TokenType == JsonToken.Null) { return default(ImmutableArray>); } JArray array = JArray.Load(reader); ImmutableArray>.Builder builder = ImmutableArray.CreateBuilder>(); for (int i = 0; i < array.Count; i++) { builder.Add((OrType)_converter.ReadJson(array[i].CreateReader(), typeof(OrType), null, serializer)!); } return builder.ToImmutable(); } public override void WriteJson(JsonWriter writer, ImmutableArray> 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 : JsonConverter>> { private OrTypeConverter _converter; public OrTypeArrayConverter() { _converter = new OrTypeConverter(); } public override ImmutableArray> ReadJson(JsonReader reader, Type objectType, ImmutableArray> existingValue, bool hasExistingValue, JsonSerializer serializer) { if (reader.TokenType == JsonToken.Null) { return default(ImmutableArray>); } JArray array = JArray.Load(reader); ImmutableArray>.Builder builder = ImmutableArray.CreateBuilder>(); for (int i = 0; i < array.Count; i++) { builder.Add((OrType)_converter.ReadJson(array[i].CreateReader(), typeof(OrType), null, serializer)!); } return builder.ToImmutable(); } public override void WriteJson(JsonWriter writer, ImmutableArray> value, JsonSerializer serializer) { if (value.IsDefault) { writer.WriteNull(); } else { writer.WriteStartArray(); foreach (var item in value) { _converter.WriteJson(writer, item, serializer); } writer.WriteEndArray(); } } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/OrTypeConverter.cs000066400000000000000000000510261502407456000305030ustar00rootroot00000000000000using 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(); string[] jTokenPropertyNames = jToken.Children().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 : JsonConverter> { public override OrType? ReadJson(JsonReader reader, Type objectType, OrType? 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(long)) || 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.ReadObjectToken(token, serializer, OrTypeConverterHelpers.SortTypesByHeuristic(types, token)); } private static OrType ReadIntegerToken(JsonReader reader, JsonSerializer serializer, Type[] types) { long integer = serializer.Deserialize(reader); if (Validators.InUIntegerRange(integer) && Validators.HasType(types, typeof(long))) { if (typeof(T) == typeof(long)) { return new OrType((T)(object)(long)integer); } if (typeof(U) == typeof(long)) { return new OrType((U)(object)(long)integer); } } if (Validators.InIntegerRange(integer) && Validators.HasType(types, typeof(int))) { if (typeof(T) == typeof(int)) { return new OrType((T)(object)(int)integer); } if (typeof(U) == typeof(int)) { return new OrType((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 [{long.MinValue}:{long.MaxValue}] => {integer}"); } private static OrType ReadFloatToken(JsonReader reader, JsonSerializer serializer, Type[] types) { float real = serializer.Deserialize(reader); if (typeof(T) == typeof(float)) { return new OrType((T)(object)real); } if (typeof(U) == typeof(float)) { return new OrType((U)(object)real); } throw new InvalidOperationException("Invalid token type for float"); } private static OrType ReadBooleanToken(JsonReader reader, JsonSerializer serializer, Type[] types) { bool boolean = serializer.Deserialize(reader); if (typeof(T) == typeof(bool)) { return new OrType((T)(object)boolean); } if (typeof(U) == typeof(bool)) { return new OrType((U)(object)boolean); } throw new InvalidOperationException("Invalid token type for boolean"); } private static OrType ReadStringToken(JsonReader reader, JsonSerializer serializer, Type[] types) { string str = serializer.Deserialize(reader)!; if (typeof(T) == typeof(string)) { return new OrType((T)(object)str); } if (typeof(U) == typeof(string)) { return new OrType((U)(object)str); } throw new InvalidOperationException("Invalid token type for string"); } private static OrType ReadObjectToken(JToken token, JsonSerializer serializer, Type[] types) { var exceptions = new List(); foreach (Type type in types) { try { object? value = null; if (token.Type == JTokenType.Array && type == typeof((long, long))) { long[]? o = token.ToObject(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); } if (value is U u) { return new OrType(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? value, JsonSerializer serializer) { if (value is null) { writer.WriteNull(); } else if (value?.Value?.GetType() == typeof((long, long))) { ValueTuple o = (ValueTuple)(value.Value); serializer.Serialize(writer, new long[] { o.Item1, o.Item2 }); } else { serializer.Serialize(writer, value?.Value); } } } public class OrTypeConverter : JsonConverter> { public override OrType? ReadJson(JsonReader reader, Type objectType, OrType? 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(long)) || 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.ReadObjectToken(token, serializer, OrTypeConverterHelpers.SortTypesByHeuristic(types, token)); } private static OrType ReadIntegerToken(JsonReader reader, JsonSerializer serializer, Type[] types) { long integer = serializer.Deserialize(reader); if (Validators.InUIntegerRange(integer) && Validators.HasType(types, typeof(long))) { if (typeof(T) == typeof(long)) { return new OrType((T)(object)(long)integer); } if (typeof(U) == typeof(long)) { return new OrType((U)(object)(long)integer); } if (typeof(V) == typeof(long)) { return new OrType((V)(object)(long)integer); } } if (Validators.InIntegerRange(integer) && Validators.HasType(types, typeof(int))) { if (typeof(T) == typeof(int)) { return new OrType((T)(object)(int)integer); } if (typeof(U) == typeof(int)) { return new OrType((U)(object)(int)integer); } if (typeof(V) == typeof(int)) { return new OrType((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 [{long.MinValue}:{long.MaxValue}] => {integer}"); } private static OrType ReadFloatToken(JsonReader reader, JsonSerializer serializer, Type[] types) { float real = serializer.Deserialize(reader); if (typeof(T) == typeof(float)) { return new OrType((T)(object)real); } if (typeof(U) == typeof(float)) { return new OrType((U)(object)real); } if (typeof(V) == typeof(float)) { return new OrType((V)(object)real); } throw new InvalidOperationException("Invalid token type for float"); } private static OrType ReadBooleanToken(JsonReader reader, JsonSerializer serializer, Type[] types) { bool boolean = serializer.Deserialize(reader); if (typeof(T) == typeof(bool)) { return new OrType((T)(object)boolean); } if (typeof(U) == typeof(bool)) { return new OrType((U)(object)boolean); } if (typeof(V) == typeof(bool)) { return new OrType((V)(object)boolean); } throw new InvalidOperationException("Invalid token type for boolean"); } private static OrType ReadStringToken(JsonReader reader, JsonSerializer serializer, Type[] types) { string str = serializer.Deserialize(reader)!; if (typeof(T) == typeof(string)) { return new OrType((T)(object)str); } if (typeof(U) == typeof(string)) { return new OrType((U)(object)str); } if (typeof(V) == typeof(string)) { return new OrType((V)(object)str); } throw new InvalidOperationException("Invalid token type for string"); } private static OrType ReadObjectToken(JToken token, JsonSerializer serializer, Type[] types) { var exceptions = new List(); foreach (Type type in types) { try { object? value = null; if (token.Type == JTokenType.Array && type == typeof((long, long))) { long[]? o = token.ToObject(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); } if (value is U u) { return new OrType(u); } if (value is V v) { return new OrType(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? value, JsonSerializer serializer) { if (value is null) { writer.WriteNull(); } else if (value?.Value?.GetType() == typeof((long, long))) { ValueTuple o = (ValueTuple)(value.Value); serializer.Serialize(writer, new long[] { o.Item1, o.Item2 }); } else { serializer.Serialize(writer, value?.Value); } } } public class OrTypeConverter : JsonConverter> { public override OrType? ReadJson(JsonReader reader, Type objectType, OrType? 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(long)) || 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.ReadObjectToken(token, serializer, OrTypeConverterHelpers.SortTypesByHeuristic(types, token)); } private static OrType ReadIntegerToken(JsonReader reader, JsonSerializer serializer, Type[] types) { long integer = serializer.Deserialize(reader); if (Validators.InUIntegerRange(integer) && Validators.HasType(types, typeof(long))) { if (typeof(T) == typeof(long)) { return new OrType((T)(object)(long)integer); } if (typeof(U) == typeof(long)) { return new OrType((U)(object)(long)integer); } if (typeof(V) == typeof(long)) { return new OrType((V)(object)(long)integer); } if (typeof(W) == typeof(long)) { return new OrType((W)(object)(long)integer); } } if (Validators.InIntegerRange(integer) && Validators.HasType(types, typeof(int))) { if (typeof(T) == typeof(int)) { return new OrType((T)(object)(int)integer); } if (typeof(U) == typeof(int)) { return new OrType((U)(object)(int)integer); } if (typeof(V) == typeof(int)) { return new OrType((V)(object)(int)integer); } if (typeof(W) == typeof(int)) { return new OrType((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 [{long.MinValue}:{long.MaxValue}] => {integer}"); } private static OrType ReadFloatToken(JsonReader reader, JsonSerializer serializer, Type[] types) { float real = serializer.Deserialize(reader); if (typeof(T) == typeof(float)) { return new OrType((T)(object)real); } if (typeof(U) == typeof(float)) { return new OrType((U)(object)real); } if (typeof(V) == typeof(float)) { return new OrType((V)(object)real); } if (typeof(W) == typeof(float)) { return new OrType((W)(object)real); } throw new InvalidOperationException("Invalid token type for float"); } private static OrType ReadBooleanToken(JsonReader reader, JsonSerializer serializer, Type[] types) { bool boolean = serializer.Deserialize(reader); if (typeof(T) == typeof(bool)) { return new OrType((T)(object)boolean); } if (typeof(U) == typeof(bool)) { return new OrType((U)(object)boolean); } if (typeof(V) == typeof(bool)) { return new OrType((V)(object)boolean); } if (typeof(W) == typeof(bool)) { return new OrType((W)(object)boolean); } throw new InvalidOperationException("Invalid token type for boolean"); } private static OrType ReadStringToken(JsonReader reader, JsonSerializer serializer, Type[] types) { string str = serializer.Deserialize(reader)!; if (typeof(T) == typeof(string)) { return new OrType((T)(object)str); } if (typeof(U) == typeof(string)) { return new OrType((U)(object)str); } if (typeof(V) == typeof(string)) { return new OrType((V)(object)str); } if (typeof(W) == typeof(string)) { return new OrType((W)(object)str); } throw new InvalidOperationException("Invalid token type for string"); } private static OrType ReadObjectToken(JToken token, JsonSerializer serializer, Type[] types) { var exceptions = new List(); foreach (Type type in types) { try { object? value = null; if (token.Type == JTokenType.Array && type == typeof((long, long))) { long[]? o = token.ToObject(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); } if (value is U u) { return new OrType(u); } if (value is V v) { return new OrType(v); } if (value is W w) { return new OrType(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? value, JsonSerializer serializer) { if (value is null) { writer.WriteNull(); } else if (value?.Value?.GetType() == typeof((long, long))) { ValueTuple o = (ValueTuple)(value.Value); serializer.Serialize(writer, new long[] { o.Item1, o.Item2 }); } else { serializer.Serialize(writer, value?.Value); } } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/Proposed.cs000066400000000000000000000005271502407456000271640ustar00rootroot00000000000000using 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; } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/ResponseError.cs000066400000000000000000000007561502407456000302050ustar00rootroot00000000000000using 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; } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/Since.cs000066400000000000000000000005531502407456000264310ustar00rootroot00000000000000using 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; } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/custom/Validators.cs000066400000000000000000000017451502407456000275040ustar00rootroot00000000000000 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; } public static long? validUInteger(long? value){ if(value == null){ return null; } if (Validators.InUIntegerRange((long)value)) { return value; } throw new ArgumentOutOfRangeException("value", value, "Value is not in the range of LSP uinteger"); } public static long validUInteger(long value){ if (Validators.InUIntegerRange(value)) { return value; } throw new ArgumentOutOfRangeException("value", value, "Value is not in the range of LSP uinteger"); } }microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/dotnet_classes.py000066400000000000000000001042221502407456000271110ustar00rootroot00000000000000# 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_name, 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.*)>") IMMUTABLE_ARRAY_CONVERTER_RE = re.compile(r"ImmutableArray<(?P.*)>") 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 "long" 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 = "string" elif _is_int_enum(enum_def): name = "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))]" elif type_def.kind == "reference" and type_def.name in [ "Pattern", "ChangeAnnotationIdentifier", "RegularExpressionEngineKind", ]: 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}";' ) elif prop_def.type.kind == "base" and prop_def.type.name == "uinteger": private_name = f"_{prop_def.name}" if prop_def.name == name else prop_def.name lines.append( f"public {type_name}{optional} {name} {{ get => {private_name}; set => {private_name} = Validators.validUInteger(value); }}" ) lines.append(f"private {type_name}{optional} {private_name};") 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\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; }", "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 = [ "[JsonConstructor]", f"public {struct.name}({sig})", "{", *indent_lines( [ f"if ({'&&'.join(conditions)})", "{", *indent_lines( [ '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, } ) name = get_name(obj) if not name.endswith(text): name += text class_template = { "name": name, "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": "The Request id.", }, ] if obj.result: properties.append( { "name": "result", "type": cattrs.unstructure(obj.result), "documentation": "Results for the request.", "optional": True, } ) else: properties.append( { "name": "result", "type": {"kind": "base", "name": "null"}, "documentation": "Results for the request.", "optional": True, } ) properties.append( { "name": "error", "type": {"kind": "reference", "name": "ResponseError"}, "documentation": "Error while handling the request.", "optional": True, } ) response_name = get_name(obj) if response_name.endswith("Request"): response_name = response_name[:-7] + "Response" class_template = { "name": response_name, "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) name = get_name(obj) if name.endswith("Request"): name = name[:-7] + "RegistrationOptions" elif name.endswith("Notification"): name = name[:-12] + "RegistrationOptions" class_template = { "name": name, "properties": [ cattrs.unstructure(p, model.Property) for p in properties ], } return model.Structure(**class_template) else: raise ValueError( f"Unexpected registrationOptions type: {obj.registrationOptions.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) request_name = get_name(request) response_name = request_name if response_name.endswith("Request"): response_name = response_name[:-7] + "Response" generate_class_from_struct( struct, spec, types, ( f"IRequest<{get_type_name(request.params, types, spec)}>" if request.params else "IRequest" ), [ f"[Direction(MessageDirection.{to_upper_camel_case(request.messageDirection)})]", f'[LSPRequest("{request.method}", typeof({response_name}), typeof({partial_result_name}))]' if partial_result_name else f'[LSPRequest("{request.method}", typeof({response_name}))]', ], ) 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({request_name}))]", ], ) 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" ), [ 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, ) microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/dotnet_commons.py000066400000000000000000000033021502407456000271240ustar00rootroot00000000000000# 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] microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/dotnet_constants.py000066400000000000000000000002571502407456000274730ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. NAMESPACE = "Microsoft.LanguageServer.Protocol" PACKAGE_DIR_NAME = "lsprotocol" microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/dotnet_enums.py000066400000000000000000000032141502407456000266020ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from typing import 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) microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/dotnet_helpers.py000066400000000000000000000142501502407456000271170ustar00rootroot00000000000000# 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'\2', line) line = BASIC_LINK_RE2.sub(r'\3', line) line = BASIC_LINK_RE3.sub(r'', line) line = BASIC_LINK_RE4.sub(r'', line) return line def lines_to_doc_comments(lines: List[str]) -> List[str]: if not lines: return [] return ( ["/// "] + [f"/// {_fix_links(line)}" for line in lines if not line.startswith("@")] + ["/// "] ) 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 get_name(obj: Union[model.Request, model.Notification]) -> str: if obj.typeName: return obj.typeName if hasattr(obj, "name"): return obj.name return lsp_method_to_name(obj.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 += ["[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))) microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/dotnet_special_classes.py000066400000000000000000000143731502407456000306200ustar00rootroot00000000000000# 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", "RegularExpressionEngineKind", "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 value):base(value){}"], "Dictionary", ["[JsonConverter(typeof(CustomObjectConverter))]"], is_record=False, ), ) if type_def.name == "InitializedParams": lines = namespace_wrapper( NAMESPACE, get_usings(["Dictionary", "DataContract", "JsonConverter"]), class_wrapper( type_def, [ "public InitializedParams(Dictionary value):base(value){}" ], "Dictionary", ["[JsonConverter(typeof(CustomObjectConverter))]"], 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 value):base(value){}"], "List", is_record=False, ), ) if type_def.name in [ "Pattern", "RegularExpressionEngineKind", "ChangeAnnotationIdentifier", ]: 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;", ] 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;", ] if type_def.name == "RegularExpressionEngineKind": inner = [ "private string engineKind;", "public RegularExpressionEngineKind(string value){engineKind = value;}", "public static implicit operator RegularExpressionEngineKind(string value) => new RegularExpressionEngineKind(value);", "public static implicit operator string(RegularExpressionEngineKind engineKind) => engineKind.engineKind;", "public override string ToString() => engineKind;", ] 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();", "}", "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 GetEnumerator() => ((IEnumerable)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", ["[JsonConverter(typeof(DocumentSelectorConverter))]"], ), ) types.add_type_info(type_def, type_def.name, lines) microsoft-lsprotocol-b6edfbf/generator/plugins/dotnet/dotnet_utils.py000066400000000000000000000035361502407456000266220ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import logging import pathlib from typing import Dict 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, _test_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") microsoft-lsprotocol-b6edfbf/generator/plugins/python/000077500000000000000000000000001502407456000235505ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/generator/plugins/python/__init__.py000066400000000000000000000002371502407456000256630ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from .utils import generate_from_spec as generate # noqa: F401 microsoft-lsprotocol-b6edfbf/generator/plugins/python/utils.py000066400000000000000000001351631502407456000252730ustar00rootroot00000000000000# 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 = [] # Special enums with duplicates SPECIAL_ENUMS = ["LanguageKind", "ErrorCodes", "LSPErrorCodes"] def customizations(spec: model.LSPModel) -> model.LSPModel: # https://github.com/microsoft/lsprotocol/issues/344 # Allow CompletionItemKind to support custom values for enum in spec.enumerations: if enum.name == "CompletionItemKind": enum.supportsCustomValues = True break return spec def generate_from_spec(spec: model.LSPModel, output_dir: str, test_dir: str) -> None: spec = customizations(spec) 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 _get_class_name(obj: Union[model.Request, model.Notification]) -> str: if obj.typeName: return obj.typeName return _to_class_name(obj.method) 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 " ".join(text.splitlines()) 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[A-Za-z]*)\]\(\#(?P=class)\)", r"\1", doc) doc = re.sub(r"\[(?P[\S]*)(\[\])\]\(\#(?P=class)\)", r"\1\2", doc) doc = re.sub(r"\[([\w\ ]+)\]\(\#[\w\.]+\)", r"\1", doc) return doc def _get_since( spec: Union[ model.Structure, model.Property, model.Enum, model.EnumItem, model.LiteralType, model.TypeAlias, model.Notification, model.Request, ], indent: str = "", ) -> List[str]: if spec.sinceTags: lines = [f"{indent}# Since:"] for tag in spec.sinceTags: lines.append(f"{indent}# {_sanitize_comment(tag)}") return lines if spec.since: return [f"{indent}# Since: {_sanitize_comment(spec.since)}"] return [] 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, Mapping, Literal, Optional, Sequence, 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"Sequence[{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"Mapping[{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 enum_def.name in SPECIAL_ENUMS 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 ""] code_lines += _get_since(enum_def, indent) code_lines += [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 "", ] item_lines += _get_since(item, indent) item_lines += [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 ""] prop_lines += _get_since(property_def, indent) prop_lines += [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 "", ] code_lines += _get_since(literal_def, indent) code_lines += [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 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 "", ] code_lines += _get_since(type_alias, indent) code_lines += ["# 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 "", ] code_lines += _get_since(type_alias, indent) code_lines += [ 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 "", ] class_lines += _get_since(struct_def, indent) class_lines += [ 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}{method}" for method 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"{_get_class_name(request)}Params" and_types.append((f"{class_name}", request.params)) if request.registrationOptions: if request.registrationOptions.kind == "and": class_name = f"{_get_class_name(request)}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"{_get_class_name(notification)}Params" and_types.append((f"{class_name}", notification.params)) if notification.registrationOptions: if notification.registrationOptions.kind == "and": class_name = f"{_get_class_name(notification)}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", "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 = _get_class_name(request) if not class_name.endswith("Request"): class_name += "Request" class_name_part = class_name.replace("Request", "") doc = _get_indented_documentation(request.documentation, indent) params_class_name = f"{class_name_part}Params" if request.params: if ( request.params.kind == "reference" and {params_class_name} in CUSTOM_REQUEST_PARAMS_ALIASES ): params_type = params_class_name 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, params_class_name ) if not self._has_type(params_type): raise ValueError(f"{params_class_name} type definition is missing.") params_field = "attrs.field()" else: params_type = "Optional[None]" params_field = "attrs.field(default=None)" result_type = None result_class_name = f"{class_name_part}Result" if request.result: if request.result.kind == "reference" or ( request.result.kind == "base" and request.result.name == "null" ): result_type = self._generate_type_name(request.result) else: is_optional = request.result.kind == "or" and any( t.kind == "base" and t.name == "null" for t in request.result.items ) result_type = ( f"Optional[{result_class_name}]" if is_optional else result_class_name ) self._add_type_alias( model.TypeAlias( name=result_class_name, type=request.result, ) ) result_field = "attrs.field(default=None)" else: result_type = "Optional[None]" result_field = "attrs.field(default=None)" self._add_type_code( class_name, [ "@attrs.define", f"class {class_name}:", 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: Literal["{request.method}"] = "{request.method}"', f'{indent}"""The method to be invoked."""', f'{indent}jsonrpc: str = attrs.field(default="2.0")', ], ) self._add_special(class_name, ["method", "jsonrpc"]) response_class_name = f"{class_name_part}Response" self._add_type_code( response_class_name, [ "@attrs.define", f"class {response_class_name}:", 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(response_class_name, ["result", "jsonrpc"]) def _add_notifications(self, lsp_mode: model.LSPModel) -> None: indent = " " * 4 for notification in lsp_mode.notifications: class_name = _get_class_name(notification) if not class_name.endswith("Notification"): class_name += "Notification" 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( class_name, [ "@attrs.define", f"class {class_name}:", f'{indent}"""{doc}"""' if notification.documentation else "", f"{indent}params: {params_type} = {params_field}", f'{indent}method: Literal["{notification.method}"] = 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(class_name, ["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 = _get_class_name(request) if not class_name.endswith("Request"): class_name += "Request" class_name_part = class_name.replace("Request", "") request_class = f"{class_name_part}Request" response_class = f"{class_name_part}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 = _get_class_name(notification) if not class_name.endswith("Notification"): class_name += "Notification" notification_class = class_name 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}'"] microsoft-lsprotocol-b6edfbf/generator/plugins/rust/000077500000000000000000000000001502407456000232245ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/generator/plugins/rust/__init__.py000066400000000000000000000002441502407456000253350ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from .rust_utils import generate_from_spec as generate # noqa: F401 microsoft-lsprotocol-b6edfbf/generator/plugins/rust/rust_commons.py000066400000000000000000000524561502407456000263420ustar00rootroot00000000000000# 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 {", " /// 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 {", " /// 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(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(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(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(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(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(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;"] 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" ) 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 = sorted( 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", "RegExp"]: return "String" elif lsp_type.name in ["DocumentUri", "URI"]: return "Url" 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: s_props = get_extended_properties(s, spec) properties += [p for p in s_props] 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) 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 = ( ['#[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): if name.endswith("Notification"): return name return f"{name}Notification" if name.endswith("Request"): return name return f"{name}Request" def get_name( type_def: Union[model.Structure, model.Notification, model.Request], ) -> str: if hasattr(type_def, "typeName"): return type_def.typeName if hasattr(type_def, "name"): return type_def.name return get_message_type_name(type_def) def struct_wrapper( type_def: Union[model.Structure, model.Notification, model.Request], inner: List[str], ) -> List[str]: name = get_name(type_def) lines = ( _get_doc(type_def.documentation) + generate_extras(type_def) + [ "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", '#[serde(rename_all = "camelCase", deny_unknown_fields)]', 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]"] if type_def.proposed: extras += ['#[cfg(feature = "proposed")]'] return extras microsoft-lsprotocol-b6edfbf/generator/plugins/rust/rust_enum.py000066400000000000000000000050261502407456000256220ustar00rootroot00000000000000# 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_serde(enum: model.Enum) -> List[str]: ser = [ f"impl Serialize for {enum.name} {{", "fn serialize(&self, serializer: S) -> Result where S: serde::Serializer,{", "match self {", ] de = [ f"impl<'de> Deserialize<'de> for {enum.name} {{", f"fn deserialize(deserializer: D) -> Result<{enum.name}, D::Error> where D: serde::Deserializer<'de>," "{", "let value = i32::deserialize(deserializer)?;", "match value {", ] for item in enum.values: full_name = f"{enum.name}::{to_upper_camel_case(item.name)}" ser += [f"{full_name} => serializer.serialize_i32({item.value}),"] de += [f"{item.value} => Ok({full_name}),"] ser += [ "}", # match "}", # fn "}", # impl ] de += [ '_ => Err(serde::de::Error::custom("Unexpected value"))', "}", # match "}", # fn "}", # impl ] return ser + de 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) if is_int: lines += ["#[derive(PartialEq, Debug, Eq, Clone)]"] else: lines += ["#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]"] lines += [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 += ["}"] if is_int: lines += generate_serde(enum) 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) microsoft-lsprotocol-b6edfbf/generator/plugins/rust/rust_file_header.py000066400000000000000000000006421502407456000271040ustar00rootroot00000000000000# 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."] microsoft-lsprotocol-b6edfbf/generator/plugins/rust/rust_lang_utils.py000066400000000000000000000037101502407456000270150ustar00rootroot00000000000000# 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] microsoft-lsprotocol-b6edfbf/generator/plugins/rust/rust_structs.py000066400000000000000000000376251502407456000263770ustar00rootroot00000000000000# 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, generate_extras, generate_literal_struct_name, generate_property, get_extended_properties, get_from_name, get_message_type_name, get_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 += ["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: ptype = get_from_name(notification_def.params.name, spec) if hasattr(ptype, "properties") and get_extended_properties(ptype, spec): properties += [ model.Property( name="params", type=notification_def.params, ) ] else: properties += [ model.Property( name="params", type=model.ReferenceType(kind="reference", name="LSPAny"), optional=True, ) ] else: properties += [ model.Property( name="params", type=model.ReferenceType(kind="reference", name="LSPNull"), optional=True, ) ] 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: ptype = get_from_name(request_def.params.name, spec) if hasattr(ptype, "properties") and get_extended_properties(ptype, spec): properties += [ model.Property( name="params", type=request_def.params, ) ] else: properties += [ model.Property( name="params", type=model.ReferenceType(kind="reference", name="LSPAny"), optional=True, ) ] else: properties += [ model.Property( name="params", type=model.ReferenceType(kind="reference", name="LSPNull"), optional=True, ) ] 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 = get_name(request_def) if name.endswith("Request"): name = name[:-7] 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 # Partial results are also typical covered in `model.Structures` that should already be generated # so we don't need to generate them here. def generate_registration_options( request_def: model.Request, types: TypeData, spec: model.LSPModel ) -> None: if not request_def.registrationOptions: return # These types have references in `model.Structures` that should already be generated # so we don't need to generate them here. microsoft-lsprotocol-b6edfbf/generator/plugins/rust/rust_tests.py000066400000000000000000000024071502407456000260200ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import pathlib import generator.model as model from .rust_commons import get_name def generate_test_code(spec: model.LSPModel, test_path: pathlib.Path) -> str: """Generate the code for the given spec.""" lines = [] for request in spec.requests: request_name = get_name(request) lines += [ f'"{request_name}" =>{{', f"return validate_type::<{request_name}>(result_type, data)", "}", ] for notification in spec.notifications: notification_name = get_name(notification) lines += [ f'"{notification_name}" =>{{', f"return validate_type::<{notification_name}>(result_type, data)", "}", ] code = test_path.read_text(encoding="utf-8").splitlines() start_marker = "GENERATED_TEST_CODE:start" end_marker = "GENERATED_TEST_CODE:end" start_index = -1 end_index = -1 for i, line in enumerate(code): if line.endswith(start_marker): start_index = i + 1 elif line.endswith(end_marker): end_index = i code[start_index:end_index] = lines test_path.write_text("\n".join(code), encoding="utf-8") microsoft-lsprotocol-b6edfbf/generator/plugins/rust/rust_utils.py000066400000000000000000000043201502407456000260120ustar00rootroot00000000000000# 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, ) from .rust_tests import generate_test_code PACKAGE_DIR_NAME = "lsprotocol" def generate_from_spec(spec: model.LSPModel, output_dir: str, test_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") # update tests if exists test_path = pathlib.Path(test_dir) / "src" / "main.rs" if test_path.exists(): generate_test_code(spec, test_path) 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 url::Url;", "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) microsoft-lsprotocol-b6edfbf/generator/plugins/testdata/000077500000000000000000000000001502407456000240405ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/generator/plugins/testdata/__init__.py000066400000000000000000000002501502407456000261460ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from .testdata_utils import generate_from_spec as generate # noqa: F401 microsoft-lsprotocol-b6edfbf/generator/plugins/testdata/testdata_generator.py000066400000000000000000000404031502407456000302720ustar00rootroot00000000000000# 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, List, Optional, 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 = 2**31 LSP_UNDER_MIN_INT = -(2**31) - 1 LSP_OVER_MAX_UINT = 2**32 + 1 LSP_UNDER_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(part) for part in lists) max_len = min(1000, max_len) return [extend(part, max_len) for part 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): 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): 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 get_name(obj: Union[model.Request, model.Notification]) -> str: if obj.typeName: return obj.typeName return lsp_method_to_name(obj.method) def generate(spec: model.LSPModel, logger: logging.Logger): spec.structures.append(RESPONSE_ERROR) testdata = {} for request in spec.requests: request_name = get_name(request) if not request_name.endswith("Request"): request_name = f"{request_name}Request" response_name_part = request_name.replace("Request", "") response_name = f"{response_name_part}Response" counter = 0 for valid, value in generate_requests(request, spec): content = json.dumps(value, indent=4, ensure_ascii=False) name = f"{request_name}-{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"{response_name}-{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: notification_name = get_name(notify) if not notification_name.endswith("Notification"): notification_name = f"{notification_name}Notification" counter = 0 for valid, value in generate_notifications(notify, spec): content = json.dumps(value, indent=4, ensure_ascii=False) name = f"{notification_name}-{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 microsoft-lsprotocol-b6edfbf/generator/plugins/testdata/testdata_utils.py000066400000000000000000000017521502407456000274500ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import logging import pathlib from typing import Dict import generator.model as model from .testdata_generator import generate logger = logging.getLogger("testdata") def generate_from_spec(spec: model.LSPModel, output_dir: str, test_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) logger.info("Cleaning up existing data") 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() microsoft-lsprotocol-b6edfbf/lsprotocol.sln000066400000000000000000000047311502407456000215030ustar00rootroot00000000000000īģŋ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.5.002.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "packages", "packages", "{F7A4C27E-590F-4449-8CEA-EB9B6476ADDD}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet", "dotnet", "{7713486B-C956-4D98-81E1-057F80FB323C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "lsprotocol", "packages\dotnet\lsprotocol\lsprotocol.csproj", "{E40E6342-0ABD-4E41-98B5-E34CB2DEA0C2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{4E56DC3C-E33A-40F5-8082-778C0A1F6B2E}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet", "dotnet", "{D6F5BE34-11D4-4D75-ADCD-178D424AF26A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "lsprotocol_tests", "tests\dotnet\lsprotocol_tests\lsprotocol_tests.csproj", "{076D13A1-3EEA-4DD3-80C8-88E8D80E08C8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {E40E6342-0ABD-4E41-98B5-E34CB2DEA0C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E40E6342-0ABD-4E41-98B5-E34CB2DEA0C2}.Debug|Any CPU.Build.0 = Debug|Any CPU {E40E6342-0ABD-4E41-98B5-E34CB2DEA0C2}.Release|Any CPU.ActiveCfg = Release|Any CPU {E40E6342-0ABD-4E41-98B5-E34CB2DEA0C2}.Release|Any CPU.Build.0 = Release|Any CPU {076D13A1-3EEA-4DD3-80C8-88E8D80E08C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {076D13A1-3EEA-4DD3-80C8-88E8D80E08C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {076D13A1-3EEA-4DD3-80C8-88E8D80E08C8}.Release|Any CPU.ActiveCfg = Release|Any CPU {076D13A1-3EEA-4DD3-80C8-88E8D80E08C8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {7713486B-C956-4D98-81E1-057F80FB323C} = {F7A4C27E-590F-4449-8CEA-EB9B6476ADDD} {E40E6342-0ABD-4E41-98B5-E34CB2DEA0C2} = {7713486B-C956-4D98-81E1-057F80FB323C} {D6F5BE34-11D4-4D75-ADCD-178D424AF26A} = {4E56DC3C-E33A-40F5-8082-778C0A1F6B2E} {076D13A1-3EEA-4DD3-80C8-88E8D80E08C8} = {D6F5BE34-11D4-4D75-ADCD-178D424AF26A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {78EC86C0-D400-4662-BE12-33A046D3F565} EndGlobalSection EndGlobal microsoft-lsprotocol-b6edfbf/noxfile.py000066400000000000000000000200761502407456000206030ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import json 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 python.""" _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 coverage(session: nox.Session): """Run coverage for generator and generated code in python.""" _install_requirements(session) session.install("pytest-cov") session.log("Running test data generator.") session.run("python", "-m", "generator", "--plugin", "testdata") session.log("Running coverage: generator and generated Python code.") session.run("pytest", "--cov=lsprotocol", "./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("mypy", "ruff") session.run("ruff", "--version") session.run("mypy", "--version") session.run("ruff", "format", "--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.""" _install_requirements(session) _format_code(session) def _format_code(session: nox.Session): session.install("ruff") session.run("ruff", "--version") session.run("ruff", "format", ".") @nox.session() def build_python_package(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( "# 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( "# 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) with session.chdir("./tests/rust"): session.run("cargo", "fmt", external=True) session.run("cargo", "build", external=True) microsoft-lsprotocol-b6edfbf/packages/000077500000000000000000000000001502407456000203365ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/packages/dotnet/000077500000000000000000000000001502407456000216335ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/packages/dotnet/lsprotocol/000077500000000000000000000000001502407456000240335ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/packages/dotnet/lsprotocol/.gitignore000066400000000000000000000000041502407456000260150ustar00rootroot00000000000000*.csmicrosoft-lsprotocol-b6edfbf/packages/dotnet/lsprotocol/lsprotocol.csproj000066400000000000000000000004571502407456000274630ustar00rootroot00000000000000 net6.0 enable enable microsoft-lsprotocol-b6edfbf/packages/python/000077500000000000000000000000001502407456000216575ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/packages/python/LICENSE000066400000000000000000000021651502407456000226700ustar00rootroot00000000000000 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 microsoft-lsprotocol-b6edfbf/packages/python/README.md000066400000000000000000000021301502407456000231320ustar00rootroot00000000000000# 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} ``` microsoft-lsprotocol-b6edfbf/packages/python/lsprotocol/000077500000000000000000000000001502407456000240575ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/packages/python/lsprotocol/__init__.py000066400000000000000000000001361502407456000261700ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. microsoft-lsprotocol-b6edfbf/packages/python/lsprotocol/_hooks.py000066400000000000000000001271201502407456000257160ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import sys from typing import Any, Optional, Sequence, 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, {}) _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, Sequence[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, Sequence[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, Sequence[lsp_types.Location], Sequence[lsp_types.LocationLink], ] ]: if object_ is None: return None if isinstance(object_, list): if len(object_) == 0: return [] 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[Sequence[lsp_types.DocumentSymbol], Sequence[lsp_types.SymbolInformation]] ]: if object_ is None: return None if isinstance(object_, list): if len(object_) == 0: return [] 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.MarkedStringWithLanguage, Sequence[Union[OptionalPrimitive, lsp_types.MarkedStringWithLanguage]], ] ]: 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.MarkedStringWithLanguage) ) for item in object_ ] if "kind" in object_: return converter.structure(object_, lsp_types.MarkupContent) else: return converter.structure(object_, lsp_types.MarkedStringWithLanguage) 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.SemanticTokensFullDelta]: if object_ is None: return None if isinstance(object_, (bool, int, str, float)): return object_ return converter.structure(object_, lsp_types.SemanticTokensFullDelta) def _semantic_tokens_capabilities_hook( object_: Any, _: type ) -> Union[ OptionalPrimitive, lsp_types.ClientSemanticTokensRequestFullDelta, ]: if object_ is None: return None if isinstance(object_, (bool, int, str, float)): return object_ return converter.structure( object_, lsp_types.ClientSemanticTokensRequestFullDelta ) 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.NotebookDocumentFilterWithNotebook, lsp_types.NotebookDocumentFilterWithCells, ]: if "notebook" in object_: return converter.structure( object_, lsp_types.NotebookDocumentFilterWithNotebook ) else: return converter.structure( object_, lsp_types.NotebookDocumentFilterWithCells ) def _semantic_token_registration_options_hook( object_: Any, _: type ) -> Optional[ Union[OptionalPrimitive, lsp_types.ClientSemanticTokensRequestFullDelta] ]: if object_ is None: return None if isinstance(object_, (bool, int, str, float)): return object_ return converter.structure( object_, lsp_types.ClientSemanticTokensRequestFullDelta ) 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, Sequence[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[ Sequence[lsp_types.SymbolInformation], Sequence[lsp_types.WorkspaceSymbol] ] ]: if object_ is None: return None assert isinstance(object_, list) if len(object_) == 0: return [] if "deprecated" in object_[0]: return [ converter.structure(item, lsp_types.SymbolInformation) for item in object_ ] elif ("data" in object_[0]) or ("range" not in object_[0]["location"]): return [ converter.structure(item, lsp_types.WorkspaceSymbol) for item in object_ ] return [ converter.structure(item, lsp_types.SymbolInformation) for item in object_ ] def _language_kind_hook( object_: Any, _: type ) -> Union[ lsp_types.LanguageKind, OptionalPrimitive, ]: if object_ is None: return None if isinstance(object_, (bool, int, str, float)): return object_ return converter.structure(object_, lsp_types.LanguageKind) def _text_edit_hook( object_: Any, _: type ) -> Union[ lsp_types.TextEdit, lsp_types.AnnotatedTextEdit, lsp_types.SnippetTextEdit ]: if "snippet" in object_: return converter.structure(object_, lsp_types.SnippetTextEdit) if "annotationId" in object_: return converter.structure(object_, lsp_types.AnnotatedTextEdit) return converter.structure(object_, lsp_types.TextEdit) def _completion_item_kind_hook( object_: Any, _: type ) -> Union[lsp_types.CompletionItemKind, OptionalPrimitive]: if object_ is None: return None if isinstance(object_, (bool, int, str, float)): return object_ return converter.structure(object_, lsp_types.CompletionItemKind) def _relative_pattern_hook( object_: Any, _: type ) -> Union[OptionalPrimitive, lsp_types.RelativePattern]: if object_ is None: return None if isinstance(object_, (bool, int, str, float)): return object_ return converter.structure(object_, lsp_types.RelativePattern) def _workspace_folder_hook( object_: Any, _: type ) -> Union[OptionalPrimitive, lsp_types.WorkspaceFolder]: if object_ is None: return None if isinstance(object_, (bool, int, str, float)): return object_ return converter.structure(object_, lsp_types.WorkspaceFolder) def _text_document_content_hook( object_: Any, _: type ) -> Union[ OptionalPrimitive, lsp_types.TextDocumentContentRegistrationOptions, lsp_types.TextDocumentContentOptions, ]: if object_ is None: return None if "id" in object_: return converter.structure( object_, lsp_types.TextDocumentContentRegistrationOptions ) else: return converter.structure(object_, lsp_types.TextDocumentContentOptions) 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, Sequence[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[Sequence[lsp_types.CompletionItem], lsp_types.CompletionList] ], _completion_list_hook, ), ( Optional[ Union[ lsp_types.Location, Sequence[lsp_types.Location], Sequence[lsp_types.LocationLink], ] ], _location_hook, ), ( Optional[ Union[ Sequence[lsp_types.SymbolInformation], Sequence[lsp_types.DocumentSymbol], ] ], _symbol_hook, ), ( Union[ lsp_types.MarkupContent, str, lsp_types.MarkedStringWithLanguage, Sequence[Union[str, lsp_types.MarkedStringWithLanguage]], ], _markup_content_hook, ), ( Union[ lsp_types.TextDocumentEdit, lsp_types.CreateFile, lsp_types.RenameFile, lsp_types.DeleteFile, ], _document_edit_hook, ), ( Optional[Union[bool, lsp_types.SemanticTokensFullDelta]], _semantic_tokens_hook, ), ( Optional[ Union[ bool, lsp_types.ClientSemanticTokensRequestFullDelta, ] ], _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.NotebookDocumentFilterWithNotebook, lsp_types.NotebookDocumentFilterWithCells, ], _notebook_sync_option_selector_hook, ), ( Optional[ Union[ lsp_types.PositionEncodingKind, str, ] ], _position_encoding_hook, ), ( Optional[Union[bool, lsp_types.ClientSemanticTokensRequestFullDelta]], _semantic_token_registration_options_hook, ), ( Optional[Union[bool, lsp_types.InlineCompletionOptions]], _inline_completion_provider_hook, ), ( Optional[ Union[ lsp_types.InlineCompletionList, Sequence[lsp_types.InlineCompletionItem], ] ], _inline_completion_list_hook, ), ( Union[str, lsp_types.StringValue], _string_value_hook, ), ( Optional[ Union[ Sequence[lsp_types.SymbolInformation], Sequence[lsp_types.WorkspaceSymbol], ] ], _symbol_list_hook, ), ( Union[lsp_types.LanguageKind, str], _language_kind_hook, ), ( Union[ lsp_types.TextEdit, lsp_types.AnnotatedTextEdit, lsp_types.SnippetTextEdit, ], _text_edit_hook, ), ( Optional[Union[lsp_types.CompletionItemKind, int]], _completion_item_kind_hook, ), ( Union[lsp_types.CompletionItemKind, int], _completion_item_kind_hook, ), ( Optional[Union[str, lsp_types.RelativePattern]], _relative_pattern_hook, ), ( Union[str, lsp_types.RelativePattern], _relative_pattern_hook, ), ( Optional[Union[lsp_types.WorkspaceFolder, str]], _workspace_folder_hook, ), ( Union[lsp_types.WorkspaceFolder, str], _workspace_folder_hook, ), ( Optional[ Union[ lsp_types.TextDocumentContentOptions, lsp_types.TextDocumentContentRegistrationOptions, ] ], _text_document_content_hook, ), ( Union[ lsp_types.TextDocumentContentOptions, lsp_types.TextDocumentContentRegistrationOptions, ], _text_document_content_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.TextDocumentFilterLanguage, lsp_types.TextDocumentFilterScheme, lsp_types.TextDocumentFilterPattern, 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.TextDocumentFilterLanguage) elif "scheme" in object_: return converter.structure(object_, lsp_types.TextDocumentFilterScheme) else: return converter.structure(object_, lsp_types.TextDocumentFilterPattern) def _notebook_filter_hook( object_: Any, _: type ) -> Union[ str, lsp_types.NotebookDocumentFilterNotebookType, lsp_types.NotebookDocumentFilterScheme, lsp_types.NotebookDocumentFilterPattern, ]: if isinstance(object_, str): return str(object_) elif "notebookType" in object_: return converter.structure( object_, lsp_types.NotebookDocumentFilterNotebookType ) elif "scheme" in object_: return converter.structure(object_, lsp_types.NotebookDocumentFilterScheme) else: return converter.structure(object_, lsp_types.NotebookDocumentFilterPattern) 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.TextDocumentFilterLanguage, lsp_types.TextDocumentFilterScheme, lsp_types.TextDocumentFilterPattern, lsp_types.NotebookCellTextDocumentFilter, ], _text_document_filter_hook, ), (lsp_types.DocumentFilter, _text_document_filter_hook), ( Union[ str, lsp_types.NotebookDocumentFilterNotebookType, lsp_types.NotebookDocumentFilterScheme, lsp_types.NotebookDocumentFilterPattern, ], _notebook_filter_hook, ), (NotebookSelectorItem, _notebook_filter_hook), ( Union[lsp_types.LSPObject, Sequence["LSPAny"], str, int, float, bool, None], _lsp_object_hook, ), ( Union[ lsp_types.LSPObject, Sequence[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, Sequence[ Union[ lsp_types.LSPObject, Sequence["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) } return cattrs.gen.make_dict_unstructure_fn(cls, converter, **attributes) # type: ignore 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) } return cattrs.gen.make_dict_structure_fn(cls, converter, **attributes) # type: ignore converter.register_unstructure_hook_factory(attrs.has, _with_custom_unstructure) converter.register_structure_hook_factory(attrs.has, _with_custom_structure) return converter microsoft-lsprotocol-b6edfbf/packages/python/lsprotocol/converters.py000066400000000000000000000006611502407456000266260ustar00rootroot00000000000000# 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) microsoft-lsprotocol-b6edfbf/packages/python/lsprotocol/py.typed000066400000000000000000000000001502407456000255440ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/packages/python/lsprotocol/types.py000066400000000000000000016430751502407456000256150ustar00rootroot00000000000000# 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, Mapping, Literal, Optional, Sequence, 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 Label = "label" """@since 3.18.0""" # Since: 3.18.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 has 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 @proposed""" # Since: 3.18.0 # Proposed @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><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 - ...""" RefactorMove = "refactor.move" """Base kind for refactoring move actions: `refactor.move` Example move actions: - Move a function to a new file - Move a property between classes - Move method to base class - ... @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed 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 Notebook = "notebook" """Base kind for all code actions applying to the entire notebook's scope. CodeActionKinds using this should always begin with `notebook.` @since 3.18.0""" # Since: 3.18.0 @enum.unique class CodeActionTag(int, enum.Enum): """Code action tags are extra annotations that tweak the behavior of a code action. @since 3.18.0 - proposed""" # Since: 3.18.0 - proposed LlmGenerated = 1 """Marks the code action as LLM-generated.""" @enum.unique class TraceValue(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""" class LanguageKind(str, enum.Enum): """Predefined Language kinds @since 3.18.0""" # Since: 3.18.0 Abap = "abap" WindowsBat = "bat" BibTeX = "bibtex" Clojure = "clojure" Coffeescript = "coffeescript" C = "c" Cpp = "cpp" CSharp = "csharp" Css = "css" D = "d" """@since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed Delphi = "pascal" """@since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed Diff = "diff" Dart = "dart" Dockerfile = "dockerfile" Elixir = "elixir" Erlang = "erlang" FSharp = "fsharp" GitCommit = "git-commit" GitRebase = "rebase" Go = "go" Groovy = "groovy" Handlebars = "handlebars" Haskell = "haskell" Html = "html" Ini = "ini" Java = "java" JavaScript = "javascript" JavaScriptReact = "javascriptreact" Json = "json" LaTeX = "latex" Less = "less" Lua = "lua" Makefile = "makefile" Markdown = "markdown" ObjectiveC = "objective-c" ObjectiveCpp = "objective-cpp" Pascal = "pascal" """@since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed Perl = "perl" Perl6 = "perl6" Php = "php" Powershell = "powershell" Pug = "jade" Python = "python" R = "r" Razor = "razor" Ruby = "ruby" Rust = "rust" Scss = "scss" Sass = "sass" Scala = "scala" ShaderLab = "shaderlab" ShellScript = "shellscript" Sql = "sql" Swift = "swift" TypeScript = "typescript" TypeScriptReact = "typescriptreact" TeX = "tex" VisualBasic = "vb" Xml = "xml" Xsl = "xsl" Yaml = "yaml" @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 = 1 """Completion was triggered explicitly by a user gesture.""" Automatic = 2 """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 ApplyKind(int, enum.Enum): """Defines how values from a set of defaults and an individual item will be merged. @since 3.18.0""" # Since: 3.18.0 Replace = 1 """The value from the individual item (if provided and not `null`) will be used instead of the default.""" Merge = 2 """The value from the item will be merged with the default. The specific rules for mergeing values are defined against each field that supports merging.""" @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", Sequence["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 = Sequence["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", Sequence["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 PrepareRenameResult = Union[ "Range", "PrepareRenamePlaceholder", "PrepareRenameDefaultBehavior" ] DocumentSelector = Sequence["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 TextDocumentContentChangeEvent = Union[ "TextDocumentContentChangePartial", "TextDocumentContentChangeWholeDocument" ] """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.""" MarkedString = Union[str, "MarkedStringWithLanguage"] """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 - support for NotebookCellTextDocumentFilter.""" # Since: 3.17.0 - 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 TextDocumentFilter = Union[ "TextDocumentFilterLanguage", "TextDocumentFilterScheme", "TextDocumentFilterPattern", ] """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 NotebookDocumentFilter = Union[ "NotebookDocumentFilterNotebookType", "NotebookDocumentFilterScheme", "NotebookDocumentFilterPattern", ] """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 RegularExpressionEngineKind = str @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: Sequence["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[Sequence["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: Sequence["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[Sequence[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: Sequence["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: Sequence["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: Sequence[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: Sequence[int] = attrs.field() @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, "SemanticTokensFullDelta"]] = 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 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, "SemanticTokensFullDelta"]] = 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: Sequence["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: Sequence["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: Sequence["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: Sequence["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[Mapping[str, Sequence["TextEdit"]]] = attrs.field(default=None) """Holds changes to existing resources.""" document_changes: Optional[ Sequence[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[ Mapping[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: Sequence["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: Sequence["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: Sequence["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[Sequence[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. If multiple hints have the same position, they will be shown in the order they appear in the response.""" label: Union[str, Sequence["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[Sequence["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: Mapping[ 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: Sequence["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: Sequence[WorkspaceDocumentDiagnosticReport] = attrs.field() @attrs.define class WorkspaceDiagnosticReportPartialResult: """A partial result for a workspace diagnostic report. @since 3.17.0""" # Since: 3.17.0 items: Sequence[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: Sequence["TextDocumentItem"] = attrs.field() """The text documents that represent the content of a notebook cell.""" @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: Sequence[ Union["NotebookDocumentFilterWithNotebook", "NotebookDocumentFilterWithCells"] ] = 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 NotebookDocumentSyncRegistrationOptions: """Registration options specific to a notebook. @since 3.17.0""" # Since: 3.17.0 notebook_selector: Sequence[ Union["NotebookDocumentFilterWithNotebook", "NotebookDocumentFilterWithCells"] ] = 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 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: Sequence["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: Sequence["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 TextDocumentContentParams: """Parameters for the `workspace/textDocumentContent` request. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed uri: str = attrs.field(validator=attrs.validators.instance_of(str)) """The uri of the text document.""" @attrs.define class TextDocumentContentResult: """Result of the `workspace/textDocumentContent` request. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed text: str = attrs.field(validator=attrs.validators.instance_of(str)) """The text content of the text document. Please note, that the content of any subsequent open notifications for the text document might differ from the returned content due to whitespace and line ending normalizations done on the client""" @attrs.define class TextDocumentContentOptions: """Text document content provider options. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed schemes: Sequence[str] = attrs.field() """The schemes for which the server provides content.""" @attrs.define class TextDocumentContentRegistrationOptions: """Text document content provider registration options. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed schemes: Sequence[str] = attrs.field() """The schemes for which the server provides content.""" 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 TextDocumentContentRefreshParams: """Parameters for the `workspace/textDocumentContent/refresh` request. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed uri: str = attrs.field(validator=attrs.validators.instance_of(str)) """The uri of the text document to refresh.""" @attrs.define class RegistrationParams: registrations: Sequence["Registration"] = attrs.field() @attrs.define class UnregistrationParams: unregisterations: Sequence["Unregistration"] = attrs.field() @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["ClientInfo"] = 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[TraceValue] = 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[Sequence[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["ClientInfo"] = 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[TraceValue] = 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[Sequence[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 InitializeResult: """The result returned from an initialize request.""" capabilities: "ServerCapabilities" = attrs.field() """The capabilities the language server provides.""" server_info: Optional["ServerInfo"] = 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, Sequence[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[Sequence["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: Sequence[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: Sequence["FileEvent"] = attrs.field() """The actual file events.""" @attrs.define class DidChangeWatchedFilesRegistrationOptions: """Describe options to be used when registered for text document change events.""" watchers: Sequence["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: Sequence["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[Union[CompletionItemKind, int]] = attrs.field(default=None) """The kind of this completion item. Based of the kind an icon is chosen by the editor.""" tags: Optional[Sequence[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` 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[Sequence[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[Sequence[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 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: Sequence[CompletionItem] = attrs.field() """The completion items.""" item_defaults: Optional["CompletionItemDefaults"] = 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 rules for combining these are defined by `applyKinds` (if the client supports it), defaulting to ApplyKind.Replace. 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 apply_kind: Optional["CompletionItemApplyKinds"] = attrs.field(default=None) """Specifies how fields from a completion item should be combined with those from `completionList.itemDefaults`. If unspecified, all fields will be treated as ApplyKind.Replace. If a field's value is ApplyKind.Replace, the value from a completion item (if provided and not `null`) will always be used instead of the value from `completionItem.itemDefaults`. If a field's value is ApplyKind.Merge, the values will be merged using the rules defined against each field below. Servers are only allowed to return `applyKind` if the client signals support for this via the `completionList.applyKindSupport` capability. @since 3.18.0""" # Since: 3.18.0 @attrs.define class CompletionOptions: """Completion options.""" trigger_characters: Optional[Sequence[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[Sequence[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["ServerCompletionItemOptions"] = 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 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[Sequence[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[Sequence[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["ServerCompletionItemOptions"] = 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, Sequence[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: Sequence["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[Union[int, None]] = attrs.field(default=None) """The active parameter of the active signature. If `null`, no parameter of the signature is active (for example a named argument that does not match any declared parameters). This is only valid if the client specifies the client capability `textDocument.signatureHelp.noActiveParameterSupport === true` 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 (but still nullable) 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[Sequence[str]] = attrs.field(default=None) """List of characters that trigger signature help automatically.""" retrigger_characters: Optional[Sequence[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[Sequence[str]] = attrs.field(default=None) """List of characters that trigger signature help automatically.""" retrigger_characters: Optional[Sequence[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[Sequence[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[Sequence[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[Sequence[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[Sequence["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.""" tooltip: Optional[str] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(str)), default=None, ) """An optional tooltip. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed arguments: Optional[Sequence[LSPAny]] = attrs.field(default=None) """Arguments that the command handler should be invoked with.""" @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[Sequence["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["CodeActionDisabled"] = 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 tags: Optional[Sequence[CodeActionTag]] = attrs.field(default=None) """Tags for this code action. @since 3.18.0 - proposed""" # Since: 3.18.0 - proposed @attrs.define class CodeActionOptions: """Provider options for a {@link CodeActionRequest}.""" code_action_kinds: Optional[Sequence[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.""" documentation: Optional[Sequence["CodeActionKindDocumentation"]] = attrs.field( default=None ) """Static documentation for a class of code actions. Documentation from the provider should be shown in the code actions menu if either: - Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that most closely matches the requested code action kind. For example, if a provider has documentation for both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`, the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`. - Any code actions of `kind` are returned by the provider. At most one documentation entry should be shown per provider. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed 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[Sequence[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.""" documentation: Optional[Sequence["CodeActionKindDocumentation"]] = attrs.field( default=None ) """Static documentation for a class of code actions. Documentation from the provider should be shown in the code actions menu if either: - Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that most closely matches the requested code action kind. For example, if a provider has documentation for both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`, the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`. - Any code actions of `kind` are returned by the provider. At most one documentation entry should be shown per provider. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed 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. The `query`-parameter should be interpreted in a *relaxed way* as editors will apply their own highlighting and scoring on the results. A good rule of thumb is to match case-insensitive and to simply check that the characters of *query* appear in their order in a candidate symbol. Servers shouldn't use prefix, substring, or similar strict matching.""" 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 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, "LocationUriOnly"] = 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[Sequence[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: Sequence["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[Sequence[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[Sequence[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[Sequence[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: Sequence[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: Sequence[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.""" metadata: Optional["WorkspaceEditMetadata"] = attrs.field(default=None) """Additional data about the edit. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed @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: TraceValue = 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: Sequence[WorkspaceFolder] = attrs.field() """The array of added workspace folders""" removed: Sequence[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).""" 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`.""" 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[Sequence[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: Sequence[Union[TextEdit, "AnnotatedTextEdit", "SnippetTextEdit"]] = ( attrs.field() ) """The edits to be applied. @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a client capability. @since 3.18.0 - support for SnippetTextEdit. This is guarded using a client capability.""" # Since: # 3.16.0 - support for AnnotatedTextEdit. This is guarded using a client capability. # 3.18.0 - support for SnippetTextEdit. This is guarded using a client 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: Sequence["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: Sequence["Diagnostic"] = attrs.field() """The actual items.""" related_documents: Optional[ Mapping[ 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[ Mapping[ 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: Sequence["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: Union[LanguageKind, str] = attrs.field() """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 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["NotebookDocumentCellChanges"] = 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 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["WorkspaceOptions"] = attrs.field(default=None) """Workspace specific server capabilities.""" experimental: Optional[LSPAny] = attrs.field(default=None) """Experimental server capabilities.""" @attrs.define class ServerInfo: """Information about the server @since 3.15.0 @since 3.18.0 ServerInfo type name added.""" # Since: # 3.15.0 # 3.18.0 ServerInfo type name added. 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 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. To avoid interpretation mismatches when a server is used with different clients it is highly recommended that servers always provide a severity value.""" 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[Sequence[DiagnosticTag]] = attrs.field(default=None) """Additional metadata about the diagnostic. @since 3.15.0""" # Since: 3.15.0 related_information: Optional[Sequence["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 CompletionItemDefaults: """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 rules for combining these are defined by `applyKinds` (if the client supports it), defaulting to ApplyKind.Replace. 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 commit_characters: Optional[Sequence[str]] = attrs.field(default=None) """A default commit character set. @since 3.17.0""" # Since: 3.17.0 edit_range: Optional[Union[Range, "EditRangeWithInsertReplace"]] = 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 CompletionItemApplyKinds: """Specifies how fields from a completion item should be combined with those from `completionList.itemDefaults`. If unspecified, all fields will be treated as ApplyKind.Replace. If a field's value is ApplyKind.Replace, the value from a completion item (if provided and not `null`) will always be used instead of the value from `completionItem.itemDefaults`. If a field's value is ApplyKind.Merge, the values will be merged using the rules defined against each field below. Servers are only allowed to return `applyKind` if the client signals support for this via the `completionList.applyKindSupport` capability. @since 3.18.0""" # Since: 3.18.0 commit_characters: Optional[ApplyKind] = attrs.field(default=None) """Specifies whether commitCharacters on a completion will replace or be merged with those in `completionList.itemDefaults.commitCharacters`. If ApplyKind.Replace, the commit characters from the completion item will always be used unless not provided, in which case those from `completionList.itemDefaults.commitCharacters` will be used. An empty list can be used if a completion item does not have any commit characters and also should not use those from `completionList.itemDefaults.commitCharacters`. If ApplyKind.Merge the commitCharacters for the completion will be the union of all values in both `completionList.itemDefaults.commitCharacters` and the completion's own `commitCharacters`. @since 3.18.0""" # Since: 3.18.0 data: Optional[ApplyKind] = attrs.field(default=None) """Specifies whether the `data` field on a completion will replace or be merged with data from `completionList.itemDefaults.data`. If ApplyKind.Replace, the data from the completion item will be used if provided (and not `null`), otherwise `completionList.itemDefaults.data` will be used. An empty object can be used if a completion item does not have any data but also should not use the value from `completionList.itemDefaults.data`. If ApplyKind.Merge, a shallow merge will be performed between `completionList.itemDefaults.data` and the completion's own data using the following rules: - If a completion's `data` field is not provided (or `null`), the entire `data` field from `completionList.itemDefaults.data` will be used as-is. - If a completion's `data` field is provided, each field will overwrite the field of the same name in `completionList.itemDefaults.data` but no merging of nested fields within that value will occur. @since 3.18.0""" # Since: 3.18.0 @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[Sequence["ParameterInformation"]] = attrs.field(default=None) """The parameters of this signature.""" active_parameter: Optional[Union[int, None]] = attrs.field(default=None) """The index of the active parameter. If `null`, no parameter of the signature is active (for example a named argument that does not match any declared parameters). This is only valid if the client specifies the client capability `textDocument.signatureHelp.noActiveParameterSupport === true` If provided (or `null`), 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: Sequence[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[Sequence[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 CodeActionDisabled: """Captures why the code action is currently disabled. @since 3.18.0""" # Since: 3.18.0 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 LocationUriOnly: """Location with only uri and does not include range. @since 3.18.0""" # Since: 3.18.0 uri: str = attrs.field(validator=attrs.validators.instance_of(str)) @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 PrepareRenamePlaceholder: """@since 3.18.0""" # Since: 3.18.0 range: Range = attrs.field() placeholder: str = attrs.field(validator=attrs.validators.instance_of(str)) @attrs.define class PrepareRenameDefaultBehavior: """@since 3.18.0""" # Since: 3.18.0 default_behavior: bool = attrs.field(validator=attrs.validators.instance_of(bool)) @attrs.define class WorkspaceEditMetadata: """Additional data about a workspace edit. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed is_refactoring: Optional[bool] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(bool)), default=None, ) """Signal to the editor that this edit is a refactoring.""" @attrs.define class SemanticTokensLegend: """@since 3.16.0""" # Since: 3.16.0 token_types: Sequence[str] = attrs.field() """The token types a server uses.""" token_modifiers: Sequence[str] = attrs.field() """The token modifiers a server uses.""" @attrs.define class SemanticTokensFullDelta: """Semantic tokens options to support deltas for full documents @since 3.18.0""" # Since: 3.18.0 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 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 SnippetTextEdit: """An interactive text edit. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed range: Range = attrs.field() """The range of the text document to be manipulated.""" snippet: StringValue = attrs.field() """The snippet to be inserted.""" annotation_id: Optional[ChangeAnnotationIdentifier] = attrs.field(default=None) """The actual identifier of the snippet edit.""" @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: Sequence[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 NotebookDocumentFilterWithNotebook: """@since 3.18.0""" # Since: 3.18.0 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[Sequence["NotebookCellLanguage"]] = attrs.field(default=None) """The cells of the matching notebook to be synced.""" @attrs.define class NotebookDocumentFilterWithCells: """@since 3.18.0""" # Since: 3.18.0 cells: Sequence["NotebookCellLanguage"] = 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 NotebookDocumentCellChanges: """Cell changes to a notebook document. @since 3.18.0""" # Since: 3.18.0 structure: Optional["NotebookDocumentCellChangeStructure"] = attrs.field( default=None ) """Changes to the cell structure to add or remove cells.""" data: Optional[Sequence[NotebookCell]] = attrs.field(default=None) """Changes to notebook cells properties like its kind, execution summary or metadata.""" text_content: Optional[Sequence["NotebookDocumentCellContentChanges"]] = ( attrs.field(default=None) ) """Changes to the text content of notebook cells.""" @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 ClientInfo: """Information about the client @since 3.15.0 @since 3.18.0 ClientInfo type name added.""" # Since: # 3.15.0 # 3.18.0 ClientInfo type name added. 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 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 WorkspaceOptions: """Defines workspace specific capabilities of the server. @since 3.18.0""" # Since: 3.18.0 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 text_document_content: Optional[ Union[TextDocumentContentOptions, TextDocumentContentRegistrationOptions] ] = attrs.field(default=None) """The server supports the `workspace/textDocumentContent` request. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed @attrs.define class TextDocumentContentChangePartial: """@since 3.18.0""" # Since: 3.18.0 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 TextDocumentContentChangeWholeDocument: """@since 3.18.0""" # Since: 3.18.0 text: str = attrs.field(validator=attrs.validators.instance_of(str)) """The new text of the whole document.""" @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 EditRangeWithInsertReplace: """Edit range variant that includes ranges for insert and replace operations. @since 3.18.0""" # Since: 3.18.0 insert: Range = attrs.field() replace: Range = attrs.field() @attrs.define class ServerCompletionItemOptions: """@since 3.18.0""" # Since: 3.18.0 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 MarkedStringWithLanguage: """@since 3.18.0 @deprecated use MarkupContent instead.""" # Since: 3.18.0 language: str = attrs.field(validator=attrs.validators.instance_of(str)) value: str = attrs.field(validator=attrs.validators.instance_of(str)) @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. To avoid ambiguities a server should use the [start, end] offset value instead of using a substring. Whether a client support this is controlled via `labelOffsetSupport` client capability. *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 CodeActionKindDocumentation: """Documentation for a class of code actions. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed kind: Union[CodeActionKind, str] = attrs.field() """The kind of the code action being documented. If the kind is generic, such as `CodeActionKind.Refactor`, the documentation will be shown whenever any refactorings are returned. If the kind if more specific, such as `CodeActionKind.RefactorExtract`, the documentation will only be shown when extract refactoring code actions are returned.""" command: Command = attrs.field() """Command that is ued to display the documentation to the user. The title of this documentation code action is taken from {@linkcode Command.title}""" @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 NotebookCellLanguage: """@since 3.18.0""" # Since: 3.18.0 language: str = attrs.field(validator=attrs.validators.instance_of(str)) @attrs.define class NotebookDocumentCellChangeStructure: """Structural changes to cells in a notebook document. @since 3.18.0""" # Since: 3.18.0 array: "NotebookCellArrayChange" = attrs.field() """The change to the cell array.""" did_open: Optional[Sequence[TextDocumentItem]] = attrs.field(default=None) """Additional opened cell text documents.""" did_close: Optional[Sequence[TextDocumentIdentifier]] = attrs.field(default=None) """Additional closed cell text documents.""" @attrs.define class NotebookDocumentCellContentChanges: """Content changes to a cell in a notebook document. @since 3.18.0""" # Since: 3.18.0 document: VersionedTextDocumentIdentifier = attrs.field() changes: Sequence[TextDocumentContentChangeEvent] = attrs.field() @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 text_document_content: Optional["TextDocumentContentClientCapabilities"] = ( attrs.field(default=None) ) """Capabilities specific to the `workspace/textDocumentContent` request. @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.""" filters: Optional["TextDocumentFilterClientCapabilities"] = attrs.field( default=None ) """Defines which filters the client supports. @since 3.18.0""" # Since: 3.18.0 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 GeneralClientCapabilities: """General client capabilities. @since 3.16.0""" # Since: 3.16.0 stale_request_support: Optional["StaleRequestSupportOptions"] = 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[Sequence[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 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 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 TextDocumentFilterLanguage: """A document filter where `language` is required field. @since 3.18.0""" # Since: 3.18.0 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[GlobPattern] = attrs.field(default=None) """A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples. @since 3.18.0 - support for relative patterns. Whether clients support relative patterns depends on the client capability `textDocuments.filters.relativePatternSupport`.""" # Since: 3.18.0 - support for relative patterns. Whether clients support relative patterns depends on the client capability `textDocuments.filters.relativePatternSupport`. @attrs.define class TextDocumentFilterScheme: """A document filter where `scheme` is required field. @since 3.18.0""" # Since: 3.18.0 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[GlobPattern] = attrs.field(default=None) """A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples. @since 3.18.0 - support for relative patterns. Whether clients support relative patterns depends on the client capability `textDocuments.filters.relativePatternSupport`.""" # Since: 3.18.0 - support for relative patterns. Whether clients support relative patterns depends on the client capability `textDocuments.filters.relativePatternSupport`. @attrs.define class TextDocumentFilterPattern: """A document filter where `pattern` is required field. @since 3.18.0""" # Since: 3.18.0 pattern: GlobPattern = attrs.field() """A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples. @since 3.18.0 - support for relative patterns. Whether clients support relative patterns depends on the client capability `textDocuments.filters.relativePatternSupport`.""" # Since: 3.18.0 - support for relative patterns. Whether clients support relative patterns depends on the client capability `textDocuments.filters.relativePatternSupport`. 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`.""" @attrs.define class NotebookDocumentFilterNotebookType: """A notebook document filter where `notebookType` is required field. @since 3.18.0""" # Since: 3.18.0 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[GlobPattern] = attrs.field(default=None) """A glob pattern.""" @attrs.define class NotebookDocumentFilterScheme: """A notebook document filter where `scheme` is required field. @since 3.18.0""" # Since: 3.18.0 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[GlobPattern] = attrs.field(default=None) """A glob pattern.""" @attrs.define class NotebookDocumentFilterPattern: """A notebook document filter where `pattern` is required field. @since 3.18.0""" # Since: 3.18.0 pattern: GlobPattern = attrs.field() """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`.""" @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[Sequence[NotebookCell]] = attrs.field(default=None) """The new cells, if any""" @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[Sequence[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["ChangeAnnotationsSupportOptions"] = ( 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 metadata_support: Optional[bool] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(bool)), default=None, ) """Whether the client supports `WorkspaceEditMetadata` in `WorkspaceEdit`s. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed snippet_edit_support: Optional[bool] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(bool)), default=None, ) """Whether the client supports snippets as text edits. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed @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 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["ClientSymbolKindOptions"] = attrs.field(default=None) """Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.""" tag_support: Optional["ClientSymbolTagOptions"] = 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["ClientSymbolResolveOptions"] = 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 TextDocumentContentClientCapabilities: """Client capabilities for a text document content provider. @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, ) """Text document content provider supports dynamic registration.""" @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 TextDocumentFilterClientCapabilities: relative_pattern_support: Optional[bool] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(bool)), default=None, ) """The client supports Relative Patterns. @since 3.18.0""" # Since: 3.18.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["ClientCompletionItemOptions"] = attrs.field(default=None) """The client supports the following `CompletionItem` specific capabilities.""" completion_item_kind: Optional["ClientCompletionItemOptionsKind"] = 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["CompletionListCapabilities"] = 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[Sequence[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 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["ClientSignatureInformationOptions"] = 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 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["ClientSymbolKindOptions"] = 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["ClientSymbolTagOptions"] = 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 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["ClientCodeActionLiteralOptions"] = ( 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["ClientCodeActionResolveOptions"] = 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 documentation_support: Optional[bool] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(bool)), default=None, ) """Whether the client supports documentation for a class of code actions. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed tag_support: Optional["CodeActionTagOptions"] = attrs.field(default=None) """Client supports the tag property on a code action. Clients supporting tags have to handle unknown tags gracefully. @since 3.18.0 - proposed""" # Since: 3.18.0 - proposed @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.""" resolve_support: Optional["ClientCodeLensResolveOptions"] = attrs.field( default=None ) """Whether the client supports resolving additional code lens properties via a separate `codeLens/resolve` request. @since 3.18.0""" # Since: 3.18.0 @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 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["ClientFoldingRangeKindOptions"] = attrs.field( default=None ) """Specific options for the folding range kind. @since 3.17.0""" # Since: 3.17.0 folding_range: Optional["ClientFoldingRangeOptions"] = 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 DiagnosticsCapabilities: """General diagnostics capabilities for pull and push model.""" 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["ClientDiagnosticsTagOptions"] = 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 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 PublishDiagnosticsClientCapabilities: """The publish diagnostic client capabilities.""" 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 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["ClientDiagnosticsTagOptions"] = 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 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 SemanticTokensClientCapabilities: """@since 3.16.0""" # Since: 3.16.0 requests: "ClientSemanticTokensRequestOptions" = 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: Sequence[str] = attrs.field() """The token types that the client supports.""" token_modifiers: Sequence[str] = attrs.field() """The token modifiers that the client supports.""" formats: Sequence[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 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["ClientInlayHintResolveOptions"] = 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.""" 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["ClientDiagnosticsTagOptions"] = 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 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 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 ShowMessageRequestClientCapabilities: """Show message request client capabilities""" message_action_item: Optional["ClientShowMessageActionItemOptions"] = 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 StaleRequestSupportOptions: """@since 3.18.0""" # Since: 3.18.0 cancel: bool = attrs.field(validator=attrs.validators.instance_of(bool)) """The client will actively cancel the request.""" retry_on_content_modified: Sequence[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 RegularExpressionsClientCapabilities: """Client capabilities specific to regular expressions. @since 3.16.0""" # Since: 3.16.0 engine: RegularExpressionEngineKind = attrs.field() """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[Sequence[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 ChangeAnnotationsSupportOptions: """@since 3.18.0""" # Since: 3.18.0 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 ClientSymbolKindOptions: """@since 3.18.0""" # Since: 3.18.0 value_set: Optional[Sequence[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 ClientSymbolTagOptions: """@since 3.18.0""" # Since: 3.18.0 value_set: Sequence[SymbolTag] = attrs.field() """The tags supported by the client.""" @attrs.define class ClientSymbolResolveOptions: """@since 3.18.0""" # Since: 3.18.0 properties: Sequence[str] = attrs.field() """The properties that a client can resolve lazily. Usually `location.range`""" @attrs.define class ClientCompletionItemOptions: """@since 3.18.0""" # Since: 3.18.0 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[Sequence[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["CompletionItemTagOptions"] = 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["ClientCompletionItemResolveOptions"] = 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["ClientCompletionItemInsertTextModeOptions"] = ( 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 ClientCompletionItemOptionsKind: """@since 3.18.0""" # Since: 3.18.0 value_set: Optional[Sequence[Union[CompletionItemKind, int]]] = 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 CompletionListCapabilities: """The client supports the following `CompletionList` specific capabilities. @since 3.17.0""" # Since: 3.17.0 item_defaults: Optional[Sequence[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 apply_kind_support: Optional[bool] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(bool)), default=None, ) """Specifies whether the client supports `CompletionList.applyKind` to indicate how supported values from `completionList.itemDefaults` and `completion` will be combined. If a client supports `applyKind` it must support it for all fields that it supports that are listed in `CompletionList.applyKind`. This means when clients add support for new/future fields in completion items the MUST also support merge for them if those fields are defined in `CompletionList.applyKind`. @since 3.18.0""" # Since: 3.18.0 @attrs.define class ClientSignatureInformationOptions: """@since 3.18.0""" # Since: 3.18.0 documentation_format: Optional[Sequence[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["ClientSignatureParameterInformationOptions"] = ( 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 no_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 `SignatureHelp`/`SignatureInformation` being set to `null` to indicate that no parameter should be active. @since 3.18.0 @proposed""" # Since: 3.18.0 # Proposed @attrs.define class ClientCodeActionLiteralOptions: """@since 3.18.0""" # Since: 3.18.0 code_action_kind: "ClientCodeActionKindOptions" = attrs.field() """The code action kind is support with the following value set.""" @attrs.define class ClientCodeActionResolveOptions: """@since 3.18.0""" # Since: 3.18.0 properties: Sequence[str] = attrs.field() """The properties that a client can resolve lazily.""" @attrs.define class CodeActionTagOptions: """@since 3.18.0 - proposed""" # Since: 3.18.0 - proposed value_set: Sequence[CodeActionTag] = attrs.field() """The tags supported by the client.""" @attrs.define class ClientCodeLensResolveOptions: """@since 3.18.0""" # Since: 3.18.0 properties: Sequence[str] = attrs.field() """The properties that a client can resolve lazily.""" @attrs.define class ClientFoldingRangeKindOptions: """@since 3.18.0""" # Since: 3.18.0 value_set: Optional[Sequence[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 ClientFoldingRangeOptions: """@since 3.18.0""" # Since: 3.18.0 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 ClientSemanticTokensRequestOptions: """@since 3.18.0""" # Since: 3.18.0 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, "ClientSemanticTokensRequestFullDelta"]] = attrs.field( default=None ) """The client will send the `textDocument/semanticTokens/full` request if the server provides a corresponding handler.""" @attrs.define class ClientInlayHintResolveOptions: """@since 3.18.0""" # Since: 3.18.0 properties: Sequence[str] = attrs.field() """The properties that a client can resolve lazily.""" @attrs.define class ClientShowMessageActionItemOptions: """@since 3.18.0""" # Since: 3.18.0 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 CompletionItemTagOptions: """@since 3.18.0""" # Since: 3.18.0 value_set: Sequence[CompletionItemTag] = attrs.field() """The tags supported by the client.""" @attrs.define class ClientCompletionItemResolveOptions: """@since 3.18.0""" # Since: 3.18.0 properties: Sequence[str] = attrs.field() """The properties that a client can resolve lazily.""" @attrs.define class ClientCompletionItemInsertTextModeOptions: """@since 3.18.0""" # Since: 3.18.0 value_set: Sequence[InsertTextMode] = attrs.field() @attrs.define class ClientSignatureParameterInformationOptions: """@since 3.18.0""" # Since: 3.18.0 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 ClientCodeActionKindOptions: """@since 3.18.0""" # Since: 3.18.0 value_set: Sequence[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 ClientDiagnosticsTagOptions: """@since 3.18.0""" # Since: 3.18.0 value_set: Sequence[DiagnosticTag] = attrs.field() """The tags supported by the client.""" @attrs.define class ClientSemanticTokensRequestFullDelta: """@since 3.18.0""" # Since: 3.18.0 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 ColorPresentationRequestOptions: 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") ImplementationResult = Union[Definition, Sequence[DefinitionLink], None] @attrs.define class ImplementationRequest: """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: Literal["textDocument/implementation"] = "textDocument/implementation" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class ImplementationResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[ImplementationResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") TypeDefinitionResult = Union[Definition, Sequence[DefinitionLink], None] @attrs.define class TypeDefinitionRequest: """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: Literal["textDocument/typeDefinition"] = "textDocument/typeDefinition" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class TypeDefinitionResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[TypeDefinitionResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") WorkspaceFoldersResult = Union[Sequence[WorkspaceFolder], None] @attrs.define class WorkspaceFoldersRequest: """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: Literal["workspace/workspaceFolders"] = "workspace/workspaceFolders" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class WorkspaceFoldersResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[WorkspaceFoldersResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") ConfigurationResult = Sequence[LSPAny] @attrs.define class ConfigurationRequest: """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: ConfigurationParams = attrs.field() method: Literal["workspace/configuration"] = "workspace/configuration" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class ConfigurationResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: ConfigurationResult = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") DocumentColorResult = Sequence[ColorInformation] @attrs.define class DocumentColorRequest: """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: Literal["textDocument/documentColor"] = "textDocument/documentColor" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DocumentColorResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: DocumentColorResult = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") ColorPresentationResult = Sequence[ColorPresentation] @attrs.define class ColorPresentationRequest: """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: Literal["textDocument/colorPresentation"] = "textDocument/colorPresentation" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class ColorPresentationResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: ColorPresentationResult = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") FoldingRangeResult = Union[Sequence[FoldingRange], None] @attrs.define class FoldingRangeRequest: """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: Literal["textDocument/foldingRange"] = "textDocument/foldingRange" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class FoldingRangeResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[FoldingRangeResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") @attrs.define class FoldingRangeRefreshRequest: """@since 3.18.0 @proposed""" id: Union[int, str] = attrs.field() """The request id.""" params: Optional[None] = attrs.field(default=None) method: Literal["workspace/foldingRange/refresh"] = "workspace/foldingRange/refresh" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class FoldingRangeRefreshResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: None = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") DeclarationResult = Union[Declaration, Sequence[DeclarationLink], None] @attrs.define class DeclarationRequest: """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: Literal["textDocument/declaration"] = "textDocument/declaration" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DeclarationResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[DeclarationResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") SelectionRangeResult = Union[Sequence[SelectionRange], None] @attrs.define class SelectionRangeRequest: """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: Literal["textDocument/selectionRange"] = "textDocument/selectionRange" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class SelectionRangeResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[SelectionRangeResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") @attrs.define class WorkDoneProgressCreateRequest: """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: Literal["window/workDoneProgress/create"] = "window/workDoneProgress/create" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class WorkDoneProgressCreateResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: None = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") CallHierarchyPrepareResult = Union[Sequence[CallHierarchyItem], None] @attrs.define class CallHierarchyPrepareRequest: """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: Literal["textDocument/prepareCallHierarchy"] = ( "textDocument/prepareCallHierarchy" ) """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class CallHierarchyPrepareResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[CallHierarchyPrepareResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") CallHierarchyIncomingCallsResult = Union[Sequence[CallHierarchyIncomingCall], None] @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: Literal["callHierarchy/incomingCalls"] = "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: Optional[CallHierarchyIncomingCallsResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") CallHierarchyOutgoingCallsResult = Union[Sequence[CallHierarchyOutgoingCall], None] @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: Literal["callHierarchy/outgoingCalls"] = "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: Optional[CallHierarchyOutgoingCallsResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") SemanticTokensResult = Union[SemanticTokens, None] @attrs.define class SemanticTokensRequest: """@since 3.16.0""" id: Union[int, str] = attrs.field() """The request id.""" params: SemanticTokensParams = attrs.field() method: Literal["textDocument/semanticTokens/full"] = ( "textDocument/semanticTokens/full" ) """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class SemanticTokensResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[SemanticTokensResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") SemanticTokensDeltaResult = Union[SemanticTokens, SemanticTokensDelta, None] @attrs.define class SemanticTokensDeltaRequest: """@since 3.16.0""" id: Union[int, str] = attrs.field() """The request id.""" params: SemanticTokensDeltaParams = attrs.field() method: Literal["textDocument/semanticTokens/full/delta"] = ( "textDocument/semanticTokens/full/delta" ) """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class SemanticTokensDeltaResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[SemanticTokensDeltaResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") SemanticTokensRangeResult = Union[SemanticTokens, None] @attrs.define class SemanticTokensRangeRequest: """@since 3.16.0""" id: Union[int, str] = attrs.field() """The request id.""" params: SemanticTokensRangeParams = attrs.field() method: Literal["textDocument/semanticTokens/range"] = ( "textDocument/semanticTokens/range" ) """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class SemanticTokensRangeResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[SemanticTokensRangeResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") @attrs.define class SemanticTokensRefreshRequest: """@since 3.16.0""" id: Union[int, str] = attrs.field() """The request id.""" params: Optional[None] = attrs.field(default=None) method: Literal["workspace/semanticTokens/refresh"] = ( "workspace/semanticTokens/refresh" ) """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class SemanticTokensRefreshResponse: 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 ShowDocumentRequest: """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: Literal["window/showDocument"] = "window/showDocument" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class ShowDocumentResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: ShowDocumentResult = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") LinkedEditingRangeResult = Union[LinkedEditingRanges, None] @attrs.define class LinkedEditingRangeRequest: """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: Literal["textDocument/linkedEditingRange"] = ( "textDocument/linkedEditingRange" ) """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class LinkedEditingRangeResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[LinkedEditingRangeResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") WillCreateFilesResult = Union[WorkspaceEdit, None] @attrs.define class WillCreateFilesRequest: """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: Literal["workspace/willCreateFiles"] = "workspace/willCreateFiles" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class WillCreateFilesResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[WillCreateFilesResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") WillRenameFilesResult = Union[WorkspaceEdit, None] @attrs.define class WillRenameFilesRequest: """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: Literal["workspace/willRenameFiles"] = "workspace/willRenameFiles" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class WillRenameFilesResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[WillRenameFilesResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") WillDeleteFilesResult = Union[WorkspaceEdit, None] @attrs.define class WillDeleteFilesRequest: """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: Literal["workspace/willDeleteFiles"] = "workspace/willDeleteFiles" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class WillDeleteFilesResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[WillDeleteFilesResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") MonikerResult = Union[Sequence[Moniker], None] @attrs.define class MonikerRequest: """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: Literal["textDocument/moniker"] = "textDocument/moniker" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class MonikerResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[MonikerResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") TypeHierarchyPrepareResult = Union[Sequence[TypeHierarchyItem], None] @attrs.define class TypeHierarchyPrepareRequest: """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: Literal["textDocument/prepareTypeHierarchy"] = ( "textDocument/prepareTypeHierarchy" ) """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class TypeHierarchyPrepareResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[TypeHierarchyPrepareResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") TypeHierarchySupertypesResult = Union[Sequence[TypeHierarchyItem], None] @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: Literal["typeHierarchy/supertypes"] = "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: Optional[TypeHierarchySupertypesResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") TypeHierarchySubtypesResult = Union[Sequence[TypeHierarchyItem], None] @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: Literal["typeHierarchy/subtypes"] = "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: Optional[TypeHierarchySubtypesResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") InlineValueResult = Union[Sequence[InlineValue], None] @attrs.define class InlineValueRequest: """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: Literal["textDocument/inlineValue"] = "textDocument/inlineValue" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class InlineValueResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[InlineValueResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") @attrs.define class InlineValueRefreshRequest: """@since 3.17.0""" id: Union[int, str] = attrs.field() """The request id.""" params: Optional[None] = attrs.field(default=None) method: Literal["workspace/inlineValue/refresh"] = "workspace/inlineValue/refresh" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class InlineValueRefreshResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: None = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") InlayHintResult = Union[Sequence[InlayHint], None] @attrs.define class InlayHintRequest: """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: Literal["textDocument/inlayHint"] = "textDocument/inlayHint" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class InlayHintResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[InlayHintResult] = 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: Literal["inlayHint/resolve"] = "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 InlayHintRefreshRequest: """@since 3.17.0""" id: Union[int, str] = attrs.field() """The request id.""" params: Optional[None] = attrs.field(default=None) method: Literal["workspace/inlayHint/refresh"] = "workspace/inlayHint/refresh" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class InlayHintRefreshResponse: 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 DocumentDiagnosticRequest: """The document diagnostic request definition. @since 3.17.0""" id: Union[int, str] = attrs.field() """The request id.""" params: DocumentDiagnosticParams = attrs.field() method: Literal["textDocument/diagnostic"] = "textDocument/diagnostic" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DocumentDiagnosticResponse: 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: Literal["workspace/diagnostic"] = "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 DiagnosticRefreshRequest: """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: Literal["workspace/diagnostic/refresh"] = "workspace/diagnostic/refresh" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DiagnosticRefreshResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: None = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") InlineCompletionResult = Union[ InlineCompletionList, Sequence[InlineCompletionItem], None ] @attrs.define class InlineCompletionRequest: """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: Literal["textDocument/inlineCompletion"] = "textDocument/inlineCompletion" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class InlineCompletionResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[InlineCompletionResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") @attrs.define class TextDocumentContentRequest: """The `workspace/textDocumentContent` request is sent from the client to the server to request the content of a text document. @since 3.18.0 @proposed""" id: Union[int, str] = attrs.field() """The request id.""" params: TextDocumentContentParams = attrs.field() method: Literal["workspace/textDocumentContent"] = "workspace/textDocumentContent" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class TextDocumentContentResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: TextDocumentContentResult = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") @attrs.define class TextDocumentContentRefreshRequest: """The `workspace/textDocumentContent` request is sent from the server to the client to refresh the content of a specific text document. @since 3.18.0 @proposed""" id: Union[int, str] = attrs.field() """The request id.""" params: TextDocumentContentRefreshParams = attrs.field() method: Literal["workspace/textDocumentContent/refresh"] = ( "workspace/textDocumentContent/refresh" ) """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class TextDocumentContentRefreshResponse: 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 RegistrationRequest: """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: Literal["client/registerCapability"] = "client/registerCapability" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class RegistrationResponse: 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 UnregistrationRequest: """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: Literal["client/unregisterCapability"] = "client/unregisterCapability" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class UnregistrationResponse: 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: Literal["initialize"] = "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: Literal["shutdown"] = "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") ShowMessageResult = Union[MessageActionItem, None] @attrs.define class ShowMessageRequest: """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: Literal["window/showMessageRequest"] = "window/showMessageRequest" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class ShowMessageResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[ShowMessageResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") WillSaveTextDocumentWaitUntilResult = Union[Sequence[TextEdit], None] @attrs.define class WillSaveTextDocumentWaitUntilRequest: """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: Literal["textDocument/willSaveWaitUntil"] = "textDocument/willSaveWaitUntil" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class WillSaveTextDocumentWaitUntilResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[WillSaveTextDocumentWaitUntilResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") CompletionResult = Union[Sequence[CompletionItem], CompletionList, None] @attrs.define class CompletionRequest: """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: Literal["textDocument/completion"] = "textDocument/completion" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class CompletionResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[CompletionResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") @attrs.define class CompletionResolveRequest: """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: Literal["completionItem/resolve"] = "completionItem/resolve" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class CompletionResolveResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: CompletionItem = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") HoverResult = Union[Hover, None] @attrs.define class HoverRequest: """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: Literal["textDocument/hover"] = "textDocument/hover" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class HoverResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[HoverResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") SignatureHelpResult = Union[SignatureHelp, None] @attrs.define class SignatureHelpRequest: id: Union[int, str] = attrs.field() """The request id.""" params: SignatureHelpParams = attrs.field() method: Literal["textDocument/signatureHelp"] = "textDocument/signatureHelp" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class SignatureHelpResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[SignatureHelpResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") DefinitionResult = Union[Definition, Sequence[DefinitionLink], None] @attrs.define class DefinitionRequest: """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: Literal["textDocument/definition"] = "textDocument/definition" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DefinitionResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[DefinitionResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") ReferencesResult = Union[Sequence[Location], None] @attrs.define class ReferencesRequest: """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: Literal["textDocument/references"] = "textDocument/references" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class ReferencesResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[ReferencesResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") DocumentHighlightResult = Union[Sequence[DocumentHighlight], None] @attrs.define class DocumentHighlightRequest: """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: Literal["textDocument/documentHighlight"] = "textDocument/documentHighlight" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DocumentHighlightResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[DocumentHighlightResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") DocumentSymbolResult = Union[ Sequence[SymbolInformation], Sequence[DocumentSymbol], None ] @attrs.define class DocumentSymbolRequest: """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: Literal["textDocument/documentSymbol"] = "textDocument/documentSymbol" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DocumentSymbolResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[DocumentSymbolResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") CodeActionResult = Union[Sequence[Union[Command, CodeAction]], None] @attrs.define class CodeActionRequest: """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: Literal["textDocument/codeAction"] = "textDocument/codeAction" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class CodeActionResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[CodeActionResult] = 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: Literal["codeAction/resolve"] = "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") WorkspaceSymbolResult = Union[ Sequence[SymbolInformation], Sequence[WorkspaceSymbol], None ] @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: Literal["workspace/symbol"] = "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: Optional[WorkspaceSymbolResult] = 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: Literal["workspaceSymbol/resolve"] = "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") CodeLensResult = Union[Sequence[CodeLens], None] @attrs.define class CodeLensRequest: """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: Literal["textDocument/codeLens"] = "textDocument/codeLens" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class CodeLensResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[CodeLensResult] = 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: Literal["codeLens/resolve"] = "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 CodeLensRefreshRequest: """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: Literal["workspace/codeLens/refresh"] = "workspace/codeLens/refresh" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class CodeLensRefreshResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: None = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") DocumentLinkResult = Union[Sequence[DocumentLink], None] @attrs.define class DocumentLinkRequest: """A request to provide document links""" id: Union[int, str] = attrs.field() """The request id.""" params: DocumentLinkParams = attrs.field() method: Literal["textDocument/documentLink"] = "textDocument/documentLink" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DocumentLinkResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[DocumentLinkResult] = 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: Literal["documentLink/resolve"] = "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") DocumentFormattingResult = Union[Sequence[TextEdit], None] @attrs.define class DocumentFormattingRequest: """A request to format a whole document.""" id: Union[int, str] = attrs.field() """The request id.""" params: DocumentFormattingParams = attrs.field() method: Literal["textDocument/formatting"] = "textDocument/formatting" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DocumentFormattingResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[DocumentFormattingResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") DocumentRangeFormattingResult = Union[Sequence[TextEdit], None] @attrs.define class DocumentRangeFormattingRequest: """A request to format a range in a document.""" id: Union[int, str] = attrs.field() """The request id.""" params: DocumentRangeFormattingParams = attrs.field() method: Literal["textDocument/rangeFormatting"] = "textDocument/rangeFormatting" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DocumentRangeFormattingResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[DocumentRangeFormattingResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") DocumentRangesFormattingResult = Union[Sequence[TextEdit], None] @attrs.define class DocumentRangesFormattingRequest: """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: Literal["textDocument/rangesFormatting"] = "textDocument/rangesFormatting" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DocumentRangesFormattingResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[DocumentRangesFormattingResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") DocumentOnTypeFormattingResult = Union[Sequence[TextEdit], None] @attrs.define class DocumentOnTypeFormattingRequest: """A request to format a document on type.""" id: Union[int, str] = attrs.field() """The request id.""" params: DocumentOnTypeFormattingParams = attrs.field() method: Literal["textDocument/onTypeFormatting"] = "textDocument/onTypeFormatting" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DocumentOnTypeFormattingResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[DocumentOnTypeFormattingResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") RenameResult = Union[WorkspaceEdit, None] @attrs.define class RenameRequest: """A request to rename a symbol.""" id: Union[int, str] = attrs.field() """The request id.""" params: RenameParams = attrs.field() method: Literal["textDocument/rename"] = "textDocument/rename" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class RenameResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[RenameResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") @attrs.define class PrepareRenameRequest: """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: Literal["textDocument/prepareRename"] = "textDocument/prepareRename" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class PrepareRenameResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[PrepareRenameResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") ExecuteCommandResult = Union[LSPAny, None] @attrs.define class ExecuteCommandRequest: """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: Literal["workspace/executeCommand"] = "workspace/executeCommand" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class ExecuteCommandResponse: id: Optional[Union[int, str]] = attrs.field() """The request id.""" result: Optional[ExecuteCommandResult] = attrs.field(default=None) jsonrpc: str = attrs.field(default="2.0") @attrs.define class ApplyWorkspaceEditRequest: """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: Literal["workspace/applyEdit"] = "workspace/applyEdit" """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class ApplyWorkspaceEditResponse: 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 DidChangeWorkspaceFoldersNotification: """The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace folder configuration changes.""" params: DidChangeWorkspaceFoldersParams = attrs.field() method: Literal["workspace/didChangeWorkspaceFolders"] = 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 WorkDoneProgressCancelNotification: """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: Literal["window/workDoneProgress/cancel"] = 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 DidCreateFilesNotification: """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: Literal["workspace/didCreateFiles"] = 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 DidRenameFilesNotification: """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: Literal["workspace/didRenameFiles"] = 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 DidDeleteFilesNotification: """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: Literal["workspace/didDeleteFiles"] = 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 DidOpenNotebookDocumentNotification: """A notification sent when a notebook opens. @since 3.17.0""" params: DidOpenNotebookDocumentParams = attrs.field() method: Literal["notebookDocument/didOpen"] = 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 DidChangeNotebookDocumentNotification: params: DidChangeNotebookDocumentParams = attrs.field() method: Literal["notebookDocument/didChange"] = 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 DidSaveNotebookDocumentNotification: """A notification sent when a notebook document is saved. @since 3.17.0""" params: DidSaveNotebookDocumentParams = attrs.field() method: Literal["notebookDocument/didSave"] = 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 DidCloseNotebookDocumentNotification: """A notification sent when a notebook closes. @since 3.17.0""" params: DidCloseNotebookDocumentParams = attrs.field() method: Literal["notebookDocument/didClose"] = 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: Literal["initialized"] = 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: Literal["exit"] = attrs.field( validator=attrs.validators.in_(["exit"]), default="exit", ) """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class DidChangeConfigurationNotification: """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: Literal["workspace/didChangeConfiguration"] = 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 ShowMessageNotification: """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: Literal["window/showMessage"] = 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 LogMessageNotification: """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: Literal["window/logMessage"] = 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: Literal["telemetry/event"] = 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 DidOpenTextDocumentNotification: """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: Literal["textDocument/didOpen"] = 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 DidChangeTextDocumentNotification: """The document change notification is sent from the client to the server to signal changes to a text document.""" params: DidChangeTextDocumentParams = attrs.field() method: Literal["textDocument/didChange"] = 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 DidCloseTextDocumentNotification: """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: Literal["textDocument/didClose"] = 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 DidSaveTextDocumentNotification: """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: Literal["textDocument/didSave"] = 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 WillSaveTextDocumentNotification: """A document will save notification is sent from the client to the server before the document is actually saved.""" params: WillSaveTextDocumentParams = attrs.field() method: Literal["textDocument/willSave"] = 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 DidChangeWatchedFilesNotification: """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: Literal["workspace/didChangeWatchedFiles"] = 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 PublishDiagnosticsNotification: """Diagnostics notification are sent from the server to the client to signal results of validation runs.""" params: PublishDiagnosticsParams = attrs.field() method: Literal["textDocument/publishDiagnostics"] = 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: Literal["$/setTrace"] = 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: Literal["$/logTrace"] = attrs.field( validator=attrs.validators.in_(["$/logTrace"]), default="$/logTrace", ) """The method to be invoked.""" jsonrpc: str = attrs.field(default="2.0") @attrs.define class CancelNotification: params: CancelParams = attrs.field() method: Literal["$/cancelRequest"] = 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: Literal["$/progress"] = 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_TEXT_DOCUMENT_CONTENT = "workspace/textDocumentContent" WORKSPACE_TEXT_DOCUMENT_CONTENT_REFRESH = "workspace/textDocumentContent/refresh" 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: ( RegistrationRequest, RegistrationResponse, RegistrationParams, None, ), CLIENT_UNREGISTER_CAPABILITY: ( UnregistrationRequest, UnregistrationResponse, UnregistrationParams, None, ), CODE_ACTION_RESOLVE: ( CodeActionResolveRequest, CodeActionResolveResponse, CodeAction, None, ), CODE_LENS_RESOLVE: ( CodeLensResolveRequest, CodeLensResolveResponse, CodeLens, None, ), COMPLETION_ITEM_RESOLVE: ( CompletionResolveRequest, CompletionResolveResponse, 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: ( CodeActionRequest, CodeActionResponse, CodeActionParams, CodeActionRegistrationOptions, ), TEXT_DOCUMENT_CODE_LENS: ( CodeLensRequest, CodeLensResponse, CodeLensParams, CodeLensRegistrationOptions, ), TEXT_DOCUMENT_COLOR_PRESENTATION: ( ColorPresentationRequest, ColorPresentationResponse, ColorPresentationParams, ColorPresentationRequestOptions, ), TEXT_DOCUMENT_COMPLETION: ( CompletionRequest, CompletionResponse, CompletionParams, CompletionRegistrationOptions, ), TEXT_DOCUMENT_DECLARATION: ( DeclarationRequest, DeclarationResponse, DeclarationParams, DeclarationRegistrationOptions, ), TEXT_DOCUMENT_DEFINITION: ( DefinitionRequest, DefinitionResponse, DefinitionParams, DefinitionRegistrationOptions, ), TEXT_DOCUMENT_DIAGNOSTIC: ( DocumentDiagnosticRequest, DocumentDiagnosticResponse, DocumentDiagnosticParams, DiagnosticRegistrationOptions, ), TEXT_DOCUMENT_DOCUMENT_COLOR: ( DocumentColorRequest, DocumentColorResponse, DocumentColorParams, DocumentColorRegistrationOptions, ), TEXT_DOCUMENT_DOCUMENT_HIGHLIGHT: ( DocumentHighlightRequest, DocumentHighlightResponse, DocumentHighlightParams, DocumentHighlightRegistrationOptions, ), TEXT_DOCUMENT_DOCUMENT_LINK: ( DocumentLinkRequest, DocumentLinkResponse, DocumentLinkParams, DocumentLinkRegistrationOptions, ), TEXT_DOCUMENT_DOCUMENT_SYMBOL: ( DocumentSymbolRequest, DocumentSymbolResponse, DocumentSymbolParams, DocumentSymbolRegistrationOptions, ), TEXT_DOCUMENT_FOLDING_RANGE: ( FoldingRangeRequest, FoldingRangeResponse, FoldingRangeParams, FoldingRangeRegistrationOptions, ), TEXT_DOCUMENT_FORMATTING: ( DocumentFormattingRequest, DocumentFormattingResponse, DocumentFormattingParams, DocumentFormattingRegistrationOptions, ), TEXT_DOCUMENT_HOVER: ( HoverRequest, HoverResponse, HoverParams, HoverRegistrationOptions, ), TEXT_DOCUMENT_IMPLEMENTATION: ( ImplementationRequest, ImplementationResponse, ImplementationParams, ImplementationRegistrationOptions, ), TEXT_DOCUMENT_INLAY_HINT: ( InlayHintRequest, InlayHintResponse, InlayHintParams, InlayHintRegistrationOptions, ), TEXT_DOCUMENT_INLINE_COMPLETION: ( InlineCompletionRequest, InlineCompletionResponse, InlineCompletionParams, InlineCompletionRegistrationOptions, ), TEXT_DOCUMENT_INLINE_VALUE: ( InlineValueRequest, InlineValueResponse, InlineValueParams, InlineValueRegistrationOptions, ), TEXT_DOCUMENT_LINKED_EDITING_RANGE: ( LinkedEditingRangeRequest, LinkedEditingRangeResponse, LinkedEditingRangeParams, LinkedEditingRangeRegistrationOptions, ), TEXT_DOCUMENT_MONIKER: ( MonikerRequest, MonikerResponse, MonikerParams, MonikerRegistrationOptions, ), TEXT_DOCUMENT_ON_TYPE_FORMATTING: ( DocumentOnTypeFormattingRequest, DocumentOnTypeFormattingResponse, DocumentOnTypeFormattingParams, DocumentOnTypeFormattingRegistrationOptions, ), TEXT_DOCUMENT_PREPARE_CALL_HIERARCHY: ( CallHierarchyPrepareRequest, CallHierarchyPrepareResponse, CallHierarchyPrepareParams, CallHierarchyRegistrationOptions, ), TEXT_DOCUMENT_PREPARE_RENAME: ( PrepareRenameRequest, PrepareRenameResponse, PrepareRenameParams, None, ), TEXT_DOCUMENT_PREPARE_TYPE_HIERARCHY: ( TypeHierarchyPrepareRequest, TypeHierarchyPrepareResponse, TypeHierarchyPrepareParams, TypeHierarchyRegistrationOptions, ), TEXT_DOCUMENT_RANGES_FORMATTING: ( DocumentRangesFormattingRequest, DocumentRangesFormattingResponse, DocumentRangesFormattingParams, DocumentRangeFormattingRegistrationOptions, ), TEXT_DOCUMENT_RANGE_FORMATTING: ( DocumentRangeFormattingRequest, DocumentRangeFormattingResponse, DocumentRangeFormattingParams, DocumentRangeFormattingRegistrationOptions, ), TEXT_DOCUMENT_REFERENCES: ( ReferencesRequest, ReferencesResponse, ReferenceParams, ReferenceRegistrationOptions, ), TEXT_DOCUMENT_RENAME: ( RenameRequest, RenameResponse, RenameParams, RenameRegistrationOptions, ), TEXT_DOCUMENT_SELECTION_RANGE: ( SelectionRangeRequest, SelectionRangeResponse, SelectionRangeParams, SelectionRangeRegistrationOptions, ), TEXT_DOCUMENT_SEMANTIC_TOKENS_FULL: ( SemanticTokensRequest, SemanticTokensResponse, SemanticTokensParams, SemanticTokensRegistrationOptions, ), TEXT_DOCUMENT_SEMANTIC_TOKENS_FULL_DELTA: ( SemanticTokensDeltaRequest, SemanticTokensDeltaResponse, SemanticTokensDeltaParams, SemanticTokensRegistrationOptions, ), TEXT_DOCUMENT_SEMANTIC_TOKENS_RANGE: ( SemanticTokensRangeRequest, SemanticTokensRangeResponse, SemanticTokensRangeParams, None, ), TEXT_DOCUMENT_SIGNATURE_HELP: ( SignatureHelpRequest, SignatureHelpResponse, SignatureHelpParams, SignatureHelpRegistrationOptions, ), TEXT_DOCUMENT_TYPE_DEFINITION: ( TypeDefinitionRequest, TypeDefinitionResponse, TypeDefinitionParams, TypeDefinitionRegistrationOptions, ), TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL: ( WillSaveTextDocumentWaitUntilRequest, WillSaveTextDocumentWaitUntilResponse, WillSaveTextDocumentParams, TextDocumentRegistrationOptions, ), TYPE_HIERARCHY_SUBTYPES: ( TypeHierarchySubtypesRequest, TypeHierarchySubtypesResponse, TypeHierarchySubtypesParams, None, ), TYPE_HIERARCHY_SUPERTYPES: ( TypeHierarchySupertypesRequest, TypeHierarchySupertypesResponse, TypeHierarchySupertypesParams, None, ), WINDOW_SHOW_DOCUMENT: ( ShowDocumentRequest, ShowDocumentResponse, ShowDocumentParams, None, ), WINDOW_SHOW_MESSAGE_REQUEST: ( ShowMessageRequest, ShowMessageResponse, ShowMessageRequestParams, None, ), WINDOW_WORK_DONE_PROGRESS_CREATE: ( WorkDoneProgressCreateRequest, WorkDoneProgressCreateResponse, WorkDoneProgressCreateParams, None, ), WORKSPACE_APPLY_EDIT: ( ApplyWorkspaceEditRequest, ApplyWorkspaceEditResponse, ApplyWorkspaceEditParams, None, ), WORKSPACE_CODE_LENS_REFRESH: ( CodeLensRefreshRequest, CodeLensRefreshResponse, None, None, ), WORKSPACE_CONFIGURATION: ( ConfigurationRequest, ConfigurationResponse, ConfigurationParams, None, ), WORKSPACE_DIAGNOSTIC: ( WorkspaceDiagnosticRequest, WorkspaceDiagnosticResponse, WorkspaceDiagnosticParams, None, ), WORKSPACE_DIAGNOSTIC_REFRESH: ( DiagnosticRefreshRequest, DiagnosticRefreshResponse, None, None, ), WORKSPACE_EXECUTE_COMMAND: ( ExecuteCommandRequest, ExecuteCommandResponse, ExecuteCommandParams, ExecuteCommandRegistrationOptions, ), WORKSPACE_FOLDING_RANGE_REFRESH: ( FoldingRangeRefreshRequest, FoldingRangeRefreshResponse, None, None, ), WORKSPACE_INLAY_HINT_REFRESH: ( InlayHintRefreshRequest, InlayHintRefreshResponse, None, None, ), WORKSPACE_INLINE_VALUE_REFRESH: ( InlineValueRefreshRequest, InlineValueRefreshResponse, None, None, ), WORKSPACE_SEMANTIC_TOKENS_REFRESH: ( SemanticTokensRefreshRequest, SemanticTokensRefreshResponse, None, None, ), WORKSPACE_SYMBOL: ( WorkspaceSymbolRequest, WorkspaceSymbolResponse, WorkspaceSymbolParams, WorkspaceSymbolRegistrationOptions, ), WORKSPACE_SYMBOL_RESOLVE: ( WorkspaceSymbolResolveRequest, WorkspaceSymbolResolveResponse, WorkspaceSymbol, None, ), WORKSPACE_TEXT_DOCUMENT_CONTENT: ( TextDocumentContentRequest, TextDocumentContentResponse, TextDocumentContentParams, TextDocumentContentRegistrationOptions, ), WORKSPACE_TEXT_DOCUMENT_CONTENT_REFRESH: ( TextDocumentContentRefreshRequest, TextDocumentContentRefreshResponse, TextDocumentContentRefreshParams, None, ), WORKSPACE_WILL_CREATE_FILES: ( WillCreateFilesRequest, WillCreateFilesResponse, CreateFilesParams, FileOperationRegistrationOptions, ), WORKSPACE_WILL_DELETE_FILES: ( WillDeleteFilesRequest, WillDeleteFilesResponse, DeleteFilesParams, FileOperationRegistrationOptions, ), WORKSPACE_WILL_RENAME_FILES: ( WillRenameFilesRequest, WillRenameFilesResponse, RenameFilesParams, FileOperationRegistrationOptions, ), WORKSPACE_WORKSPACE_FOLDERS: ( WorkspaceFoldersRequest, WorkspaceFoldersResponse, None, None, ), # Notifications CANCEL_REQUEST: (CancelNotification, None, CancelParams, None), EXIT: (ExitNotification, None, None, None), INITIALIZED: (InitializedNotification, None, InitializedParams, None), LOG_TRACE: (LogTraceNotification, None, LogTraceParams, None), NOTEBOOK_DOCUMENT_DID_CHANGE: ( DidChangeNotebookDocumentNotification, None, DidChangeNotebookDocumentParams, NotebookDocumentSyncRegistrationOptions, ), NOTEBOOK_DOCUMENT_DID_CLOSE: ( DidCloseNotebookDocumentNotification, None, DidCloseNotebookDocumentParams, NotebookDocumentSyncRegistrationOptions, ), NOTEBOOK_DOCUMENT_DID_OPEN: ( DidOpenNotebookDocumentNotification, None, DidOpenNotebookDocumentParams, NotebookDocumentSyncRegistrationOptions, ), NOTEBOOK_DOCUMENT_DID_SAVE: ( DidSaveNotebookDocumentNotification, None, DidSaveNotebookDocumentParams, NotebookDocumentSyncRegistrationOptions, ), PROGRESS: (ProgressNotification, None, ProgressParams, None), SET_TRACE: (SetTraceNotification, None, SetTraceParams, None), TELEMETRY_EVENT: (TelemetryEventNotification, None, LSPAny, None), TEXT_DOCUMENT_DID_CHANGE: ( DidChangeTextDocumentNotification, None, DidChangeTextDocumentParams, TextDocumentChangeRegistrationOptions, ), TEXT_DOCUMENT_DID_CLOSE: ( DidCloseTextDocumentNotification, None, DidCloseTextDocumentParams, TextDocumentRegistrationOptions, ), TEXT_DOCUMENT_DID_OPEN: ( DidOpenTextDocumentNotification, None, DidOpenTextDocumentParams, TextDocumentRegistrationOptions, ), TEXT_DOCUMENT_DID_SAVE: ( DidSaveTextDocumentNotification, None, DidSaveTextDocumentParams, TextDocumentSaveRegistrationOptions, ), TEXT_DOCUMENT_PUBLISH_DIAGNOSTICS: ( PublishDiagnosticsNotification, None, PublishDiagnosticsParams, None, ), TEXT_DOCUMENT_WILL_SAVE: ( WillSaveTextDocumentNotification, None, WillSaveTextDocumentParams, TextDocumentRegistrationOptions, ), WINDOW_LOG_MESSAGE: (LogMessageNotification, None, LogMessageParams, None), WINDOW_SHOW_MESSAGE: (ShowMessageNotification, None, ShowMessageParams, None), WINDOW_WORK_DONE_PROGRESS_CANCEL: ( WorkDoneProgressCancelNotification, None, WorkDoneProgressCancelParams, None, ), WORKSPACE_DID_CHANGE_CONFIGURATION: ( DidChangeConfigurationNotification, None, DidChangeConfigurationParams, DidChangeConfigurationRegistrationOptions, ), WORKSPACE_DID_CHANGE_WATCHED_FILES: ( DidChangeWatchedFilesNotification, None, DidChangeWatchedFilesParams, DidChangeWatchedFilesRegistrationOptions, ), WORKSPACE_DID_CHANGE_WORKSPACE_FOLDERS: ( DidChangeWorkspaceFoldersNotification, None, DidChangeWorkspaceFoldersParams, None, ), WORKSPACE_DID_CREATE_FILES: ( DidCreateFilesNotification, None, CreateFilesParams, FileOperationRegistrationOptions, ), WORKSPACE_DID_DELETE_FILES: ( DidDeleteFilesNotification, None, DeleteFilesParams, FileOperationRegistrationOptions, ), WORKSPACE_DID_RENAME_FILES: ( DidRenameFilesNotification, None, RenameFilesParams, FileOperationRegistrationOptions, ), } REQUESTS = Union[ ApplyWorkspaceEditRequest, CallHierarchyIncomingCallsRequest, CallHierarchyOutgoingCallsRequest, CallHierarchyPrepareRequest, CodeActionRequest, CodeActionResolveRequest, CodeLensRefreshRequest, CodeLensRequest, CodeLensResolveRequest, ColorPresentationRequest, CompletionRequest, CompletionResolveRequest, ConfigurationRequest, DeclarationRequest, DefinitionRequest, DiagnosticRefreshRequest, DocumentColorRequest, DocumentDiagnosticRequest, DocumentFormattingRequest, DocumentHighlightRequest, DocumentLinkRequest, DocumentLinkResolveRequest, DocumentOnTypeFormattingRequest, DocumentRangeFormattingRequest, DocumentRangesFormattingRequest, DocumentSymbolRequest, ExecuteCommandRequest, FoldingRangeRefreshRequest, FoldingRangeRequest, HoverRequest, ImplementationRequest, InitializeRequest, InlayHintRefreshRequest, InlayHintRequest, InlayHintResolveRequest, InlineCompletionRequest, InlineValueRefreshRequest, InlineValueRequest, LinkedEditingRangeRequest, MonikerRequest, PrepareRenameRequest, ReferencesRequest, RegistrationRequest, RenameRequest, SelectionRangeRequest, SemanticTokensDeltaRequest, SemanticTokensRangeRequest, SemanticTokensRefreshRequest, SemanticTokensRequest, ShowDocumentRequest, ShowMessageRequest, ShutdownRequest, SignatureHelpRequest, TextDocumentContentRefreshRequest, TextDocumentContentRequest, TypeDefinitionRequest, TypeHierarchyPrepareRequest, TypeHierarchySubtypesRequest, TypeHierarchySupertypesRequest, UnregistrationRequest, WillCreateFilesRequest, WillDeleteFilesRequest, WillRenameFilesRequest, WillSaveTextDocumentWaitUntilRequest, WorkDoneProgressCreateRequest, WorkspaceDiagnosticRequest, WorkspaceFoldersRequest, WorkspaceSymbolRequest, WorkspaceSymbolResolveRequest, ] RESPONSES = Union[ ApplyWorkspaceEditResponse, CallHierarchyIncomingCallsResponse, CallHierarchyOutgoingCallsResponse, CallHierarchyPrepareResponse, CodeActionResolveResponse, CodeActionResponse, CodeLensRefreshResponse, CodeLensResolveResponse, CodeLensResponse, ColorPresentationResponse, CompletionResolveResponse, CompletionResponse, ConfigurationResponse, DeclarationResponse, DefinitionResponse, DiagnosticRefreshResponse, DocumentColorResponse, DocumentDiagnosticResponse, DocumentFormattingResponse, DocumentHighlightResponse, DocumentLinkResolveResponse, DocumentLinkResponse, DocumentOnTypeFormattingResponse, DocumentRangeFormattingResponse, DocumentRangesFormattingResponse, DocumentSymbolResponse, ExecuteCommandResponse, FoldingRangeRefreshResponse, FoldingRangeResponse, HoverResponse, ImplementationResponse, InitializeResponse, InlayHintRefreshResponse, InlayHintResolveResponse, InlayHintResponse, InlineCompletionResponse, InlineValueRefreshResponse, InlineValueResponse, LinkedEditingRangeResponse, MonikerResponse, PrepareRenameResponse, ReferencesResponse, RegistrationResponse, RenameResponse, SelectionRangeResponse, SemanticTokensDeltaResponse, SemanticTokensRangeResponse, SemanticTokensRefreshResponse, SemanticTokensResponse, ShowDocumentResponse, ShowMessageResponse, ShutdownResponse, SignatureHelpResponse, TextDocumentContentRefreshResponse, TextDocumentContentResponse, TypeDefinitionResponse, TypeHierarchyPrepareResponse, TypeHierarchySubtypesResponse, TypeHierarchySupertypesResponse, UnregistrationResponse, WillCreateFilesResponse, WillDeleteFilesResponse, WillRenameFilesResponse, WillSaveTextDocumentWaitUntilResponse, WorkDoneProgressCreateResponse, WorkspaceDiagnosticResponse, WorkspaceFoldersResponse, WorkspaceSymbolResolveResponse, WorkspaceSymbolResponse, ] NOTIFICATIONS = Union[ CancelNotification, DidChangeConfigurationNotification, DidChangeNotebookDocumentNotification, DidChangeTextDocumentNotification, DidChangeWatchedFilesNotification, DidChangeWorkspaceFoldersNotification, DidCloseNotebookDocumentNotification, DidCloseTextDocumentNotification, DidCreateFilesNotification, DidDeleteFilesNotification, DidOpenNotebookDocumentNotification, DidOpenTextDocumentNotification, DidRenameFilesNotification, DidSaveNotebookDocumentNotification, DidSaveTextDocumentNotification, ExitNotification, InitializedNotification, LogMessageNotification, LogTraceNotification, ProgressNotification, PublishDiagnosticsNotification, SetTraceNotification, ShowMessageNotification, TelemetryEventNotification, WillSaveTextDocumentNotification, WorkDoneProgressCancelNotification, ] 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 = [ ApplyWorkspaceEditRequest, ApplyWorkspaceEditResponse, CallHierarchyIncomingCallsRequest, CallHierarchyIncomingCallsResponse, CallHierarchyOutgoingCallsRequest, CallHierarchyOutgoingCallsResponse, CallHierarchyPrepareRequest, CallHierarchyPrepareResponse, CallHierarchyRegistrationOptions, CancelNotification, CodeActionRegistrationOptions, CodeActionRequest, CodeActionResolveRequest, CodeActionResolveResponse, CodeActionResponse, CodeLensRefreshRequest, CodeLensRefreshResponse, CodeLensRegistrationOptions, CodeLensRequest, CodeLensResolveRequest, CodeLensResolveResponse, CodeLensResponse, ColorPresentationRequest, ColorPresentationRequestOptions, ColorPresentationResponse, CompletionRegistrationOptions, CompletionRequest, CompletionResolveRequest, CompletionResolveResponse, CompletionResponse, ConfigurationRequest, ConfigurationResponse, CreateFile, DeclarationRegistrationOptions, DeclarationRequest, DeclarationResponse, DefinitionRegistrationOptions, DefinitionRequest, DefinitionResponse, DeleteFile, DiagnosticRefreshRequest, DiagnosticRefreshResponse, DiagnosticRegistrationOptions, DidChangeConfigurationNotification, DidChangeNotebookDocumentNotification, DidChangeTextDocumentNotification, DidChangeWatchedFilesNotification, DidChangeWorkspaceFoldersNotification, DidCloseNotebookDocumentNotification, DidCloseTextDocumentNotification, DidCreateFilesNotification, DidDeleteFilesNotification, DidOpenNotebookDocumentNotification, DidOpenTextDocumentNotification, DidRenameFilesNotification, DidSaveNotebookDocumentNotification, DidSaveTextDocumentNotification, DocumentColorRegistrationOptions, DocumentColorRequest, DocumentColorResponse, DocumentDiagnosticRequest, DocumentDiagnosticResponse, DocumentFormattingRegistrationOptions, DocumentFormattingRequest, DocumentFormattingResponse, DocumentHighlightRegistrationOptions, DocumentHighlightRequest, DocumentHighlightResponse, DocumentLinkRegistrationOptions, DocumentLinkRequest, DocumentLinkResolveRequest, DocumentLinkResolveResponse, DocumentLinkResponse, DocumentOnTypeFormattingRegistrationOptions, DocumentOnTypeFormattingRequest, DocumentOnTypeFormattingResponse, DocumentRangeFormattingRegistrationOptions, DocumentRangeFormattingRequest, DocumentRangeFormattingResponse, DocumentRangesFormattingRequest, DocumentRangesFormattingResponse, DocumentSymbolRegistrationOptions, DocumentSymbolRequest, DocumentSymbolResponse, ExecuteCommandRequest, ExecuteCommandResponse, ExitNotification, FoldingRangeRefreshRequest, FoldingRangeRefreshResponse, FoldingRangeRegistrationOptions, FoldingRangeRequest, FoldingRangeResponse, FullDocumentDiagnosticReport, HoverRegistrationOptions, HoverRequest, HoverResponse, ImplementationRegistrationOptions, ImplementationRequest, ImplementationResponse, InitializeParams, InitializeRequest, InitializeResponse, InitializedNotification, InlayHintRefreshRequest, InlayHintRefreshResponse, InlayHintRegistrationOptions, InlayHintRequest, InlayHintResolveRequest, InlayHintResolveResponse, InlayHintResponse, InlineCompletionRegistrationOptions, InlineCompletionRequest, InlineCompletionResponse, InlineValueRefreshRequest, InlineValueRefreshResponse, InlineValueRegistrationOptions, InlineValueRequest, InlineValueResponse, LinkedEditingRangeRegistrationOptions, LinkedEditingRangeRequest, LinkedEditingRangeResponse, LogMessageNotification, LogTraceNotification, MonikerRegistrationOptions, MonikerRequest, MonikerResponse, OptionalVersionedTextDocumentIdentifier, PrepareRenameRequest, PrepareRenameResponse, ProgressNotification, PublishDiagnosticsNotification, ReferenceRegistrationOptions, ReferencesRequest, ReferencesResponse, RegistrationRequest, RegistrationResponse, RelatedFullDocumentDiagnosticReport, RelatedUnchangedDocumentDiagnosticReport, RenameFile, RenameRegistrationOptions, RenameRequest, RenameResponse, ResponseErrorMessage, SelectionRangeRegistrationOptions, SelectionRangeRequest, SelectionRangeResponse, SemanticTokensDeltaRequest, SemanticTokensDeltaResponse, SemanticTokensRangeRequest, SemanticTokensRangeResponse, SemanticTokensRefreshRequest, SemanticTokensRefreshResponse, SemanticTokensRegistrationOptions, SemanticTokensRequest, SemanticTokensResponse, SetTraceNotification, ShowDocumentRequest, ShowDocumentResponse, ShowMessageNotification, ShowMessageRequest, ShowMessageResponse, ShutdownRequest, ShutdownResponse, SignatureHelp, SignatureHelpRegistrationOptions, SignatureHelpRequest, SignatureHelpResponse, SignatureInformation, StringValue, TelemetryEventNotification, TextDocumentChangeRegistrationOptions, TextDocumentContentRefreshRequest, TextDocumentContentRefreshResponse, TextDocumentContentRequest, TextDocumentContentResponse, TextDocumentRegistrationOptions, TextDocumentSaveRegistrationOptions, TypeDefinitionRegistrationOptions, TypeDefinitionRequest, TypeDefinitionResponse, TypeHierarchyPrepareRequest, TypeHierarchyPrepareResponse, TypeHierarchyRegistrationOptions, TypeHierarchySubtypesRequest, TypeHierarchySubtypesResponse, TypeHierarchySupertypesRequest, TypeHierarchySupertypesResponse, UnchangedDocumentDiagnosticReport, UnregistrationRequest, UnregistrationResponse, WillCreateFilesRequest, WillCreateFilesResponse, WillDeleteFilesRequest, WillDeleteFilesResponse, WillRenameFilesRequest, WillRenameFilesResponse, WillSaveTextDocumentNotification, WillSaveTextDocumentWaitUntilRequest, WillSaveTextDocumentWaitUntilResponse, WorkDoneProgressBegin, WorkDoneProgressCancelNotification, WorkDoneProgressCreateRequest, WorkDoneProgressCreateResponse, WorkDoneProgressEnd, WorkDoneProgressReport, WorkspaceDiagnosticRequest, WorkspaceDiagnosticResponse, WorkspaceFoldersInitializeParams, WorkspaceFoldersRequest, WorkspaceFoldersResponse, WorkspaceFullDocumentDiagnosticReport, WorkspaceSymbolRequest, WorkspaceSymbolResolveRequest, WorkspaceSymbolResolveResponse, WorkspaceSymbolResponse, WorkspaceUnchangedDocumentDiagnosticReport, _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 = [ "ApplyWorkspaceEditRequest.jsonrpc", "ApplyWorkspaceEditRequest.method", "ApplyWorkspaceEditResponse.jsonrpc", "ApplyWorkspaceEditResponse.result", "CallHierarchyIncomingCallsRequest.jsonrpc", "CallHierarchyIncomingCallsRequest.method", "CallHierarchyIncomingCallsResponse.jsonrpc", "CallHierarchyIncomingCallsResponse.result", "CallHierarchyOutgoingCallsRequest.jsonrpc", "CallHierarchyOutgoingCallsRequest.method", "CallHierarchyOutgoingCallsResponse.jsonrpc", "CallHierarchyOutgoingCallsResponse.result", "CallHierarchyPrepareRequest.jsonrpc", "CallHierarchyPrepareRequest.method", "CallHierarchyPrepareResponse.jsonrpc", "CallHierarchyPrepareResponse.result", "CallHierarchyRegistrationOptions.document_selector", "CancelNotification.jsonrpc", "CancelNotification.method", "CodeActionRegistrationOptions.document_selector", "CodeActionRequest.jsonrpc", "CodeActionRequest.method", "CodeActionResolveRequest.jsonrpc", "CodeActionResolveRequest.method", "CodeActionResolveResponse.jsonrpc", "CodeActionResolveResponse.result", "CodeActionResponse.jsonrpc", "CodeActionResponse.result", "CodeLensRefreshRequest.jsonrpc", "CodeLensRefreshRequest.method", "CodeLensRefreshResponse.jsonrpc", "CodeLensRefreshResponse.result", "CodeLensRegistrationOptions.document_selector", "CodeLensRequest.jsonrpc", "CodeLensRequest.method", "CodeLensResolveRequest.jsonrpc", "CodeLensResolveRequest.method", "CodeLensResolveResponse.jsonrpc", "CodeLensResolveResponse.result", "CodeLensResponse.jsonrpc", "CodeLensResponse.result", "ColorPresentationRequest.jsonrpc", "ColorPresentationRequest.method", "ColorPresentationRequestOptions.document_selector", "ColorPresentationResponse.jsonrpc", "ColorPresentationResponse.result", "CompletionRegistrationOptions.document_selector", "CompletionRequest.jsonrpc", "CompletionRequest.method", "CompletionResolveRequest.jsonrpc", "CompletionResolveRequest.method", "CompletionResolveResponse.jsonrpc", "CompletionResolveResponse.result", "CompletionResponse.jsonrpc", "CompletionResponse.result", "ConfigurationRequest.jsonrpc", "ConfigurationRequest.method", "ConfigurationResponse.jsonrpc", "ConfigurationResponse.result", "CreateFile.kind", "DeclarationRegistrationOptions.document_selector", "DeclarationRequest.jsonrpc", "DeclarationRequest.method", "DeclarationResponse.jsonrpc", "DeclarationResponse.result", "DefinitionRegistrationOptions.document_selector", "DefinitionRequest.jsonrpc", "DefinitionRequest.method", "DefinitionResponse.jsonrpc", "DefinitionResponse.result", "DeleteFile.kind", "DiagnosticRefreshRequest.jsonrpc", "DiagnosticRefreshRequest.method", "DiagnosticRefreshResponse.jsonrpc", "DiagnosticRefreshResponse.result", "DiagnosticRegistrationOptions.document_selector", "DidChangeConfigurationNotification.jsonrpc", "DidChangeConfigurationNotification.method", "DidChangeNotebookDocumentNotification.jsonrpc", "DidChangeNotebookDocumentNotification.method", "DidChangeTextDocumentNotification.jsonrpc", "DidChangeTextDocumentNotification.method", "DidChangeWatchedFilesNotification.jsonrpc", "DidChangeWatchedFilesNotification.method", "DidChangeWorkspaceFoldersNotification.jsonrpc", "DidChangeWorkspaceFoldersNotification.method", "DidCloseNotebookDocumentNotification.jsonrpc", "DidCloseNotebookDocumentNotification.method", "DidCloseTextDocumentNotification.jsonrpc", "DidCloseTextDocumentNotification.method", "DidCreateFilesNotification.jsonrpc", "DidCreateFilesNotification.method", "DidDeleteFilesNotification.jsonrpc", "DidDeleteFilesNotification.method", "DidOpenNotebookDocumentNotification.jsonrpc", "DidOpenNotebookDocumentNotification.method", "DidOpenTextDocumentNotification.jsonrpc", "DidOpenTextDocumentNotification.method", "DidRenameFilesNotification.jsonrpc", "DidRenameFilesNotification.method", "DidSaveNotebookDocumentNotification.jsonrpc", "DidSaveNotebookDocumentNotification.method", "DidSaveTextDocumentNotification.jsonrpc", "DidSaveTextDocumentNotification.method", "DocumentColorRegistrationOptions.document_selector", "DocumentColorRequest.jsonrpc", "DocumentColorRequest.method", "DocumentColorResponse.jsonrpc", "DocumentColorResponse.result", "DocumentDiagnosticRequest.jsonrpc", "DocumentDiagnosticRequest.method", "DocumentDiagnosticResponse.jsonrpc", "DocumentDiagnosticResponse.result", "DocumentFormattingRegistrationOptions.document_selector", "DocumentFormattingRequest.jsonrpc", "DocumentFormattingRequest.method", "DocumentFormattingResponse.jsonrpc", "DocumentFormattingResponse.result", "DocumentHighlightRegistrationOptions.document_selector", "DocumentHighlightRequest.jsonrpc", "DocumentHighlightRequest.method", "DocumentHighlightResponse.jsonrpc", "DocumentHighlightResponse.result", "DocumentLinkRegistrationOptions.document_selector", "DocumentLinkRequest.jsonrpc", "DocumentLinkRequest.method", "DocumentLinkResolveRequest.jsonrpc", "DocumentLinkResolveRequest.method", "DocumentLinkResolveResponse.jsonrpc", "DocumentLinkResolveResponse.result", "DocumentLinkResponse.jsonrpc", "DocumentLinkResponse.result", "DocumentOnTypeFormattingRegistrationOptions.document_selector", "DocumentOnTypeFormattingRequest.jsonrpc", "DocumentOnTypeFormattingRequest.method", "DocumentOnTypeFormattingResponse.jsonrpc", "DocumentOnTypeFormattingResponse.result", "DocumentRangeFormattingRegistrationOptions.document_selector", "DocumentRangeFormattingRequest.jsonrpc", "DocumentRangeFormattingRequest.method", "DocumentRangeFormattingResponse.jsonrpc", "DocumentRangeFormattingResponse.result", "DocumentRangesFormattingRequest.jsonrpc", "DocumentRangesFormattingRequest.method", "DocumentRangesFormattingResponse.jsonrpc", "DocumentRangesFormattingResponse.result", "DocumentSymbolRegistrationOptions.document_selector", "DocumentSymbolRequest.jsonrpc", "DocumentSymbolRequest.method", "DocumentSymbolResponse.jsonrpc", "DocumentSymbolResponse.result", "ExecuteCommandRequest.jsonrpc", "ExecuteCommandRequest.method", "ExecuteCommandResponse.jsonrpc", "ExecuteCommandResponse.result", "ExitNotification.jsonrpc", "ExitNotification.method", "FoldingRangeRefreshRequest.jsonrpc", "FoldingRangeRefreshRequest.method", "FoldingRangeRefreshResponse.jsonrpc", "FoldingRangeRefreshResponse.result", "FoldingRangeRegistrationOptions.document_selector", "FoldingRangeRequest.jsonrpc", "FoldingRangeRequest.method", "FoldingRangeResponse.jsonrpc", "FoldingRangeResponse.result", "FullDocumentDiagnosticReport.kind", "HoverRegistrationOptions.document_selector", "HoverRequest.jsonrpc", "HoverRequest.method", "HoverResponse.jsonrpc", "HoverResponse.result", "ImplementationRegistrationOptions.document_selector", "ImplementationRequest.jsonrpc", "ImplementationRequest.method", "ImplementationResponse.jsonrpc", "ImplementationResponse.result", "InitializeParams.process_id", "InitializeParams.root_path", "InitializeParams.root_uri", "InitializeParams.workspace_folders", "InitializeRequest.jsonrpc", "InitializeRequest.method", "InitializeResponse.jsonrpc", "InitializeResponse.result", "InitializedNotification.jsonrpc", "InitializedNotification.method", "InlayHintRefreshRequest.jsonrpc", "InlayHintRefreshRequest.method", "InlayHintRefreshResponse.jsonrpc", "InlayHintRefreshResponse.result", "InlayHintRegistrationOptions.document_selector", "InlayHintRequest.jsonrpc", "InlayHintRequest.method", "InlayHintResolveRequest.jsonrpc", "InlayHintResolveRequest.method", "InlayHintResolveResponse.jsonrpc", "InlayHintResolveResponse.result", "InlayHintResponse.jsonrpc", "InlayHintResponse.result", "InlineCompletionRegistrationOptions.document_selector", "InlineCompletionRequest.jsonrpc", "InlineCompletionRequest.method", "InlineCompletionResponse.jsonrpc", "InlineCompletionResponse.result", "InlineValueRefreshRequest.jsonrpc", "InlineValueRefreshRequest.method", "InlineValueRefreshResponse.jsonrpc", "InlineValueRefreshResponse.result", "InlineValueRegistrationOptions.document_selector", "InlineValueRequest.jsonrpc", "InlineValueRequest.method", "InlineValueResponse.jsonrpc", "InlineValueResponse.result", "LinkedEditingRangeRegistrationOptions.document_selector", "LinkedEditingRangeRequest.jsonrpc", "LinkedEditingRangeRequest.method", "LinkedEditingRangeResponse.jsonrpc", "LinkedEditingRangeResponse.result", "LogMessageNotification.jsonrpc", "LogMessageNotification.method", "LogTraceNotification.jsonrpc", "LogTraceNotification.method", "MonikerRegistrationOptions.document_selector", "MonikerRequest.jsonrpc", "MonikerRequest.method", "MonikerResponse.jsonrpc", "MonikerResponse.result", "OptionalVersionedTextDocumentIdentifier.version", "PrepareRenameRequest.jsonrpc", "PrepareRenameRequest.method", "PrepareRenameResponse.jsonrpc", "PrepareRenameResponse.result", "ProgressNotification.jsonrpc", "ProgressNotification.method", "PublishDiagnosticsNotification.jsonrpc", "PublishDiagnosticsNotification.method", "ReferenceRegistrationOptions.document_selector", "ReferencesRequest.jsonrpc", "ReferencesRequest.method", "ReferencesResponse.jsonrpc", "ReferencesResponse.result", "RegistrationRequest.jsonrpc", "RegistrationRequest.method", "RegistrationResponse.jsonrpc", "RegistrationResponse.result", "RelatedFullDocumentDiagnosticReport.kind", "RelatedUnchangedDocumentDiagnosticReport.kind", "RenameFile.kind", "RenameRegistrationOptions.document_selector", "RenameRequest.jsonrpc", "RenameRequest.method", "RenameResponse.jsonrpc", "RenameResponse.result", "ResponseErrorMessage.error", "ResponseErrorMessage.jsonrpc", "SelectionRangeRegistrationOptions.document_selector", "SelectionRangeRequest.jsonrpc", "SelectionRangeRequest.method", "SelectionRangeResponse.jsonrpc", "SelectionRangeResponse.result", "SemanticTokensDeltaRequest.jsonrpc", "SemanticTokensDeltaRequest.method", "SemanticTokensDeltaResponse.jsonrpc", "SemanticTokensDeltaResponse.result", "SemanticTokensRangeRequest.jsonrpc", "SemanticTokensRangeRequest.method", "SemanticTokensRangeResponse.jsonrpc", "SemanticTokensRangeResponse.result", "SemanticTokensRefreshRequest.jsonrpc", "SemanticTokensRefreshRequest.method", "SemanticTokensRefreshResponse.jsonrpc", "SemanticTokensRefreshResponse.result", "SemanticTokensRegistrationOptions.document_selector", "SemanticTokensRequest.jsonrpc", "SemanticTokensRequest.method", "SemanticTokensResponse.jsonrpc", "SemanticTokensResponse.result", "SetTraceNotification.jsonrpc", "SetTraceNotification.method", "ShowDocumentRequest.jsonrpc", "ShowDocumentRequest.method", "ShowDocumentResponse.jsonrpc", "ShowDocumentResponse.result", "ShowMessageNotification.jsonrpc", "ShowMessageNotification.method", "ShowMessageRequest.jsonrpc", "ShowMessageRequest.method", "ShowMessageResponse.jsonrpc", "ShowMessageResponse.result", "ShutdownRequest.jsonrpc", "ShutdownRequest.method", "ShutdownResponse.jsonrpc", "ShutdownResponse.result", "SignatureHelp.active_parameter", "SignatureHelpRegistrationOptions.document_selector", "SignatureHelpRequest.jsonrpc", "SignatureHelpRequest.method", "SignatureHelpResponse.jsonrpc", "SignatureHelpResponse.result", "SignatureInformation.active_parameter", "StringValue.kind", "TelemetryEventNotification.jsonrpc", "TelemetryEventNotification.method", "TextDocumentChangeRegistrationOptions.document_selector", "TextDocumentContentRefreshRequest.jsonrpc", "TextDocumentContentRefreshRequest.method", "TextDocumentContentRefreshResponse.jsonrpc", "TextDocumentContentRefreshResponse.result", "TextDocumentContentRequest.jsonrpc", "TextDocumentContentRequest.method", "TextDocumentContentResponse.jsonrpc", "TextDocumentContentResponse.result", "TextDocumentRegistrationOptions.document_selector", "TextDocumentSaveRegistrationOptions.document_selector", "TypeDefinitionRegistrationOptions.document_selector", "TypeDefinitionRequest.jsonrpc", "TypeDefinitionRequest.method", "TypeDefinitionResponse.jsonrpc", "TypeDefinitionResponse.result", "TypeHierarchyPrepareRequest.jsonrpc", "TypeHierarchyPrepareRequest.method", "TypeHierarchyPrepareResponse.jsonrpc", "TypeHierarchyPrepareResponse.result", "TypeHierarchyRegistrationOptions.document_selector", "TypeHierarchySubtypesRequest.jsonrpc", "TypeHierarchySubtypesRequest.method", "TypeHierarchySubtypesResponse.jsonrpc", "TypeHierarchySubtypesResponse.result", "TypeHierarchySupertypesRequest.jsonrpc", "TypeHierarchySupertypesRequest.method", "TypeHierarchySupertypesResponse.jsonrpc", "TypeHierarchySupertypesResponse.result", "UnchangedDocumentDiagnosticReport.kind", "UnregistrationRequest.jsonrpc", "UnregistrationRequest.method", "UnregistrationResponse.jsonrpc", "UnregistrationResponse.result", "WillCreateFilesRequest.jsonrpc", "WillCreateFilesRequest.method", "WillCreateFilesResponse.jsonrpc", "WillCreateFilesResponse.result", "WillDeleteFilesRequest.jsonrpc", "WillDeleteFilesRequest.method", "WillDeleteFilesResponse.jsonrpc", "WillDeleteFilesResponse.result", "WillRenameFilesRequest.jsonrpc", "WillRenameFilesRequest.method", "WillRenameFilesResponse.jsonrpc", "WillRenameFilesResponse.result", "WillSaveTextDocumentNotification.jsonrpc", "WillSaveTextDocumentNotification.method", "WillSaveTextDocumentWaitUntilRequest.jsonrpc", "WillSaveTextDocumentWaitUntilRequest.method", "WillSaveTextDocumentWaitUntilResponse.jsonrpc", "WillSaveTextDocumentWaitUntilResponse.result", "WorkDoneProgressBegin.kind", "WorkDoneProgressCancelNotification.jsonrpc", "WorkDoneProgressCancelNotification.method", "WorkDoneProgressCreateRequest.jsonrpc", "WorkDoneProgressCreateRequest.method", "WorkDoneProgressCreateResponse.jsonrpc", "WorkDoneProgressCreateResponse.result", "WorkDoneProgressEnd.kind", "WorkDoneProgressReport.kind", "WorkspaceDiagnosticRequest.jsonrpc", "WorkspaceDiagnosticRequest.method", "WorkspaceDiagnosticResponse.jsonrpc", "WorkspaceDiagnosticResponse.result", "WorkspaceFoldersInitializeParams.workspace_folders", "WorkspaceFoldersRequest.jsonrpc", "WorkspaceFoldersRequest.method", "WorkspaceFoldersResponse.jsonrpc", "WorkspaceFoldersResponse.result", "WorkspaceFullDocumentDiagnosticReport.kind", "WorkspaceFullDocumentDiagnosticReport.version", "WorkspaceSymbolRequest.jsonrpc", "WorkspaceSymbolRequest.method", "WorkspaceSymbolResolveRequest.jsonrpc", "WorkspaceSymbolResolveRequest.method", "WorkspaceSymbolResolveResponse.jsonrpc", "WorkspaceSymbolResolveResponse.result", "WorkspaceSymbolResponse.jsonrpc", "WorkspaceSymbolResponse.result", "WorkspaceUnchangedDocumentDiagnosticReport.kind", "WorkspaceUnchangedDocumentDiagnosticReport.version", "_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, "ApplyKind": ApplyKind, "ApplyWorkspaceEditParams": ApplyWorkspaceEditParams, "ApplyWorkspaceEditRequest": ApplyWorkspaceEditRequest, "ApplyWorkspaceEditResponse": ApplyWorkspaceEditResponse, "ApplyWorkspaceEditResult": ApplyWorkspaceEditResult, "BaseSymbolInformation": BaseSymbolInformation, "CallHierarchyClientCapabilities": CallHierarchyClientCapabilities, "CallHierarchyIncomingCall": CallHierarchyIncomingCall, "CallHierarchyIncomingCallsParams": CallHierarchyIncomingCallsParams, "CallHierarchyIncomingCallsRequest": CallHierarchyIncomingCallsRequest, "CallHierarchyIncomingCallsResponse": CallHierarchyIncomingCallsResponse, "CallHierarchyIncomingCallsResult": CallHierarchyIncomingCallsResult, "CallHierarchyItem": CallHierarchyItem, "CallHierarchyOptions": CallHierarchyOptions, "CallHierarchyOutgoingCall": CallHierarchyOutgoingCall, "CallHierarchyOutgoingCallsParams": CallHierarchyOutgoingCallsParams, "CallHierarchyOutgoingCallsRequest": CallHierarchyOutgoingCallsRequest, "CallHierarchyOutgoingCallsResponse": CallHierarchyOutgoingCallsResponse, "CallHierarchyOutgoingCallsResult": CallHierarchyOutgoingCallsResult, "CallHierarchyPrepareParams": CallHierarchyPrepareParams, "CallHierarchyPrepareRequest": CallHierarchyPrepareRequest, "CallHierarchyPrepareResponse": CallHierarchyPrepareResponse, "CallHierarchyPrepareResult": CallHierarchyPrepareResult, "CallHierarchyRegistrationOptions": CallHierarchyRegistrationOptions, "CancelNotification": CancelNotification, "CancelParams": CancelParams, "ChangeAnnotation": ChangeAnnotation, "ChangeAnnotationIdentifier": ChangeAnnotationIdentifier, "ChangeAnnotationsSupportOptions": ChangeAnnotationsSupportOptions, "ClientCapabilities": ClientCapabilities, "ClientCodeActionKindOptions": ClientCodeActionKindOptions, "ClientCodeActionLiteralOptions": ClientCodeActionLiteralOptions, "ClientCodeActionResolveOptions": ClientCodeActionResolveOptions, "ClientCodeLensResolveOptions": ClientCodeLensResolveOptions, "ClientCompletionItemInsertTextModeOptions": ClientCompletionItemInsertTextModeOptions, "ClientCompletionItemOptions": ClientCompletionItemOptions, "ClientCompletionItemOptionsKind": ClientCompletionItemOptionsKind, "ClientCompletionItemResolveOptions": ClientCompletionItemResolveOptions, "ClientDiagnosticsTagOptions": ClientDiagnosticsTagOptions, "ClientFoldingRangeKindOptions": ClientFoldingRangeKindOptions, "ClientFoldingRangeOptions": ClientFoldingRangeOptions, "ClientInfo": ClientInfo, "ClientInlayHintResolveOptions": ClientInlayHintResolveOptions, "ClientSemanticTokensRequestFullDelta": ClientSemanticTokensRequestFullDelta, "ClientSemanticTokensRequestOptions": ClientSemanticTokensRequestOptions, "ClientShowMessageActionItemOptions": ClientShowMessageActionItemOptions, "ClientSignatureInformationOptions": ClientSignatureInformationOptions, "ClientSignatureParameterInformationOptions": ClientSignatureParameterInformationOptions, "ClientSymbolKindOptions": ClientSymbolKindOptions, "ClientSymbolResolveOptions": ClientSymbolResolveOptions, "ClientSymbolTagOptions": ClientSymbolTagOptions, "CodeAction": CodeAction, "CodeActionClientCapabilities": CodeActionClientCapabilities, "CodeActionContext": CodeActionContext, "CodeActionDisabled": CodeActionDisabled, "CodeActionKind": CodeActionKind, "CodeActionKindDocumentation": CodeActionKindDocumentation, "CodeActionOptions": CodeActionOptions, "CodeActionParams": CodeActionParams, "CodeActionRegistrationOptions": CodeActionRegistrationOptions, "CodeActionRequest": CodeActionRequest, "CodeActionResolveRequest": CodeActionResolveRequest, "CodeActionResolveResponse": CodeActionResolveResponse, "CodeActionResponse": CodeActionResponse, "CodeActionResult": CodeActionResult, "CodeActionTag": CodeActionTag, "CodeActionTagOptions": CodeActionTagOptions, "CodeActionTriggerKind": CodeActionTriggerKind, "CodeDescription": CodeDescription, "CodeLens": CodeLens, "CodeLensClientCapabilities": CodeLensClientCapabilities, "CodeLensOptions": CodeLensOptions, "CodeLensParams": CodeLensParams, "CodeLensRefreshRequest": CodeLensRefreshRequest, "CodeLensRefreshResponse": CodeLensRefreshResponse, "CodeLensRegistrationOptions": CodeLensRegistrationOptions, "CodeLensRequest": CodeLensRequest, "CodeLensResolveRequest": CodeLensResolveRequest, "CodeLensResolveResponse": CodeLensResolveResponse, "CodeLensResponse": CodeLensResponse, "CodeLensResult": CodeLensResult, "CodeLensWorkspaceClientCapabilities": CodeLensWorkspaceClientCapabilities, "Color": Color, "ColorInformation": ColorInformation, "ColorPresentation": ColorPresentation, "ColorPresentationParams": ColorPresentationParams, "ColorPresentationRequest": ColorPresentationRequest, "ColorPresentationRequestOptions": ColorPresentationRequestOptions, "ColorPresentationResponse": ColorPresentationResponse, "ColorPresentationResult": ColorPresentationResult, "Command": Command, "CompletionClientCapabilities": CompletionClientCapabilities, "CompletionContext": CompletionContext, "CompletionItem": CompletionItem, "CompletionItemApplyKinds": CompletionItemApplyKinds, "CompletionItemDefaults": CompletionItemDefaults, "CompletionItemKind": CompletionItemKind, "CompletionItemLabelDetails": CompletionItemLabelDetails, "CompletionItemTag": CompletionItemTag, "CompletionItemTagOptions": CompletionItemTagOptions, "CompletionList": CompletionList, "CompletionListCapabilities": CompletionListCapabilities, "CompletionOptions": CompletionOptions, "CompletionParams": CompletionParams, "CompletionRegistrationOptions": CompletionRegistrationOptions, "CompletionRequest": CompletionRequest, "CompletionResolveRequest": CompletionResolveRequest, "CompletionResolveResponse": CompletionResolveResponse, "CompletionResponse": CompletionResponse, "CompletionResult": CompletionResult, "CompletionTriggerKind": CompletionTriggerKind, "ConfigurationItem": ConfigurationItem, "ConfigurationParams": ConfigurationParams, "ConfigurationRequest": ConfigurationRequest, "ConfigurationResponse": ConfigurationResponse, "ConfigurationResult": ConfigurationResult, "CreateFile": CreateFile, "CreateFileOptions": CreateFileOptions, "CreateFilesParams": CreateFilesParams, "Declaration": Declaration, "DeclarationClientCapabilities": DeclarationClientCapabilities, "DeclarationLink": DeclarationLink, "DeclarationOptions": DeclarationOptions, "DeclarationParams": DeclarationParams, "DeclarationRegistrationOptions": DeclarationRegistrationOptions, "DeclarationRequest": DeclarationRequest, "DeclarationResponse": DeclarationResponse, "DeclarationResult": DeclarationResult, "Definition": Definition, "DefinitionClientCapabilities": DefinitionClientCapabilities, "DefinitionLink": DefinitionLink, "DefinitionOptions": DefinitionOptions, "DefinitionParams": DefinitionParams, "DefinitionRegistrationOptions": DefinitionRegistrationOptions, "DefinitionRequest": DefinitionRequest, "DefinitionResponse": DefinitionResponse, "DefinitionResult": DefinitionResult, "DeleteFile": DeleteFile, "DeleteFileOptions": DeleteFileOptions, "DeleteFilesParams": DeleteFilesParams, "Diagnostic": Diagnostic, "DiagnosticClientCapabilities": DiagnosticClientCapabilities, "DiagnosticOptions": DiagnosticOptions, "DiagnosticRefreshRequest": DiagnosticRefreshRequest, "DiagnosticRefreshResponse": DiagnosticRefreshResponse, "DiagnosticRegistrationOptions": DiagnosticRegistrationOptions, "DiagnosticRelatedInformation": DiagnosticRelatedInformation, "DiagnosticServerCancellationData": DiagnosticServerCancellationData, "DiagnosticSeverity": DiagnosticSeverity, "DiagnosticTag": DiagnosticTag, "DiagnosticWorkspaceClientCapabilities": DiagnosticWorkspaceClientCapabilities, "DiagnosticsCapabilities": DiagnosticsCapabilities, "DidChangeConfigurationClientCapabilities": DidChangeConfigurationClientCapabilities, "DidChangeConfigurationNotification": DidChangeConfigurationNotification, "DidChangeConfigurationParams": DidChangeConfigurationParams, "DidChangeConfigurationRegistrationOptions": DidChangeConfigurationRegistrationOptions, "DidChangeNotebookDocumentNotification": DidChangeNotebookDocumentNotification, "DidChangeNotebookDocumentParams": DidChangeNotebookDocumentParams, "DidChangeTextDocumentNotification": DidChangeTextDocumentNotification, "DidChangeTextDocumentParams": DidChangeTextDocumentParams, "DidChangeWatchedFilesClientCapabilities": DidChangeWatchedFilesClientCapabilities, "DidChangeWatchedFilesNotification": DidChangeWatchedFilesNotification, "DidChangeWatchedFilesParams": DidChangeWatchedFilesParams, "DidChangeWatchedFilesRegistrationOptions": DidChangeWatchedFilesRegistrationOptions, "DidChangeWorkspaceFoldersNotification": DidChangeWorkspaceFoldersNotification, "DidChangeWorkspaceFoldersParams": DidChangeWorkspaceFoldersParams, "DidCloseNotebookDocumentNotification": DidCloseNotebookDocumentNotification, "DidCloseNotebookDocumentParams": DidCloseNotebookDocumentParams, "DidCloseTextDocumentNotification": DidCloseTextDocumentNotification, "DidCloseTextDocumentParams": DidCloseTextDocumentParams, "DidCreateFilesNotification": DidCreateFilesNotification, "DidDeleteFilesNotification": DidDeleteFilesNotification, "DidOpenNotebookDocumentNotification": DidOpenNotebookDocumentNotification, "DidOpenNotebookDocumentParams": DidOpenNotebookDocumentParams, "DidOpenTextDocumentNotification": DidOpenTextDocumentNotification, "DidOpenTextDocumentParams": DidOpenTextDocumentParams, "DidRenameFilesNotification": DidRenameFilesNotification, "DidSaveNotebookDocumentNotification": DidSaveNotebookDocumentNotification, "DidSaveNotebookDocumentParams": DidSaveNotebookDocumentParams, "DidSaveTextDocumentNotification": DidSaveTextDocumentNotification, "DidSaveTextDocumentParams": DidSaveTextDocumentParams, "DocumentColorClientCapabilities": DocumentColorClientCapabilities, "DocumentColorOptions": DocumentColorOptions, "DocumentColorParams": DocumentColorParams, "DocumentColorRegistrationOptions": DocumentColorRegistrationOptions, "DocumentColorRequest": DocumentColorRequest, "DocumentColorResponse": DocumentColorResponse, "DocumentColorResult": DocumentColorResult, "DocumentDiagnosticParams": DocumentDiagnosticParams, "DocumentDiagnosticReport": DocumentDiagnosticReport, "DocumentDiagnosticReportKind": DocumentDiagnosticReportKind, "DocumentDiagnosticReportPartialResult": DocumentDiagnosticReportPartialResult, "DocumentDiagnosticRequest": DocumentDiagnosticRequest, "DocumentDiagnosticResponse": DocumentDiagnosticResponse, "DocumentFilter": DocumentFilter, "DocumentFormattingClientCapabilities": DocumentFormattingClientCapabilities, "DocumentFormattingOptions": DocumentFormattingOptions, "DocumentFormattingParams": DocumentFormattingParams, "DocumentFormattingRegistrationOptions": DocumentFormattingRegistrationOptions, "DocumentFormattingRequest": DocumentFormattingRequest, "DocumentFormattingResponse": DocumentFormattingResponse, "DocumentFormattingResult": DocumentFormattingResult, "DocumentHighlight": DocumentHighlight, "DocumentHighlightClientCapabilities": DocumentHighlightClientCapabilities, "DocumentHighlightKind": DocumentHighlightKind, "DocumentHighlightOptions": DocumentHighlightOptions, "DocumentHighlightParams": DocumentHighlightParams, "DocumentHighlightRegistrationOptions": DocumentHighlightRegistrationOptions, "DocumentHighlightRequest": DocumentHighlightRequest, "DocumentHighlightResponse": DocumentHighlightResponse, "DocumentHighlightResult": DocumentHighlightResult, "DocumentLink": DocumentLink, "DocumentLinkClientCapabilities": DocumentLinkClientCapabilities, "DocumentLinkOptions": DocumentLinkOptions, "DocumentLinkParams": DocumentLinkParams, "DocumentLinkRegistrationOptions": DocumentLinkRegistrationOptions, "DocumentLinkRequest": DocumentLinkRequest, "DocumentLinkResolveRequest": DocumentLinkResolveRequest, "DocumentLinkResolveResponse": DocumentLinkResolveResponse, "DocumentLinkResponse": DocumentLinkResponse, "DocumentLinkResult": DocumentLinkResult, "DocumentOnTypeFormattingClientCapabilities": DocumentOnTypeFormattingClientCapabilities, "DocumentOnTypeFormattingOptions": DocumentOnTypeFormattingOptions, "DocumentOnTypeFormattingParams": DocumentOnTypeFormattingParams, "DocumentOnTypeFormattingRegistrationOptions": DocumentOnTypeFormattingRegistrationOptions, "DocumentOnTypeFormattingRequest": DocumentOnTypeFormattingRequest, "DocumentOnTypeFormattingResponse": DocumentOnTypeFormattingResponse, "DocumentOnTypeFormattingResult": DocumentOnTypeFormattingResult, "DocumentRangeFormattingClientCapabilities": DocumentRangeFormattingClientCapabilities, "DocumentRangeFormattingOptions": DocumentRangeFormattingOptions, "DocumentRangeFormattingParams": DocumentRangeFormattingParams, "DocumentRangeFormattingRegistrationOptions": DocumentRangeFormattingRegistrationOptions, "DocumentRangeFormattingRequest": DocumentRangeFormattingRequest, "DocumentRangeFormattingResponse": DocumentRangeFormattingResponse, "DocumentRangeFormattingResult": DocumentRangeFormattingResult, "DocumentRangesFormattingParams": DocumentRangesFormattingParams, "DocumentRangesFormattingRequest": DocumentRangesFormattingRequest, "DocumentRangesFormattingResponse": DocumentRangesFormattingResponse, "DocumentRangesFormattingResult": DocumentRangesFormattingResult, "DocumentSelector": DocumentSelector, "DocumentSymbol": DocumentSymbol, "DocumentSymbolClientCapabilities": DocumentSymbolClientCapabilities, "DocumentSymbolOptions": DocumentSymbolOptions, "DocumentSymbolParams": DocumentSymbolParams, "DocumentSymbolRegistrationOptions": DocumentSymbolRegistrationOptions, "DocumentSymbolRequest": DocumentSymbolRequest, "DocumentSymbolResponse": DocumentSymbolResponse, "DocumentSymbolResult": DocumentSymbolResult, "EditRangeWithInsertReplace": EditRangeWithInsertReplace, "ErrorCodes": ErrorCodes, "ExecuteCommandClientCapabilities": ExecuteCommandClientCapabilities, "ExecuteCommandOptions": ExecuteCommandOptions, "ExecuteCommandParams": ExecuteCommandParams, "ExecuteCommandRegistrationOptions": ExecuteCommandRegistrationOptions, "ExecuteCommandRequest": ExecuteCommandRequest, "ExecuteCommandResponse": ExecuteCommandResponse, "ExecuteCommandResult": ExecuteCommandResult, "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, "FoldingRangeKind": FoldingRangeKind, "FoldingRangeOptions": FoldingRangeOptions, "FoldingRangeParams": FoldingRangeParams, "FoldingRangeRefreshRequest": FoldingRangeRefreshRequest, "FoldingRangeRefreshResponse": FoldingRangeRefreshResponse, "FoldingRangeRegistrationOptions": FoldingRangeRegistrationOptions, "FoldingRangeRequest": FoldingRangeRequest, "FoldingRangeResponse": FoldingRangeResponse, "FoldingRangeResult": FoldingRangeResult, "FoldingRangeWorkspaceClientCapabilities": FoldingRangeWorkspaceClientCapabilities, "FormattingOptions": FormattingOptions, "FullDocumentDiagnosticReport": FullDocumentDiagnosticReport, "GeneralClientCapabilities": GeneralClientCapabilities, "GlobPattern": GlobPattern, "Hover": Hover, "HoverClientCapabilities": HoverClientCapabilities, "HoverOptions": HoverOptions, "HoverParams": HoverParams, "HoverRegistrationOptions": HoverRegistrationOptions, "HoverRequest": HoverRequest, "HoverResponse": HoverResponse, "HoverResult": HoverResult, "ImplementationClientCapabilities": ImplementationClientCapabilities, "ImplementationOptions": ImplementationOptions, "ImplementationParams": ImplementationParams, "ImplementationRegistrationOptions": ImplementationRegistrationOptions, "ImplementationRequest": ImplementationRequest, "ImplementationResponse": ImplementationResponse, "ImplementationResult": ImplementationResult, "InitializeError": InitializeError, "InitializeParams": InitializeParams, "InitializeRequest": InitializeRequest, "InitializeResponse": InitializeResponse, "InitializeResult": InitializeResult, "InitializedNotification": InitializedNotification, "InitializedParams": InitializedParams, "InlayHint": InlayHint, "InlayHintClientCapabilities": InlayHintClientCapabilities, "InlayHintKind": InlayHintKind, "InlayHintLabelPart": InlayHintLabelPart, "InlayHintOptions": InlayHintOptions, "InlayHintParams": InlayHintParams, "InlayHintRefreshRequest": InlayHintRefreshRequest, "InlayHintRefreshResponse": InlayHintRefreshResponse, "InlayHintRegistrationOptions": InlayHintRegistrationOptions, "InlayHintRequest": InlayHintRequest, "InlayHintResolveRequest": InlayHintResolveRequest, "InlayHintResolveResponse": InlayHintResolveResponse, "InlayHintResponse": InlayHintResponse, "InlayHintResult": InlayHintResult, "InlayHintWorkspaceClientCapabilities": InlayHintWorkspaceClientCapabilities, "InlineCompletionClientCapabilities": InlineCompletionClientCapabilities, "InlineCompletionContext": InlineCompletionContext, "InlineCompletionItem": InlineCompletionItem, "InlineCompletionList": InlineCompletionList, "InlineCompletionOptions": InlineCompletionOptions, "InlineCompletionParams": InlineCompletionParams, "InlineCompletionRegistrationOptions": InlineCompletionRegistrationOptions, "InlineCompletionRequest": InlineCompletionRequest, "InlineCompletionResponse": InlineCompletionResponse, "InlineCompletionResult": InlineCompletionResult, "InlineCompletionTriggerKind": InlineCompletionTriggerKind, "InlineValue": InlineValue, "InlineValueClientCapabilities": InlineValueClientCapabilities, "InlineValueContext": InlineValueContext, "InlineValueEvaluatableExpression": InlineValueEvaluatableExpression, "InlineValueOptions": InlineValueOptions, "InlineValueParams": InlineValueParams, "InlineValueRefreshRequest": InlineValueRefreshRequest, "InlineValueRefreshResponse": InlineValueRefreshResponse, "InlineValueRegistrationOptions": InlineValueRegistrationOptions, "InlineValueRequest": InlineValueRequest, "InlineValueResponse": InlineValueResponse, "InlineValueResult": InlineValueResult, "InlineValueText": InlineValueText, "InlineValueVariableLookup": InlineValueVariableLookup, "InlineValueWorkspaceClientCapabilities": InlineValueWorkspaceClientCapabilities, "InsertReplaceEdit": InsertReplaceEdit, "InsertTextFormat": InsertTextFormat, "InsertTextMode": InsertTextMode, "LSPAny": LSPAny, "LSPArray": LSPArray, "LSPErrorCodes": LSPErrorCodes, "LSPObject": LSPObject, "LanguageKind": LanguageKind, "LinkedEditingRangeClientCapabilities": LinkedEditingRangeClientCapabilities, "LinkedEditingRangeOptions": LinkedEditingRangeOptions, "LinkedEditingRangeParams": LinkedEditingRangeParams, "LinkedEditingRangeRegistrationOptions": LinkedEditingRangeRegistrationOptions, "LinkedEditingRangeRequest": LinkedEditingRangeRequest, "LinkedEditingRangeResponse": LinkedEditingRangeResponse, "LinkedEditingRangeResult": LinkedEditingRangeResult, "LinkedEditingRanges": LinkedEditingRanges, "Location": Location, "LocationLink": LocationLink, "LocationUriOnly": LocationUriOnly, "LogMessageNotification": LogMessageNotification, "LogMessageParams": LogMessageParams, "LogTraceNotification": LogTraceNotification, "LogTraceParams": LogTraceParams, "MarkdownClientCapabilities": MarkdownClientCapabilities, "MarkedString": MarkedString, "MarkedStringWithLanguage": MarkedStringWithLanguage, "MarkupContent": MarkupContent, "MarkupKind": MarkupKind, "MessageActionItem": MessageActionItem, "MessageDirection": MessageDirection, "MessageType": MessageType, "Moniker": Moniker, "MonikerClientCapabilities": MonikerClientCapabilities, "MonikerKind": MonikerKind, "MonikerOptions": MonikerOptions, "MonikerParams": MonikerParams, "MonikerRegistrationOptions": MonikerRegistrationOptions, "MonikerRequest": MonikerRequest, "MonikerResponse": MonikerResponse, "MonikerResult": MonikerResult, "NotebookCell": NotebookCell, "NotebookCellArrayChange": NotebookCellArrayChange, "NotebookCellKind": NotebookCellKind, "NotebookCellLanguage": NotebookCellLanguage, "NotebookCellTextDocumentFilter": NotebookCellTextDocumentFilter, "NotebookDocument": NotebookDocument, "NotebookDocumentCellChangeStructure": NotebookDocumentCellChangeStructure, "NotebookDocumentCellChanges": NotebookDocumentCellChanges, "NotebookDocumentCellContentChanges": NotebookDocumentCellContentChanges, "NotebookDocumentChangeEvent": NotebookDocumentChangeEvent, "NotebookDocumentClientCapabilities": NotebookDocumentClientCapabilities, "NotebookDocumentFilter": NotebookDocumentFilter, "NotebookDocumentFilterNotebookType": NotebookDocumentFilterNotebookType, "NotebookDocumentFilterPattern": NotebookDocumentFilterPattern, "NotebookDocumentFilterScheme": NotebookDocumentFilterScheme, "NotebookDocumentFilterWithCells": NotebookDocumentFilterWithCells, "NotebookDocumentFilterWithNotebook": NotebookDocumentFilterWithNotebook, "NotebookDocumentIdentifier": NotebookDocumentIdentifier, "NotebookDocumentSyncClientCapabilities": NotebookDocumentSyncClientCapabilities, "NotebookDocumentSyncOptions": NotebookDocumentSyncOptions, "NotebookDocumentSyncRegistrationOptions": NotebookDocumentSyncRegistrationOptions, "OptionalVersionedTextDocumentIdentifier": OptionalVersionedTextDocumentIdentifier, "ParameterInformation": ParameterInformation, "PartialResultParams": PartialResultParams, "Pattern": Pattern, "Position": Position, "PositionEncodingKind": PositionEncodingKind, "PrepareRenameDefaultBehavior": PrepareRenameDefaultBehavior, "PrepareRenameParams": PrepareRenameParams, "PrepareRenamePlaceholder": PrepareRenamePlaceholder, "PrepareRenameRequest": PrepareRenameRequest, "PrepareRenameResponse": PrepareRenameResponse, "PrepareRenameResult": PrepareRenameResult, "PrepareSupportDefaultBehavior": PrepareSupportDefaultBehavior, "PreviousResultId": PreviousResultId, "ProgressNotification": ProgressNotification, "ProgressParams": ProgressParams, "ProgressToken": ProgressToken, "PublishDiagnosticsClientCapabilities": PublishDiagnosticsClientCapabilities, "PublishDiagnosticsNotification": PublishDiagnosticsNotification, "PublishDiagnosticsParams": PublishDiagnosticsParams, "Range": Range, "ReferenceClientCapabilities": ReferenceClientCapabilities, "ReferenceContext": ReferenceContext, "ReferenceOptions": ReferenceOptions, "ReferenceParams": ReferenceParams, "ReferenceRegistrationOptions": ReferenceRegistrationOptions, "ReferencesRequest": ReferencesRequest, "ReferencesResponse": ReferencesResponse, "ReferencesResult": ReferencesResult, "Registration": Registration, "RegistrationParams": RegistrationParams, "RegistrationRequest": RegistrationRequest, "RegistrationResponse": RegistrationResponse, "RegularExpressionEngineKind": RegularExpressionEngineKind, "RegularExpressionsClientCapabilities": RegularExpressionsClientCapabilities, "RelatedFullDocumentDiagnosticReport": RelatedFullDocumentDiagnosticReport, "RelatedUnchangedDocumentDiagnosticReport": RelatedUnchangedDocumentDiagnosticReport, "RelativePattern": RelativePattern, "RenameClientCapabilities": RenameClientCapabilities, "RenameFile": RenameFile, "RenameFileOptions": RenameFileOptions, "RenameFilesParams": RenameFilesParams, "RenameOptions": RenameOptions, "RenameParams": RenameParams, "RenameRegistrationOptions": RenameRegistrationOptions, "RenameRequest": RenameRequest, "RenameResponse": RenameResponse, "RenameResult": RenameResult, "ResourceOperation": ResourceOperation, "ResourceOperationKind": ResourceOperationKind, "ResponseError": ResponseError, "ResponseErrorMessage": ResponseErrorMessage, "SaveOptions": SaveOptions, "SelectedCompletionInfo": SelectedCompletionInfo, "SelectionRange": SelectionRange, "SelectionRangeClientCapabilities": SelectionRangeClientCapabilities, "SelectionRangeOptions": SelectionRangeOptions, "SelectionRangeParams": SelectionRangeParams, "SelectionRangeRegistrationOptions": SelectionRangeRegistrationOptions, "SelectionRangeRequest": SelectionRangeRequest, "SelectionRangeResponse": SelectionRangeResponse, "SelectionRangeResult": SelectionRangeResult, "SemanticTokenModifiers": SemanticTokenModifiers, "SemanticTokenTypes": SemanticTokenTypes, "SemanticTokens": SemanticTokens, "SemanticTokensClientCapabilities": SemanticTokensClientCapabilities, "SemanticTokensDelta": SemanticTokensDelta, "SemanticTokensDeltaParams": SemanticTokensDeltaParams, "SemanticTokensDeltaPartialResult": SemanticTokensDeltaPartialResult, "SemanticTokensDeltaRequest": SemanticTokensDeltaRequest, "SemanticTokensDeltaResponse": SemanticTokensDeltaResponse, "SemanticTokensDeltaResult": SemanticTokensDeltaResult, "SemanticTokensEdit": SemanticTokensEdit, "SemanticTokensFullDelta": SemanticTokensFullDelta, "SemanticTokensLegend": SemanticTokensLegend, "SemanticTokensOptions": SemanticTokensOptions, "SemanticTokensParams": SemanticTokensParams, "SemanticTokensPartialResult": SemanticTokensPartialResult, "SemanticTokensRangeParams": SemanticTokensRangeParams, "SemanticTokensRangeRequest": SemanticTokensRangeRequest, "SemanticTokensRangeResponse": SemanticTokensRangeResponse, "SemanticTokensRangeResult": SemanticTokensRangeResult, "SemanticTokensRefreshRequest": SemanticTokensRefreshRequest, "SemanticTokensRefreshResponse": SemanticTokensRefreshResponse, "SemanticTokensRegistrationOptions": SemanticTokensRegistrationOptions, "SemanticTokensRequest": SemanticTokensRequest, "SemanticTokensResponse": SemanticTokensResponse, "SemanticTokensResult": SemanticTokensResult, "SemanticTokensWorkspaceClientCapabilities": SemanticTokensWorkspaceClientCapabilities, "ServerCapabilities": ServerCapabilities, "ServerCompletionItemOptions": ServerCompletionItemOptions, "ServerInfo": ServerInfo, "SetTraceNotification": SetTraceNotification, "SetTraceParams": SetTraceParams, "ShowDocumentClientCapabilities": ShowDocumentClientCapabilities, "ShowDocumentParams": ShowDocumentParams, "ShowDocumentRequest": ShowDocumentRequest, "ShowDocumentResponse": ShowDocumentResponse, "ShowDocumentResult": ShowDocumentResult, "ShowMessageNotification": ShowMessageNotification, "ShowMessageParams": ShowMessageParams, "ShowMessageRequest": ShowMessageRequest, "ShowMessageRequestClientCapabilities": ShowMessageRequestClientCapabilities, "ShowMessageRequestParams": ShowMessageRequestParams, "ShowMessageResponse": ShowMessageResponse, "ShowMessageResult": ShowMessageResult, "ShutdownRequest": ShutdownRequest, "ShutdownResponse": ShutdownResponse, "SignatureHelp": SignatureHelp, "SignatureHelpClientCapabilities": SignatureHelpClientCapabilities, "SignatureHelpContext": SignatureHelpContext, "SignatureHelpOptions": SignatureHelpOptions, "SignatureHelpParams": SignatureHelpParams, "SignatureHelpRegistrationOptions": SignatureHelpRegistrationOptions, "SignatureHelpRequest": SignatureHelpRequest, "SignatureHelpResponse": SignatureHelpResponse, "SignatureHelpResult": SignatureHelpResult, "SignatureHelpTriggerKind": SignatureHelpTriggerKind, "SignatureInformation": SignatureInformation, "SnippetTextEdit": SnippetTextEdit, "StaleRequestSupportOptions": StaleRequestSupportOptions, "StaticRegistrationOptions": StaticRegistrationOptions, "StringValue": StringValue, "SymbolInformation": SymbolInformation, "SymbolKind": SymbolKind, "SymbolTag": SymbolTag, "TelemetryEventNotification": TelemetryEventNotification, "TextDocumentChangeRegistrationOptions": TextDocumentChangeRegistrationOptions, "TextDocumentClientCapabilities": TextDocumentClientCapabilities, "TextDocumentContentChangeEvent": TextDocumentContentChangeEvent, "TextDocumentContentChangePartial": TextDocumentContentChangePartial, "TextDocumentContentChangeWholeDocument": TextDocumentContentChangeWholeDocument, "TextDocumentContentClientCapabilities": TextDocumentContentClientCapabilities, "TextDocumentContentOptions": TextDocumentContentOptions, "TextDocumentContentParams": TextDocumentContentParams, "TextDocumentContentRefreshParams": TextDocumentContentRefreshParams, "TextDocumentContentRefreshRequest": TextDocumentContentRefreshRequest, "TextDocumentContentRefreshResponse": TextDocumentContentRefreshResponse, "TextDocumentContentRegistrationOptions": TextDocumentContentRegistrationOptions, "TextDocumentContentRequest": TextDocumentContentRequest, "TextDocumentContentResponse": TextDocumentContentResponse, "TextDocumentContentResult": TextDocumentContentResult, "TextDocumentEdit": TextDocumentEdit, "TextDocumentFilter": TextDocumentFilter, "TextDocumentFilterClientCapabilities": TextDocumentFilterClientCapabilities, "TextDocumentFilterLanguage": TextDocumentFilterLanguage, "TextDocumentFilterPattern": TextDocumentFilterPattern, "TextDocumentFilterScheme": TextDocumentFilterScheme, "TextDocumentIdentifier": TextDocumentIdentifier, "TextDocumentItem": TextDocumentItem, "TextDocumentPositionParams": TextDocumentPositionParams, "TextDocumentRegistrationOptions": TextDocumentRegistrationOptions, "TextDocumentSaveReason": TextDocumentSaveReason, "TextDocumentSaveRegistrationOptions": TextDocumentSaveRegistrationOptions, "TextDocumentSyncClientCapabilities": TextDocumentSyncClientCapabilities, "TextDocumentSyncKind": TextDocumentSyncKind, "TextDocumentSyncOptions": TextDocumentSyncOptions, "TextEdit": TextEdit, "TokenFormat": TokenFormat, "TraceValue": TraceValue, "TypeDefinitionClientCapabilities": TypeDefinitionClientCapabilities, "TypeDefinitionOptions": TypeDefinitionOptions, "TypeDefinitionParams": TypeDefinitionParams, "TypeDefinitionRegistrationOptions": TypeDefinitionRegistrationOptions, "TypeDefinitionRequest": TypeDefinitionRequest, "TypeDefinitionResponse": TypeDefinitionResponse, "TypeDefinitionResult": TypeDefinitionResult, "TypeHierarchyClientCapabilities": TypeHierarchyClientCapabilities, "TypeHierarchyItem": TypeHierarchyItem, "TypeHierarchyOptions": TypeHierarchyOptions, "TypeHierarchyPrepareParams": TypeHierarchyPrepareParams, "TypeHierarchyPrepareRequest": TypeHierarchyPrepareRequest, "TypeHierarchyPrepareResponse": TypeHierarchyPrepareResponse, "TypeHierarchyPrepareResult": TypeHierarchyPrepareResult, "TypeHierarchyRegistrationOptions": TypeHierarchyRegistrationOptions, "TypeHierarchySubtypesParams": TypeHierarchySubtypesParams, "TypeHierarchySubtypesRequest": TypeHierarchySubtypesRequest, "TypeHierarchySubtypesResponse": TypeHierarchySubtypesResponse, "TypeHierarchySubtypesResult": TypeHierarchySubtypesResult, "TypeHierarchySupertypesParams": TypeHierarchySupertypesParams, "TypeHierarchySupertypesRequest": TypeHierarchySupertypesRequest, "TypeHierarchySupertypesResponse": TypeHierarchySupertypesResponse, "TypeHierarchySupertypesResult": TypeHierarchySupertypesResult, "UnchangedDocumentDiagnosticReport": UnchangedDocumentDiagnosticReport, "UniquenessLevel": UniquenessLevel, "Unregistration": Unregistration, "UnregistrationParams": UnregistrationParams, "UnregistrationRequest": UnregistrationRequest, "UnregistrationResponse": UnregistrationResponse, "VersionedNotebookDocumentIdentifier": VersionedNotebookDocumentIdentifier, "VersionedTextDocumentIdentifier": VersionedTextDocumentIdentifier, "WatchKind": WatchKind, "WillCreateFilesRequest": WillCreateFilesRequest, "WillCreateFilesResponse": WillCreateFilesResponse, "WillCreateFilesResult": WillCreateFilesResult, "WillDeleteFilesRequest": WillDeleteFilesRequest, "WillDeleteFilesResponse": WillDeleteFilesResponse, "WillDeleteFilesResult": WillDeleteFilesResult, "WillRenameFilesRequest": WillRenameFilesRequest, "WillRenameFilesResponse": WillRenameFilesResponse, "WillRenameFilesResult": WillRenameFilesResult, "WillSaveTextDocumentNotification": WillSaveTextDocumentNotification, "WillSaveTextDocumentParams": WillSaveTextDocumentParams, "WillSaveTextDocumentWaitUntilRequest": WillSaveTextDocumentWaitUntilRequest, "WillSaveTextDocumentWaitUntilResponse": WillSaveTextDocumentWaitUntilResponse, "WillSaveTextDocumentWaitUntilResult": WillSaveTextDocumentWaitUntilResult, "WindowClientCapabilities": WindowClientCapabilities, "WorkDoneProgressBegin": WorkDoneProgressBegin, "WorkDoneProgressCancelNotification": WorkDoneProgressCancelNotification, "WorkDoneProgressCancelParams": WorkDoneProgressCancelParams, "WorkDoneProgressCreateParams": WorkDoneProgressCreateParams, "WorkDoneProgressCreateRequest": WorkDoneProgressCreateRequest, "WorkDoneProgressCreateResponse": WorkDoneProgressCreateResponse, "WorkDoneProgressEnd": WorkDoneProgressEnd, "WorkDoneProgressOptions": WorkDoneProgressOptions, "WorkDoneProgressParams": WorkDoneProgressParams, "WorkDoneProgressReport": WorkDoneProgressReport, "WorkspaceClientCapabilities": WorkspaceClientCapabilities, "WorkspaceDiagnosticParams": WorkspaceDiagnosticParams, "WorkspaceDiagnosticReport": WorkspaceDiagnosticReport, "WorkspaceDiagnosticReportPartialResult": WorkspaceDiagnosticReportPartialResult, "WorkspaceDiagnosticRequest": WorkspaceDiagnosticRequest, "WorkspaceDiagnosticResponse": WorkspaceDiagnosticResponse, "WorkspaceDocumentDiagnosticReport": WorkspaceDocumentDiagnosticReport, "WorkspaceEdit": WorkspaceEdit, "WorkspaceEditClientCapabilities": WorkspaceEditClientCapabilities, "WorkspaceEditMetadata": WorkspaceEditMetadata, "WorkspaceFolder": WorkspaceFolder, "WorkspaceFoldersChangeEvent": WorkspaceFoldersChangeEvent, "WorkspaceFoldersInitializeParams": WorkspaceFoldersInitializeParams, "WorkspaceFoldersRequest": WorkspaceFoldersRequest, "WorkspaceFoldersResponse": WorkspaceFoldersResponse, "WorkspaceFoldersResult": WorkspaceFoldersResult, "WorkspaceFoldersServerCapabilities": WorkspaceFoldersServerCapabilities, "WorkspaceFullDocumentDiagnosticReport": WorkspaceFullDocumentDiagnosticReport, "WorkspaceOptions": WorkspaceOptions, "WorkspaceSymbol": WorkspaceSymbol, "WorkspaceSymbolClientCapabilities": WorkspaceSymbolClientCapabilities, "WorkspaceSymbolOptions": WorkspaceSymbolOptions, "WorkspaceSymbolParams": WorkspaceSymbolParams, "WorkspaceSymbolRegistrationOptions": WorkspaceSymbolRegistrationOptions, "WorkspaceSymbolRequest": WorkspaceSymbolRequest, "WorkspaceSymbolResolveRequest": WorkspaceSymbolResolveRequest, "WorkspaceSymbolResolveResponse": WorkspaceSymbolResolveResponse, "WorkspaceSymbolResponse": WorkspaceSymbolResponse, "WorkspaceSymbolResult": WorkspaceSymbolResult, "WorkspaceUnchangedDocumentDiagnosticReport": WorkspaceUnchangedDocumentDiagnosticReport, "_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_TEXT_DOCUMENT_CONTENT: "clientToServer", WORKSPACE_TEXT_DOCUMENT_CONTENT_REFRESH: "serverToClient", 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] microsoft-lsprotocol-b6edfbf/packages/python/lsprotocol/validators.py000066400000000000000000000026141502407456000266040ustar00rootroot00000000000000# 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 microsoft-lsprotocol-b6edfbf/packages/python/pyproject.toml000066400000000000000000000027771502407456000246100ustar00rootroot00000000000000[build-system] requires = ["flit_core >=3.2,<4"] build-backend = "flit_core.buildapi" [project] name = "lsprotocol" description = 'Python types for Language Server Protocol.' version = "2025.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.8" maintainers = [ { name = "Brett Cannon", email = "brett@python.org" }, { name = "Karthik Nadig", email = "kanadig@microsoft.com" }, ] classifiers = [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "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!=23.2.1"] [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 microsoft-lsprotocol-b6edfbf/packages/python/requirements.in000066400000000000000000000004101502407456000247250ustar00rootroot00000000000000# 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 microsoft-lsprotocol-b6edfbf/packages/python/requirements.txt000066400000000000000000000021161502407456000251430ustar00rootroot00000000000000# # This file is autogenerated by pip-compile with Python 3.8 # by the following command: # # pip-compile --generate-hashes ./packages/python/requirements.in # attrs==25.3.0 \ --hash=sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3 \ --hash=sha256:75d7cefc7fb576747b2c81b4442d4d4a1ce0900973527c011d1030fd3bf4af1b # via # -r ./packages/python/requirements.in # cattrs cattrs==24.1.3 \ --hash=sha256:981a6ef05875b5bb0c7fb68885546186d306f10f0f6718fe9b96c226e68821ff \ --hash=sha256:adf957dddd26840f27ffbd060a6c4dd3b2192c5b7c2c0525ef1bd8131d8a83f5 # via -r ./packages/python/requirements.in exceptiongroup==1.3.0 \ --hash=sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10 \ --hash=sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88 # via cattrs typing-extensions==4.13.2 \ --hash=sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c \ --hash=sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef # via # cattrs # exceptiongroup microsoft-lsprotocol-b6edfbf/packages/rust/000077500000000000000000000000001502407456000213335ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/packages/rust/lsprotocol/000077500000000000000000000000001502407456000235335ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/packages/rust/lsprotocol/Cargo.toml000066400000000000000000000011551502407456000254650ustar00rootroot00000000000000[package] name = "lsprotocol" version = "1.0.0-alpha.3" edition = "2021" description = "Rust types for Language Server Protocol generated from LSP specification." authors = ["Microsoft Corporation "] license = "MIT" repository = "https://github.com/microsoft/lsprotocol" documentation = "https://microsoft.github.io/language-server-protocol" readme = "README.md" keywords = ["lsp"] [features] proposed=[] [dependencies] serde = {version ="1.0.152", features = ["derive"]} serde_json = "1.0.93" serde_repr = "0.1.10" url = {version = "2.3.1", features = ["serde"]} rust_decimal = "1.29.1" microsoft-lsprotocol-b6edfbf/packages/rust/lsprotocol/LICENSE000066400000000000000000000021651502407456000245440ustar00rootroot00000000000000 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 microsoft-lsprotocol-b6edfbf/packages/rust/lsprotocol/README.md000066400000000000000000000005651502407456000250200ustar00rootroot00000000000000# Language Server Protocol types for Rust This package contains Language Server Protocol types for Rust generated from the LSP specification. It is intended to be used by Rust language servers and clients. This includes types from latest version of the specification including proposed types. ## Usage ```toml [dependencies] lsprotocol = { features = ["proposed"]} ``` microsoft-lsprotocol-b6edfbf/packages/rust/lsprotocol/src/000077500000000000000000000000001502407456000243225ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/packages/rust/lsprotocol/src/lib.rs000066400000000000000000014634561502407456000254610ustar00rootroot00000000000000// 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; use url::Url; /// This type allows extending any string enum to support custom values. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(untagged)] pub enum CustomStringEnum { /// 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 { /// 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(T), U(U), } /// This allows a field to have three types. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(untagged)] pub enum OR3 { 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(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(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(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(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; /// 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>, } #[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 = "workspace/textDocumentContent")] WorkspaceTextDocumentContent, #[serde(rename = "workspace/textDocumentContent/refresh")] WorkspaceTextDocumentContentRefresh, #[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 = "both")] Both, #[serde(rename = "clientToServer")] ClientToServer, #[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, /// @since 3.18.0 #[serde(rename = "label")] Label, } /// 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(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, } impl Serialize for ErrorCodes { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { ErrorCodes::ParseError => serializer.serialize_i32(-32700), ErrorCodes::InvalidRequest => serializer.serialize_i32(-32600), ErrorCodes::MethodNotFound => serializer.serialize_i32(-32601), ErrorCodes::InvalidParams => serializer.serialize_i32(-32602), ErrorCodes::InternalError => serializer.serialize_i32(-32603), ErrorCodes::ServerNotInitialized => serializer.serialize_i32(-32002), ErrorCodes::UnknownErrorCode => serializer.serialize_i32(-32001), } } } impl<'de> Deserialize<'de> for ErrorCodes { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { -32700 => Ok(ErrorCodes::ParseError), -32600 => Ok(ErrorCodes::InvalidRequest), -32601 => Ok(ErrorCodes::MethodNotFound), -32602 => Ok(ErrorCodes::InvalidParams), -32603 => Ok(ErrorCodes::InternalError), -32002 => Ok(ErrorCodes::ServerNotInitialized), -32001 => Ok(ErrorCodes::UnknownErrorCode), _ => Err(serde::de::Error::custom("Unexpected value")), } } } #[derive(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 has detected /// the cancel. RequestCancelled = -32800, } impl Serialize for LSPErrorCodes { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { LSPErrorCodes::RequestFailed => serializer.serialize_i32(-32803), LSPErrorCodes::ServerCancelled => serializer.serialize_i32(-32802), LSPErrorCodes::ContentModified => serializer.serialize_i32(-32801), LSPErrorCodes::RequestCancelled => serializer.serialize_i32(-32800), } } } impl<'de> Deserialize<'de> for LSPErrorCodes { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { -32803 => Ok(LSPErrorCodes::RequestFailed), -32802 => Ok(LSPErrorCodes::ServerCancelled), -32801 => Ok(LSPErrorCodes::ContentModified), -32800 => Ok(LSPErrorCodes::RequestCancelled), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// 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(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, } impl Serialize for SymbolKind { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { SymbolKind::File => serializer.serialize_i32(1), SymbolKind::Module => serializer.serialize_i32(2), SymbolKind::Namespace => serializer.serialize_i32(3), SymbolKind::Package => serializer.serialize_i32(4), SymbolKind::Class => serializer.serialize_i32(5), SymbolKind::Method => serializer.serialize_i32(6), SymbolKind::Property => serializer.serialize_i32(7), SymbolKind::Field => serializer.serialize_i32(8), SymbolKind::Constructor => serializer.serialize_i32(9), SymbolKind::Enum => serializer.serialize_i32(10), SymbolKind::Interface => serializer.serialize_i32(11), SymbolKind::Function => serializer.serialize_i32(12), SymbolKind::Variable => serializer.serialize_i32(13), SymbolKind::Constant => serializer.serialize_i32(14), SymbolKind::String => serializer.serialize_i32(15), SymbolKind::Number => serializer.serialize_i32(16), SymbolKind::Boolean => serializer.serialize_i32(17), SymbolKind::Array => serializer.serialize_i32(18), SymbolKind::Object => serializer.serialize_i32(19), SymbolKind::Key => serializer.serialize_i32(20), SymbolKind::Null => serializer.serialize_i32(21), SymbolKind::EnumMember => serializer.serialize_i32(22), SymbolKind::Struct => serializer.serialize_i32(23), SymbolKind::Event => serializer.serialize_i32(24), SymbolKind::Operator => serializer.serialize_i32(25), SymbolKind::TypeParameter => serializer.serialize_i32(26), } } } impl<'de> Deserialize<'de> for SymbolKind { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(SymbolKind::File), 2 => Ok(SymbolKind::Module), 3 => Ok(SymbolKind::Namespace), 4 => Ok(SymbolKind::Package), 5 => Ok(SymbolKind::Class), 6 => Ok(SymbolKind::Method), 7 => Ok(SymbolKind::Property), 8 => Ok(SymbolKind::Field), 9 => Ok(SymbolKind::Constructor), 10 => Ok(SymbolKind::Enum), 11 => Ok(SymbolKind::Interface), 12 => Ok(SymbolKind::Function), 13 => Ok(SymbolKind::Variable), 14 => Ok(SymbolKind::Constant), 15 => Ok(SymbolKind::String), 16 => Ok(SymbolKind::Number), 17 => Ok(SymbolKind::Boolean), 18 => Ok(SymbolKind::Array), 19 => Ok(SymbolKind::Object), 20 => Ok(SymbolKind::Key), 21 => Ok(SymbolKind::Null), 22 => Ok(SymbolKind::EnumMember), 23 => Ok(SymbolKind::Struct), 24 => Ok(SymbolKind::Event), 25 => Ok(SymbolKind::Operator), 26 => Ok(SymbolKind::TypeParameter), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// Symbol tags are extra annotations that tweak the rendering of a symbol. /// /// @since 3.16 #[derive(PartialEq, Debug, Eq, Clone)] pub enum SymbolTag { /// Render a symbol as obsolete, usually using a strike-out. Deprecated = 1, } impl Serialize for SymbolTag { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { SymbolTag::Deprecated => serializer.serialize_i32(1), } } } impl<'de> Deserialize<'de> for SymbolTag { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(SymbolTag::Deprecated), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// 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(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, } impl Serialize for InlayHintKind { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { InlayHintKind::Type => serializer.serialize_i32(1), InlayHintKind::Parameter => serializer.serialize_i32(2), } } } impl<'de> Deserialize<'de> for InlayHintKind { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(InlayHintKind::Type), 2 => Ok(InlayHintKind::Parameter), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// The message type #[derive(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 /// @proposed #[cfg(feature = "proposed")] Debug = 5, } impl Serialize for MessageType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { MessageType::Error => serializer.serialize_i32(1), MessageType::Warning => serializer.serialize_i32(2), MessageType::Info => serializer.serialize_i32(3), MessageType::Log => serializer.serialize_i32(4), MessageType::Debug => serializer.serialize_i32(5), } } } impl<'de> Deserialize<'de> for MessageType { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(MessageType::Error), 2 => Ok(MessageType::Warning), 3 => Ok(MessageType::Info), 4 => Ok(MessageType::Log), 5 => Ok(MessageType::Debug), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// Defines how the host (editor) should sync /// document changes to the language server. #[derive(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, } impl Serialize for TextDocumentSyncKind { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { TextDocumentSyncKind::None => serializer.serialize_i32(0), TextDocumentSyncKind::Full => serializer.serialize_i32(1), TextDocumentSyncKind::Incremental => serializer.serialize_i32(2), } } } impl<'de> Deserialize<'de> for TextDocumentSyncKind { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 0 => Ok(TextDocumentSyncKind::None), 1 => Ok(TextDocumentSyncKind::Full), 2 => Ok(TextDocumentSyncKind::Incremental), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// Represents reasons why a text document is saved. #[derive(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, } impl Serialize for TextDocumentSaveReason { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { TextDocumentSaveReason::Manual => serializer.serialize_i32(1), TextDocumentSaveReason::AfterDelay => serializer.serialize_i32(2), TextDocumentSaveReason::FocusOut => serializer.serialize_i32(3), } } } impl<'de> Deserialize<'de> for TextDocumentSaveReason { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(TextDocumentSaveReason::Manual), 2 => Ok(TextDocumentSaveReason::AfterDelay), 3 => Ok(TextDocumentSaveReason::FocusOut), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// The kind of a completion entry. #[derive(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, } impl Serialize for CompletionItemKind { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { CompletionItemKind::Text => serializer.serialize_i32(1), CompletionItemKind::Method => serializer.serialize_i32(2), CompletionItemKind::Function => serializer.serialize_i32(3), CompletionItemKind::Constructor => serializer.serialize_i32(4), CompletionItemKind::Field => serializer.serialize_i32(5), CompletionItemKind::Variable => serializer.serialize_i32(6), CompletionItemKind::Class => serializer.serialize_i32(7), CompletionItemKind::Interface => serializer.serialize_i32(8), CompletionItemKind::Module => serializer.serialize_i32(9), CompletionItemKind::Property => serializer.serialize_i32(10), CompletionItemKind::Unit => serializer.serialize_i32(11), CompletionItemKind::Value => serializer.serialize_i32(12), CompletionItemKind::Enum => serializer.serialize_i32(13), CompletionItemKind::Keyword => serializer.serialize_i32(14), CompletionItemKind::Snippet => serializer.serialize_i32(15), CompletionItemKind::Color => serializer.serialize_i32(16), CompletionItemKind::File => serializer.serialize_i32(17), CompletionItemKind::Reference => serializer.serialize_i32(18), CompletionItemKind::Folder => serializer.serialize_i32(19), CompletionItemKind::EnumMember => serializer.serialize_i32(20), CompletionItemKind::Constant => serializer.serialize_i32(21), CompletionItemKind::Struct => serializer.serialize_i32(22), CompletionItemKind::Event => serializer.serialize_i32(23), CompletionItemKind::Operator => serializer.serialize_i32(24), CompletionItemKind::TypeParameter => serializer.serialize_i32(25), } } } impl<'de> Deserialize<'de> for CompletionItemKind { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(CompletionItemKind::Text), 2 => Ok(CompletionItemKind::Method), 3 => Ok(CompletionItemKind::Function), 4 => Ok(CompletionItemKind::Constructor), 5 => Ok(CompletionItemKind::Field), 6 => Ok(CompletionItemKind::Variable), 7 => Ok(CompletionItemKind::Class), 8 => Ok(CompletionItemKind::Interface), 9 => Ok(CompletionItemKind::Module), 10 => Ok(CompletionItemKind::Property), 11 => Ok(CompletionItemKind::Unit), 12 => Ok(CompletionItemKind::Value), 13 => Ok(CompletionItemKind::Enum), 14 => Ok(CompletionItemKind::Keyword), 15 => Ok(CompletionItemKind::Snippet), 16 => Ok(CompletionItemKind::Color), 17 => Ok(CompletionItemKind::File), 18 => Ok(CompletionItemKind::Reference), 19 => Ok(CompletionItemKind::Folder), 20 => Ok(CompletionItemKind::EnumMember), 21 => Ok(CompletionItemKind::Constant), 22 => Ok(CompletionItemKind::Struct), 23 => Ok(CompletionItemKind::Event), 24 => Ok(CompletionItemKind::Operator), 25 => Ok(CompletionItemKind::TypeParameter), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// Completion item tags are extra annotations that tweak the rendering of a completion /// item. /// /// @since 3.15.0 #[derive(PartialEq, Debug, Eq, Clone)] pub enum CompletionItemTag { /// Render a completion as obsolete, usually using a strike-out. Deprecated = 1, } impl Serialize for CompletionItemTag { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { CompletionItemTag::Deprecated => serializer.serialize_i32(1), } } } impl<'de> Deserialize<'de> for CompletionItemTag { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(CompletionItemTag::Deprecated), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// Defines whether the insert text in a completion item should be interpreted as /// plain text or a snippet. #[derive(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, } impl Serialize for InsertTextFormat { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { InsertTextFormat::PlainText => serializer.serialize_i32(1), InsertTextFormat::Snippet => serializer.serialize_i32(2), } } } impl<'de> Deserialize<'de> for InsertTextFormat { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(InsertTextFormat::PlainText), 2 => Ok(InsertTextFormat::Snippet), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// How whitespace and indentation is handled during completion /// item insertion. /// /// @since 3.16.0 #[derive(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><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, } impl Serialize for InsertTextMode { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { InsertTextMode::AsIs => serializer.serialize_i32(1), InsertTextMode::AdjustIndentation => serializer.serialize_i32(2), } } } impl<'de> Deserialize<'de> for InsertTextMode { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(InsertTextMode::AsIs), 2 => Ok(InsertTextMode::AdjustIndentation), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// A document highlight kind. #[derive(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, } impl Serialize for DocumentHighlightKind { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { DocumentHighlightKind::Text => serializer.serialize_i32(1), DocumentHighlightKind::Read => serializer.serialize_i32(2), DocumentHighlightKind::Write => serializer.serialize_i32(3), } } } impl<'de> Deserialize<'de> for DocumentHighlightKind { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(DocumentHighlightKind::Text), 2 => Ok(DocumentHighlightKind::Read), 3 => Ok(DocumentHighlightKind::Write), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// 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 move actions: `refactor.move` /// /// Example move actions: /// /// - Move a function to a new file /// - Move a property between classes /// - Move method to base class /// - ... /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[serde(rename = "refactor.move")] RefactorMove, /// 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, /// Base kind for all code actions applying to the entire notebook's scope. CodeActionKinds using /// this should always begin with `notebook.` /// /// @since 3.18.0 #[serde(rename = "notebook")] Notebook, } /// Code action tags are extra annotations that tweak the behavior of a code action. /// /// @since 3.18.0 - proposed #[derive(PartialEq, Debug, Eq, Clone)] pub enum CodeActionTag { /// Marks the code action as LLM-generated. Llmgenerated = 1, } impl Serialize for CodeActionTag { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { CodeActionTag::Llmgenerated => serializer.serialize_i32(1), } } } impl<'de> Deserialize<'de> for CodeActionTag { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(CodeActionTag::Llmgenerated), _ => Err(serde::de::Error::custom("Unexpected value")), } } } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] pub enum TraceValue { /// 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, } /// Predefined Language kinds /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] pub enum LanguageKind { #[serde(rename = "abap")] Abap, #[serde(rename = "bat")] WindowsBat, #[serde(rename = "bibtex")] BibTeX, #[serde(rename = "clojure")] Clojure, #[serde(rename = "coffeescript")] Coffeescript, #[serde(rename = "c")] C, #[serde(rename = "cpp")] Cpp, #[serde(rename = "csharp")] Csharp, #[serde(rename = "css")] Css, /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[serde(rename = "d")] D, /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[serde(rename = "pascal")] Delphi, #[serde(rename = "diff")] Diff, #[serde(rename = "dart")] Dart, #[serde(rename = "dockerfile")] Dockerfile, #[serde(rename = "elixir")] Elixir, #[serde(rename = "erlang")] Erlang, #[serde(rename = "fsharp")] Fsharp, #[serde(rename = "git-commit")] GitCommit, #[serde(rename = "rebase")] GitRebase, #[serde(rename = "go")] Go, #[serde(rename = "groovy")] Groovy, #[serde(rename = "handlebars")] Handlebars, #[serde(rename = "haskell")] Haskell, #[serde(rename = "html")] Html, #[serde(rename = "ini")] Ini, #[serde(rename = "java")] Java, #[serde(rename = "javascript")] JavaScript, #[serde(rename = "javascriptreact")] JavaScriptReact, #[serde(rename = "json")] Json, #[serde(rename = "latex")] LaTeX, #[serde(rename = "less")] Less, #[serde(rename = "lua")] Lua, #[serde(rename = "makefile")] Makefile, #[serde(rename = "markdown")] Markdown, #[serde(rename = "objective-c")] ObjectiveC, #[serde(rename = "objective-cpp")] ObjectiveCpp, /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[serde(rename = "pascal")] Pascal, #[serde(rename = "perl")] Perl, #[serde(rename = "perl6")] Perl6, #[serde(rename = "php")] Php, #[serde(rename = "powershell")] Powershell, #[serde(rename = "jade")] Pug, #[serde(rename = "python")] Python, #[serde(rename = "r")] R, #[serde(rename = "razor")] Razor, #[serde(rename = "ruby")] Ruby, #[serde(rename = "rust")] Rust, #[serde(rename = "scss")] Scss, #[serde(rename = "sass")] Sass, #[serde(rename = "scala")] Scala, #[serde(rename = "shaderlab")] ShaderLab, #[serde(rename = "shellscript")] ShellScript, #[serde(rename = "sql")] Sql, #[serde(rename = "swift")] Swift, #[serde(rename = "typescript")] TypeScript, #[serde(rename = "typescriptreact")] TypeScriptReact, #[serde(rename = "tex")] TeX, #[serde(rename = "vb")] VisualBasic, #[serde(rename = "xml")] Xml, #[serde(rename = "xsl")] Xsl, #[serde(rename = "yaml")] Yaml, } /// Describes how an [inline completion provider][InlineCompletionItemProvider] was triggered. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(PartialEq, Debug, Eq, Clone)] pub enum InlineCompletionTriggerKind { /// Completion was triggered explicitly by a user gesture. Invoked = 1, /// Completion was triggered automatically while editing. Automatic = 2, } impl Serialize for InlineCompletionTriggerKind { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { InlineCompletionTriggerKind::Invoked => serializer.serialize_i32(1), InlineCompletionTriggerKind::Automatic => serializer.serialize_i32(2), } } } impl<'de> Deserialize<'de> for InlineCompletionTriggerKind { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(InlineCompletionTriggerKind::Invoked), 2 => Ok(InlineCompletionTriggerKind::Automatic), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// 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(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, } impl Serialize for FileChangeType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { FileChangeType::Created => serializer.serialize_i32(1), FileChangeType::Changed => serializer.serialize_i32(2), FileChangeType::Deleted => serializer.serialize_i32(3), } } } impl<'de> Deserialize<'de> for FileChangeType { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(FileChangeType::Created), 2 => Ok(FileChangeType::Changed), 3 => Ok(FileChangeType::Deleted), _ => Err(serde::de::Error::custom("Unexpected value")), } } } #[derive(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, } impl Serialize for WatchKind { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { WatchKind::Create => serializer.serialize_i32(1), WatchKind::Change => serializer.serialize_i32(2), WatchKind::Delete => serializer.serialize_i32(4), } } } impl<'de> Deserialize<'de> for WatchKind { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(WatchKind::Create), 2 => Ok(WatchKind::Change), 4 => Ok(WatchKind::Delete), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// The diagnostic's severity. #[derive(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, } impl Serialize for DiagnosticSeverity { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { DiagnosticSeverity::Error => serializer.serialize_i32(1), DiagnosticSeverity::Warning => serializer.serialize_i32(2), DiagnosticSeverity::Information => serializer.serialize_i32(3), DiagnosticSeverity::Hint => serializer.serialize_i32(4), } } } impl<'de> Deserialize<'de> for DiagnosticSeverity { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(DiagnosticSeverity::Error), 2 => Ok(DiagnosticSeverity::Warning), 3 => Ok(DiagnosticSeverity::Information), 4 => Ok(DiagnosticSeverity::Hint), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// The diagnostic tags. /// /// @since 3.15.0 #[derive(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, } impl Serialize for DiagnosticTag { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { DiagnosticTag::Unnecessary => serializer.serialize_i32(1), DiagnosticTag::Deprecated => serializer.serialize_i32(2), } } } impl<'de> Deserialize<'de> for DiagnosticTag { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(DiagnosticTag::Unnecessary), 2 => Ok(DiagnosticTag::Deprecated), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// How a completion was triggered #[derive(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, } impl Serialize for CompletionTriggerKind { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { CompletionTriggerKind::Invoked => serializer.serialize_i32(1), CompletionTriggerKind::TriggerCharacter => serializer.serialize_i32(2), CompletionTriggerKind::TriggerForIncompleteCompletions => serializer.serialize_i32(3), } } } impl<'de> Deserialize<'de> for CompletionTriggerKind { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(CompletionTriggerKind::Invoked), 2 => Ok(CompletionTriggerKind::TriggerCharacter), 3 => Ok(CompletionTriggerKind::TriggerForIncompleteCompletions), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// Defines how values from a set of defaults and an individual item will be /// merged. /// /// @since 3.18.0 #[derive(PartialEq, Debug, Eq, Clone)] pub enum ApplyKind { /// The value from the individual item (if provided and not `null`) will be /// used instead of the default. Replace = 1, /// The value from the item will be merged with the default. /// /// The specific rules for mergeing values are defined against each field /// that supports merging. Merge = 2, } impl Serialize for ApplyKind { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { ApplyKind::Replace => serializer.serialize_i32(1), ApplyKind::Merge => serializer.serialize_i32(2), } } } impl<'de> Deserialize<'de> for ApplyKind { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(ApplyKind::Replace), 2 => Ok(ApplyKind::Merge), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// How a signature help was triggered. /// /// @since 3.15.0 #[derive(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, } impl Serialize for SignatureHelpTriggerKind { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { SignatureHelpTriggerKind::Invoked => serializer.serialize_i32(1), SignatureHelpTriggerKind::TriggerCharacter => serializer.serialize_i32(2), SignatureHelpTriggerKind::ContentChange => serializer.serialize_i32(3), } } } impl<'de> Deserialize<'de> for SignatureHelpTriggerKind { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(SignatureHelpTriggerKind::Invoked), 2 => Ok(SignatureHelpTriggerKind::TriggerCharacter), 3 => Ok(SignatureHelpTriggerKind::ContentChange), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// The reason why code actions were requested. /// /// @since 3.17.0 #[derive(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, } impl Serialize for CodeActionTriggerKind { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { CodeActionTriggerKind::Invoked => serializer.serialize_i32(1), CodeActionTriggerKind::Automatic => serializer.serialize_i32(2), } } } impl<'de> Deserialize<'de> for CodeActionTriggerKind { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(CodeActionTriggerKind::Invoked), 2 => Ok(CodeActionTriggerKind::Automatic), _ => Err(serde::de::Error::custom("Unexpected value")), } } } /// 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(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, } impl Serialize for NotebookCellKind { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { NotebookCellKind::Markup => serializer.serialize_i32(1), NotebookCellKind::Code => serializer.serialize_i32(2), } } } impl<'de> Deserialize<'de> for NotebookCellKind { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(NotebookCellKind::Markup), 2 => Ok(NotebookCellKind::Code), _ => Err(serde::de::Error::custom("Unexpected value")), } } } #[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(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, } impl Serialize for PrepareSupportDefaultBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { PrepareSupportDefaultBehavior::Identifier => serializer.serialize_i32(1), } } } impl<'de> Deserialize<'de> for PrepareSupportDefaultBehavior { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let value = i32::deserialize(deserializer)?; match value { 1 => Ok(PrepareSupportDefaultBehavior::Identifier), _ => Err(serde::de::Error::custom("Unexpected value")), } } } #[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), } /// 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), } /// 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(untagged)] pub enum PrepareRenameResult { Range(Range), PrepareRenamePlaceholder(PrepareRenamePlaceholder), DefaultBehavior(PrepareRenameDefaultBehavior), } /// 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; #[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), } /// 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 { Partial(TextDocumentContentChangePartial), Whole(TextDocumentContentChangeWholeDocument), } /// 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), MarkedStringWithLanguage(MarkedStringWithLanguage), } /// A document filter describes a top level text document or /// a notebook cell document. /// /// @since 3.17.0 - 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), } /// 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(TextDocumentFilterLanguage), Scheme(TextDocumentFilterScheme), Pattern(TextDocumentFilterPattern), } /// 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(NotebookDocumentFilterNotebookType), Scheme(NotebookDocumentFilterScheme), Pattern(NotebookDocumentFilterPattern), } /// 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; pub type RegularExpressionEngineKind = String; #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// 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", deny_unknown_fields)] pub struct Location { pub range: Range, pub uri: Url, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, pub work_done_progress: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, pub work_done_progress: Option, } /// A workspace folder inside a client. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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: Url, } /// The parameters of a `workspace/didChangeWorkspaceFolders` notification. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct ConfigurationParams { pub items: Vec, } /// Parameters for a [DocumentColorRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// Represents a color range from a document. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, pub work_done_progress: Option, } /// Parameters for a [ColorPresentationRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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>, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkDoneProgressOptions { pub work_done_progress: Option, } /// General text document registration options. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Parameters for a [FoldingRangeRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// 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", deny_unknown_fields)] 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, /// 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, /// 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>, /// 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, /// 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", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, pub work_done_progress: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, pub work_done_progress: Option, } /// A parameter literal used in selection range requests. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The positions inside the text document. pub positions: Vec, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, pub work_done_progress: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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, } /// 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", deny_unknown_fields)] 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, /// More detail for this item, e.g. the signature of a function. pub detail: Option, /// 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>, /// The resource identifier of this item. pub uri: Url, } /// Call hierarchy options used during static or dynamic registration. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, pub work_done_progress: Option, } /// The parameter of a `callHierarchy/incomingCalls` request. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// An optional token that a server can use to report work done progress. pub work_done_token: Option, } /// 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", deny_unknown_fields)] 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, } /// The parameter of a `callHierarchy/outgoingCalls` request. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// An optional token that a server can use to report work done progress. pub work_done_token: Option, } /// 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", deny_unknown_fields)] 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, /// The item that is called. pub to: CallHierarchyItem, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokens { /// The actual tokens. pub data: Vec, /// 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, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensPartialResult { pub data: Vec, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// Server supports providing semantic tokens for a full document. pub full: Option>, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, /// The legend used by the server pub legend: SemanticTokensLegend, /// Server supports providing semantic tokens for a specific range /// of a document. pub range: Option>, pub work_done_progress: Option, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensDelta { /// The semantic token edits to transform a previous result into a new result. pub edits: Vec, pub result_id: Option, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensDeltaPartialResult { pub edits: Vec, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// Params to show a resource in the UI. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, /// 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, /// The uri to show. pub uri: Url, } /// The result of a showDocument request. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] 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, } /// The result of a linked editing range request. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, pub work_done_progress: Option, } /// 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", deny_unknown_fields)] pub struct CreateFilesParams { /// An array of all files/folders created in this operation. pub files: Vec, } /// 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", deny_unknown_fields)] 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>, /// Holds changes to existing resources. pub changes: Option>>, /// 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>>, } /// The options to register for file operations. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct FileOperationRegistrationOptions { /// The actual filters. pub filters: Vec, } /// 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", deny_unknown_fields)] 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, } /// 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", deny_unknown_fields)] pub struct DeleteFilesParams { /// An array of all files/folders deleted in this operation. pub files: Vec, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// Moniker definition to match LSIF 0.5 moniker definition. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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", deny_unknown_fields)] 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, pub work_done_progress: Option, } /// The parameter of a `textDocument/prepareTypeHierarchy` request. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// More detail for this item, e.g. the signature of a function. pub detail: Option, /// 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>, /// The resource identifier of this item. pub uri: Url, } /// Type hierarchy options used during static or dynamic registration. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, pub work_done_progress: Option, } /// The parameter of a `typeHierarchy/supertypes` request. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// An optional token that a server can use to report work done progress. pub work_done_token: Option, } /// The parameter of a `typeHierarchy/subtypes` request. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// An optional token that a server can use to report work done progress. pub work_done_token: Option, } /// A parameter literal used in inline value requests. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Inline value options used during static or dynamic registration. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, pub work_done_progress: Option, } /// A parameter literal used in inlay hint requests. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Inlay hint information. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The kind of this hint. Can be omitted in which case the client /// should fall back to a reasonable default. pub kind: Option, /// 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>, /// 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, /// 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, /// The position of this hint. /// /// If multiple hints have the same position, they will be shown in the order /// they appear in the response. 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>, /// The tooltip text when you hover over this item. pub tooltip: Option>, } /// Inlay hint options used during static or dynamic registration. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, /// The server provides support to resolve additional /// information for an inlay hint item. pub resolve_provider: Option, pub work_done_progress: Option, } /// Parameters of the document diagnostic request. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentDiagnosticParams { /// The additional identifier provided during registration. pub identifier: Option, /// An optional token that a server can use to report partial results (e.g. streaming) to /// the client. pub partial_result_token: Option, /// The result id of a previous response if provided. pub previous_result_id: Option, /// 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, } /// A partial result for a document diagnostic report. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentDiagnosticReportPartialResult { pub related_documents: HashMap>, } /// Cancellation data returned from a diagnostic request. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, /// An optional identifier under which the diagnostics are /// managed by the client. pub identifier: Option, /// 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, /// 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", deny_unknown_fields)] pub struct WorkspaceDiagnosticParams { /// The additional identifier provided during registration. pub identifier: Option, /// An optional token that a server can use to report partial results (e.g. streaming) to /// the client. pub partial_result_token: Option, /// The currently known diagnostic reports with their /// previous result ids. pub previous_result_ids: Vec, /// An optional token that a server can use to report work done progress. pub work_done_token: Option, } /// A workspace diagnostic report. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkspaceDiagnosticReport { pub items: Vec, } /// A partial result for a workspace diagnostic report. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkspaceDiagnosticReportPartialResult { pub items: Vec, } /// The params sent in an open notebook document notification. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DidOpenNotebookDocumentParams { /// The text documents that represent the content /// of a notebook cell. pub cell_text_documents: Vec, /// The notebook document that got opened. pub notebook_document: NotebookDocument, } /// Registration options specific to a notebook. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The notebooks to be synced pub notebook_selector: Vec>, /// Whether save notification should be forwarded to /// the server. Will only be honored if mode === `notebook`. pub save: Option, } /// The params sent in a change notebook document notification. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct DidCloseNotebookDocumentParams { /// The text documents that represent the content /// of a notebook cell that got closed. pub cell_text_documents: Vec, /// 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")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Represents a collection of [inline completion items][InlineCompletionItem] to be presented in the editor. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlineCompletionList { /// The inline completion items pub items: Vec, } /// 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")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlineCompletionItem { /// An optional [Command] that is executed *after* inserting this completion. pub command: Option, /// 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, /// The text to replace the range with. Must be set. pub insert_text: OR2, /// The range to replace. Must begin and end on the same line. pub range: Option, } /// Inline completion options used during static or dynamic registration. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, pub work_done_progress: Option, } /// Parameters for the `workspace/textDocumentContent` request. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentParams { /// The uri of the text document. pub uri: Url, } /// Result of the `workspace/textDocumentContent` request. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentResult { /// The text content of the text document. Please note, that the content of /// any subsequent open notifications for the text document might differ /// from the returned content due to whitespace and line ending /// normalizations done on the client pub text: String, } /// Text document content provider registration options. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentRegistrationOptions { /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. pub id: Option, /// The schemes for which the server provides content. pub schemes: Vec, } /// Parameters for the `workspace/textDocumentContent/refresh` request. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentRefreshParams { /// The uri of the text document to refresh. pub uri: Url, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct RegistrationParams { pub registrations: Vec, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct UnregistrationParams { pub unregisterations: Vec, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// User provided initialization options. pub initialization_options: Option, /// 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, /// 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, /// The rootPath of the workspace. Is null /// if no folder is open. /// /// @deprecated in favour of rootUri. #[deprecated] pub root_path: Option, /// 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, /// The initial trace setting. If omitted trace is disabled ('off'). pub trace: Option, /// An optional token that a server can use to report work done progress. pub work_done_token: Option, /// 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>, } /// The result returned from an initialize request. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InitializeResult { /// The capabilities the language server provides. pub capabilities: ServerCapabilities, /// Information about the server. /// /// @since 3.15.0 pub server_info: Option, } /// The data type of the ResponseError if the /// initialize request fails. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct InitializedParams {} /// The parameters of a change configuration notification. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DidChangeConfigurationParams { /// The actual changed settings pub settings: LSPAny, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DidChangeConfigurationRegistrationOptions { pub section: Option>>, } /// The parameters of a notification message. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct ShowMessageRequestParams { /// The message action items to present. pub actions: Option>, /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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, /// 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", deny_unknown_fields)] 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, /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct DidSaveTextDocumentParams { /// Optional the content when saved. Depends on the includeText value /// when the save notification was requested. pub text: Option, /// The document that was saved. pub text_document: TextDocumentIdentifier, } /// Save registration options. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The client is supposed to include the content on save. pub include_text: Option, } /// The parameters sent in a will save text document notification. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct DidChangeWatchedFilesParams { /// The actual file events. pub changes: Vec, } /// Describe options to be used when registered for text document change events. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DidChangeWatchedFilesRegistrationOptions { /// The watchers to register. pub watchers: Vec, } /// The publish diagnostic notification's parameters. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct PublishDiagnosticsParams { /// An array of diagnostic information items. pub diagnostics: Vec, /// The URI for which diagnostic information is reported. pub uri: Url, /// Optional the version number of the document the diagnostics are published for. /// /// @since 3.15.0 pub version: Option, } /// Completion parameters #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// An optional token that a server can use to report partial results (e.g. streaming) to /// the client. pub partial_result_token: Option, /// 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, } /// 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", deny_unknown_fields)] 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>, /// 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, /// 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>, /// A data entry field that is preserved on a completion item between a /// [CompletionRequest] and a [CompletionResolveRequest]. pub data: Option, /// Indicates if this item is deprecated. /// @deprecated Use `tags` instead. #[deprecated] pub deprecated: Option, /// A human-readable string with additional information /// about this item, like type or symbol information. pub detail: Option, /// A human-readable string that represents a doc-comment. pub documentation: Option>, /// 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, /// 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` 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, /// 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, /// 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, /// The kind of this completion item. Based of the kind /// an icon is chosen by the editor. pub kind: Option, /// 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, /// 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, /// 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, /// Tags for this completion item. /// /// @since 3.15.0 pub tags: Option>, /// 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>, /// 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, } /// Represents a collection of [completion items][CompletionItem] to be presented /// in the editor. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CompletionList { /// Specifies how fields from a completion item should be combined with those /// from `completionList.itemDefaults`. /// /// If unspecified, all fields will be treated as ApplyKind.Replace. /// /// If a field's value is ApplyKind.Replace, the value from a completion item /// (if provided and not `null`) will always be used instead of the value /// from `completionItem.itemDefaults`. /// /// If a field's value is ApplyKind.Merge, the values will be merged using /// the rules defined against each field below. /// /// Servers are only allowed to return `applyKind` if the client /// signals support for this via the `completionList.applyKindSupport` /// capability. /// /// @since 3.18.0 pub apply_kind: Option, /// 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 rules for combining these are /// defined by `applyKinds` (if the client supports it), defaulting to /// ApplyKind.Replace. /// /// 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, /// The completion items. pub items: Vec, } /// Registration options for a [CompletionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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>, /// The server supports the following `CompletionItem` specific /// capabilities. /// /// @since 3.17.0 pub completion_item: Option, /// 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, /// The server provides support to resolve additional /// information for a completion item. pub resolve_provider: Option, /// 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>, pub work_done_progress: Option, } /// Parameters for a [HoverRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// The result of a hover request. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct Hover { /// The hover's content pub contents: OR3>, /// An optional range inside the text document that is used to /// visualize the hover, e.g. by changing the background color. pub range: Option, } /// Registration options for a [HoverRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, pub work_done_progress: Option, } /// Parameters for a [SignatureHelpRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// 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", deny_unknown_fields)] pub struct SignatureHelp { /// The active parameter of the active signature. /// /// If `null`, no parameter of the signature is active (for example a named /// argument that does not match any declared parameters). This is only valid /// if the client specifies the client capability /// `textDocument.signatureHelp.noActiveParameterSupport === true` /// /// 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 (but still nullable) to better express the active parameter if /// the active signature does have any. pub active_parameter: Option, /// 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, /// One or more signatures. pub signatures: Vec, } /// Registration options for a [SignatureHelpRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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>, /// List of characters that trigger signature help automatically. pub trigger_characters: Option>, pub work_done_progress: Option, } /// Parameters for a [DefinitionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// Registration options for a [DefinitionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, pub work_done_progress: Option, } /// Parameters for a [ReferencesRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// Registration options for a [ReferencesRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, pub work_done_progress: Option, } /// Parameters for a [DocumentHighlightRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// 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", deny_unknown_fields)] pub struct DocumentHighlight { /// The highlight kind, default is [text][`DocumentHighlightKind::Text`]. pub kind: Option, /// 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", deny_unknown_fields)] 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, pub work_done_progress: Option, } /// Parameters for a [DocumentSymbolRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// Represents information about programming constructs like variables, classes, /// interfaces etc. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// Indicates if this symbol is deprecated. /// /// @deprecated Use tags instead #[deprecated] pub deprecated: Option, /// 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>, } /// 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", deny_unknown_fields)] pub struct DocumentSymbol { /// Children of this symbol, e.g. properties of a class. pub children: Option>, /// Indicates if this symbol is deprecated. /// /// @deprecated Use tags instead #[deprecated] pub deprecated: Option, /// More detail for this symbol, e.g the signature of a function. pub detail: Option, /// 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>, } /// Registration options for a [DocumentSymbolRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// A human-readable string that is shown when multiple outlines trees /// are shown for the same document. /// /// @since 3.16.0 pub label: Option, pub work_done_progress: Option, } /// The parameters of a [CodeActionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// 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", deny_unknown_fields)] pub struct Command { /// Arguments that the command handler should be /// invoked with. pub arguments: Option>, /// The identifier of the actual command handler. pub command: String, /// Title of the command, like `save`. pub title: String, /// An optional tooltip. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub tooltip: Option, } /// 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", deny_unknown_fields)] 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, /// 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, /// The diagnostics that this code action resolves. pub diagnostics: Option>, /// 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, /// The workspace edit this code action performs. pub edit: Option, /// 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, /// The kind of the code action. /// /// Used to filter code actions. pub kind: Option>, /// Tags for this code action. /// /// @since 3.18.0 - proposed pub tags: Option>, /// 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", deny_unknown_fields)] 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>>, /// 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, /// Static documentation for a class of code actions. /// /// Documentation from the provider should be shown in the code actions menu if either: /// /// - Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that /// most closely matches the requested code action kind. For example, if a provider has documentation for /// both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`, /// the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`. /// /// - Any code actions of `kind` are returned by the provider. /// /// At most one documentation entry should be shown per provider. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub documentation: Option>, /// The server provides support to resolve additional /// information for a code action. /// /// @since 3.16.0 pub resolve_provider: Option, pub work_done_progress: Option, } /// The parameters of a [WorkspaceSymbolRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// A query string to filter symbols by. Clients may send an empty /// string here to request all symbols. /// /// The `query`-parameter should be interpreted in a *relaxed way* as editors /// will apply their own highlighting and scoring on the results. A good rule /// of thumb is to match case-insensitive and to simply check that the /// characters of *query* appear in their order in a candidate symbol. /// Servers shouldn't use prefix, substring, or similar strict matching. pub query: String, /// An optional token that a server can use to report work done progress. pub work_done_token: Option, } /// 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", deny_unknown_fields)] 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, /// 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, /// 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, /// The name of this symbol. pub name: String, /// Tags for this symbol. /// /// @since 3.16.0 pub tags: Option>, } /// Registration options for a [WorkspaceSymbolRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkspaceSymbolRegistrationOptions { /// The server provides support to resolve additional /// information for a workspace symbol. /// /// @since 3.17.0 pub resolve_provider: Option, pub work_done_progress: Option, } /// The parameters of a [CodeLensRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// 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", deny_unknown_fields)] pub struct CodeLens { /// The command this code lens represents. pub command: Option, /// A data entry field that is preserved on a code lens item between /// a [CodeLensRequest] and a [CodeLensResolveRequest] pub data: Option, /// 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", deny_unknown_fields)] 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, /// Code lens has a resolve provider as well. pub resolve_provider: Option, pub work_done_progress: Option, } /// The parameters of a [DocumentLinkRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, } /// 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", deny_unknown_fields)] pub struct DocumentLink { /// A data entry field that is preserved on a document link between a /// DocumentLinkRequest and a DocumentLinkResolveRequest. pub data: Option, /// 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, /// 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, } /// Registration options for a [DocumentLinkRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// Document links have a resolve provider as well. pub resolve_provider: Option, pub work_done_progress: Option, } /// The parameters of a [DocumentFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Registration options for a [DocumentFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, pub work_done_progress: Option, } /// The parameters of a [DocumentRangeFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Registration options for a [DocumentRangeFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// Whether the server supports formatting multiple ranges at once. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub ranges_support: Option, pub work_done_progress: Option, } /// The parameters of a [DocumentRangesFormattingRequest]. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentRangesFormattingParams { /// The format options pub options: FormattingOptions, /// The ranges to format pub ranges: Vec, /// 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, } /// The parameters of a [DocumentOnTypeFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] 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, /// A character on which formatting should be triggered, like `{`. pub first_trigger_character: String, /// More trigger characters. pub more_trigger_character: Option>, } /// The parameters of a [RenameRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Registration options for a [RenameRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// Renames should be checked and tested before being executed. /// /// @since version 3.12.0 pub prepare_provider: Option, pub work_done_progress: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// The parameters of a [ExecuteCommandRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ExecuteCommandParams { /// Arguments that the command should be invoked with. pub arguments: Option>, /// 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, } /// Registration options for a [ExecuteCommandRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ExecuteCommandRegistrationOptions { /// The commands to be executed on the server pub commands: Vec, pub work_done_progress: Option, } /// The parameters passed via an apply workspace edit request. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// Additional data about the edit. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub metadata: Option, } /// 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", deny_unknown_fields)] 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, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, 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, /// 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, /// 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", deny_unknown_fields)] 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, 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, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkDoneProgressEnd { pub kind: String, /// Optional, a final message indicating to for example indicate the outcome /// of the operation. pub message: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SetTraceParams { pub value: TraceValue, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct LogTraceParams { pub message: String, pub verbose: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CancelParams { /// The request id to cancel. pub id: OR2, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct WorkDoneProgressParams { /// An optional token that a server can use to report work done progress. pub work_done_token: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// 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", deny_unknown_fields)] 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, /// 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: Url, } /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct ImplementationOptions { pub work_done_progress: Option, } /// Static registration options to be returned in the initialize /// request. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TypeDefinitionOptions { pub work_done_progress: Option, } /// The workspace folder change event. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkspaceFoldersChangeEvent { /// The array of added workspace folders pub added: Vec, /// The array of the removed workspace folders pub removed: Vec, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ConfigurationItem { /// The scope to get the configuration section for. pub scope_uri: Option, /// The configuration section asked for. pub section: Option, } /// A literal to identify a text document in the client. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentIdentifier { /// The text document's uri. pub uri: Url, } /// Represents a color in RGBA space. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct DocumentColorOptions { pub work_done_progress: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct FoldingRangeOptions { pub work_done_progress: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DeclarationOptions { pub work_done_progress: Option, } /// 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", deny_unknown_fields)] pub struct Position { /// Character offset on a line in a document (zero-based). /// /// The meaning of this offset is determined by the negotiated /// `PositionEncodingKind`. pub character: u32, /// Line position in a document (zero-based). pub line: u32, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SelectionRangeOptions { pub work_done_progress: Option, } /// Call hierarchy options used during static registration. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CallHierarchyOptions { pub work_done_progress: Option, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensOptions { /// Server supports providing semantic tokens for a full document. pub full: Option>, /// The legend used by the server pub legend: SemanticTokensLegend, /// Server supports providing semantic tokens for a specific range /// of a document. pub range: Option>, pub work_done_progress: Option, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensEdit { /// The elements to insert. pub data: Option>, /// 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", deny_unknown_fields)] pub struct LinkedEditingRangeOptions { pub work_done_progress: Option, } /// Represents information on a file/folder create. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct TextDocumentEdit { /// The edits to be applied. /// /// @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a /// client capability. /// /// @since 3.18.0 - support for SnippetTextEdit. This is guarded using a /// client capability. pub edits: Vec>, /// The text document to change. pub text_document: OptionalVersionedTextDocumentIdentifier, } /// Create file operation. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CreateFile { /// An optional annotation identifier describing the operation. /// /// @since 3.16.0 pub annotation_id: Option, /// A create pub kind: String, /// Additional options pub options: Option, /// The resource to create. pub uri: Url, } /// Rename file operation #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct RenameFile { /// An optional annotation identifier describing the operation. /// /// @since 3.16.0 pub annotation_id: Option, /// A rename pub kind: String, /// The new location. pub new_uri: Url, /// The old (existing) location. pub old_uri: Url, /// Rename options. pub options: Option, } /// Delete file operation #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DeleteFile { /// An optional annotation identifier describing the operation. /// /// @since 3.16.0 pub annotation_id: Option, /// A delete pub kind: String, /// Delete options. pub options: Option, /// The file to delete. pub uri: Url, } /// Additional information that describes document changes. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ChangeAnnotation { /// A human-readable string which is rendered less prominent in /// the user interface. pub description: Option, /// 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, } /// 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", deny_unknown_fields)] pub struct FileOperationFilter { /// The actual file operation pattern. pub pattern: FileOperationPattern, /// A Uri scheme like `file` or `untitled`. pub scheme: Option, } /// Represents information on a file/folder rename. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct MonikerOptions { pub work_done_progress: Option, } /// Type hierarchy options used during static registration. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TypeHierarchyOptions { pub work_done_progress: Option, } /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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, } /// 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", deny_unknown_fields)] pub struct InlineValueEvaluatableExpression { /// If specified the expression overrides the extracted expression. pub expression: Option, /// 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", deny_unknown_fields)] pub struct InlineValueOptions { pub work_done_progress: Option, } /// 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", deny_unknown_fields)] 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, /// 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, /// 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>, /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct InlayHintOptions { /// The server provides support to resolve additional /// information for an inlay hint item. pub resolve_provider: Option, pub work_done_progress: Option, } /// 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", deny_unknown_fields)] pub struct RelatedFullDocumentDiagnosticReport { /// The actual items. pub items: Vec, /// 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>>, /// An optional result id. If provided it will /// be sent on the next diagnostic request for the /// same document. pub result_id: Option, } /// 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", deny_unknown_fields)] 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>>, /// 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", deny_unknown_fields)] pub struct FullDocumentDiagnosticReport { /// The actual items. pub items: Vec, /// 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, } /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct DiagnosticOptions { /// An optional identifier under which the diagnostics are /// managed by the client. pub identifier: Option, /// 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, /// 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", deny_unknown_fields)] pub struct PreviousResultId { /// The URI for which the client knowns a /// result id. pub uri: Url, /// 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", deny_unknown_fields)] pub struct NotebookDocument { /// The cells of a notebook. pub cells: Vec, /// Additional metadata stored with the notebook /// document. /// /// Note: should always be an object literal (e.g. LSPObject) pub metadata: Option, /// The type of the notebook. pub notebook_type: String, /// The notebook document's uri. pub uri: Url, /// 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", deny_unknown_fields)] pub struct TextDocumentItem { /// The text document's language identifier. pub language_id: CustomStringEnum, /// The content of the opened text document. pub text: String, /// The text document's uri. pub uri: Url, /// The version number of this document (it will increase after each /// change, including undo/redo). pub version: i32, } /// 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", deny_unknown_fields)] pub struct NotebookDocumentSyncOptions { /// The notebooks to be synced pub notebook_selector: Vec>, /// Whether save notification should be forwarded to /// the server. Will only be honored if mode === `notebook`. pub save: Option, } /// A versioned notebook document identifier. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct VersionedNotebookDocumentIdentifier { /// The notebook document's uri. pub uri: Url, /// The version number of this notebook document. pub version: i32, } /// A change event for a notebook document. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct NotebookDocumentChangeEvent { /// Changes to cells pub cells: Option, /// The changed meta data if any. /// /// Note: should always be an object literal (e.g. LSPObject) pub metadata: Option, } /// 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", deny_unknown_fields)] pub struct NotebookDocumentIdentifier { /// The notebook document's uri. pub uri: Url, } /// Provides information about the context in which an inline completion was requested. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlineCompletionContext { /// Provides information about the currently selected item in the autocomplete widget if it is visible. pub selected_completion_info: Option, /// 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")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlineCompletionOptions { pub work_done_progress: Option, } /// Text document content provider options. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentOptions { /// The schemes for which the server provides content. pub schemes: Vec, } /// General parameters to register for a notification or to register a provider. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// General parameters to unregister a request or notification. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] 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, /// User provided initialization options. pub initialization_options: Option, /// 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, /// 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, /// The rootPath of the workspace. Is null /// if no folder is open. /// /// @deprecated in favour of rootUri. #[deprecated] pub root_path: Option, /// 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, /// The initial trace setting. If omitted trace is disabled ('off'). pub trace: Option, /// An optional token that a server can use to report work done progress. pub work_done_token: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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>, } /// Defines the capabilities provided by a language /// server. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ServerCapabilities { /// The server provides call hierarchy support. /// /// @since 3.16.0 pub call_hierarchy_provider: Option>, /// 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>, /// The server provides code lens. pub code_lens_provider: Option, /// The server provides color provider support. pub color_provider: Option>, /// The server provides completion support. pub completion_provider: Option, /// The server provides Goto Declaration support. pub declaration_provider: Option>, /// The server provides goto definition support. pub definition_provider: Option>, /// The server has support for pull model diagnostics. /// /// @since 3.17.0 pub diagnostic_provider: Option>, /// The server provides document formatting. pub document_formatting_provider: Option>, /// The server provides document highlight support. pub document_highlight_provider: Option>, /// The server provides document link support. pub document_link_provider: Option, /// The server provides document formatting on typing. pub document_on_type_formatting_provider: Option, /// The server provides document range formatting. pub document_range_formatting_provider: Option>, /// The server provides document symbol support. pub document_symbol_provider: Option>, /// The server provides execute command support. pub execute_command_provider: Option, /// Experimental server capabilities. pub experimental: Option, /// The server provides folding provider support. pub folding_range_provider: Option>, /// The server provides hover support. pub hover_provider: Option>, /// The server provides Goto Implementation support. pub implementation_provider: Option>, /// The server provides inlay hints. /// /// @since 3.17.0 pub inlay_hint_provider: Option>, /// Inline completion options used during static registration. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub inline_completion_provider: Option>, /// The server provides inline values. /// /// @since 3.17.0 pub inline_value_provider: Option>, /// The server provides linked editing range support. /// /// @since 3.16.0 pub linked_editing_range_provider: Option>, /// The server provides moniker support. /// /// @since 3.16.0 pub moniker_provider: Option>, /// Defines how notebook documents are synced. /// /// @since 3.17.0 pub notebook_document_sync: Option>, /// 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>, /// The server provides find references support. pub references_provider: Option>, /// 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>, /// The server provides selection range support. pub selection_range_provider: Option>, /// The server provides semantic tokens support. /// /// @since 3.16.0 pub semantic_tokens_provider: Option>, /// The server provides signature help support. pub signature_help_provider: Option, /// 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>, /// The server provides Goto Type Definition support. pub type_definition_provider: Option>, /// The server provides type hierarchy support. /// /// @since 3.17.0 pub type_hierarchy_provider: Option>, /// Workspace specific server capabilities. pub workspace: Option, /// The server provides workspace symbol support. pub workspace_symbol_provider: Option>, } /// Information about the server /// /// @since 3.15.0 /// @since 3.18.0 ServerInfo type name added. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ServerInfo { /// 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, } /// A text document identifier to denote a specific version of a text document. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct VersionedTextDocumentIdentifier { /// The text document's uri. pub uri: Url, /// The version number of this document. pub version: i32, } /// Save options. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SaveOptions { /// The client is supposed to include the content on save. pub include_text: Option, } /// An event describing a file change. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct FileEvent { /// The change type. #[serde(rename = "type")] pub type_: FileChangeType, /// The file's uri. pub uri: Url, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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>, } /// 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", deny_unknown_fields)] pub struct Diagnostic { /// The diagnostic's code, which usually appear in the user interface. pub code: Option>, /// 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, /// A data entry field that is preserved between a `textDocument/publishDiagnostics` /// notification and `textDocument/codeAction` request. /// /// @since 3.16.0 pub data: Option, /// 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>, /// The diagnostic's severity. To avoid interpretation mismatches when a /// server is used with different clients it is highly recommended that servers /// always provide a severity value. pub severity: Option, /// 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, /// Additional metadata about the diagnostic. /// /// @since 3.15.0 pub tags: Option>, } /// Contains additional information about the context in which a completion request is triggered. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CompletionContext { /// The trigger character (a single character) that has trigger code complete. /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` pub trigger_character: Option, /// 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", deny_unknown_fields)] 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, /// 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, } /// 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", deny_unknown_fields)] 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, } /// 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 rules for combining these are /// defined by `applyKinds` (if the client supports it), defaulting to /// ApplyKind.Replace. /// /// Servers are only allowed to return default values if the client /// signals support for this via the `completionList.itemDefaults` /// capability. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CompletionItemDefaults { /// A default commit character set. /// /// @since 3.17.0 pub commit_characters: Option>, /// A default data value. /// /// @since 3.17.0 pub data: Option, /// A default edit range. /// /// @since 3.17.0 pub edit_range: Option>, /// A default insert text format. /// /// @since 3.17.0 pub insert_text_format: Option, /// A default insert text mode. /// /// @since 3.17.0 pub insert_text_mode: Option, } /// Specifies how fields from a completion item should be combined with those /// from `completionList.itemDefaults`. /// /// If unspecified, all fields will be treated as ApplyKind.Replace. /// /// If a field's value is ApplyKind.Replace, the value from a completion item (if /// provided and not `null`) will always be used instead of the value from /// `completionItem.itemDefaults`. /// /// If a field's value is ApplyKind.Merge, the values will be merged using the rules /// defined against each field below. /// /// Servers are only allowed to return `applyKind` if the client /// signals support for this via the `completionList.applyKindSupport` /// capability. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CompletionItemApplyKinds { /// Specifies whether commitCharacters on a completion will replace or be /// merged with those in `completionList.itemDefaults.commitCharacters`. /// /// If ApplyKind.Replace, the commit characters from the completion item will /// always be used unless not provided, in which case those from /// `completionList.itemDefaults.commitCharacters` will be used. An /// empty list can be used if a completion item does not have any commit /// characters and also should not use those from /// `completionList.itemDefaults.commitCharacters`. /// /// If ApplyKind.Merge the commitCharacters for the completion will be the /// union of all values in both `completionList.itemDefaults.commitCharacters` /// and the completion's own `commitCharacters`. /// /// @since 3.18.0 pub commit_characters: Option, /// Specifies whether the `data` field on a completion will replace or /// be merged with data from `completionList.itemDefaults.data`. /// /// If ApplyKind.Replace, the data from the completion item will be used if /// provided (and not `null`), otherwise /// `completionList.itemDefaults.data` will be used. An empty object can /// be used if a completion item does not have any data but also should /// not use the value from `completionList.itemDefaults.data`. /// /// If ApplyKind.Merge, a shallow merge will be performed between /// `completionList.itemDefaults.data` and the completion's own data /// using the following rules: /// /// - If a completion's `data` field is not provided (or `null`), the /// entire `data` field from `completionList.itemDefaults.data` will be /// used as-is. /// - If a completion's `data` field is provided, each field will /// overwrite the field of the same name in /// `completionList.itemDefaults.data` but no merging of nested fields /// within that value will occur. /// /// @since 3.18.0 pub data: Option, } /// Completion options. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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>, /// The server supports the following `CompletionItem` specific /// capabilities. /// /// @since 3.17.0 pub completion_item: Option, /// The server provides support to resolve additional /// information for a completion item. pub resolve_provider: Option, /// 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>, pub work_done_progress: Option, } /// Hover options. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct HoverOptions { pub work_done_progress: Option, } /// 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", deny_unknown_fields)] 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, /// `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, /// 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", deny_unknown_fields)] pub struct SignatureInformation { /// The index of the active parameter. /// /// If `null`, no parameter of the signature is active (for example a named /// argument that does not match any declared parameters). This is only valid /// if the client specifies the client capability /// `textDocument.signatureHelp.noActiveParameterSupport === true` /// /// If provided (or `null`), this is used in place of /// `SignatureHelp.activeParameter`. /// /// @since 3.16.0 pub active_parameter: Option, /// The human-readable doc-comment of this signature. Will be shown /// in the UI but can be omitted. pub documentation: Option>, /// The label of this signature. Will be shown in /// the UI. pub label: String, /// The parameters of this signature. pub parameters: Option>, } /// Server Capabilities for a [SignatureHelpRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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>, /// List of characters that trigger signature help automatically. pub trigger_characters: Option>, pub work_done_progress: Option, } /// Server Capabilities for a [DefinitionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DefinitionOptions { pub work_done_progress: Option, } /// Value-object that contains additional information when /// requesting references. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct ReferenceOptions { pub work_done_progress: Option, } /// Provider options for a [DocumentHighlightRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentHighlightOptions { pub work_done_progress: Option, } /// A base for all symbol information. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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>, } /// Provider options for a [DocumentSymbolRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, pub work_done_progress: Option, } /// 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", deny_unknown_fields)] 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, /// 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>>, /// The reason why code actions were requested. /// /// @since 3.17.0 pub trigger_kind: Option, } /// Captures why the code action is currently disabled. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CodeActionDisabled { /// Human readable description of why the code action is currently disabled. /// /// This is displayed in the code actions UI. pub reason: String, } /// Provider options for a [CodeActionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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>>, /// Static documentation for a class of code actions. /// /// Documentation from the provider should be shown in the code actions menu if either: /// /// - Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that /// most closely matches the requested code action kind. For example, if a provider has documentation for /// both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`, /// the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`. /// /// - Any code actions of `kind` are returned by the provider. /// /// At most one documentation entry should be shown per provider. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub documentation: Option>, /// The server provides support to resolve additional /// information for a code action. /// /// @since 3.16.0 pub resolve_provider: Option, pub work_done_progress: Option, } /// Location with only uri and does not include range. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct LocationUriOnly { pub uri: Url, } /// Server capabilities for a [WorkspaceSymbolRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkspaceSymbolOptions { /// The server provides support to resolve additional /// information for a workspace symbol. /// /// @since 3.17.0 pub resolve_provider: Option, pub work_done_progress: Option, } /// Code Lens provider options of a [CodeLensRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CodeLensOptions { /// Code lens has a resolve provider as well. pub resolve_provider: Option, pub work_done_progress: Option, } /// Provider options for a [DocumentLinkRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentLinkOptions { /// Document links have a resolve provider as well. pub resolve_provider: Option, pub work_done_progress: Option, } /// Value-object describing what options formatting should use. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, /// Trim trailing whitespace on a line. /// /// @since 3.15.0 pub trim_trailing_whitespace: Option, } /// Provider options for a [DocumentFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentFormattingOptions { pub work_done_progress: Option, } /// Provider options for a [DocumentRangeFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentRangeFormattingOptions { /// Whether the server supports formatting multiple ranges at once. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub ranges_support: Option, pub work_done_progress: Option, } /// Provider options for a [DocumentOnTypeFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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>, } /// Provider options for a [RenameRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct RenameOptions { /// Renames should be checked and tested before being executed. /// /// @since version 3.12.0 pub prepare_provider: Option, pub work_done_progress: Option, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct PrepareRenamePlaceholder { pub placeholder: String, pub range: Range, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct PrepareRenameDefaultBehavior { pub default_behavior: bool, } /// The server capabilities of a [ExecuteCommandRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ExecuteCommandOptions { /// The commands to be executed on the server pub commands: Vec, pub work_done_progress: Option, } /// Additional data about a workspace edit. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkspaceEditMetadata { /// Signal to the editor that this edit is a refactoring. pub is_refactoring: Option, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensLegend { /// The token modifiers a server uses. pub token_modifiers: Vec, /// The token types a server uses. pub token_types: Vec, } /// Semantic tokens options to support deltas for full documents /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensFullDelta { /// The server supports deltas for full documents. pub delta: Option, } /// 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", deny_unknown_fields)] pub struct OptionalVersionedTextDocumentIdentifier { /// The text document's uri. pub uri: Url, /// 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, } /// A special text edit with an additional change annotation. /// /// @since 3.16.0. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// An interactive text edit. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SnippetTextEdit { /// The actual identifier of the snippet edit. pub annotation_id: Option, /// The range of the text document to be manipulated. pub range: Range, /// The snippet to be inserted. pub snippet: StringValue, } /// A generic resource operation. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ResourceOperation { /// An optional annotation identifier describing the operation. /// /// @since 3.16.0 pub annotation_id: Option, /// The resource operation kind. pub kind: String, } /// Options to create a file. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CreateFileOptions { /// Ignore if exists. pub ignore_if_exists: Option, /// Overwrite existing file. Overwrite wins over `ignoreIfExists` pub overwrite: Option, } /// Rename file options #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct RenameFileOptions { /// Ignores if target exists. pub ignore_if_exists: Option, /// Overwrite target if existing. Overwrite wins over `ignoreIfExists` pub overwrite: Option, } /// Delete file options #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DeleteFileOptions { /// Ignore the operation if the file doesn't exist. pub ignore_if_not_exists: Option, /// Delete the content recursively if a folder is denoted. pub recursive: Option, } /// 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", deny_unknown_fields)] 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, /// Additional options used during matching. pub options: Option, } /// 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", deny_unknown_fields)] pub struct WorkspaceFullDocumentDiagnosticReport { /// The actual items. pub items: Vec, /// 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, /// The URI for which diagnostic information is reported. pub uri: Url, /// 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, } /// 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", deny_unknown_fields)] 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: Url, /// 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, } /// 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", deny_unknown_fields)] pub struct NotebookCell { /// The URI of the cell's text document /// content. pub document: Url, /// Additional execution summary information /// if supported by the client. pub execution_summary: Option, /// 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, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct NotebookDocumentFilterWithNotebook { /// The cells of the matching notebook to be synced. pub cells: Option>, /// The notebook to be synced If a string /// value is provided it matches against the /// notebook type. '*' matches every notebook. pub notebook: OR2, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct NotebookDocumentFilterWithCells { /// The cells of the matching notebook to be synced. pub cells: Vec, /// The notebook to be synced If a string /// value is provided it matches against the /// notebook type. '*' matches every notebook. pub notebook: Option>, } /// Cell changes to a notebook document. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct NotebookDocumentCellChanges { /// Changes to notebook cells properties like its /// kind, execution summary or metadata. pub data: Option>, /// Changes to the cell structure to add or /// remove cells. pub structure: Option, /// Changes to the text content of notebook cells. pub text_content: Option>, } /// Describes the currently selected completion item. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Information about the client /// /// @since 3.15.0 /// @since 3.18.0 ClientInfo type name added. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientInfo { /// 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, } /// Defines the capabilities provided by the client. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientCapabilities { /// Experimental client capabilities. pub experimental: Option, /// General client capabilities. /// /// @since 3.16.0 pub general: Option, /// Capabilities specific to the notebook document support. /// /// @since 3.17.0 pub notebook_document: Option, /// Text document specific client capabilities. pub text_document: Option, /// Window specific client capabilities. pub window: Option, /// Workspace specific client capabilities. pub workspace: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// Open and close notifications are sent to the server. If omitted open close notification should not /// be sent. pub open_close: Option, /// If present save notifications are sent to the server. If omitted the notification should not be /// sent. pub save: Option>, /// If present will save notifications are sent to the server. If omitted the notification should not be /// sent. pub will_save: Option, /// 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, } /// Defines workspace specific capabilities of the server. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkspaceOptions { /// The server is interested in notifications/requests for operations on files. /// /// @since 3.16.0 pub file_operations: Option, /// The server supports the `workspace/textDocumentContent` request. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub text_document_content: Option>, /// The server supports workspace folder. /// /// @since 3.6.0 pub workspace_folders: Option, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentChangePartial { /// The range of the document that changed. pub range: Range, /// The optional length of the range that got replaced. /// /// @deprecated use range instead. #[deprecated] pub range_length: Option, /// The new text for the provided range. pub text: String, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentChangeWholeDocument { /// The new text of the whole document. pub text: String, } /// Structure to capture a description for an error code. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CodeDescription { /// An URI to open with more information about the diagnostic error. pub href: Url, } /// 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", deny_unknown_fields)] pub struct DiagnosticRelatedInformation { /// The location of this related diagnostic information. pub location: Location, /// The message of this related diagnostic information. pub message: String, } /// Edit range variant that includes ranges for insert and replace operations. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct EditRangeWithInsertReplace { pub insert: Range, pub replace: Range, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ServerCompletionItemOptions { /// 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, } /// @since 3.18.0 /// @deprecated use MarkupContent instead. #[deprecated] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct MarkedStringWithLanguage { pub language: String, pub value: 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", deny_unknown_fields)] pub struct ParameterInformation { /// The human-readable doc-comment of this parameter. Will be shown /// in the UI but can be omitted. pub documentation: Option>, /// 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. /// /// To avoid ambiguities a server should use the [start, end] offset value instead of using /// a substring. Whether a client support this is controlled via `labelOffsetSupport` client /// capability. /// /// *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, } /// Documentation for a class of code actions. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CodeActionKindDocumentation { /// Command that is ued to display the documentation to the user. /// /// The title of this documentation code action is taken from {@linkcode Command.title} pub command: Command, /// The kind of the code action being documented. /// /// If the kind is generic, such as `CodeActionKind.Refactor`, the documentation will be shown whenever any /// refactorings are returned. If the kind if more specific, such as `CodeActionKind.RefactorExtract`, the /// documentation will only be shown when extract refactoring code actions are returned. pub kind: CustomStringEnum, } /// 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", deny_unknown_fields)] 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, /// 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, } /// Matching options for the file operation pattern. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct FileOperationPatternOptions { /// The pattern should be matched ignoring casing. pub ignore_case: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct NotebookCellLanguage { pub language: String, } /// Structural changes to cells in a notebook document. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct NotebookDocumentCellChangeStructure { /// The change to the cell array. pub array: NotebookCellArrayChange, /// Additional closed cell text documents. pub did_close: Option>, /// Additional opened cell text documents. pub did_open: Option>, } /// Content changes to a cell in a notebook document. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct NotebookDocumentCellContentChanges { pub changes: Vec, pub document: VersionedTextDocumentIdentifier, } /// Workspace specific client capabilities. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkspaceClientCapabilities { /// The client supports applying batch edits /// to the workspace by supporting the request /// 'workspace/applyEdit' pub apply_edit: Option, /// Capabilities specific to the code lens requests scoped to the /// workspace. /// /// @since 3.16.0. pub code_lens: Option, /// The client supports `workspace/configuration` requests. /// /// @since 3.6.0 pub configuration: Option, /// Capabilities specific to the diagnostic requests scoped to the /// workspace. /// /// @since 3.17.0. pub diagnostics: Option, /// Capabilities specific to the `workspace/didChangeConfiguration` notification. pub did_change_configuration: Option, /// Capabilities specific to the `workspace/didChangeWatchedFiles` notification. pub did_change_watched_files: Option, /// Capabilities specific to the `workspace/executeCommand` request. pub execute_command: Option, /// The client has support for file notifications/requests for user operations on files. /// /// Since 3.16.0 pub file_operations: Option, /// Capabilities specific to the folding range requests scoped to the workspace. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub folding_range: Option, /// Capabilities specific to the inlay hint requests scoped to the /// workspace. /// /// @since 3.17.0. pub inlay_hint: Option, /// Capabilities specific to the inline values requests scoped to the /// workspace. /// /// @since 3.17.0. pub inline_value: Option, /// Capabilities specific to the semantic token requests scoped to the /// workspace. /// /// @since 3.16.0. pub semantic_tokens: Option, /// Capabilities specific to the `workspace/symbol` request. pub symbol: Option, /// Capabilities specific to the `workspace/textDocumentContent` request. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub text_document_content: Option, /// Capabilities specific to `WorkspaceEdit`s. pub workspace_edit: Option, /// The client has support for workspace folders. /// /// @since 3.6.0 pub workspace_folders: Option, } /// Text document specific client capabilities. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentClientCapabilities { /// Capabilities specific to the various call hierarchy requests. /// /// @since 3.16.0 pub call_hierarchy: Option, /// Capabilities specific to the `textDocument/codeAction` request. pub code_action: Option, /// Capabilities specific to the `textDocument/codeLens` request. pub code_lens: Option, /// Capabilities specific to the `textDocument/documentColor` and the /// `textDocument/colorPresentation` request. /// /// @since 3.6.0 pub color_provider: Option, /// Capabilities specific to the `textDocument/completion` request. pub completion: Option, /// Capabilities specific to the `textDocument/declaration` request. /// /// @since 3.14.0 pub declaration: Option, /// Capabilities specific to the `textDocument/definition` request. pub definition: Option, /// Capabilities specific to the diagnostic pull model. /// /// @since 3.17.0 pub diagnostic: Option, /// Capabilities specific to the `textDocument/documentHighlight` request. pub document_highlight: Option, /// Capabilities specific to the `textDocument/documentLink` request. pub document_link: Option, /// Capabilities specific to the `textDocument/documentSymbol` request. pub document_symbol: Option, /// Defines which filters the client supports. /// /// @since 3.18.0 pub filters: Option, /// Capabilities specific to the `textDocument/foldingRange` request. /// /// @since 3.10.0 pub folding_range: Option, /// Capabilities specific to the `textDocument/formatting` request. pub formatting: Option, /// Capabilities specific to the `textDocument/hover` request. pub hover: Option, /// Capabilities specific to the `textDocument/implementation` request. /// /// @since 3.6.0 pub implementation: Option, /// Capabilities specific to the `textDocument/inlayHint` request. /// /// @since 3.17.0 pub inlay_hint: Option, /// Client capabilities specific to inline completions. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub inline_completion: Option, /// Capabilities specific to the `textDocument/inlineValue` request. /// /// @since 3.17.0 pub inline_value: Option, /// Capabilities specific to the `textDocument/linkedEditingRange` request. /// /// @since 3.16.0 pub linked_editing_range: Option, /// Client capabilities specific to the `textDocument/moniker` request. /// /// @since 3.16.0 pub moniker: Option, /// Capabilities specific to the `textDocument/onTypeFormatting` request. pub on_type_formatting: Option, /// Capabilities specific to the `textDocument/publishDiagnostics` notification. pub publish_diagnostics: Option, /// Capabilities specific to the `textDocument/rangeFormatting` request. pub range_formatting: Option, /// Capabilities specific to the `textDocument/references` request. pub references: Option, /// Capabilities specific to the `textDocument/rename` request. pub rename: Option, /// Capabilities specific to the `textDocument/selectionRange` request. /// /// @since 3.15.0 pub selection_range: Option, /// Capabilities specific to the various semantic token request. /// /// @since 3.16.0 pub semantic_tokens: Option, /// Capabilities specific to the `textDocument/signatureHelp` request. pub signature_help: Option, /// Defines which synchronization capabilities the client supports. pub synchronization: Option, /// Capabilities specific to the `textDocument/typeDefinition` request. /// /// @since 3.6.0 pub type_definition: Option, /// Capabilities specific to the various type hierarchy requests. /// /// @since 3.17.0 pub type_hierarchy: Option, } /// Capabilities specific to the notebook document support. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct WindowClientCapabilities { /// Capabilities specific to the showDocument request. /// /// @since 3.16.0 pub show_document: Option, /// Capabilities specific to the showMessage request. /// /// @since 3.16.0 pub show_message: Option, /// 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, } /// General client capabilities. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct GeneralClientCapabilities { /// Client capabilities specific to the client's markdown parser. /// /// @since 3.16.0 pub markdown: Option, /// 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>>, /// Client capabilities specific to regular expressions. /// /// @since 3.16.0 pub regular_expressions: Option, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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>, /// The server has support for workspace folders pub supported: Option, } /// Options for notifications/requests for user operations on files. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct FileOperationOptions { /// The server is interested in receiving didCreateFiles notifications. pub did_create: Option, /// The server is interested in receiving didDeleteFiles file notifications. pub did_delete: Option, /// The server is interested in receiving didRenameFiles notifications. pub did_rename: Option, /// The server is interested in receiving willCreateFiles requests. pub will_create: Option, /// The server is interested in receiving willDeleteFiles file requests. pub will_delete: Option, /// The server is interested in receiving willRenameFiles requests. pub will_rename: Option, } /// 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", deny_unknown_fields)] pub struct RelativePattern { /// A workspace folder or a base URI to which this pattern will be matched /// against relatively. pub base_uri: OR2, /// The actual glob pattern; pub pattern: Pattern, } /// A document filter where `language` is required field. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentFilterLanguage { /// A language id, like `typescript`. pub language: String, /// A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. /// /// @since 3.18.0 - support for relative patterns. Whether clients support /// relative patterns depends on the client capability /// `textDocuments.filters.relativePatternSupport`. pub pattern: Option, /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`. pub scheme: Option, } /// A document filter where `scheme` is required field. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentFilterScheme { /// A language id, like `typescript`. pub language: Option, /// A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. /// /// @since 3.18.0 - support for relative patterns. Whether clients support /// relative patterns depends on the client capability /// `textDocuments.filters.relativePatternSupport`. pub pattern: Option, /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`. pub scheme: String, } /// A document filter where `pattern` is required field. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentFilterPattern { /// A language id, like `typescript`. pub language: Option, /// A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. /// /// @since 3.18.0 - support for relative patterns. Whether clients support /// relative patterns depends on the client capability /// `textDocuments.filters.relativePatternSupport`. pub pattern: GlobPattern, /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`. pub scheme: Option, } /// A notebook document filter where `notebookType` is required field. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct NotebookDocumentFilterNotebookType { /// The type of the enclosing notebook. pub notebook_type: String, /// A glob pattern. pub pattern: Option, /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`. pub scheme: Option, } /// A notebook document filter where `scheme` is required field. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct NotebookDocumentFilterScheme { /// The type of the enclosing notebook. pub notebook_type: Option, /// A glob pattern. pub pattern: Option, /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`. pub scheme: String, } /// A notebook document filter where `pattern` is required field. /// /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct NotebookDocumentFilterPattern { /// The type of the enclosing notebook. pub notebook_type: Option, /// A glob pattern. pub pattern: GlobPattern, /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`. pub scheme: Option, } /// 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", deny_unknown_fields)] pub struct NotebookCellArrayChange { /// The new cells, if any pub cells: Option>, /// The deleted cells pub delete_count: u32, /// The start oftest of the cell that changed. pub start: u32, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The client supports versioned document changes in `WorkspaceEdit`s pub document_changes: Option, /// The failure handling strategy of a client if applying the workspace edit /// fails. /// /// @since 3.13.0 pub failure_handling: Option, /// Whether the client supports `WorkspaceEditMetadata` in `WorkspaceEdit`s. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub metadata_support: Option, /// 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, /// 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>, /// Whether the client supports snippets as text edits. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub snippet_edit_support: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DidChangeConfigurationClientCapabilities { /// Did change configuration notification supports dynamic registration. pub dynamic_registration: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// Whether the client has support for [relative pattern][RelativePattern] /// or not. /// /// @since 3.17.0 pub relative_pattern_support: Option, } /// Client capabilities for a [WorkspaceSymbolRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkspaceSymbolClientCapabilities { /// Symbol request supports dynamic registration. pub dynamic_registration: Option, /// 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, /// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. pub symbol_kind: Option, /// The client supports tags on `SymbolInformation`. /// Clients supporting tags have to handle unknown tags gracefully. /// /// @since 3.16.0 pub tag_support: Option, } /// The client capabilities of a [ExecuteCommandRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ExecuteCommandClientCapabilities { /// Execute command supports dynamic registration. pub dynamic_registration: Option, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// 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", deny_unknown_fields)] pub struct FileOperationClientCapabilities { /// The client has support for sending didCreateFiles notifications. pub did_create: Option, /// The client has support for sending didDeleteFiles notifications. pub did_delete: Option, /// The client has support for sending didRenameFiles notifications. pub did_rename: Option, /// Whether the client supports dynamic registration for file requests/notifications. pub dynamic_registration: Option, /// The client has support for sending willCreateFiles requests. pub will_create: Option, /// The client has support for sending willDeleteFiles requests. pub will_delete: Option, /// The client has support for sending willRenameFiles requests. pub will_rename: Option, } /// Client workspace capabilities specific to inline values. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Client workspace capabilities specific to inlay hints. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Workspace client capabilities specific to diagnostic pull requests. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Client workspace capabilities specific to folding ranges /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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")] pub refresh_support: Option, } /// Client capabilities for a text document content provider. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentClientCapabilities { /// Text document content provider supports dynamic registration. pub dynamic_registration: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentSyncClientCapabilities { /// The client supports did save notifications. pub did_save: Option, /// Whether text document synchronization supports dynamic registration. pub dynamic_registration: Option, /// The client supports sending will save notifications. pub will_save: Option, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentFilterClientCapabilities { /// The client supports Relative Patterns. /// /// @since 3.18.0 pub relative_pattern_support: Option, } /// Completion client capabilities #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CompletionClientCapabilities { /// The client supports the following `CompletionItem` specific /// capabilities. pub completion_item: Option, pub completion_item_kind: Option, /// The client supports the following `CompletionList` specific /// capabilities. /// /// @since 3.17.0 pub completion_list: Option, /// The client supports to send additional context information for a /// `textDocument/completion` request. pub context_support: Option, /// Whether completion supports dynamic registration. pub dynamic_registration: Option, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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>, /// Whether hover supports dynamic registration. pub dynamic_registration: Option, } /// Client Capabilities for a [SignatureHelpRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// Whether signature help supports dynamic registration. pub dynamic_registration: Option, /// The client supports the following `SignatureInformation` /// specific properties. pub signature_information: Option, } /// @since 3.14.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The client supports additional metadata in the form of declaration links. pub link_support: Option, } /// Client Capabilities for a [DefinitionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DefinitionClientCapabilities { /// Whether definition supports dynamic registration. pub dynamic_registration: Option, /// The client supports additional metadata in the form of definition links. /// /// @since 3.14.0 pub link_support: Option, } /// Since 3.6.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The client supports additional metadata in the form of definition links. /// /// Since 3.14.0 pub link_support: Option, } /// @since 3.6.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The client supports additional metadata in the form of definition links. /// /// @since 3.14.0 pub link_support: Option, } /// Client Capabilities for a [ReferencesRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ReferenceClientCapabilities { /// Whether references supports dynamic registration. pub dynamic_registration: Option, } /// Client Capabilities for a [DocumentHighlightRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentHighlightClientCapabilities { /// Whether document highlight supports dynamic registration. pub dynamic_registration: Option, } /// Client Capabilities for a [DocumentSymbolRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentSymbolClientCapabilities { /// Whether document symbol supports dynamic registration. pub dynamic_registration: Option, /// The client supports hierarchical document symbols. pub hierarchical_document_symbol_support: Option, /// The client supports an additional label presented in the UI when /// registering a document symbol provider. /// /// @since 3.16.0 pub label_support: Option, /// Specific capabilities for the `SymbolKind` in the /// `textDocument/documentSymbol` request. pub symbol_kind: Option, /// 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, } /// The Client Capabilities of a [CodeActionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, /// Whether code action supports the `disabled` property. /// /// @since 3.16.0 pub disabled_support: Option, /// Whether the client supports documentation for a class of /// code actions. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub documentation_support: Option, /// Whether code action supports dynamic registration. pub dynamic_registration: Option, /// 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, /// Whether code action supports the `isPreferred` property. /// /// @since 3.15.0 pub is_preferred_support: Option, /// Whether the client supports resolving additional code action /// properties via a separate `codeAction/resolve` request. /// /// @since 3.16.0 pub resolve_support: Option, /// Client supports the tag property on a code action. Clients /// supporting tags have to handle unknown tags gracefully. /// /// @since 3.18.0 - proposed pub tag_support: Option, } /// The client capabilities of a [CodeLensRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CodeLensClientCapabilities { /// Whether code lens supports dynamic registration. pub dynamic_registration: Option, /// Whether the client supports resolving additional code lens /// properties via a separate `codeLens/resolve` request. /// /// @since 3.18.0 pub resolve_support: Option, } /// The client capabilities of a [DocumentLinkRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentLinkClientCapabilities { /// Whether document link supports dynamic registration. pub dynamic_registration: Option, /// Whether the client supports the `tooltip` property on `DocumentLink`. /// /// @since 3.15.0 pub tooltip_support: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Client capabilities of a [DocumentFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentFormattingClientCapabilities { /// Whether formatting supports dynamic registration. pub dynamic_registration: Option, } /// Client capabilities of a [DocumentRangeFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentRangeFormattingClientCapabilities { /// Whether range formatting supports dynamic registration. pub dynamic_registration: Option, /// Whether the client supports formatting multiple ranges at once. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub ranges_support: Option, } /// Client capabilities of a [DocumentOnTypeFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentOnTypeFormattingClientCapabilities { /// Whether on type formatting supports dynamic registration. pub dynamic_registration: Option, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct RenameClientCapabilities { /// Whether rename supports dynamic registration. pub dynamic_registration: Option, /// 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, /// Client supports testing for validity of rename operations /// before execution. /// /// @since 3.12.0 pub prepare_support: Option, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// Specific options for the folding range. /// /// @since 3.17.0 pub folding_range: Option, /// Specific options for the folding range kind. /// /// @since 3.17.0 pub folding_range_kind: Option, /// 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, /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// The publish diagnostic client capabilities. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct PublishDiagnosticsClientCapabilities { /// Client supports a codeDescription property /// /// @since 3.16.0 pub code_description_support: Option, /// 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, /// Whether the clients accepts diagnostics with related information. pub related_information: Option, /// 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, /// Whether the client interprets the version property of the /// `textDocument/publishDiagnostics` notification's parameter. /// /// @since 3.15.0 pub version_support: Option, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// 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, /// The token formats the clients supports. pub formats: Vec, /// Whether the client supports tokens that can span multiple lines. pub multiline_token_support: Option, /// Whether the client supports tokens that can overlap each other. pub overlapping_token_support: Option, /// 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: ClientSemanticTokensRequestOptions, /// 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, /// The token modifiers that the client supports. pub token_modifiers: Vec, /// The token types that the client supports. pub token_types: Vec, } /// Client capabilities for the linked editing range request. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Client capabilities specific to the moniker request. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, } /// Client capabilities specific to inline values. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlineValueClientCapabilities { /// Whether implementation supports dynamic registration for inline value providers. pub dynamic_registration: Option, } /// Inlay hint client capabilities. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlayHintClientCapabilities { /// Whether inlay hints support dynamic registration. pub dynamic_registration: Option, /// Indicates which properties a client can resolve lazily on an inlay /// hint. pub resolve_support: Option, } /// Client capabilities specific to diagnostic pull requests. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DiagnosticClientCapabilities { /// Client supports a codeDescription property /// /// @since 3.16.0 pub code_description_support: Option, /// 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, /// 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, /// Whether the clients supports related documents for document diagnostic pulls. pub related_document_support: Option, /// Whether the clients accepts diagnostics with related information. pub related_information: Option, /// 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, } /// Client capabilities specific to inline completions. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlineCompletionClientCapabilities { /// Whether implementation supports dynamic registration for inline completion providers. pub dynamic_registration: Option, } /// Notebook specific client capabilities. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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, /// The client supports sending execution summary data per cell. pub execution_summary_support: Option, } /// Show message request client capabilities #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ShowMessageRequestClientCapabilities { /// Capabilities specific to the `MessageActionItem` type. pub message_action_item: Option, } /// Client capabilities for the showDocument request. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ShowDocumentClientCapabilities { /// The client has support for the showDocument /// request. pub support: bool, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct StaleRequestSupportOptions { /// 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, } /// Client capabilities specific to regular expressions. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct RegularExpressionsClientCapabilities { /// The engine's name. pub engine: RegularExpressionEngineKind, /// The engine's version. pub version: Option, } /// Client capabilities specific to the used markdown parser. /// /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct MarkdownClientCapabilities { /// A list of HTML tags that the client allows / supports in /// Markdown. /// /// @since 3.17.0 pub allowed_tags: Option>, /// The name of the parser. pub parser: String, /// The version of the parser. pub version: Option, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ChangeAnnotationsSupportOptions { /// 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, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientSymbolKindOptions { /// 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>, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientSymbolTagOptions { /// The tags supported by the client. pub value_set: Vec, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientSymbolResolveOptions { /// The properties that a client can resolve lazily. Usually /// `location.range` pub properties: Vec, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientCompletionItemOptions { /// Client supports commit characters on a completion item. pub commit_characters_support: Option, /// Client supports the deprecated property on a completion item. pub deprecated_support: Option, /// Client supports the following content formats for the documentation /// property. The order describes the preferred format of the client. pub documentation_format: Option>, /// 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, /// 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, /// The client has support for completion item label /// details (see also `CompletionItemLabelDetails`). /// /// @since 3.17.0 pub label_details_support: Option, /// Client supports the preselect property on a completion item. pub preselect_support: Option, /// 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, /// 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, /// 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, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientCompletionItemOptionsKind { /// 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>, } /// The client supports the following `CompletionList` specific /// capabilities. /// /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CompletionListCapabilities { /// Specifies whether the client supports `CompletionList.applyKind` to /// indicate how supported values from `completionList.itemDefaults` /// and `completion` will be combined. /// /// If a client supports `applyKind` it must support it for all fields /// that it supports that are listed in `CompletionList.applyKind`. This /// means when clients add support for new/future fields in completion /// items the MUST also support merge for them if those fields are /// defined in `CompletionList.applyKind`. /// /// @since 3.18.0 pub apply_kind_support: Option, /// 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>, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientSignatureInformationOptions { /// The client supports the `activeParameter` property on `SignatureInformation` /// literal. /// /// @since 3.16.0 pub active_parameter_support: Option, /// Client supports the following content formats for the documentation /// property. The order describes the preferred format of the client. pub documentation_format: Option>, /// The client supports the `activeParameter` property on /// `SignatureHelp`/`SignatureInformation` being set to `null` to /// indicate that no parameter should be active. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] pub no_active_parameter_support: Option, /// Client capabilities specific to parameter information. pub parameter_information: Option, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientCodeActionLiteralOptions { /// The code action kind is support with the following value /// set. pub code_action_kind: ClientCodeActionKindOptions, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientCodeActionResolveOptions { /// The properties that a client can resolve lazily. pub properties: Vec, } /// @since 3.18.0 - proposed #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CodeActionTagOptions { /// The tags supported by the client. pub value_set: Vec, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientCodeLensResolveOptions { /// The properties that a client can resolve lazily. pub properties: Vec, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientFoldingRangeKindOptions { /// 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>>, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientFoldingRangeOptions { /// 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, } /// General diagnostics capabilities for pull and push model. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DiagnosticsCapabilities { /// Client supports a codeDescription property /// /// @since 3.16.0 pub code_description_support: Option, /// 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, /// Whether the clients accepts diagnostics with related information. pub related_information: Option, /// 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, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientSemanticTokensRequestOptions { /// The client will send the `textDocument/semanticTokens/full` request if /// the server provides a corresponding handler. pub full: Option>, /// The client will send the `textDocument/semanticTokens/range` request if /// the server provides a corresponding handler. pub range: Option>, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientInlayHintResolveOptions { /// The properties that a client can resolve lazily. pub properties: Vec, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientShowMessageActionItemOptions { /// 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, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CompletionItemTagOptions { /// The tags supported by the client. pub value_set: Vec, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientCompletionItemResolveOptions { /// The properties that a client can resolve lazily. pub properties: Vec, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientCompletionItemInsertTextModeOptions { pub value_set: Vec, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientSignatureParameterInformationOptions { /// The client supports processing label offsets instead of a /// simple label string. /// /// @since 3.14.0 pub label_offset_support: Option, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientCodeActionKindOptions { /// 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>, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientDiagnosticsTagOptions { /// The tags supported by the client. pub value_set: Vec, } /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ClientSemanticTokensRequestFullDelta { /// The client will send the `textDocument/semanticTokens/full/delta` request if /// the server provides a corresponding handler. pub delta: Option, } /// 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", deny_unknown_fields)] pub struct DidChangeWorkspaceFoldersNotification { /// 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", deny_unknown_fields)] pub struct WorkDoneProgressCancelNotification { /// 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", deny_unknown_fields)] pub struct DidCreateFilesNotification { /// 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", deny_unknown_fields)] pub struct DidRenameFilesNotification { /// 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", deny_unknown_fields)] pub struct DidDeleteFilesNotification { /// 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", deny_unknown_fields)] pub struct DidOpenNotebookDocumentNotification { /// 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", deny_unknown_fields)] pub struct DidChangeNotebookDocumentNotification { /// 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", deny_unknown_fields)] pub struct DidSaveNotebookDocumentNotification { /// 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", deny_unknown_fields)] pub struct DidCloseNotebookDocumentNotification { /// 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", deny_unknown_fields)] pub struct InitializedNotification { /// The version of the JSON RPC protocol. pub jsonrpc: String, /// The method to be invoked. pub method: LSPNotificationMethods, pub params: Option, } /// 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", deny_unknown_fields)] pub struct ExitNotification { /// The version of the JSON RPC protocol. pub jsonrpc: String, /// The method to be invoked. pub method: LSPNotificationMethods, pub params: Option, } /// 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", deny_unknown_fields)] pub struct DidChangeConfigurationNotification { /// 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", deny_unknown_fields)] pub struct ShowMessageNotification { /// 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", deny_unknown_fields)] pub struct LogMessageNotification { /// 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", deny_unknown_fields)] pub struct TelemetryEventNotification { /// The version of the JSON RPC protocol. pub jsonrpc: String, /// The method to be invoked. pub method: LSPNotificationMethods, pub params: Option, } /// 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", deny_unknown_fields)] pub struct DidOpenTextDocumentNotification { /// 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", deny_unknown_fields)] pub struct DidChangeTextDocumentNotification { /// 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", deny_unknown_fields)] pub struct DidCloseTextDocumentNotification { /// 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", deny_unknown_fields)] pub struct DidSaveTextDocumentNotification { /// 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", deny_unknown_fields)] pub struct WillSaveTextDocumentNotification { /// 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", deny_unknown_fields)] pub struct DidChangeWatchedFilesNotification { /// 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", deny_unknown_fields)] pub struct PublishDiagnosticsNotification { /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct CancelNotification { /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct ImplementationRequest { /// 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 [ImplementationRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ImplementationResponse { /// 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>>, } /// 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", deny_unknown_fields)] pub struct TypeDefinitionRequest { /// 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 [TypeDefinitionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TypeDefinitionResponse { /// 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>>, } /// 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", deny_unknown_fields)] pub struct WorkspaceFoldersRequest { /// 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: Option, } /// Response to the [WorkspaceFoldersRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkspaceFoldersResponse { /// 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>, } /// 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", deny_unknown_fields)] pub struct ConfigurationRequest { /// 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 [ConfigurationRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ConfigurationResponse { /// 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, } /// 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", deny_unknown_fields)] pub struct DocumentColorRequest { /// 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 [DocumentColorRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentColorResponse { /// 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, } /// 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", deny_unknown_fields)] pub struct ColorPresentationRequest { /// 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 [ColorPresentationRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ColorPresentationResponse { /// 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, } /// 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", deny_unknown_fields)] pub struct FoldingRangeRequest { /// 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 [FoldingRangeRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct FoldingRangeResponse { /// 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>, } /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct FoldingRangeRefreshRequest { /// 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: Option, } /// Response to the [FoldingRangeRefreshRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct FoldingRangeRefreshResponse { /// 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", deny_unknown_fields)] pub struct DeclarationRequest { /// 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 [DeclarationRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DeclarationResponse { /// 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>>, } /// 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", deny_unknown_fields)] pub struct SelectionRangeRequest { /// 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 [SelectionRangeRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SelectionRangeResponse { /// 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>, } /// 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", deny_unknown_fields)] pub struct WorkDoneProgressCreateRequest { /// 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 [WorkDoneProgressCreateRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WorkDoneProgressCreateResponse { /// 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", deny_unknown_fields)] pub struct CallHierarchyPrepareRequest { /// 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 [CallHierarchyPrepareRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CallHierarchyPrepareResponse { /// 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>, } /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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>, } /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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>, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensRequest { /// 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 [SemanticTokensRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensResponse { /// 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, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensDeltaRequest { /// 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 [SemanticTokensDeltaRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensDeltaResponse { /// 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>, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensRangeRequest { /// 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 [SemanticTokensRangeRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensRangeResponse { /// 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, } /// @since 3.16.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensRefreshRequest { /// 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: Option, } /// Response to the [SemanticTokensRefreshRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SemanticTokensRefreshResponse { /// 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", deny_unknown_fields)] pub struct ShowDocumentRequest { /// 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 [ShowDocumentRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ShowDocumentResponse { /// 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", deny_unknown_fields)] pub struct LinkedEditingRangeRequest { /// 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 [LinkedEditingRangeRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct LinkedEditingRangeResponse { /// 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, } /// 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", deny_unknown_fields)] pub struct WillCreateFilesRequest { /// 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 [WillCreateFilesRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WillCreateFilesResponse { /// 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, } /// 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", deny_unknown_fields)] pub struct WillRenameFilesRequest { /// 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 [WillRenameFilesRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WillRenameFilesResponse { /// 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, } /// 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", deny_unknown_fields)] pub struct WillDeleteFilesRequest { /// 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 [WillDeleteFilesRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WillDeleteFilesResponse { /// 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, } /// 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", deny_unknown_fields)] pub struct MonikerRequest { /// 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 [MonikerRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct MonikerResponse { /// 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>, } /// 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", deny_unknown_fields)] pub struct TypeHierarchyPrepareRequest { /// 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 [TypeHierarchyPrepareRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TypeHierarchyPrepareResponse { /// 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>, } /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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>, } /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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>, } /// 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", deny_unknown_fields)] pub struct InlineValueRequest { /// 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 [InlineValueRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlineValueResponse { /// 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>, } /// @since 3.17.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlineValueRefreshRequest { /// 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: Option, } /// Response to the [InlineValueRefreshRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlineValueRefreshResponse { /// 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", deny_unknown_fields)] pub struct InlayHintRequest { /// 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 [InlayHintRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlayHintResponse { /// 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>, } /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct InlayHintRefreshRequest { /// 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: Option, } /// Response to the [InlayHintRefreshRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlayHintRefreshResponse { /// 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", deny_unknown_fields)] pub struct DocumentDiagnosticRequest { /// 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 [DocumentDiagnosticRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentDiagnosticResponse { /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct DiagnosticRefreshRequest { /// 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: Option, } /// Response to the [DiagnosticRefreshRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DiagnosticRefreshResponse { /// 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")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlineCompletionRequest { /// 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 [InlineCompletionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InlineCompletionResponse { /// 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>>, } /// The `workspace/textDocumentContent` request is sent from the client to the /// server to request the content of a text document. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentRequest { /// 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: TextDocumentContentParams, } /// Response to the [TextDocumentContentRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentResponse { /// 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: TextDocumentContentResult, } /// The `workspace/textDocumentContent` request is sent from the server to the client to refresh /// the content of a specific text document. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentRefreshRequest { /// 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: TextDocumentContentRefreshParams, } /// Response to the [TextDocumentContentRefreshRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentRefreshResponse { /// 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/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", deny_unknown_fields)] pub struct RegistrationRequest { /// 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 [RegistrationRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct RegistrationResponse { /// 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", deny_unknown_fields)] pub struct UnregistrationRequest { /// 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 [UnregistrationRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct UnregistrationResponse { /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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, pub params: Option, } /// Response to the [ShutdownRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct ShowMessageRequest { /// 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 [ShowMessageRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ShowMessageResponse { /// 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, } /// 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", deny_unknown_fields)] pub struct WillSaveTextDocumentWaitUntilRequest { /// 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 [WillSaveTextDocumentWaitUntilRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WillSaveTextDocumentWaitUntilResponse { /// 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>, } /// 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", deny_unknown_fields)] pub struct CompletionRequest { /// 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 [CompletionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CompletionResponse { /// 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, 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", deny_unknown_fields)] pub struct CompletionResolveRequest { /// 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 [CompletionResolveRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CompletionResolveResponse { /// 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", deny_unknown_fields)] pub struct HoverRequest { /// 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 [HoverRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct HoverResponse { /// 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, } #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SignatureHelpRequest { /// 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 [SignatureHelpRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SignatureHelpResponse { /// 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, } /// 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", deny_unknown_fields)] pub struct DefinitionRequest { /// 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 [DefinitionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DefinitionResponse { /// 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>>, } /// 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", deny_unknown_fields)] pub struct ReferencesRequest { /// 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 [ReferencesRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ReferencesResponse { /// 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>, } /// 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", deny_unknown_fields)] pub struct DocumentHighlightRequest { /// 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 [DocumentHighlightRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentHighlightResponse { /// 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>, } /// 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", deny_unknown_fields)] pub struct DocumentSymbolRequest { /// 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 [DocumentSymbolRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentSymbolResponse { /// 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>>, } /// A request to provide commands for the given text document and range. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CodeActionRequest { /// 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 [CodeActionRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CodeActionResponse { /// 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>>, } /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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, Vec>>, } /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct CodeLensRequest { /// 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 [CodeLensRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CodeLensResponse { /// 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>, } /// A request to resolve a command for a given code lens. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct CodeLensRefreshRequest { /// 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: Option, } /// Response to the [CodeLensRefreshRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CodeLensRefreshResponse { /// 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", deny_unknown_fields)] pub struct DocumentLinkRequest { /// 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 [DocumentLinkRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentLinkResponse { /// 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>, } /// 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", deny_unknown_fields)] 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", deny_unknown_fields)] 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", deny_unknown_fields)] pub struct DocumentFormattingRequest { /// 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 [DocumentFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentFormattingResponse { /// 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>, } /// A request to format a range in a document. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentRangeFormattingRequest { /// 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 [DocumentRangeFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentRangeFormattingResponse { /// 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>, } /// A request to format ranges in a document. /// /// @since 3.18.0 /// @proposed #[cfg(feature = "proposed")] #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentRangesFormattingRequest { /// 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 [DocumentRangesFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentRangesFormattingResponse { /// 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>, } /// A request to format a document on type. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentOnTypeFormattingRequest { /// 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 [DocumentOnTypeFormattingRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct DocumentOnTypeFormattingResponse { /// 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>, } /// A request to rename a symbol. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct RenameRequest { /// 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 [RenameRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct RenameResponse { /// 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, } /// 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", deny_unknown_fields)] pub struct PrepareRenameRequest { /// 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 [PrepareRenameRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct PrepareRenameResponse { /// 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, } /// 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", deny_unknown_fields)] pub struct ExecuteCommandRequest { /// 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 [ExecuteCommandRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ExecuteCommandResponse { /// 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, } /// A request sent from the server to the client to modified certain resources. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ApplyWorkspaceEditRequest { /// 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 [ApplyWorkspaceEditRequest]. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ApplyWorkspaceEditResponse { /// 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, } microsoft-lsprotocol-b6edfbf/pyproject.toml000066400000000000000000000001321502407456000214700ustar00rootroot00000000000000[build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" microsoft-lsprotocol-b6edfbf/requirements.in000066400000000000000000000004151502407456000216330ustar00rootroot00000000000000# 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!=23.2.1 jsonschema importlib_resources pytest PyHamcrest microsoft-lsprotocol-b6edfbf/requirements.txt000066400000000000000000000357721502407456000220620ustar00rootroot00000000000000# # This file is autogenerated by pip-compile with Python 3.8 # by the following command: # # pip-compile --generate-hashes ./requirements.in # attrs==25.3.0 \ --hash=sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3 \ --hash=sha256:75d7cefc7fb576747b2c81b4442d4d4a1ce0900973527c011d1030fd3bf4af1b # via # -r ./requirements.in # cattrs # jsonschema # referencing cattrs==24.1.3 \ --hash=sha256:981a6ef05875b5bb0c7fb68885546186d306f10f0f6718fe9b96c226e68821ff \ --hash=sha256:adf957dddd26840f27ffbd060a6c4dd3b2192c5b7c2c0525ef1bd8131d8a83f5 # via -r ./requirements.in colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 # via pytest exceptiongroup==1.3.0 \ --hash=sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10 \ --hash=sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88 # via # cattrs # pytest importlib-resources==6.4.5 \ --hash=sha256:980862a1d16c9e147a59603677fa2aa5fd82b87f223b6cb870695bcfce830065 \ --hash=sha256:ac29d5f956f01d5e4bb63102a5a19957f1b9175e45649977264a1416783bb717 # via # -r ./requirements.in # jsonschema # jsonschema-specifications iniconfig==2.1.0 \ --hash=sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7 \ --hash=sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760 # via pytest jsonschema==4.23.0 \ --hash=sha256:d71497fef26351a33265337fa77ffeb82423f3ea21283cd9467bb03999266bc4 \ --hash=sha256:fbadb6f8b144a8f8cf9f0b89ba94501d143e50411a1278633f56a7acf7fd5566 # via -r ./requirements.in jsonschema-specifications==2023.12.1 \ --hash=sha256:48a76787b3e70f5ed53f1160d2b81f586e4ca6d1548c5de7085d1682674764cc \ --hash=sha256:87e4fdf3a94858b8a2ba2778d9ba57d8a9cafca7c7489c46ba0d30a8bc6a9c3c # via jsonschema packaging==25.0 \ --hash=sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484 \ --hash=sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f # via pytest pkgutil-resolve-name==1.3.10 \ --hash=sha256:357d6c9e6a755653cfd78893817c0853af365dd51ec97f3d358a819373bbd174 \ --hash=sha256:ca27cc078d25c5ad71a9de0a7a330146c4e014c2462d9af19c6b828280649c5e # via jsonschema pluggy==1.5.0 \ --hash=sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1 \ --hash=sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669 # via pytest pyhamcrest==2.1.0 \ --hash=sha256:c6acbec0923d0cb7e72c22af1926f3e7c97b8e8d69fc7498eabacaf7c975bd9c \ --hash=sha256:f6913d2f392e30e0375b3ecbd7aee79e5d1faa25d345c8f4ff597665dcac2587 # via -r ./requirements.in pytest==8.3.5 \ --hash=sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820 \ --hash=sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845 # via -r ./requirements.in referencing==0.35.1 \ --hash=sha256:25b42124a6c8b632a425174f24087783efb348a6f1e0008e63cd4466fedf703c \ --hash=sha256:eda6d3234d62814d1c64e305c1331c9a3a6132da475ab6382eaa997b21ee75de # via # jsonschema # jsonschema-specifications rpds-py==0.20.1 \ --hash=sha256:02a0629ec053fc013808a85178524e3cb63a61dbc35b22499870194a63578fb9 \ --hash=sha256:07924c1b938798797d60c6308fa8ad3b3f0201802f82e4a2c41bb3fafb44cc28 \ --hash=sha256:07f59760ef99f31422c49038964b31c4dfcfeb5d2384ebfc71058a7c9adae2d2 \ --hash=sha256:0a3a1e9ee9728b2c1734f65d6a1d376c6f2f6fdcc13bb007a08cc4b1ff576dc5 \ --hash=sha256:0a90c373ea2975519b58dece25853dbcb9779b05cc46b4819cb1917e3b3215b6 \ --hash=sha256:0ad56edabcdb428c2e33bbf24f255fe2b43253b7d13a2cdbf05de955217313e6 \ --hash=sha256:0b581f47257a9fce535c4567782a8976002d6b8afa2c39ff616edf87cbeff712 \ --hash=sha256:0f8f741b6292c86059ed175d80eefa80997125b7c478fb8769fd9ac8943a16c0 \ --hash=sha256:0fc212779bf8411667234b3cdd34d53de6c2b8b8b958e1e12cb473a5f367c338 \ --hash=sha256:13c56de6518e14b9bf6edde23c4c39dac5b48dcf04160ea7bce8fca8397cdf86 \ --hash=sha256:142c0a5124d9bd0e2976089484af5c74f47bd3298f2ed651ef54ea728d2ea42c \ --hash=sha256:14511a539afee6f9ab492b543060c7491c99924314977a55c98bfa2ee29ce78c \ --hash=sha256:15a842bb369e00295392e7ce192de9dcbf136954614124a667f9f9f17d6a216f \ --hash=sha256:16d4477bcb9fbbd7b5b0e4a5d9b493e42026c0bf1f06f723a9353f5153e75d30 \ --hash=sha256:1791ff70bc975b098fe6ecf04356a10e9e2bd7dc21fa7351c1742fdeb9b4966f \ --hash=sha256:19b73643c802f4eaf13d97f7855d0fb527fbc92ab7013c4ad0e13a6ae0ed23bd \ --hash=sha256:200a23239781f46149e6a415f1e870c5ef1e712939fe8fa63035cd053ac2638e \ --hash=sha256:2249280b870e6a42c0d972339e9cc22ee98730a99cd7f2f727549af80dd5a963 \ --hash=sha256:2b431c777c9653e569986ecf69ff4a5dba281cded16043d348bf9ba505486f36 \ --hash=sha256:2cc3712a4b0b76a1d45a9302dd2f53ff339614b1c29603a911318f2357b04dd2 \ --hash=sha256:2fbb0ffc754490aff6dabbf28064be47f0f9ca0b9755976f945214965b3ace7e \ --hash=sha256:32b922e13d4c0080d03e7b62991ad7f5007d9cd74e239c4b16bc85ae8b70252d \ --hash=sha256:36785be22066966a27348444b40389f8444671630063edfb1a2eb04318721e17 \ --hash=sha256:37fe0f12aebb6a0e3e17bb4cd356b1286d2d18d2e93b2d39fe647138458b4bcb \ --hash=sha256:3aea7eed3e55119635a74bbeb80b35e776bafccb70d97e8ff838816c124539f1 \ --hash=sha256:3c6afcf2338e7f374e8edc765c79fbcb4061d02b15dd5f8f314a4af2bdc7feb5 \ --hash=sha256:3ccb8ac2d3c71cda472b75af42818981bdacf48d2e21c36331b50b4f16930163 \ --hash=sha256:3d089d0b88996df627693639d123c8158cff41c0651f646cd8fd292c7da90eaf \ --hash=sha256:3dd645e2b0dcb0fd05bf58e2e54c13875847687d0b71941ad2e757e5d89d4356 \ --hash=sha256:3e310838a5801795207c66c73ea903deda321e6146d6f282e85fa7e3e4854804 \ --hash=sha256:42cbde7789f5c0bcd6816cb29808e36c01b960fb5d29f11e052215aa85497c93 \ --hash=sha256:483b29f6f7ffa6af845107d4efe2e3fa8fb2693de8657bc1849f674296ff6a5a \ --hash=sha256:4888e117dd41b9d34194d9e31631af70d3d526efc363085e3089ab1a62c32ed1 \ --hash=sha256:49fe9b04b6fa685bd39237d45fad89ba19e9163a1ccaa16611a812e682913496 \ --hash=sha256:4a5a844f68776a7715ecb30843b453f07ac89bad393431efbf7accca3ef599c1 \ --hash=sha256:4a916087371afd9648e1962e67403c53f9c49ca47b9680adbeef79da3a7811b0 \ --hash=sha256:4f676e21db2f8c72ff0936f895271e7a700aa1f8d31b40e4e43442ba94973899 \ --hash=sha256:518d2ca43c358929bf08f9079b617f1c2ca6e8848f83c1225c88caeac46e6cbc \ --hash=sha256:5265505b3d61a0f56618c9b941dc54dc334dc6e660f1592d112cd103d914a6db \ --hash=sha256:55cd1fa4ecfa6d9f14fbd97ac24803e6f73e897c738f771a9fe038f2f11ff07c \ --hash=sha256:58b1d5dd591973d426cbb2da5e27ba0339209832b2f3315928c9790e13f159e8 \ --hash=sha256:59240685e7da61fb78f65a9f07f8108e36a83317c53f7b276b4175dc44151684 \ --hash=sha256:5b48e790e0355865197ad0aca8cde3d8ede347831e1959e158369eb3493d2191 \ --hash=sha256:5d4eea0761e37485c9b81400437adb11c40e13ef513375bbd6973e34100aeb06 \ --hash=sha256:648386ddd1e19b4a6abab69139b002bc49ebf065b596119f8f37c38e9ecee8ff \ --hash=sha256:653647b8838cf83b2e7e6a0364f49af96deec64d2a6578324db58380cff82aca \ --hash=sha256:6740a3e8d43a32629bb9b009017ea5b9e713b7210ba48ac8d4cb6d99d86c8ee8 \ --hash=sha256:6889469bfdc1eddf489729b471303739bf04555bb151fe8875931f8564309afc \ --hash=sha256:68cb0a499f2c4a088fd2f521453e22ed3527154136a855c62e148b7883b99f9a \ --hash=sha256:6aa97af1558a9bef4025f8f5d8c60d712e0a3b13a2fe875511defc6ee77a1ab7 \ --hash=sha256:6b73c67850ca7cae0f6c56f71e356d7e9fa25958d3e18a64927c2d930859b8e4 \ --hash=sha256:6c8e9340ce5a52f95fa7d3b552b35c7e8f3874d74a03a8a69279fd5fca5dc751 \ --hash=sha256:6ca91093a4a8da4afae7fe6a222c3b53ee4eef433ebfee4d54978a103435159e \ --hash=sha256:754bbed1a4ca48479e9d4182a561d001bbf81543876cdded6f695ec3d465846b \ --hash=sha256:762703bdd2b30983c1d9e62b4c88664df4a8a4d5ec0e9253b0231171f18f6d75 \ --hash=sha256:78f0b6877bfce7a3d1ff150391354a410c55d3cdce386f862926a4958ad5ab7e \ --hash=sha256:7a07ced2b22f0cf0b55a6a510078174c31b6d8544f3bc00c2bcee52b3d613f74 \ --hash=sha256:7dca7081e9a0c3b6490a145593f6fe3173a94197f2cb9891183ef75e9d64c425 \ --hash=sha256:7e21b7031e17c6b0e445f42ccc77f79a97e2687023c5746bfb7a9e45e0921b84 \ --hash=sha256:7f5179583d7a6cdb981151dd349786cbc318bab54963a192692d945dd3f6435d \ --hash=sha256:83cba698cfb3c2c5a7c3c6bac12fe6c6a51aae69513726be6411076185a8b24a \ --hash=sha256:842c19a6ce894493563c3bd00d81d5100e8e57d70209e84d5491940fdb8b9e3a \ --hash=sha256:84b8382a90539910b53a6307f7c35697bc7e6ffb25d9c1d4e998a13e842a5e83 \ --hash=sha256:8ba6f89cac95c0900d932c9efb7f0fb6ca47f6687feec41abcb1bd5e2bd45535 \ --hash=sha256:8bbe951244a838a51289ee53a6bae3a07f26d4e179b96fc7ddd3301caf0518eb \ --hash=sha256:925d176a549f4832c6f69fa6026071294ab5910e82a0fe6c6228fce17b0706bd \ --hash=sha256:92b68b79c0da2a980b1c4197e56ac3dd0c8a149b4603747c4378914a68706979 \ --hash=sha256:93da1d3db08a827eda74356f9f58884adb254e59b6664f64cc04cdff2cc19b0d \ --hash=sha256:95f3b65d2392e1c5cec27cff08fdc0080270d5a1a4b2ea1d51d5f4a2620ff08d \ --hash=sha256:9c4cb04a16b0f199a8c9bf807269b2f63b7b5b11425e4a6bd44bd6961d28282c \ --hash=sha256:a624cc00ef2158e04188df5e3016385b9353638139a06fb77057b3498f794782 \ --hash=sha256:a649dfd735fff086e8a9d0503a9f0c7d01b7912a333c7ae77e1515c08c146dad \ --hash=sha256:a94e52537a0e0a85429eda9e49f272ada715506d3b2431f64b8a3e34eb5f3e75 \ --hash=sha256:aa7ac11e294304e615b43f8c441fee5d40094275ed7311f3420d805fde9b07b4 \ --hash=sha256:b41b6321805c472f66990c2849e152aff7bc359eb92f781e3f606609eac877ad \ --hash=sha256:b71b8666eeea69d6363248822078c075bac6ed135faa9216aa85f295ff009b1e \ --hash=sha256:b9c2fe36d1f758b28121bef29ed1dee9b7a2453e997528e7d1ac99b94892527c \ --hash=sha256:bb63804105143c7e24cee7db89e37cb3f3941f8e80c4379a0b355c52a52b6780 \ --hash=sha256:be5ef2f1fc586a7372bfc355986226484e06d1dc4f9402539872c8bb99e34b01 \ --hash=sha256:c142b88039b92e7e0cb2552e8967077e3179b22359e945574f5e2764c3953dcf \ --hash=sha256:c14937af98c4cc362a1d4374806204dd51b1e12dded1ae30645c298e5a5c4cb1 \ --hash=sha256:ca449520e7484534a2a44faf629362cae62b660601432d04c482283c47eaebab \ --hash=sha256:cd945871335a639275eee904caef90041568ce3b42f402c6959b460d25ae8732 \ --hash=sha256:d0b937b2a1988f184a3e9e577adaa8aede21ec0b38320d6009e02bd026db04fa \ --hash=sha256:d126b52e4a473d40232ec2052a8b232270ed1f8c9571aaf33f73a14cc298c24f \ --hash=sha256:d8761c3c891cc51e90bc9926d6d2f59b27beaf86c74622c8979380a29cc23ac3 \ --hash=sha256:d9ecb51120de61e4604650666d1f2b68444d46ae18fd492245a08f53ad2b7711 \ --hash=sha256:da584ff96ec95e97925174eb8237e32f626e7a1a97888cdd27ee2f1f24dd0ad8 \ --hash=sha256:dbcf360c9e3399b056a238523146ea77eeb2a596ce263b8814c900263e46031a \ --hash=sha256:dbddc10776ca7ebf2a299c41a4dde8ea0d8e3547bfd731cb87af2e8f5bf8962d \ --hash=sha256:dc73505153798c6f74854aba69cc75953888cf9866465196889c7cdd351e720c \ --hash=sha256:e13de156137b7095442b288e72f33503a469aa1980ed856b43c353ac86390519 \ --hash=sha256:e1791c4aabd117653530dccd24108fa03cc6baf21f58b950d0a73c3b3b29a350 \ --hash=sha256:e75ba609dba23f2c95b776efb9dd3f0b78a76a151e96f96cc5b6b1b0004de66f \ --hash=sha256:e79059d67bea28b53d255c1437b25391653263f0e69cd7dec170d778fdbca95e \ --hash=sha256:ecd27a66740ffd621d20b9a2f2b5ee4129a56e27bfb9458a3bcc2e45794c96cb \ --hash=sha256:f009c69bc8c53db5dfab72ac760895dc1f2bc1b62ab7408b253c8d1ec52459fc \ --hash=sha256:f16bc1334853e91ddaaa1217045dd7be166170beec337576818461268a3de67f \ --hash=sha256:f19169781dddae7478a32301b499b2858bc52fc45a112955e798ee307e294977 \ --hash=sha256:fa3060d885657abc549b2a0f8e1b79699290e5d83845141717c6c90c2df38311 \ --hash=sha256:fa41a64ac5b08b292906e248549ab48b69c5428f3987b09689ab2441f267d04d \ --hash=sha256:fbf15aff64a163db29a91ed0868af181d6f68ec1a3a7d5afcfe4501252840bad \ --hash=sha256:fe00a9057d100e69b4ae4a094203a708d65b0f345ed546fdef86498bf5390982 # via # jsonschema # referencing tomli==2.2.1 \ --hash=sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6 \ --hash=sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd \ --hash=sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c \ --hash=sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b \ --hash=sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8 \ --hash=sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6 \ --hash=sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77 \ --hash=sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff \ --hash=sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea \ --hash=sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192 \ --hash=sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249 \ --hash=sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee \ --hash=sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4 \ --hash=sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98 \ --hash=sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8 \ --hash=sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4 \ --hash=sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281 \ --hash=sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744 \ --hash=sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69 \ --hash=sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13 \ --hash=sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140 \ --hash=sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e \ --hash=sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e \ --hash=sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc \ --hash=sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff \ --hash=sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec \ --hash=sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2 \ --hash=sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222 \ --hash=sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106 \ --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 # via pytest typing-extensions==4.13.2 \ --hash=sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c \ --hash=sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef # via # cattrs # exceptiongroup zipp==3.20.2 \ --hash=sha256:a817ac80d6cf4b23bf7f2828b7cabf326f15a001bea8b1f9b49631780ba28350 \ --hash=sha256:bc9eb26f4506fda01b81bcde0ca78103b6e62f991b381fec825435c836edbc29 # via importlib-resources microsoft-lsprotocol-b6edfbf/runtime.txt000066400000000000000000000000151502407456000210000ustar00rootroot00000000000000python-3.8.18microsoft-lsprotocol-b6edfbf/scripts/000077500000000000000000000000001502407456000202475ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/scripts/onCreateCommand.sh000066400000000000000000000014561502407456000236500ustar00rootroot00000000000000#!/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 3.9 3.10 3.11 3.12 # Set default Python version to 3.8 . pyenv global 3.8 # Create Virutal environment. pyenv exec python3.8 -m venv .venv # Activate Virtual environment. source /workspaces/lsprotocol/.venv/bin/activate microsoft-lsprotocol-b6edfbf/scripts/postCreateCommand.sh000066400000000000000000000002341502407456000242120ustar00rootroot00000000000000source /workspaces/lsprotocol/.venv/bin/activate python -m pip install nox python -m pip install -r ./packages/python/requirements.txt -r ./requirements.txtmicrosoft-lsprotocol-b6edfbf/setup.cfg000066400000000000000000000013031502407456000203760ustar00rootroot00000000000000[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 microsoft-lsprotocol-b6edfbf/tests/000077500000000000000000000000001502407456000177225ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/tests/dotnet/000077500000000000000000000000001502407456000212175ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/tests/dotnet/lsprotocol_tests/000077500000000000000000000000001502407456000246415ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/tests/dotnet/lsprotocol_tests/.gitignore000066400000000000000000000000111502407456000266210ustar00rootroot00000000000000bin/ obj/microsoft-lsprotocol-b6edfbf/tests/dotnet/lsprotocol_tests/LSPTests.cs000066400000000000000000000076521502407456000266630ustar00rootroot00000000000000 namespace lsprotocol_tests; using Newtonsoft.Json; using Newtonsoft.Json.Linq; public class LSPTests { public static IEnumerable 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: --.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); } } } } }microsoft-lsprotocol-b6edfbf/tests/dotnet/lsprotocol_tests/Usings.cs000066400000000000000000000001031502407456000264320ustar00rootroot00000000000000global using Xunit; global using Microsoft.LanguageServer.Protocol;microsoft-lsprotocol-b6edfbf/tests/dotnet/lsprotocol_tests/lsprotocol_tests.csproj000066400000000000000000000020201502407456000314770ustar00rootroot00000000000000 net6.0 enable enable false true runtime; build; native; contentfiles; analyzers; buildtransitive all runtime; build; native; contentfiles; analyzers; buildtransitive all microsoft-lsprotocol-b6edfbf/tests/generator/000077500000000000000000000000001502407456000217105ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/tests/generator/test_model.py000066400000000000000000000011241502407456000244170ustar00rootroot00000000000000# 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(): 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) microsoft-lsprotocol-b6edfbf/tests/generator/test_schema.py000066400000000000000000000007661502407456000245720ustar00rootroot00000000000000# 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) microsoft-lsprotocol-b6edfbf/tests/python/000077500000000000000000000000001502407456000212435ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/tests/python/__init__.py000066400000000000000000000001361502407456000233540ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. microsoft-lsprotocol-b6edfbf/tests/python/common/000077500000000000000000000000001502407456000225335ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/tests/python/common/jsonrpc.py000066400000000000000000000031501502407456000245620ustar00rootroot00000000000000# 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("`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("`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) microsoft-lsprotocol-b6edfbf/tests/python/notifications/000077500000000000000000000000001502407456000241145ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/tests/python/notifications/test_exit.py000066400000000000000000000020451502407456000264770ustar00rootroot00000000000000# 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) microsoft-lsprotocol-b6edfbf/tests/python/notifications/test_progress.py000066400000000000000000000050111502407456000273660ustar00rootroot00000000000000# 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)) microsoft-lsprotocol-b6edfbf/tests/python/requests/000077500000000000000000000000001502407456000231165ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/tests/python/requests/test_initilize_request.py000066400000000000000000000344611502407456000303070ustar00rootroot00000000000000# 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)) microsoft-lsprotocol-b6edfbf/tests/python/requests/test_inlay_hint_resolve_request.py000066400000000000000000000045071502407456000322020ustar00rootroot00000000000000# 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()) 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)) microsoft-lsprotocol-b6edfbf/tests/python/requests/test_workspace_sematic_tokens_refresh.py000066400000000000000000000026411502407456000333360ustar00rootroot00000000000000# 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) microsoft-lsprotocol-b6edfbf/tests/python/requests/test_workspace_symbols_request.py000066400000000000000000000045731502407456000320560ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import hamcrest import pytest from cattrs import ClassValidationError from lsprotocol import converters as cv from lsprotocol import types as lsp TEST_DATA = [ { "id": 1, "result": [{"name": "test", "kind": 1, "location": {"uri": "test"}}], "jsonrpc": "2.0", }, { "id": 1, "result": [ { "name": "test", "kind": 1, "location": { "uri": "test", "range": { "start": {"line": 1, "character": 1}, "end": {"line": 1, "character": 1}, }, }, } ], "jsonrpc": "2.0", }, { "id": 1, "result": [{"name": "test", "kind": 1, "location": {"uri": "test"}, "data": 1}], "jsonrpc": "2.0", }, { "id": 1, "result": [ { "name": "test", "kind": 1, "location": { "uri": "test", "range": { "start": {"line": 1, "character": 1}, "end": {"line": 1, "character": 1}, }, }, "deprecated": True, } ], "jsonrpc": "2.0", }, ] BAD_TEST_DATA = [ { "id": 1, "result": [ { "name": "test", "kind": 1, "location": {"uri": "test"}, "deprecated": True, } ], "jsonrpc": "2.0", }, ] @pytest.mark.parametrize("data", TEST_DATA) def test_workspace_symbols(data): converter = cv.get_converter() obj = converter.structure(data, lsp.WorkspaceSymbolResponse) hamcrest.assert_that(obj, hamcrest.instance_of(lsp.WorkspaceSymbolResponse)) hamcrest.assert_that( converter.unstructure(obj, lsp.WorkspaceSymbolResponse), hamcrest.is_(data), ) @pytest.mark.parametrize("data", BAD_TEST_DATA) def test_workspace_symbols_bad(data): converter = cv.get_converter() with pytest.raises(ClassValidationError): obj = converter.structure(data, lsp.WorkspaceSymbolResponse) hamcrest.assert_that(obj, hamcrest.instance_of(lsp.WorkspaceSymbolResponse)) microsoft-lsprotocol-b6edfbf/tests/python/test_cattrs_special_cases.py000066400000000000000000000241571502407456000270430ustar00rootroot00000000000000# 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 _PosEncoding: """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, _PosEncoding) hamcrest.assert_that(obj, hamcrest.instance_of(_PosEncoding)) if e is None: hamcrest.assert_that(converter.unstructure(obj, _PosEncoding), hamcrest.is_({})) else: hamcrest.assert_that( converter.unstructure(obj, _PosEncoding), hamcrest.is_(data) ) def test_prepare_rename_response(): data = { "id": 1, "jsonrpc": "2.0", "result": None, } converter = cv.get_converter() obj = converter.structure(data, lsp.PrepareRenameResponse) hamcrest.assert_that(obj, hamcrest.instance_of(lsp.PrepareRenameResponse)) hamcrest.assert_that( converter.unstructure(obj, lsp.PrepareRenameResponse), hamcrest.is_(data), ) microsoft-lsprotocol-b6edfbf/tests/python/test_custom_validators.py000066400000000000000000000020311502407456000264120ustar00rootroot00000000000000# 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) microsoft-lsprotocol-b6edfbf/tests/python/test_enums.py000066400000000000000000000025011502407456000240010ustar00rootroot00000000000000# 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)) microsoft-lsprotocol-b6edfbf/tests/python/test_generated_data.py000066400000000000000000000020221502407456000255770ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import json import pathlib from typing import 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: assert result_type == "False", "Expected success, but failed structuring" microsoft-lsprotocol-b6edfbf/tests/python/test_import.py000066400000000000000000000004521502407456000241670ustar00rootroot00000000000000# 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")) microsoft-lsprotocol-b6edfbf/tests/python/test_location.py000066400000000000000000000025351502407456000244710ustar00rootroot00000000000000# 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")) microsoft-lsprotocol-b6edfbf/tests/python/test_misc.py000066400000000000000000000017221502407456000236110ustar00rootroot00000000000000# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import pytest from hamcrest import assert_that, is_ from lsprotocol import types as lsp @pytest.mark.parametrize( ("msg", "expected"), [ (lsp.PROGRESS, "both"), (lsp.WORKSPACE_WILL_RENAME_FILES, "clientToServer"), (lsp.WORKSPACE_WORKSPACE_FOLDERS, "serverToClient"), ], ) def test_message_direction(msg, expected): assert_that(lsp.message_direction(msg), is_(expected)) @pytest.mark.parametrize( ("cls", "expected"), [(lsp.CancelNotification, True), (lsp.CancelParams, False)] ) def test_is_special_class(cls, expected): assert_that(lsp.is_special_class(cls), is_(expected)) @pytest.mark.parametrize( ("cls", "expected"), [ (lsp.CancelNotification, False), (lsp.CallHierarchyIncomingCall, True), ], ) def test_is_keyword_class(cls, expected): assert_that(lsp.is_keyword_class(cls), is_(expected)) microsoft-lsprotocol-b6edfbf/tests/python/test_position.py000066400000000000000000000032151502407456000245210ustar00rootroot00000000000000# 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")) microsoft-lsprotocol-b6edfbf/tests/python/test_range.py000066400000000000000000000017331502407456000237540ustar00rootroot00000000000000# 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")) microsoft-lsprotocol-b6edfbf/tests/rust/000077500000000000000000000000001502407456000207175ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/tests/rust/Cargo.toml000066400000000000000000000010241502407456000226440ustar00rootroot00000000000000[package] name = "lsprotocol-test" version = "0.1.0" edition = "2021" description = "Tests for generated Rust types for Language Server Protocol." authors = ["Microsoft Corporation "] license = "MIT" repository = "https://github.com/microsoft/lsprotocol" [dependencies] glob = "0.3.1" 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" lsprotocol = { path = "../../packages/rust/lsprotocol", features = ["proposed"]} microsoft-lsprotocol-b6edfbf/tests/rust/src/000077500000000000000000000000001502407456000215065ustar00rootroot00000000000000microsoft-lsprotocol-b6edfbf/tests/rust/src/main.rs000066400000000000000000000367151502407456000230140ustar00rootroot00000000000000// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #[cfg(test)] mod tests { use glob::glob; use lsprotocol::*; use serde::Deserialize; use std::fs; fn get_all_json_files(root: &str) -> Vec { let pattern = format!("{}/*.json", root); glob(&pattern) .expect("Failed to read glob pattern") .filter_map(Result::ok) .map(|path| path.to_str().unwrap().to_string()) .collect() } fn validate_type Deserialize<'de>>(result_type: &str, data: &str) { match serde_json::from_str::(data) { Ok(_) => assert_eq!( result_type, "True", "Expected error, but succeeded deserializing:\r\n{}", data ), Err(e) => assert_eq!( result_type, "False", "Expected success, but failed deserializing: {}\r\nJSON data:\r\n{}", e.to_string(), data ), } } fn validate(lsp_type: &str, result_type: &str, data: &str) { println!("Validating: {}", lsp_type); match lsp_type { // Sample Generated Code: // "CallHierarchyIncomingCallsRequest" => { // return validate_type::(result_type, data) // } // GENERATED_TEST_CODE:start "ImplementationRequest" => { return validate_type::(result_type, data) } "TypeDefinitionRequest" => { return validate_type::(result_type, data) } "WorkspaceFoldersRequest" => { return validate_type::(result_type, data) } "ConfigurationRequest" => { return validate_type::(result_type, data) } "DocumentColorRequest" => { return validate_type::(result_type, data) } "ColorPresentationRequest" => { return validate_type::(result_type, data) } "FoldingRangeRequest" => { return validate_type::(result_type, data) } "FoldingRangeRefreshRequest" => { return validate_type::(result_type, data) } "DeclarationRequest" => return validate_type::(result_type, data), "SelectionRangeRequest" => { return validate_type::(result_type, data) } "WorkDoneProgressCreateRequest" => { return validate_type::(result_type, data) } "CallHierarchyPrepareRequest" => { return validate_type::(result_type, data) } "CallHierarchyIncomingCallsRequest" => { return validate_type::(result_type, data) } "CallHierarchyOutgoingCallsRequest" => { return validate_type::(result_type, data) } "SemanticTokensRequest" => { return validate_type::(result_type, data) } "SemanticTokensDeltaRequest" => { return validate_type::(result_type, data) } "SemanticTokensRangeRequest" => { return validate_type::(result_type, data) } "SemanticTokensRefreshRequest" => { return validate_type::(result_type, data) } "ShowDocumentRequest" => { return validate_type::(result_type, data) } "LinkedEditingRangeRequest" => { return validate_type::(result_type, data) } "WillCreateFilesRequest" => { return validate_type::(result_type, data) } "WillRenameFilesRequest" => { return validate_type::(result_type, data) } "WillDeleteFilesRequest" => { return validate_type::(result_type, data) } "MonikerRequest" => return validate_type::(result_type, data), "TypeHierarchyPrepareRequest" => { return validate_type::(result_type, data) } "TypeHierarchySupertypesRequest" => { return validate_type::(result_type, data) } "TypeHierarchySubtypesRequest" => { return validate_type::(result_type, data) } "InlineValueRequest" => return validate_type::(result_type, data), "InlineValueRefreshRequest" => { return validate_type::(result_type, data) } "InlayHintRequest" => return validate_type::(result_type, data), "InlayHintResolveRequest" => { return validate_type::(result_type, data) } "InlayHintRefreshRequest" => { return validate_type::(result_type, data) } "DocumentDiagnosticRequest" => { return validate_type::(result_type, data) } "WorkspaceDiagnosticRequest" => { return validate_type::(result_type, data) } "DiagnosticRefreshRequest" => { return validate_type::(result_type, data) } "InlineCompletionRequest" => { return validate_type::(result_type, data) } "TextDocumentContentRequest" => { return validate_type::(result_type, data) } "TextDocumentContentRefreshRequest" => { return validate_type::(result_type, data) } "RegistrationRequest" => { return validate_type::(result_type, data) } "UnregistrationRequest" => { return validate_type::(result_type, data) } "InitializeRequest" => return validate_type::(result_type, data), "ShutdownRequest" => return validate_type::(result_type, data), "ShowMessageRequest" => return validate_type::(result_type, data), "WillSaveTextDocumentWaitUntilRequest" => { return validate_type::(result_type, data) } "CompletionRequest" => return validate_type::(result_type, data), "CompletionResolveRequest" => { return validate_type::(result_type, data) } "HoverRequest" => return validate_type::(result_type, data), "SignatureHelpRequest" => { return validate_type::(result_type, data) } "DefinitionRequest" => return validate_type::(result_type, data), "ReferencesRequest" => return validate_type::(result_type, data), "DocumentHighlightRequest" => { return validate_type::(result_type, data) } "DocumentSymbolRequest" => { return validate_type::(result_type, data) } "CodeActionRequest" => return validate_type::(result_type, data), "CodeActionResolveRequest" => { return validate_type::(result_type, data) } "WorkspaceSymbolRequest" => { return validate_type::(result_type, data) } "WorkspaceSymbolResolveRequest" => { return validate_type::(result_type, data) } "CodeLensRequest" => return validate_type::(result_type, data), "CodeLensResolveRequest" => { return validate_type::(result_type, data) } "CodeLensRefreshRequest" => { return validate_type::(result_type, data) } "DocumentLinkRequest" => { return validate_type::(result_type, data) } "DocumentLinkResolveRequest" => { return validate_type::(result_type, data) } "DocumentFormattingRequest" => { return validate_type::(result_type, data) } "DocumentRangeFormattingRequest" => { return validate_type::(result_type, data) } "DocumentRangesFormattingRequest" => { return validate_type::(result_type, data) } "DocumentOnTypeFormattingRequest" => { return validate_type::(result_type, data) } "RenameRequest" => return validate_type::(result_type, data), "PrepareRenameRequest" => { return validate_type::(result_type, data) } "ExecuteCommandRequest" => { return validate_type::(result_type, data) } "ApplyWorkspaceEditRequest" => { return validate_type::(result_type, data) } "DidChangeWorkspaceFoldersNotification" => { return validate_type::(result_type, data) } "WorkDoneProgressCancelNotification" => { return validate_type::(result_type, data) } "DidCreateFilesNotification" => { return validate_type::(result_type, data) } "DidRenameFilesNotification" => { return validate_type::(result_type, data) } "DidDeleteFilesNotification" => { return validate_type::(result_type, data) } "DidOpenNotebookDocumentNotification" => { return validate_type::(result_type, data) } "DidChangeNotebookDocumentNotification" => { return validate_type::(result_type, data) } "DidSaveNotebookDocumentNotification" => { return validate_type::(result_type, data) } "DidCloseNotebookDocumentNotification" => { return validate_type::(result_type, data) } "InitializedNotification" => { return validate_type::(result_type, data) } "ExitNotification" => return validate_type::(result_type, data), "DidChangeConfigurationNotification" => { return validate_type::(result_type, data) } "ShowMessageNotification" => { return validate_type::(result_type, data) } "LogMessageNotification" => { return validate_type::(result_type, data) } "TelemetryEventNotification" => { return validate_type::(result_type, data) } "DidOpenTextDocumentNotification" => { return validate_type::(result_type, data) } "DidChangeTextDocumentNotification" => { return validate_type::(result_type, data) } "DidCloseTextDocumentNotification" => { return validate_type::(result_type, data) } "DidSaveTextDocumentNotification" => { return validate_type::(result_type, data) } "WillSaveTextDocumentNotification" => { return validate_type::(result_type, data) } "DidChangeWatchedFilesNotification" => { return validate_type::(result_type, data) } "PublishDiagnosticsNotification" => { return validate_type::(result_type, data) } "SetTraceNotification" => { return validate_type::(result_type, data) } "LogTraceNotification" => { return validate_type::(result_type, data) } "CancelNotification" => return validate_type::(result_type, data), "ProgressNotification" => { return validate_type::(result_type, data) } // GENERATED_TEST_CODE:end _ => (), } } fn validate_file(file_path: &str) { let basename = std::path::Path::new(&file_path) .file_name() .unwrap() .to_str() .unwrap(); let type_name_result_type: Vec<&str> = basename.split("-").collect(); let lsp_type = type_name_result_type[0]; let result_type = type_name_result_type[1]; let data = &fs::read_to_string(file_path).unwrap(); validate(&lsp_type, &result_type, &data); } #[test] fn test_generated_data() { println!("Running generated data tests"); let cwd = std::env::current_dir() .unwrap() .join("../../packages/testdata"); let env_value = std::env::var("LSP_TEST_DATA_PATH") .unwrap_or_else(|_| cwd.to_str().unwrap().to_string()); println!("TEST_DATA_ROOT: {}", env_value); for json_file in get_all_json_files(env_value.as_str()) { validate_file(&json_file); } } } fn main() { // Use data from test error report here to debug // let json_data = ""; // Update the type here to debug // serde_json::from_str::(json_data).unwrap(); }