能分享一下你们的 sublime lsp-pyright 配置吗?小白无从下手 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
iMath
V2EX    Python

能分享一下你们的 sublime lsp-pyright 配置吗?小白无从下手

  •  
  •   iMath 2022-12-17 18:35:03 +08:00 3226 次点击
    这是一个创建于 1104 天前的主题,其中的信息可能已经有所发展或是发生改变。

    还有就是能否配置 nodejs 的路径?

    19 条回复    2022-12-17 22:53:07 +08:00
    jfcherng
        1
    jfcherng  
       2022-12-17 18:52:06 +08:00
    理上是箱即用的西,不知道你遇到了什。

    > 还有就是能否配置 nodejs 的路径?

    https://www.reddit.com/r/SublimeText/comments/o5g8mk/how_to_use_lsp_with_nvm/

    不想省事的,建直接用 lsp_utils 提供的 node.
    iMath
        2
    iMath  
    OP
       2022-12-17 20:57:00 +08:00
    @jfcherng 因为我下载的是便携版的 nodejs ,想问问看怎么设置了让 lsp-pyright 正常工作起来
    jfcherng
        3
    jfcherng  
       2022-12-17 21:05:17 +08:00
    建直接用 lsp_utils 提供的 node 省事。lsp_utils 找不到 node 要不要下版才是,然後它下便版放在某他自己管理的地方,使用它跑 pyright 。

    > 因为我下载的是便携版的 nodejs ,想问问看怎么设置了让 lsp-pyright 正常工作起来

    已了。

    add the following to your LSP-* config.

    "env": {
    "PATH": "$PATH:YOUR_NODE_DIR"
    }

    Or just install Node.js via LSP.
    iMath
        4
    iMath  
    OP
       2022-12-17 21:15:55 +08:00
    @jfcherng 多谢啦!不好意思,后面我没办法就放弃用便携版的执念改用安装到 C 盘的方式了,现在已经正常工作了。

    BTW ,不知道你是否知道怎么解决我这个问题 https://stackoverflow.com/questions/74834145/let-sublimetext-run-last-used-build-command
    jfcherng
        5
    jfcherng  
       2022-12-17 21:26:18 +08:00
    我自己除非是文件用的本,否不怎用 ST 自己的 build system ,我向直接在外部的 shell 做事情。

    不知道你用不用 Makefile ,如果 project root 有 Makefile 的,不管在哪文件,build system 都可以 Makefile 。
    jfcherng
        6
    jfcherng  
       2022-12-17 21:32:52 +08:00
    好吧,了一下。Makefile 在 Windows 的 ST 用, /bin/sh 找不到的。。。
    iMath
        7
    iMath  
    OP
       2022-12-17 21:35:40 +08:00
    @jfcherng 谢谢回复!主要还是:“I expect there is a feature to remember last build command so that I can repeat last command by some shortcut.”这样子才方便我运行其他的一些非 project 内的各种用途的 script 。
    jfcherng
        8
    jfcherng  
       2022-12-17 21:36:35 +08:00
    ST 的 project settings 例中好有 build system 的例子
    https://www.sublimetext.com/docs/projects.html#project-format
    jfcherng
        9
    jfcherng  
       2022-12-17 21:37:35 +08:00
    @iMath #7 我所知,automatic build 一直都是跑上次所定的 build system
    jfcherng
        10
    jfcherng  
       2022-12-17 21:38:35 +08:00
    @jfcherng #9 但我不定是定 file, project, view, window 是什
    iMath
        11
    iMath  
    OP
       2022-12-17 21:47:54 +08:00
    我的意思是如果上次我运行的是 A.py ,那么当我切换到 B.py 的情况下如果想再次运行 A.py ,那么我希望找到一种不用切换回 A.py 所在的标签窗口就可以运行它的方法。
    @jfcherng
    jfcherng
        12
    jfcherng  
       2022-12-17 22:01:50 +08:00
    @jfcherng #8 法解你的用法
    jfcherng
        13
    jfcherng  
       2022-12-17 22:03:10 +08:00
    弄 project-specific build system 跑 A.py
    zhuangzhuang1988
        14
    zhuangzhuang1988  
       2022-12-17 22:11:16 +08:00
    歪个楼
    还是用 vscode 吧
    vscode 用的增强的 pyright -》 pylance
    iMath
        15
    iMath  
    OP
       2022-12-17 22:22:37 +08:00
    @jfcherng 我有点懒写.sublime-project file ,希望能实现一个运行上次的 build command 的功能,况且这个功能也不能局限于 project ,它在各种不同功能的 scripts 之间切换也会用得到。
    另外据我了解你说到的 automatic build 应该只是一种自动选择 build system 的机制而不是“一直都是跑上次所定的 build system”吧?
    jfcherng
        16
    jfcherng  
       2022-12-17 22:25:59 +08:00
    @iMath #15

    > 据我了解你说到的 automatic build 应该只是一种自动选择 build system 的机制而不是“一直都是跑上次所定的 build system”吧?

    ST 底怎的不可。在察上,我他每次都行上次定的 build
    iMath
        17
    iMath  
    OP
       2022-12-17 22:32:05 +08:00
    @jfcherng 我理解的 automatic build 和你说的可能有差别,我理解成[这里的`selector`选项]( https://sublime-text-unofficial-documentation.readthedocs.io/en/sublime-text-2/reference/build_systems.html#build-system-specific-options)
    jfcherng
        18
    jfcherng  
       2022-12-17 22:45:53 +08:00
    @iMath #17 以後,project-specific build system + auto build = 一直都是跑上次所定的 build system
    jfcherng
        19
    jfcherng  
       2022-12-17 22:53:07 +08:00
    selector 可以留空,等於永匹配
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     5612 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 32ms UTC 02:23 PVG 10:23 LAX 18:23 JFK 21:23
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86