![]() | 1 mineralsalt 2022-10-02 02:04:25 +08:00 ![]() PyCharm, VSCode 不好么, 折腾自己没意思 |
![]() | 2 jfcherng 2022-10-02 02:16:58 +08:00 然我在用 Anaconda , 不些 completions 看著都不像是自 Anaconda |
![]() | 3 jfcherng 2022-10-02 02:19:55 +08:00 |
![]() | 4 jeeyong OP |
![]() | 5 jeeyong OP |
![]() | 7 jfcherng 2022-10-02 09:16:51 +08:00 requests 可能需要 stubs (?) 可以 pip install types-requests |
![]() | 8 jfcherng 2022-10-02 09:25:29 +08:00 ![]() 或者跳槽改用 LSP + LSP-pyright (狗 |
![]() | 9 jeeyong OP |
![]() | 10 jeeyong OP |
![]() | 11 ChrisFreeMan 2022-10-02 12:05:09 +08:00 ![]() 虽然没用过 sublime ,但是配置 python 的开发环境不要太简单,无论什么编辑器,只要支持 lsp ,就配置三个东西就行了 pyright autopep8 || black (代码格式化) mypy (如果使用静态类型的话,建议覆盖掉 pyright 的静态检查) |
![]() | 12 jeeyong OP |
![]() | 13 ChrisFreeMan 2022-10-02 12:22:12 +08:00 @jeeyong 这下舒服了 |
![]() | 14 jeeyong OP @jfcherng 你和我说 lsp 的时候, 我搜索的方向完全是错误的..所以没发现这个好东西. 跳槽了! @ChrisFreeMan 我现在的表情就好像你得头像... 果断卸载了 Anaconda... 那么,请问 vscode 的 ms-pyright 好用嘛? 替代原来的 python 插件. |
![]() | 15 ChrisFreeMan 2022-10-02 12:29:12 +08:00 @jeeyong 那个所谓的 python 插件是一个集成的配置环境,和 pyright 不是一个东西,pyright 只是 lsp 。而 python 插件可以让你选择配置更多的功能,比如选择其他 lsp ,配置自动格式化插件,配置代码 lint 等等 |
![]() | 16 jeeyong OP @ChrisFreeMan 喔...受教. |
![]() | 17 jfcherng 2022-10-02 13:19:23 +08:00 ![]() 如果你用操作的,LSP 的 default keybinding 有很多例,可以自己配置一下。 |
![]() | 19 jeeyong OP @GTim 代码主题是 brogrammer. Sublime 主题是 predawn 然后 settings 里添加如下修改 "predawn_findreplace_small": true, "predawn_quick_panel_small": false, "predawn_sidebar_arrows": false, "predawn_sidebar_large": false, "predawn_sidebar_medium": true, "predawn_sidebar_narrow": false, "predawn_sidebar_small": false, "predawn_sidebar_xlarge": false, "predawn_sidebar_xsmall": false, "predawn_tabs_active_underline": true, "predawn_tabs_large": false, "predawn_tabs_medium": true, "predawn_tabs_small": false, "theme": "predawn-DEV.sublime-theme", |
![]() | 21 brucmao 2022-10-02 19:11:32 +08:00 我用的 LSP-pylsp 当时按这个配置的,提示好像没有 LSP-pyright 多 https://yeray.dev/python/setting-up-sublime-text-4-for-python |
22 PrinceofInj 2022-10-02 20:06:02 +08:00 @ChrisFreeMan 怪不得,之前初学 python ,在 vscode 安装了 Python 插件,结果多了一个叫啥 jupyter 的东西,搞得我完全不会了。 |
![]() | 23 ChrisFreeMan 2022-10-02 20:23:46 +08:00 @PrinceofInj 一开始给用户塞太多东西是很容易困惑,好在 VSCode 尽量做到了自动化,傻瓜式的配置,起码能马上用起来。 |
![]() | 24 XIVN1987 2022-10-03 09:54:01 +08:00 @jfcherng 感谢推荐,,试了下,,LSP-pyright 好强大,,速度快、补全准确,,比我现在用的 SublimeJEDI 强大 100 倍,,sublime 下终于有能用的 python 补全了。。 |
![]() | 26 milkpuff 2022-10-04 13:00:14 +08:00 @jfcherng 头像眼熟,一看是 github sublimelsp/LSP-pyright 的第一贡献者。 anaconda 的 github 上也推荐使用 lsp ,我也从 anaconda 切到了 lsp 。 |
![]() | 27 brucmao 2022-10-06 11:43:22 +08:00 @jeeyong 能发下你的 lsp-pyright 配置吗,我同时用了 LSP-py-lsp 和 LSP-pyright ,会报错 https://s3.bmp.ovh/imgs/2022/10/06/60a2bc3d47751d21.png |
![]() | 28 jeeyong OP |
![]() | 29 brucmao 2022-10-06 22:28:09 +08:00 @jeeyong 确实不影响使用,我现在同时用 lsp-pylsp 和 lsp-pyright ,设置如下 ``` { "pylsp.plugins.mypy-ls.enabled": true, "pylsp.plugins.flake8.enabled": true, // "pylsp.plugins.black.enabled":true, "pylsp.configurationSources": ["flake8"], "pylsp.plugins.pyls_black.enabled": true, "disabled_capabilities": { "completionProvider": true, "definitionProvider": true, "documentHighlightProvider": true, "documentSymbolProvider": true, "hoverProvider": true, "referencesProvider": true, "renameProvider": true, "signatureHelpProvider": true, }, "settings": { "pylsp.plugins.jedi_completion.enabled": false, "pylsp.plugins.jedi_definition.enabled": false, "pylsp.plugins.jedi_hover.enabled": false, "pylsp.plugins.jedi_references.enabled": false, "pylsp.plugins.jedi_signature_help.enabled": false, "pylsp.plugins.jedi_symbols.enabled": false, }, } ``` https://github.com/sublimelsp/LSP-pylsp#running-alongside-lsp-pyright |
![]() | 30 jfcherng 2022-10-07 09:03:38 +08:00 ![]() @brucmao #29 LSP-pyright 依於 builtin python syntax, 必保 builtin python syntax 有被 disable |
![]() | 31 brucmao 2022-10-07 12:55:43 +08:00 @jfcherng 找到原因了,我以前安装了[MagicPython]( https://github.com/MagicStack/MagicPython),把内置的 python 给禁用了 |
32 iMath 2022-12-17 18:29:28 +08:00 能分享一下你们的 lsp-pyright 配置吗?小白无从下手 |