Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

pylsp: Tweak default user settings (#21025)

Piotr Osiewicz0663bf2a5311
diff --git a/crates/languages/src/python.rs b/crates/languages/src/python.rs
index df158b9c7d2..429da01c8f4 100644
--- a/crates/languages/src/python.rs
+++ b/crates/languages/src/python.rs
@@ -917,13 +917,17 @@ impl LspAdapter for PyLspAdapter {
.unwrap_or_else(|| {
json!({
"plugins": {
- "rope_autoimport": {"enabled": true},
- "mypy": {"enabled": true}
- }
+ "pycodestyle": {"enabled": false},
+ "rope_autoimport": {"enabled": true, "memory": true},
+ "mypy": {"enabled": false}
+ },
+ "rope": {
+ "ropeFolder": null
+ },
})
});
- // If python.pythonPath is not set in user config, do so using our toolchain picker.
+ // If user did not explicitly modify their python venv, use one from picker.
if let Some(toolchain) = toolchain {
if user_settings.is_null() {
user_settings = Value::Object(serde_json::Map::default());
@@ -939,23 +943,22 @@ impl LspAdapter for PyLspAdapter {
.or_insert(Value::Object(serde_json::Map::default()))
.as_object_mut()
{
- jedi.insert(
- "environment".to_string(),
- Value::String(toolchain.path.clone().into()),
- );
+ jedi.entry("environment".to_string())
+ .or_insert_with(|| Value::String(toolchain.path.clone().into()));
}
if let Some(pylint) = python
.entry("mypy")
.or_insert(Value::Object(serde_json::Map::default()))
.as_object_mut()
{
- pylint.insert(
- "overrides".to_string(),
+ pylint.entry("overrides".to_string()).or_insert_with(|| {
Value::Array(vec![
Value::String("--python-executable".into()),
Value::String(toolchain.path.into()),
- ]),
- );
+ Value::String("--cache-dir=/dev/null".into()),
+ Value::Bool(true),
+ ])
+ });
}
}
}