带有 coc 和 python 格式的 nvim

nvim with coc and formatting for python

我一直在尝试将 nvim 作为我的代码编辑器,但我在使用代码格式方面遇到了问题。现在我想为 python 设置它,每次我尝试执行格式化操作时,我都会收到以下错误:

[coc.nvim]: UnhandledRejection: request error nvim_call_function - Vim:E117: Unknown function: coc#util#echo_line
Error
    at wF.request (/home/andy/.config/nvim/autoload/plugged/coc.nvim/build/index.js:30:34430)
    at wF.call (/home/andy/.config/nvim/autoload/plugged/coc.nvim/build/index.js:33:3671)
    at Timeout._onTimeout (/home/andy/.config/coc/extensions/node_modules/coc-python/lib/index.js:123358:39)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7)
Press ENTER or type command to continue

这是我的设置: nvim

NVIM v0.5.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az242-526

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

npm

6.14.15

节点

v14.17.6

coc-settings.json

{
  "coc.preferences.formatOnSaveFiletypes": ["css", "markdown", "javascript", "graphql", "html", "yaml",  "json", "python"],

  // python config
  "python.linting.enabled": true,
  "python.linting.pylintEnabled": true,
  "python.formatting.provider": "yapf",

  "snippets.ultisnips.directories":
  [
    "UltiSnips",
    "~/.config/nvim/utils/snips"
  ]

}

错误来自 coc-python,但 coc-python 已弃用,https://github.com/neoclide/coc-python#coc-python,试试 coc-pyright 或 coc-jedi。