Skip to content

Commit b96899b

Browse files
authored
Update to latest LSP spec with type name changes (#286)
closes #161 closes #159 Updates to latest LSP spec and re-generates lsprotocol package for following languages: - [x] python - [x] rust - [x] dotnet (C#) This includes updates to tests and test code generation.
1 parent d1d8d47 commit b96899b

57 files changed

Lines changed: 6479 additions & 4592 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pr-check.yml

Lines changed: 85 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
- name: Checkout
1212
uses: actions/checkout@v4
1313

14-
- name: Use Python 3.7
14+
- name: Use Python 3.8
1515
uses: actions/setup-python@v4
1616
with:
17-
python-version: 3.7
17+
python-version: 3.8
1818

1919
- name: Pip cache
2020
uses: actions/cache@v3
@@ -28,8 +28,8 @@ jobs:
2828
run: python -m pip install nox
2929
shell: bash
3030

31-
- name: Build sdist and wheels
32-
run: python -m nox --session build
31+
- name: Build pypi package
32+
run: python -m nox --session build_python_package
3333
shell: bash
3434

3535
- name: Upload Python Packages to Artifacts
@@ -96,7 +96,7 @@ jobs:
9696
fail-fast: false
9797
matrix:
9898
os: [ubuntu-latest, windows-latest]
99-
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
99+
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
100100

101101
steps:
102102
- name: Checkout
@@ -115,6 +115,37 @@ jobs:
115115
run: python -m nox --session tests
116116
shell: bash
117117

118+
rust-tests:
119+
name: 'Rust Tests'
120+
runs-on: ${{ matrix.os }}
121+
strategy:
122+
fail-fast: false
123+
matrix:
124+
os: [ubuntu-latest, windows-latest]
125+
steps:
126+
- name: Checkout
127+
uses: actions/checkout@v4
128+
129+
- name: Install Python
130+
uses: actions/setup-python@v4
131+
with:
132+
python-version: '3.x'
133+
134+
- name: Rust Tool Chain setup
135+
uses: dtolnay/rust-toolchain@stable
136+
137+
- name: Install Generator
138+
run: python -m pip install -r ./requirements.txt
139+
140+
- name: Generate Test Data
141+
run: python -m generator --plugin testdata
142+
143+
- name: Rust Run Tests
144+
run: cargo test --manifest-path tests/rust/Cargo.toml
145+
shell: bash
146+
env:
147+
LSP_TEST_DATA_PATH: ${{ github.workspace }}/packages/testdata
148+
118149
dotnet-tests:
119150
name: Dotnet Tests
120151
runs-on: ${{ matrix.os }}
@@ -187,52 +218,52 @@ jobs:
187218
if-no-files-found: error
188219
retention-days: 7
189220

190-
smoke-tests:
191-
name: Smoke Tests (pygls)
192-
runs-on: ${{ matrix.os }}
193-
strategy:
194-
fail-fast: false
195-
matrix:
196-
os: [ubuntu-latest, windows-latest]
197-
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
198-
199-
steps:
200-
- name: Checkout
201-
uses: actions/checkout@v4
202-
203-
- name: Checkout Pygls
204-
uses: actions/checkout@v4
205-
with:
206-
repository: openlawlibrary/pygls
207-
path: smoke_tests
208-
209-
- name: Use Python ${{ matrix.python }}
210-
uses: actions/setup-python@v4
211-
with:
212-
python-version: ${{ matrix.python }}
213-
214-
- name: Update pip, install wheel
215-
run: python -m pip install -U pip wheel
216-
shell: bash
217-
218-
- name: Install pip pygls dependencies
219-
run: python -m pip install typeguard mock pytest pytest-asyncio
220-
shell: bash
221-
222-
- name: Install pip lsprotocol dependencies
223-
run: python -m pip install -r ./packages/python/requirements.txt
224-
shell: bash
225-
226-
- name: Install pygls
227-
run: python -m pip install --no-deps ./smoke_tests
228-
shell: bash
229-
230-
- name: Pip List
231-
run: python -m pip list
232-
shell: bash
233-
234-
- name: Run Tests
235-
run: python -m pytest smoke_tests/tests
236-
env:
237-
PYTHONPATH: ./packages/python
238-
shell: bash
221+
# smoke-tests:
222+
# name: Smoke Tests (pygls)
223+
# runs-on: ${{ matrix.os }}
224+
# strategy:
225+
# fail-fast: false
226+
# matrix:
227+
# os: [ubuntu-latest, windows-latest]
228+
# python: ['3.8', '3.9', '3.10', '3.11', '3.12']
229+
230+
# steps:
231+
# - name: Checkout
232+
# uses: actions/checkout@v4
233+
234+
# - name: Checkout Pygls
235+
# uses: actions/checkout@v4
236+
# with:
237+
# repository: openlawlibrary/pygls
238+
# path: smoke_tests
239+
240+
# - name: Use Python ${{ matrix.python }}
241+
# uses: actions/setup-python@v4
242+
# with:
243+
# python-version: ${{ matrix.python }}
244+
245+
# - name: Update pip, install wheel
246+
# run: python -m pip install -U pip wheel
247+
# shell: bash
248+
249+
# - name: Install pip pygls dependencies
250+
# run: python -m pip install typeguard mock pytest pytest-asyncio
251+
# shell: bash
252+
253+
# - name: Install pip lsprotocol dependencies
254+
# run: python -m pip install -r ./packages/python/requirements.txt
255+
# shell: bash
256+
257+
# - name: Install pygls
258+
# run: python -m pip install --no-deps ./smoke_tests
259+
# shell: bash
260+
261+
# - name: Pip List
262+
# run: python -m pip list
263+
# shell: bash
264+
265+
# - name: Run Tests
266+
# run: python -m pytest smoke_tests/tests
267+
# env:
268+
# PYTHONPATH: ./packages/python
269+
# shell: bash

.github/workflows/push-check.yml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
- name: Checkout
1717
uses: actions/checkout@v4
1818

19-
- name: Use Python 3.7
19+
- name: Use Python 3.8
2020
uses: actions/setup-python@v4
2121
with:
22-
python-version: 3.7
22+
python-version: 3.8
2323

2424
- name: Pip cache
2525
uses: actions/cache@v3
@@ -34,7 +34,7 @@ jobs:
3434
shell: bash
3535

3636
- name: Build sdist and wheels
37-
run: python -m nox --session build
37+
run: python -m nox --session build_python_package
3838
shell: bash
3939

4040
- name: Upload Python Packages to Artifacts
@@ -101,7 +101,7 @@ jobs:
101101
fail-fast: false
102102
matrix:
103103
os: [ubuntu-latest, windows-latest]
104-
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
104+
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
105105

106106
steps:
107107
- name: Checkout
@@ -120,6 +120,37 @@ jobs:
120120
run: python -m nox --session tests
121121
shell: bash
122122

123+
rust-tests:
124+
name: 'Rust Tests'
125+
runs-on: ${{ matrix.os }}
126+
strategy:
127+
fail-fast: false
128+
matrix:
129+
os: [ubuntu-latest, windows-latest]
130+
steps:
131+
- name: Checkout
132+
uses: actions/checkout@v4
133+
134+
- name: Install Python
135+
uses: actions/setup-python@v4
136+
with:
137+
python-version: '3.x'
138+
139+
- name: Rust Tool Chain setup
140+
uses: dtolnay/rust-toolchain@stable
141+
142+
- name: Install Generator
143+
run: python -m pip install -r ./requirements.txt
144+
145+
- name: Generate Test Data
146+
run: python -m generator --plugin testdata
147+
148+
- name: Rust Run Tests
149+
run: cargo test --manifest-path tests/rust/Cargo.toml
150+
shell: bash
151+
env:
152+
LSP_TEST_DATA_PATH: ${{ github.workspace }}/packages/testdata
153+
123154
dotnet-tests:
124155
name: Dotnet Tests
125156
runs-on: ${{ matrix.os }}

.github/workflows/version_check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
version = line.split("=")[1].strip().strip('"')
2121
year, minor, micro = version.split(".")
2222
today = datetime.date.today()
23-
if int(year) != today.year:
24-
print(f"Version {version} year should be {today.year}")
23+
if int(year) not in [today.year, today.year + 1]:
24+
print(f"Version {version} year should be {today.year} or {today.year + 1}")
2525
sys.exit(1)
2626

2727
print("Version check passed")

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ packages/rust/**/target/
1010
packages/rust/**/Cargo.lock
1111
packages/dotnet/lsprotocol/bin/
1212
packages/dotnet/lsprotocol/obj/
13+
tests/rust/**/target/
14+
tests/rust/**/Cargo.lock

.vscode/extensions.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
{
2-
"recommendations": [
3-
"esbenp.prettier-vscode",
4-
"ms-python.python",
5-
"ms-python.vscode-pylance",
6-
"ms-python.black-formatter",
7-
"ms-python.isort"
8-
]
2+
"recommendations": ["esbenp.prettier-vscode", "ms-python.python", "ms-python.vscode-pylance", "charliermarsh.ruff"]
93
}

.vscode/settings.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212
"source.organizeImports": true
1313
},
1414
"[python]": {
15-
"editor.defaultFormatter": "ms-python.black-formatter"
15+
"editor.defaultFormatter": "charliermarsh.ruff",
16+
"editor.formatOnSave": true,
17+
"editor.codeActionsOnSave": {
18+
"source.organizeImports.ruff": true
19+
}
1620
},
17-
"isort.args": ["--profile", "black"],
1821
"python.testing.pytestArgs": ["tests"],
1922
"python.testing.unittestEnabled": false,
2023
"python.testing.pytestEnabled": true,
2124
"python.analysis.extraPaths": ["packages/python", "tests/python/common"],
22-
"rust-analyzer.linkedProjects": ["packages/rust/lsprotocol/Cargo.toml"]
25+
"rust-analyzer.linkedProjects": ["packages/rust/lsprotocol/Cargo.toml", "tests/rust/Cargo.toml"]
2326
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This repository contains code to generate Language Server Protocol types and cla
88

