Skip to content

Commit

Permalink
Merge branch 'main' into skip-invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
T-256 authored Jan 9, 2025
2 parents 467af1e + b939c3e commit 25bcdd4
Show file tree
Hide file tree
Showing 21 changed files with 2,437 additions and 566 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
env:
UV_SYSTEM_PYTHON: 1
steps:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ jobs:

# Install Node.
- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22

# Install Node dependencies.
- run: npm ci
Expand Down Expand Up @@ -172,9 +172,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Nodejs
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22

- name: Checkout repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -237,9 +237,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Nodejs
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22

- name: Checkout repository
uses: actions/checkout@v3
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

See [here](https://github.com/astral-sh/ruff/releases) for the Ruff release notes.

## 2024.56.0

This release upgrades the bundled Ruff version to `v0.8.0`, and the bundled `ruff-lsp`
version to `0.0.59`.

**Full Changelog**: https://github.com/astral-sh/ruff-vscode/compare/2024.54.0...2024.56.0

## 2024.54.0

This release upgrades the bundled Ruff version to `v0.7.1` that includes an important
fix for the language server to avoid indexing the entire root directory when opening
a file directly in VS Code.

**Full Changelog**: https://github.com/astral-sh/ruff-vscode/compare/2024.52.0...2024.54.0

## 2024.52.0

This release upgrades the bundled Ruff version to `v0.7.0`, and the bundled `ruff-lsp`
version to `0.0.58`.

**Full Changelog**: https://github.com/astral-sh/ruff-vscode/compare/2024.50.0...2024.52.0

## 2024.50.0

This release upgrades the bundled Ruff version to `v0.6.6`, and the bundled `ruff-lsp`
Expand Down
21 changes: 9 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ This extension is based on the [Template for VS Code Python tools extensions](ht

### Getting Started

- Install [`uv`](https://github.com/astral-sh/uv)
- Install [`just`](https://github.com/casey/just), or see the `justfile` for corresponding commands.
- Create and activate a virtual environment (e.g., `python -m venv .venv && source .venv/bin/activate`).
- Create and activate a virtual environment (e.g., `uv venv && source .venv/bin/activate`).
- Install development dependencies (`just install`).
- To automatically format the codebase, run: `just fmt`.
- To run lint and type checks, run: `just check`.
Expand All @@ -19,7 +20,7 @@ and Python log messages in the debug console under "Python Server".
### Modifying the LSP

- Clone [ruff-lsp](https://github.com/astral-sh/ruff-lsp) to, e.g., `../ruff-lsp`.
- In `../ruff-lsp`, run: `pip install -t ../ruff-vscode/bundled/libs/ -e .`.
- In `../ruff-lsp`, run: `uv pip install -t ../ruff-vscode/bundled/libs/ -e .`.

### Using a custom version of ruff

Expand All @@ -29,16 +30,12 @@ and Python log messages in the debug console under "Python Server".

## Release

- Bump the version in `package.json` and `pyproject.toml` (use even numbers for stable releases).
- Bump the `ruff` and `ruff-lsp` versions in `pyproject.toml`.
- Update the `ruff` version in the README.md
- in the Base URLs
- in "The extension ships with `ruff==...`"
- Make sure you use Python 3.7 installed and as your default Python.
- Run `python -m venv .venv` to create a venv and activate it.
- Run `python -m pip install pip-tools` to install `pip-tools`.
- Run `rm requirements.txt requirements-dev.txt` and then `just lock` to update `ruff` and `ruff-lsp`.
- Make sure you have Python 3.7 installed and locatable by uv.
(If you're using pyenv, you may need to run `pyenv local 3.7`.)
- Run `uv run --python=3.7 scripts/release.py`.
(Run `uv run --python=3.7 scripts/release.py --help` for information on what this script does,
and its various options.)
- Check the changes the script made, copy-edit the changelog, and commit the changes.
- Create a new PR and merge it.
- Update the Changelog
- [Create a new Release](https://github.com/astral-sh/ruff-vscode/releases/new), enter `x.x.x` (where `x.x.x` is the new version) into the _Choose a tag_ selector. Click _Generate release notes_, curate the release notes and publish the release.
- The Release workflow publishes the extension to the VS Code marketplace.
68 changes: 48 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Ruff extension for Visual Studio Code

[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![image](https://img.shields.io/pypi/v/ruff/0.6.6.svg)](https://pypi.python.org/pypi/ruff)
[![image](https://img.shields.io/pypi/l/ruff/0.6.6.svg)](https://pypi.python.org/pypi/ruff)
[![image](https://img.shields.io/pypi/pyversions/ruff/0.6.6.svg)](https://pypi.python.org/pypi/ruff)
[![image](https://img.shields.io/pypi/v/ruff/0.8.0.svg)](https://pypi.python.org/pypi/ruff)
[![image](https://img.shields.io/pypi/l/ruff/0.8.0.svg)](https://pypi.python.org/pypi/ruff)
[![image](https://img.shields.io/pypi/pyversions/ruff/0.8.0.svg)](https://pypi.python.org/pypi/ruff)
[![Actions status](https://github.com/astral-sh/ruff-vscode/workflows/CI/badge.svg)](https://github.com/astral-sh/ruff-vscode/actions)

> [!NOTE]
Expand All @@ -21,7 +21,7 @@ Python linter and code formatter, written in Rust. Available on the [Visual Stud
Ruff can be used to replace Flake8 (plus dozens of plugins), Black, isort, pyupgrade, and more,
all while executing tens or hundreds of times faster than any individual tool.

The extension ships with `ruff==0.6.6`.
The extension ships with `ruff==0.8.0`.

## Highlights

Expand Down Expand Up @@ -335,7 +335,7 @@ To use a custom configuration file, set the `ruff.configuration` setting to the
```

Finally, to use a common Ruff configuration across all projects, consider creating a user-specific
`pyproject.toml` or `ruff.toml` file as described in the [FAQ](https://docs.astral.sh/ruff/faq/#does-ruff-support-numpy-or-google-style-docstrings).
`pyproject.toml` or `ruff.toml` file as described in the [FAQ](https://docs.astral.sh/ruff/faq/#how-can-i-change-ruffs-default-configuration).

#### Python-based language server (`ruff-lsp`)

Expand Down Expand Up @@ -366,14 +366,15 @@ Finally, to use a common Ruff configuration across all projects, consider creati

## Commands

| Command | Description |
| -------------------------------------------------- | ------------------------------------------------ |
| Ruff: Fix all auto-fixable problems | Fix all auto-fixable problems. |
| Ruff: Format Imports | Organize imports. |
| Ruff: Format Document | Format the entire document. |
| Ruff: Restart Server | Force restart the linter server. |
| Ruff: Print debug information (native server only) | Print debug information about the native server. |
| Ruff: Show logs | Open the Ruff output channel. |
| Command | Description |
| -------------------------------------------------- | ----------------------------------------------- |
| Ruff: Fix all auto-fixable problems | Fix all auto-fixable problems |
| Ruff: Format Imports | Organize imports |
| Ruff: Format Document | Format the entire document |
| Ruff: Restart Server | Force restart the linter server |
| Ruff: Print debug information (native server only) | Print debug information about the native server |
| Ruff: Show client logs | Open the Ruff output channel |
| Ruff: Show server logs | Open the Ruff Language Server output channel |

## Requirements

Expand All @@ -383,21 +384,48 @@ itself is compatible with Python 3.7 to 3.13.
## Troubleshooting

If you encounter any issues with the extension or the language server, please refer to the
logs in the output panel in VS Code. You can access the logs by running the `Ruff: Show logs`
command.
logs in the corresponding output channel in VS Code. The extension logs are in the "Ruff"
output channel and the language server logs are in the "Ruff Language Server" output channel.

To open the output panel, use the `Output: Show Output Channels` command in the command palette
(`Ctrl+Shift+P` or `Cmd+Shift+P`), then select "Ruff" or "Ruff Language Server". Alternatively,
you can use the `Ruff: Show client logs` and `Ruff: Show server logs` command to open the "Ruff"
and "Ruff Language Server" output channel respectively.

The default log level for the extension is `info` which can be changed from the output panel using
the settings icon in the top right corner of the panel.

The default log level for the language server is `info` which can be changed using the `ruff.logLevel`
setting in your `settings.json`:

```json
{
"ruff.logLevel": "info"
}
```

The language server logs can be directed to a file by setting the `ruff.logFile` setting in
your `settings.json`:

```json
{
"ruff.logFile": "/path/to/ruff.log"
}
```

By default, the output panel will only contain logs from the extension. To enable logs from the
language server, set the `trace.server` setting to `messages` in your `settings.json`:
To capture the LSP messages between the editor and the server, set the `ruff.trace.server`
setting to either `messages` or `verbose` in your `settings.json`:

```json
{
"ruff.trace.server": "messages"
}
```

The trace value can also be set to `verbose` for more detailed logs. If you're using the Rust-based
language server, you can use the `ruff.logLevel` setting to control the log level of the server and
`ruff.logFile` to write logs to a file instead of the output panel.
This will be visible in the "Ruff Language Server Trace" output channel. The difference between
`messages` and `verbose` is that `messages` only logs the method name for both the request
and response, while `verbose` also logs the request parameters sent by the client and the
response result sent by the server.

The extension also displays certain information in the status bar. This can be pinned to the status
bar as a permanent item.
Expand Down
12 changes: 8 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ e2e-tests: setup
npm run tests

check:
ruff check ./bundled/tool ./build ./tests
ruff format --check ./bundled/tool ./build ./tests
ruff check ./bundled/tool ./build ./tests ./scripts
ruff format --check ./bundled/tool ./build ./tests ./scripts
uvx --with=types-requests --with=tomli --with=tomlkit --with=packaging --with=rich-argparse mypy scripts/release.py --strict --warn-unreachable --enable-error-code=possibly-undefined --enable-error-code=redundant-expr --enable-error-code=truthy-bool
mypy ./bundled/tool ./build ./tests
npm run fmt-check
npm run lint
npm run tsc

fmt:
ruff check --fix ./bundled/tool ./build ./tests
ruff format ./bundled/tool ./build ./tests
ruff check --fix ./bundled/tool ./build ./tests ./scripts
ruff format ./bundled/tool ./build ./tests ./scripts
npm run fmt

build-package: setup
Expand All @@ -41,3 +42,6 @@ clean:
rm -rf node_modules
rm -rf .vscode-test
rm -rf bundled/libs

release:
uv run --python=3.7 scripts/release.py
Loading

0 comments on commit 25bcdd4

Please sign in to comment.