facebook / facebook/pyrefly

Docstrings on variables

Open
#2,620 1 comment 0 reactions 1 assignee Claimed by @oyarsa View on GitHub
help wanted language-server
Dominant language
Rust
Stars
7k
Forks
519
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

Given this code:

```py
VAR = "abc"
"""Some documentation."""
```

With pyright, if I hover `VAR`[1], it shows:

```
(constant) VAR: Literal['abc']
──────────────────────────────
Some documentation
```

While pyrefly shows only:

```
(constant) VAR: Literal['abc']
```

I know docstrings on variables are non-standard, but some tools support them, and they're quite useful. Does pyrefly have any plans to support this, or something else instead?

Versions:
- pyright 1.1.408
- pyrefly 0.54.0
- python 3.12.3
- Ubuntu 24.04.3

[1] `vim.lsp.buf.hover` on neovim 0.11.6

### Sandbox Link

[pyright](https://pyright-play.net/?code=GoQQSgBAvBBECGAjAxrAULTBlA9gWwFMIATHZAV0IDsAXeGgSxyoDpNYg)

[pyrefly](https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIAagIIBKABALz0A6Iq2Axmy%2BjyGwDKuALYx6mXJwCuY9ABdU8iLnSF%2BbEABoQ05VDglyiEAGJ6AVX0R5pemGnpOy1XF69MMMPdwAnEUoA%2Buiy2DC%2BABT4iPQQCgCU9AC0AHz0cPK%2BiLz0ufS%2BMPLSvuj2bAByoeExwPgAvjzo2iBkBWBQpITyolAU5gAKpG0d6Rg4BPScqpAA5sVKKmq85oIw4gAW8vLEcIgA9HutXh2EfjN7MOh7kpxwe1Pos-MuVz6%2B9KgAbqjQHLCT0wgc18C1U9FwxBehl4ZHk61USU%2B4TgiyYrBAAGZCABGABMjRAdR0qGcECRADFoDAKGgsHgiGRCUA)

### (Only applicable for extension issues) IDE Information

neovim 0.11.6

```
vim.lsp: Active Clients ~
- pyrefly (id: 1)
- Version: 0.54.0
- Root directory: ~/dev/genret
- Command: { "pyrefly", "lsp" }
- Settings: {}
- Attached buffers: 1
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.