推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
superhxl
V2EX  ›  Python

Neovim 的代码检查、补全问题

  •  
  •   superhxl · Nov 5, 2025 · 2620 views
    This topic created in 199 days ago, the information mentioned may be changed or developed.

    Neovim 采用 nvim-cmp + pyright 进行 Python 代码检查、补全,但是对于复杂的代码,譬如自定义类,继承自父类的一些属性、方法就检测不到,提示错误。如图: 自定义类 MoneyAgent 中有继承自父类 CellAgent 的对象 cell ,cell 具有属性 neighborhood ,pyright 完全意识不到。 请教: 1 、是不是有设置方法可以改进、提升 2 、除了 pyright 或者 nvim-cmp ,是不是还有更好的补全工具? 谢谢,请各位 V 友不吝赐教。

    5 replies    2025-11-07 15:50:14 +08:00
    user1284
        1
    user1284  
       Nov 5, 2025   ❤️ 1
    我觉得应该是 lsp 能力有限, 之前在 vsc 上试过也是一样的, 嵌套过深就不行, 最终还是得用 ide.包括 pyrefly 的跳转也是完全不能用.
    apple115
        2
    apple115  
       Nov 5, 2025
    或许可以试试 basepyright
    superhxl
        3
    superhxl  
    OP
       Nov 5, 2025
    @apple115 一样的,存在同样的问题。
    Syiize
        4
    Syiize  
       Nov 5, 2025
    给 cell 手动加个 type hint 就好了,比如 def __init__(self, model, cell: CLASS_TYPE)
    Alias4ck
        5
    Alias4ck  
       Nov 7, 2025
    pylance /pyrefly/ty
    虽然 ty/prefly 有很多功能没有支持
    可以用 pylance 的 crack 版本 delance😄
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2222 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 466ea39e · 43ms · UTC 00:31 · PVG 08:31 · LAX 17:31 · JFK 20:31
    ♥ Do have faith in what you're doing.