Skip to content

Commit d66904e

Browse files
authored
Merge branch 'main' into remove-pylance-client2
2 parents 0d77877 + cd5ecb9 commit d66904e

Some content is hidden

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

47 files changed

+1444
-553
lines changed

.github/actions/build-vsix/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ runs:
2222
using: 'composite'
2323
steps:
2424
- name: Install Node
25-
uses: actions/setup-node@v4
25+
uses: actions/setup-node@v6
2626
with:
2727
node-version: ${{ inputs.node_version }}
2828
cache: 'npm'
@@ -32,7 +32,7 @@ runs:
3232

3333
# Jedi LS depends on dataclasses which is not in the stdlib in Python 3.7.
3434
- name: Use Python 3.9 for JediLSP
35-
uses: actions/setup-python@v5
35+
uses: actions/setup-python@v6
3636
with:
3737
python-version: 3.9
3838
cache: 'pip'
@@ -93,7 +93,7 @@ runs:
9393
VSIX_NAME: ${{ inputs.vsix_name }}
9494

9595
- name: Upload VSIX
96-
uses: actions/upload-artifact@v4
96+
uses: actions/upload-artifact@v5
9797
with:
9898
name: ${{ inputs.artifact_name }}
9999
path: ${{ inputs.vsix_name }}

.github/actions/lint/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ runs:
1010
using: 'composite'
1111
steps:
1212
- name: Install Node
13-
uses: actions/setup-node@v4
13+
uses: actions/setup-node@v6
1414
with:
1515
node-version: ${{ inputs.node_version }}
1616
cache: 'npm'
@@ -36,7 +36,7 @@ runs:
3636
shell: bash
3737

3838
- name: Install Python
39-
uses: actions/setup-python@v5
39+
uses: actions/setup-python@v6
4040
with:
4141
python-version: '3.x'
4242
cache: 'pip'
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
applyTo: '**'
3+
description: This document describes how to deal with learnings that you make. (meta instruction)
4+
---
5+
6+
This document describes how to deal with learnings that you make.
7+
It is a meta-instruction file.
8+
9+
Structure of learnings:
10+
11+
- Each instruction file has a "Learnings" section.
12+
- Each learning has a counter that indicates how often that learning was useful (initially 1).
13+
- Each learning has a 1 sentence description of the learning that is clear and concise.
14+
15+
Example:
16+
17+
```markdown
18+
## Learnings
19+
20+
- Prefer `const` over `let` whenever possible (1)
21+
- Avoid `any` type (3)
22+
```
23+
24+
When the user tells you "learn!", you should:
25+
26+
- extract a learning from the recent conversation
27+
_ identify the problem that you created
28+
_ identify why it was a problem
29+
_ identify how you were told to fix it/how the user fixed it
30+
_ generate only one learning (1 sentence) that helps to summarize the insight gained
31+
- then, add the reflected learning to the "Learnings" section of the most appropriate instruction file
32+
33+
Important: Whenever a learning was really useful, increase the counter!!
34+
When a learning was not useful and just caused more problems, decrease the counter.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
applyTo: 'python_files/**'
3+
description: Guide for running and fixing Python quality checks (Ruff and Pyright) that run in CI
4+
---
5+
6+
# Python Quality Checks — Ruff and Pyright
7+
8+
Run the same Python quality checks that run in CI. All checks target `python_files/` and use config from `python_files/pyproject.toml`.
9+
10+
## Commands
11+
12+
```bash
13+
npm run check-python # Run both Ruff and Pyright
14+
npm run check-python:ruff # Linting and formatting only
15+
npm run check-python:pyright # Type checking only
16+
```
17+
18+
## Fixing Ruff Errors
19+
20+
**Auto-fix most issues:**
21+
22+
```bash
23+
cd python_files
24+
python -m ruff check . --fix
25+
python -m ruff format
26+
npm run check-python:ruff # Verify
27+
```
28+
29+
**Manual fixes:**
30+
31+
- Ruff shows file, line number, rule code (e.g., `F841`), and description
32+
- Open the file, read the error, fix the code
33+
- Common: line length (100 char max), import sorting, unused variables
34+
35+
## Fixing Pyright Errors
36+
37+
**Common patterns and fixes:**
38+
39+
- **Undefined variable/import**: Add the missing import
40+
- **Type mismatch**: Correct the type or add type annotations
41+
- **Missing return type**: Add `-> ReturnType` to function signatures
42+
```python
43+
def my_function() -> str: # Add return type
44+
return "result"
45+
```
46+
47+
**Verify:**
48+
49+
```bash
50+
npm run check-python:pyright
51+
```
52+
53+
## Configuration
54+
55+
- **Ruff**: Line length 100, Python 3.9+, 40+ rule families (flake8, isort, pyupgrade, etc.)
56+
- **Pyright**: Version 1.1.308 (or whatever is found in the environment), ignores `lib/` and 15+ legacy files
57+
- Config: `python_files/pyproject.toml` sections `[tool.ruff]` and `[tool.pyright]`
58+
59+
## Troubleshooting
60+
61+
**"Module not found" in Pyright**: Install dependencies
62+
63+
```bash
64+
python -m pip install --upgrade -r build/test-requirements.txt
65+
nox --session install_python_libs
66+
```
67+
68+
**Import order errors**: Auto-fix with `ruff check . --fix`
69+
70+
**Type errors in ignored files**: Legacy files in `pyproject.toml` ignore list—fix if working on them
71+
72+
## Learnings
73+
74+
- Always run `npm run check-python` before pushing to catch CI failures early (1)
75+
- Use `ruff check . --fix` to auto-fix most linting issues before manual review (1)
76+
- Pyright version must match CI (1.1.308) to avoid inconsistent results between local and CI runs (1)

0 commit comments

Comments
 (0)