99
You will need a python environment to run the generator. Here are the steps:
1010

11-
1. Create a python environment (min supported python 3.7): `python -m venv .venv`
11+
1. Create a python environment (min supported python 3.8): `python -m venv .venv`
1212
2. Get this tool: `python -m pip install git+https://github.com/microsoft/lsprotocol.git`
1313
3. Run your plugin: `python -m generator --plugin dotnet --output-dir ./code`
1414

@@ -52,10 +52,10 @@ You can format code, run tests, and other tasks using `nox` as well.
5252

5353
Follow these steps to generate boiler plate code for new plugin:
5454

55-
1. Create a virtual environment for python using python 3.7 and activate that environment.
55+
1. Create a virtual environment for python using python 3.8 and activate that environment.
5656
1. If you have python extension for VS Code installed then run `Python: Create Environment` command. Be sure to select all the `requirements.txt` files in the repo. This should, install all packages needed and select the environment for you.
5757
1. Ensure `nox` is installed.
58-
1. Run `nox --list`, is nox is installed oyu should see a list of available sessions. Otherwise, run `python -m pip install nox` from the python 3.7 environment you created above.
58+
1. Run `nox --list`, is nox is installed oyu should see a list of available sessions. Otherwise, run `python -m pip install nox` from the python 3.8 environment you created above.
5959
1. Run `nox --session create_plugin` and follow the prompts to create a new plugin.
6060

6161
Example:

azure-pipelines/release-pypi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ extends:
1919
template: azure-pipelines/pypi-package/pipeline.yml@templates
2020
parameters:
2121
publishPackage: ${{ parameters.publishPackage }}
22-
pythonVersion: '3.7'
22+
pythonVersion: '3.8'
2323
# We don't ship any built in packages.
2424
generateNotice: false
2525
pyProjectTomlPath: $(Build.SourcesDirectory)/packages/python/pyproject.toml
2626
buildSteps:
2727
- script: python -m pip install nox
2828
displayName: Install nox
2929

30-
- script: python -m nox --session build
30+
- script: python -m nox --session build_python_package
3131
displayName: Build package (sdist and wheels)
3232

3333
- publish: $(Build.SourcesDirectory)/packages/python/dist
3434
artifact: dist
35-
displayName: 🚛 Publish artifact
35+
displayName: 🚛 Publish pypi artifact

azure-pipelines/release.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)