Open ItaloCunhaBueno opened 2 months ago
I followed this documentation on the ruff site and ruff seems to be working. But unable to get any of the pylsp features working for some reason.
https://docs.astral.sh/ruff/editors/setup/#zed
I have the following config:
"lsp": {
"ruff": {
"initialization_options": {
"settings": {
// Ruff server settings goes here
"lineLength": 95,
"lint": {
"extendSelect": ["I"],
}
}
}
},
"pylsp": {
"initialization_options": {
"settings": {
"python": {
"pythonPath": ".venv/bin/python"
}
}
},
"settings": {
"plugins": {
"pylsp_mypy": {
"live_mode": true,
"enabled": true,
"dmypy": true
},
"pylint": {
"enabled": false
},
"pycodestyle": {
"enabled": false
},
"jedi_symbols": {
"enabled": true
},
"jedi_definition": {
"enabled": true
},
"jedi_references": {
"enabled": true
},
"jedi_hover": {
"enabled": true
},
"jedi_completion": {
"enabled": true
},
"jedi_signature_help": {
"enablded": true
},
"jedi": {
"environment": {
"PYTHONPATH": ".venv"
}
}
}
}
}
},
"languages": {
"Python": {
"language_servers": ["pylsp", "ruff"],
"format_on_save": "on",
"formatter": [
{
"code_actions": {
"source.organizeImports.ruff": true,
"source.fixAll.ruff": true
}
},
{
"language_server": {
"name": "ruff"
}
}
],
"python": {
"pythonPath": ".venv/bin/python"
},
}
},
After a bit more head banging.. I seem to have this all working after removing the following section. Tried several things including attempt to set VIRTUAL_ENV=".venv"
but nothing worked until removing that section and setting VIRTUAL_ENV globally in my shell.
"jedi": {
"environment": {
"PYTHONPATH": ".venv"
}
}
The standalone extension "ruff" works fine, I was trying to use the ruff as a plugin for pylsp.
Understood..
Looking at the github for the language server, it does say that the python-lsp-ruff plugin must be installed for that functionality.
Yeah, it is installed. Well, I decided to use both ruff and pylsp extensions side by side, instead of trying to use just pylsp. Thank's for your time.
I'm trying to use ruff plugin as linter and formatter on zed but the format on save is not working. Here's a part of my settings.json:
Everything is working fine even code actions (Ctrl + .) except for the format on save part. Could someone give a little help on how to enabled pylsp to format code on save?
Thanks.