zed icon indicating copy to clipboard operation
zed copied to clipboard

python: wrong indent when autocompleting inherited class method

Open iiicebearrr opened this issue 6 months ago • 2 comments

Summary

Wrong indent when autocompleting inherited class method

Image

Description

Steps to reproduce:

  1. Write some class
  2. Inherit from it and override some method
  3. Get wrong indent after autocompleting

Expected Behavior: Actual Behavior:

Zed Version and System Specs

Zed: v0.188.4 (Zed) OS: macOS 15.5.0 Memory: 36 GiB Architecture: aarch64

iiicebearrr avatar May 31 '25 05:05 iiicebearrr

I could not reproduce with your example (in Zed v0.188.x or v0.190x) with an empty settings.

  1. Which language server are you using?
  2. Can you share any relevant settings?
  3. Could you provide a step by step and/or a video demonstrating the issue. Thanks

notpeter avatar May 31 '25 16:05 notpeter

I could not reproduce with your example (in Zed v0.188.x or v0.190x) with an empty settings.

1. Which language server are you using?

2. Can you share any relevant settings?

3. Could you provide a step by step and/or a video demonstrating the issue.
   Thanks

I'm using pyright and ruff as my language servers, here are my lsp settings:

  "languages": {
    "Python": {
      "format_on_save": "on",
      "language_servers": ["pyright", "ruff"],
      "formatter": [
        {
          "language_server": {
            "name": "ruff"
          }
        },
        {
          "code_actions": {
            // Fix all auto-fixable lint violations
            "source.fixAll.ruff": true,
            // Organize imports
            "source.organizeImports.ruff": true
          }
        }
      ]
    }
  },
  "lsp": {
    "pyright": {
      "settings": {
        "python": {
          "pythonPath": ".venv/bin/python"
        }
      }
    },
    "ruff": {
      "initialization_options": {
        "settings": {
          "ruff.fixAll": true,
          "ruff.organizeImports": true
        }
      }
    }
  }
My full settings
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run `zed: open default settings` from the
// command palette (cmd-shift-p / ctrl-shift-p)
{
  "icon_theme": "Zed (Default)",
  "agent": {
    "always_allow_tool_actions": true,
    "model_parameters": [],
    "default_model": {
      "provider": "zed.dev",
      "model": "claude-sonnet-4-latest"
    },
    "version": "2"
  },
  "inlay_hints": {
    "enabled": true
  },
  "relative_line_numbers": true,
  "indent_guides": {
    "coloring": "indent_aware",
    "enabled": true
  },
  "scrollbar": {
    "show": "never"
  },

  "edit_predictions": {
    "disabled_globs": [],
    "mode": "eager",
    "copilot": {
      "proxy": "http://127.0.0.1:7890",
      "proxy_no_verify": true
    },
    "enabled_in_text_threads": false
  },
  "features": {
    "edit_prediction_provider": "zed"
  },
  "base_keymap": "VSCode",
  "vim_mode": true,
  "ui_font_size": 16,
  "buffer_font_size": 16,
  "theme": {
    "mode": "system",
    "light": "Gruvbox Light Hard",
    "dark": "Vercel Dark"
  },

  "terminal": {
    "detect_venv": {
      "on": {
        "directories": [".env", "env", ".venv", "venv", "backend/.venv"],
        "activate_script": "default"
      }
    }
  },
  "buffer_font_family": "Fira Code",
  "languages": {
    "Python": {
      "format_on_save": "on",
      "language_servers": ["pyright", "ruff"],
      "formatter": [
        {
          "language_server": {
            "name": "ruff"
          }
        },
        {
          "code_actions": {
            // Fix all auto-fixable lint violations
            "source.fixAll.ruff": true,
            // Organize imports
            "source.organizeImports.ruff": true
          }
        }
      ]
    }
  },
  "lsp": {
    "pyright": {
      "settings": {
        "python": {
          "pythonPath": ".venv/bin/python"
        }
      }
    },
    "ruff": {
      "initialization_options": {
        "settings": {
          "ruff.fixAll": true,
          "ruff.organizeImports": true
        }
      }
    }
  },
  "autosave": "on_focus_change"
}

This is the video for reproducing the problem: https://github.com/user-attachments/assets/c2db0571-ed5e-4da1-9388-17b3df9a871b

iiicebearrr avatar Jun 01 '25 11:06 iiicebearrr

Examining that video, this appears to be specifically about a pyright provided snippet expansion.

mikayla-maki avatar Jun 20 '25 19:06 mikayla-maki