5

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

 1 year ago
source link: https://www.v2ex.com/t/903175
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Python

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

  iMath · 11 小时 44 分钟前 · 393 次点击

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

19 条回复    2022-12-17 22:53:07 +08:00
iMath

iMath      9 小时 22 分钟前

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

jfcherng      9 小时 14 分钟前

建議直接用 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.
jfcherng

jfcherng      8 小时 53 分钟前

我自己除非是單文件用的測試腳本,否則不怎麼用 ST 自己的 build system ,我傾向直接在外部的 shell 做事情。

不知道你用不用 Makefile ,如果 project root 有個 Makefile 的話,不管在哪個文件裡,build system 都可以選 Makefile 。
jfcherng

jfcherng      8 小时 46 分钟前

好吧,試了一下。Makefile 在 Windows 的 ST 裡沒用,會報 /bin/sh 找不到的錯誤。。。
iMath

iMath      8 小时 43 分钟前

@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

jfcherng      8 小时 41 分钟前

@iMath #7 據我所知,automatic build 一直都是跑上次所選定的 build system
jfcherng

jfcherng      8 小时 40 分钟前

@jfcherng #9 但這個我不確定是綁定 file, project, view, window 還是什麼
iMath

iMath      8 小时 31 分钟前

我的意思是如果上次我运行的是 A.py ,那么当我切换到 B.py 的情况下如果想再次运行 A.py ,那么我希望找到一种不用切换回 A.py 所在的标签窗口就可以运行它的方法。
@jfcherng
jfcherng

jfcherng      8 小时 17 分钟前

@jfcherng #8 這個無法解決你的用法麼
jfcherng

jfcherng      8 小时 16 分钟前

弄個 project-specific build system 跑 A.py
zhuangzhuang1988

zhuangzhuang1988      8 小时 8 分钟前

歪个楼
还是用 vscode 吧
vscode 用的增强的 pyright -》 pylance
iMath

iMath      7 小时 56 分钟前

@jfcherng 我有点懒写.sublime-project file ,希望能实现一个运行上次的 build command 的功能,况且这个功能也不能局限于 project ,它在各种不同功能的 scripts 之间切换也会用得到。
另外据我了解你说到的 automatic build 应该只是一种自动选择 build system 的机制而不是“一直都是跑上次所選定的 build system”吧?
jfcherng

jfcherng      7 小时 53 分钟前

@iMath #15

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

ST 底層怎麼實現的不可見。在觀察上,我認為他每次都運行上次選定的 build
jfcherng

jfcherng      7 小时 33 分钟前

@iMath #17 經過測試以後,project-specific build system + auto build = 一直都是跑上次所選定的 build system
jfcherng

jfcherng      7 小时 26 分钟前

selector 可以留空,等於永遠匹配

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK