Skip to content

Commit

Permalink
Replace coc-pyright because of performance issues
Browse files Browse the repository at this point in the history
coc-pyright is often stuck at 100% CPU for minutes when it encounters
certain functions, probably while generating inlay type hints.
(see fannheyward/coc-pyright#1087)

pyright itself doesn't provide these hints (MS keeps that feature hidden
in the closed-source pylance VS Code extension), but the fork
basedpyright does. Performance has been good so far, so switch to using
that language server directly from coc.nvim

coc-pyright also handled linting / formatting via e.g. ruff, so that
functionality needs to be replaced as well.

efm-languageserver acts like a proxy between LSP clients and linting /
formatting tools. Multiple tools can be configured per language to
provide linting suggestions or formatting files.

coc.nvim is okay with running multiple language servers for a filetype,
so basedpyright and efm-languageserver can be used together.
  • Loading branch information
Terr committed Jan 29, 2025
1 parent 453a6e9 commit 9e3f9fe
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
18 changes: 18 additions & 0 deletions home/.config/efm-langserver/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
root-markers:
- .git/
- .hg/
lint-debounce: 1s

tools:
python-ruff: &python-ruff
lint-command: "ruff check --stdin-filename ${INPUT} --output-format concise --quiet -"
lint-stdin: true
lint-formats:
- "%f:%l:%c: %m"
format-command: "ruff format --stdin-filename ${INPUT} --quiet -"
format-stdin: true

languages:
python:
- <<: *python-ruff
13 changes: 10 additions & 3 deletions home/.vim/coc-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
"args": [],
"initializationOptions": {}
},
"linting": {
"command": "efm-langserver",
"args": [],
"filetypes": ["python"]
},
"python": {
"command": "basedpyright-langserver",
"args": ["--stdio"],
"filetypes": ["python"]
},
"haskell": {
"command": "haskell-language-server-wrapper",
"args": ["--lsp"],
Expand All @@ -35,8 +45,5 @@

"elixir.pathToElixirLS": "/usr/local/bin/elixir-ls",

"python.pythonPath": "python3",
"python.formatting.provider": "ruff",

"rust.clippy_preference": "on"
}

0 comments on commit 9e3f9fe

Please sign in to comment.