Skip to content

Docstrings on variables #2620

@oyarsa

Description

@oyarsa

Describe the Bug

Given this code:

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

pyrefly

(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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedLarger than "good first issue", but still well-defined and ready for someone to pick uplanguage-serverIssues specific to our IDE integration rather than type checking

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions