# python: Support nested analysis settings for \`Pyright\` and \`basedpyright\` \(\#62673\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/0cfb1ca1a3d11982e5fa43ad8e76b4bb9a543130)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 0cfb1ca1a3d11982e5fa43ad8e76b4bb9a543130

Requested commit: 0cfb1ca1a3d11982e5fa43ad8e76b4bb9a543130

Commit: 0cfb1ca1a3d11982e5fa43ad8e76b4bb9a543130

Tree: 4f1f8fb3b71335ab2825756267404a3e4e25e185

Author: Xin Zhao

Committer: GitHub

## Message

```
python: Support nested analysis settings for `Pyright` and `basedpyright` (#62673)

# Objective

Closes #62624

Recently, Pyright and BasedPyright changed how they retrieve analysis
settings through `workspace/configuration` in microsoft/pyright#11480
and DetachHead/basedpyright#1847, respectively. Older versions requested
the dotted `python.analysis` and `basedpyright.analysis` sections
directly. Recent versions instead request the parent `python` or
`basedpyright` section and read its nested `analysis` object. Because
Zed stores many existing configurations under the dotted top-level keys,
those settings are not included in its responses to the new
parent-section requests and are therefore silently ignored.

Zed's documentation and many users' settings still use configurations
like this:

https://github.com/zed-industries/zed/blob/9bde578ef5afa84920c4300af25f9dee31c96fcf/docs/src/languages/python.md?plain=1#L131-L148
all the configrations in `basedpyright.analysis` won't work now.

## Solution

To maintain compatibility with both old and new servers, we need to
support both configuration formats. This PR introduces
`normalize_pyright_analysis_configuration`, which copies the analysis
settings into both the dotted and nested formats. This ensures that the
settings are available regardless of which format the language server
requests.

The documentation, however, has been updated to use the nested
structure.

## Testing

New unit tests have been added, and the changes have also been built and
tested locally.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed some Pyright and BasedPyright settings not being applied
properly.
```

## Parents

- [828544342d206f5fb4a987bdd35456f35c2af386](https://git.cafe/gitcafe/zed/commit/828544342d206f5fb4a987bdd35456f35c2af386?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/0cfb1ca1a3d11982e5fa43ad8e76b4bb9a543130?format=markdown)
