neoclide / coc-python

Python extension for coc.nvim, fork of vscode-python
573 stars 51 forks source link
coc neovim python vim

coc-python

WARNING: it's recommended to use coc-pyright if you're using python3 or use coc-jedi if you're using jedi, the code of coc-python is too hard to maintain!

Python extension for coc.nvim, fork of vscode-python from commit 16899f6b13477786212f29eb3cb7a459b5ebf0a4.

Built with rich support for the Python language (for all actively supported versions of the language: 2.7, >=3.5), including features such as linting, IntelliSense, code navigation, code formatting, refactoring, snippets, and more!

关于 VS Code 中 python 的智障补全的解决方案,以 pytorch 为例

Install

In your vim/neovim, run command:

:CocInstall coc-python

Get start

Useful commands

Open the Command List (use :CocCommand command in vim) and type in one of the following commands:

Command Description
python.setInterpreter Switch between Python interpreters, versions, and environments.
python.startREPL Start an interactive Python REPL using the selected interpreter in the VS Code terminal.
python.execInTerminal Runs the active Python file in the VS Code terminal.
python.setLinter Switch from PyLint to flake8 or other supported linters.
python.upgradePythonLanguageServer Upgrade MPLS to latest daily version.

To see all available Python commands, open the Command Palette and type Python.

Note: to enable multiple linters, edit the configuration file instead of use python.setLinter command.

Features

Except from test, debug and datascience features of vscode-python.

Options

F.A.Q

Q: "python.linting.enabled": false not work when jedi disabled.

A: That setting only works when python files are used, not MPLS, you have to use "python.analysis.diagnosticEnabled": false to disable diagnostics from language server.

Q: MPLS using too much memory and CPU.

A: It's bug of MPLS, checkout https://github.com/Microsoft/python-language-server/issues/832.

Q: MPLS doesn't work with unsaved buffer.

A: Yes, it's not. You have to save your buffer to make it work.

Q: Get unable to find document error from MPLS.

A: Some filename would cause MPLS throw this error.

License

MIT