Skip to content
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

Ruff "lineLength" Configuration Not Working in Zed 0.164.2 #21434

Closed
1 task done
ZuidVolt opened this issue Dec 3, 2024 · 6 comments
Closed
1 task done

Ruff "lineLength" Configuration Not Working in Zed 0.164.2 #21434

ZuidVolt opened this issue Dec 3, 2024 · 6 comments
Labels
language server An umbrella label for all language servers python Python programming language support support User support (non-defect troubleshooting, documentation, etc)

Comments

@ZuidVolt
Copy link

ZuidVolt commented Dec 3, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

After updating to Zed version 0.164.2, the Ruff line length configuration is not being respected. Despite setting a line length of 120 in the configuration, the editor defaults to a line length of 80 when formatting or saving files

Current configuration:

    "Python": {
      "tab_size": 4,
      "language_servers": ["ruff"],
      "format_on_save": "on",
      "formatter": [
        {
          "code_actions": {
            "source.organizeImports.ruff": false,
            "source.fixAll.ruff": false
          }
        },
        {
          "language_server": {
            "name": "ruff"
          }
        }
      ],
      "show_inline_completions": true
    },
    "lsp": {
      "ruff": {
        "initialization_options": {
          "settings": {
            "lineLength": 120,
            "lint": {
              "extendSelect": ["I"]
            }
          }
        }

Environment

OS: macOS Sequoia
CPU: Apple M3
Memory: 16 GB
Zed 0.164.2

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

@ZuidVolt ZuidVolt added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Dec 3, 2024
@villem
Copy link

villem commented Dec 3, 2024

Maybe related? After update to 0.163.3 I'm getting error when zed is started.

Language server error: ruff

failed to spawn command. path: "/opt/homebrew/bin/ruff", working directory: "/Users/zzz/src/yyy/xxx", args: ["server"]

@ZuidVolt
Copy link
Author

ZuidVolt commented Dec 4, 2024

I think this is the same issue as

@ZuidVolt
Copy link
Author

ZuidVolt commented Dec 6, 2024

Log update:
With the configuration from the top message, I'm getting:

2024-12-04T09:34:43.803095+08:00 [INFO] attempting to start language server "ruff", path: "/Users/usr/Dev/vscode/ping-search-engines/benchmark_search_engines.py", id: 3
2024-12-04T09:34:43.803654+08:00 [INFO] starting language server process. binary path: "/Users/usr.venv/bin/ruff", working directory: "/Users/usr/Dev/vscode/ping-search-engines", args: ["server"]
2024-12-04T11:28:52.58072+08:00 [WARN] no language server found matching 'ruff'

@ZuidVolt ZuidVolt changed the title Ruff "lineLength" Configuration Not Working in Zed 0.163.3 Ruff "lineLength" Configuration Not Working in Zed 0.164.2 Dec 7, 2024
@notpeter
Copy link
Member

@ZuidVolt I am not able to reproduce.

I believe it may because your settings are incorrect, lsp should be a top-level settings key (two space indent) not under "languages" (four space indent). Or it could just be a copy paste indentation error 🤷.

I am able to use the following settings.json:

{
  "languages": {
    "Python": {
      "auto_indent_on_paste": false,
      "language_servers": ["ruff"],
      "format_on_save": "on",
      "formatter": [
        {
          "code_actions": {
            "source.organizeImports.ruff": false,
            "source.fixAll.ruff": false
          }
        },
        {
          "language_server": {
            "name": "ruff"
          }
        }
      ]
    }
  },
  "lsp": {
    "ruff": {
      "initialization_options": {
        "settings": {
          "lineLength": 120
        }
      }
    }
  }
}
Screen.Recording.2024-12-10.at.12.25.44.mov

If you are still seeing this, can you create a mini repo with a .zed/settings.json with a minimal settings that reproduces the issue when your user settings.json is empty ({}).

@notpeter
Copy link
Member

Just re-reading your second comment:

2024-12-04T11:28:52.58072+08:00 [WARN] no language server found matching 'ruff'

Do you have the ruff extension installed?

@notpeter notpeter added python Python programming language support language server An umbrella label for all language servers support User support (non-defect troubleshooting, documentation, etc) and removed bug [core label] triage Maintainer needs to classify the issue admin read Pending admin review labels Dec 10, 2024
@ZuidVolt
Copy link
Author

ZuidVolt commented Dec 25, 2024

after updating the newest version ZED the issue seems to be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language server An umbrella label for all language servers python Python programming language support support User support (non-defect troubleshooting, documentation, etc)
Projects
None yet
Development

No branches or pull requests

3 participants