Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: pylsp deletes all python code on save #8771

Closed
cgahr opened this issue Nov 9, 2023 · 1 comment
Closed

bug: pylsp deletes all python code on save #8771

cgahr opened this issue Nov 9, 2023 · 1 comment
Labels
C-bug Category: This is a bug

Comments

@cgahr
Copy link
Contributor

cgahr commented Nov 9, 2023

Summary

I have format on save enabled. When I save my file, pylsp deletes my whole python document. pylsp is installed from nix. This issue didn't exist with helix 23.05.

Reproduction Steps

  1. start hx
  2. open python file
  3. :w
  4. lose everything in the current file

language.toml:

[[language]]
auto-format = true
name = "python"

[language.indent]
tab-width = 4
unit = " "

[language-server.pylsp]
command = "pylsp"

[language-server.pylsp.config.plugins]
[language-server.pylsp.config.plugins.black]
enabled = true

[language-server.pylsp.config.plugins.mypy]
enable = true

[language-server.pylsp.config.plugins.ruff]
enable = true

Helix log

~/.cache/helix/helix.log

2023-11-09T17:22:58.123 helix_lsp::transport [ERROR] pylsp err <- "2023-11-09 17:22:58,123 CET - ERROR - pylsp_ruff.plugin - Error running ruff: error: unexpected argument '--format' found\n"
2023-11-09T17:22:58.123 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:22:58.123 helix_lsp::transport [ERROR] pylsp err <- "  tip: to pass '--format' as a value, use '-- --format'\n"
2023-11-09T17:22:58.123 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:22:58.123 helix_lsp::transport [ERROR] pylsp err <- "Usage: ruff check <--verbose|--quiet|--silent> [FILES]...\n"
2023-11-09T17:22:58.123 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:22:58.123 helix_lsp::transport [ERROR] pylsp err <- "For more information, try '--help'.\n"
2023-11-09T17:22:58.123 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:02.830 helix_lsp::transport [ERROR] nil err: <- StreamClosed
2023-11-09T17:23:10.739 helix_lsp::transport [ERROR] pylsp err <- "2023-11-09 17:23:10,739 CET - ERROR - pylsp_ruff.plugin - Error running ruff: error: unexpected argument '--format' found\n"
2023-11-09T17:23:10.739 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:10.739 helix_lsp::transport [ERROR] pylsp err <- "  tip: to pass '--format' as a value, use '-- --format'\n"
2023-11-09T17:23:10.739 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:10.739 helix_lsp::transport [ERROR] pylsp err <- "Usage: ruff check <--verbose|--quiet|--silent> [FILES]...\n"
2023-11-09T17:23:10.739 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:10.739 helix_lsp::transport [ERROR] pylsp err <- "For more information, try '--help'.\n"
2023-11-09T17:23:10.739 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:10.989 helix_lsp::transport [ERROR] pylsp err <- "2023-11-09 17:23:10,989 CET - ERROR - pylsp_ruff.plugin - Error running ruff: error: unexpected argument '--format' found\n"
2023-11-09T17:23:10.989 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:10.989 helix_lsp::transport [ERROR] pylsp err <- "  tip: to pass '--format' as a value, use '-- --format'\n"
2023-11-09T17:23:10.989 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:10.989 helix_lsp::transport [ERROR] pylsp err <- "Usage: ruff check <--verbose|--quiet|--silent> [FILES]...\n"
2023-11-09T17:23:10.989 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:10.989 helix_lsp::transport [ERROR] pylsp err <- "For more information, try '--help'.\n"
2023-11-09T17:23:10.989 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:11.496 helix_lsp::transport [ERROR] pylsp err <- "2023-11-09 17:23:11,495 CET - ERROR - pylsp_ruff.plugin - Error running ruff: error: unexpected argument '--format' found\n"
2023-11-09T17:23:11.496 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:11.496 helix_lsp::transport [ERROR] pylsp err <- "  tip: to pass '--format' as a value, use '-- --format'\n"
2023-11-09T17:23:11.496 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:11.496 helix_lsp::transport [ERROR] pylsp err <- "Usage: ruff check <--verbose|--quiet|--silent> [FILES]...\n"
2023-11-09T17:23:11.496 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:11.496 helix_lsp::transport [ERROR] pylsp err <- "For more information, try '--help'.\n"
2023-11-09T17:23:11.496 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:13.424 helix_lsp::transport [ERROR] pylsp err <- "2023-11-09 17:23:13,424 CET - ERROR - pylsp_ruff.plugin - Error running ruff: error: unexpected argument '--format' found\n"
2023-11-09T17:23:13.425 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:13.425 helix_lsp::transport [ERROR] pylsp err <- "  tip: to pass '--format' as a value, use '-- --format'\n"
2023-11-09T17:23:13.425 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:13.425 helix_lsp::transport [ERROR] pylsp err <- "Usage: ruff check <--verbose|--quiet|--silent> [FILES]...\n"
2023-11-09T17:23:13.425 helix_lsp::transport [ERROR] pylsp err <- "\n"
2023-11-09T17:23:13.425 helix_lsp::transport [ERROR] pylsp err <- "For more information, try '--help'.\n"
2023-11-09T17:23:13.425 helix_lsp::transport [ERROR] pylsp err <- "\n"

Platform

Linux

Terminal Emulator

default

Installation Method

source

Helix Version

23.10-39-g6ab774da

@cgahr cgahr added the C-bug Category: This is a bug label Nov 9, 2023
@gabydd
Copy link
Member

gabydd commented Nov 9, 2023

See python-lsp/python-lsp-ruff#48 and python-lsp/python-lsp-ruff#52 you need to update the pylsp ruff plugin to the latest version

@gabydd gabydd converted this issue into discussion #8772 Nov 9, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants