推荐学习书目
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
darylc
V2EX  ›  Python

关于 Python Language Server 在 VsCode 中增加代码提示的问题

  •  
  •   darylc · Oct 31, 2021 · 2563 views
    This topic created in 1675 days ago, the information mentioned may be changed or developed.

    先说说我干了啥,在 Python 的初始化的时候,自动为每个 View 生成 Schema class(使用 pydantic ,联动对应的 Model)用以校验请求入参和出参,并且生成了对应的 schema 对象(例如:req_obj, resp_obj),现在我在想,有没有可能,我在写某个对应的 View 时,使用到了req_obj/resp_obj能够在 VsCode 展示对应的提示,现在想到了两种方式:

    1. 使用 VsCode 插件
    2. 对 Language Server 做插件

    两种方式都没有做过,想来问问各位大佬有木有建议教教小弟

    2 replies    2021-10-31 20:08:10 +08:00
    janxin
        1
    janxin  
       Oct 31, 2021
    没太明白你的需求,type hint 不能满足你的需求吗
    darylc
        2
    darylc  
    OP
       Oct 31, 2021 via Android
    @janxin 我的 schema class 是运行时生成的,用 type hint 搞不定吧,毕竟对于不同的 model 会生成不同的 schema class
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1761 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 257ms · UTC 16:26 · PVG 00:26 · LAX 09:26 · JFK 12:26
    ♥ Do have faith in what you're doing.