Skip to content

Fix indexing of excluded nested Ruff workspaces - #27303

Merged
MichaReiser merged 2 commits into
mainfrom
micha/fix-nested-workspace-exclusions
Jul 29, 2026
Merged

Fix indexing of excluded nested Ruff workspaces#27303
MichaReiser merged 2 commits into
mainfrom
micha/fix-nested-workspace-exclusions

Conversation

@MichaReiser

@MichaReiser MichaReiser commented Jul 29, 2026

Copy link
Copy Markdown
Member

Summary

Never exclude explicitly opened workspace folders. Treat them the same as a ruff check <excluded_folder>

Fixes astral-sh/ruff-vscode#753.

Test Plan

Added E2E integration tests

@astral-sh-bot astral-sh-bot Bot added the server Related to the LSP server label Jul 29, 2026
// An explicitly opened workspace root must be indexed even if an ancestor
// configuration excludes it. Excluded descendants can still be skipped.
if depth > 0
&& let Some(file_name) = directory.file_name()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We skip workspace folders before where the ancestor configuration excluded them (the ancestor configuration is built above)

@MichaReiser
MichaReiser requested a review from dhruvmanila July 29, 2026 09:08
@astral-sh-bot

astral-sh-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

ExtendExclude,
}

fn nested_workspace_server(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be useful to have the function doc include the file tree it's constructing otherwise it's a little bit hard to visualize the tree structure here 😅

Thanks to Codex:

<temp_dir>/
├── .ruff.toml              # exclude or extend-exclude = ["sub"]
├── test.py
├── sub/
│   ├── .ruff.toml          # extend-exclude = ["foo"]
│   │                       # format.quote-style = "single"
│   ├── test.py
│   └── foo/
│       └── test.py
└── unrelated/
    └── test.py

.with_file(
".ruff.toml",
r#"target-version = "py312"
line-length = 120

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we reduce the line-length value here and reduce the size of the ISSUE_SOURCE content mainly for readability?

@MichaReiser
MichaReiser enabled auto-merge (squash) July 29, 2026 17:34
@MichaReiser
MichaReiser merged commit 7de420e into main Jul 29, 2026
46 checks passed
@MichaReiser
MichaReiser deleted the micha/fix-nested-workspace-exclusions branch July 29, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server Related to the LSP server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nested workspace omits sub configs, probably because of extend-exclude

2 participants