zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.48k stars 3.12k forks source link

Ruff extension bug with pyright #16076

Open giovanniOfficioso opened 3 months ago

giovanniOfficioso commented 3 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I found what seems to be a bug: when I code using pyright I have no problem with suggestions. They appear as I expect when I type something or I invoke a modules, as os, pandas and so on. The problem is when I install Ruff to use it as formatter: the suggestion on pyright don't work. I have to delete the pyright folder in Library/Apple Support/Zed/languages: in this way the suggestions rework, but only until I compile the code or I exit from Zed. When I run again a file or I open again Zed the suggestions don't work and I have to delete again the pyright folder. I attach the settings that I use with ruff, but at the moment I'm using Zed without having installing Ruff extension in order to use suggestion proved by pyright.

{
  "vim_mode": true,
  "telemetry": {
    "diagnostics": false,
    "metrics": false
  },
  "ui_font_size": 16,
  "buffer_font_size": 14,
  "buffer_font_family": "Meslo",
  "buffer_font_weight": 300,
  "buffer_font_features": {
    "ss02": true
  },
  "theme": {
    "mode": "system",
    "light": "One Dark Vivid",
    "dark": "One Dark Vivid"
  },
  "lsp": {
    "ruff": {
      "initialization_options": {
        "settings": {
          "lineLength": 80,
          "lint": {
            "extendSelect": ["I"]
          }
        }
      }
    },
    "pyright": {
      "settings": {
        "python.analysis": {
          "diagnosticMode": "workspace",
          "typeCheckingMode": "basic"
        }
      }
    }
  },
  "languages": {
    "Python": {
      "format_on_save": "on",
      "formatter": [
        {
          "code_actions": {
            "source.organizeImports.ruff": true,
            "source.fixAll.ruff": true
          }
        },
        {
          "language_server": {
            "name": "ruff"
          }
        }
      ]
    }
  },
  "current_line_highlight": "gutter",
  "indent_guides": {
    "enabled": true,
    "line_width": 1,
    "active_line_width": 1,
    "coloring": "fixed",
    "background_coloring": "indent_aware"
  },
  "show_wrap_guides": true,
  "terminal": {
    "font_family": "MesloLGS NF"
  },
  "cursor_blink": true
}

Environment

Zed: v0.147.2 OS: macOS 13.6.7 Memory: 64 GiB Architecture: aarch64

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

Screenshot 2024-08-11 at 13 05 59 What I expect and how it works without ruff extension

Screenshot 2024-08-11 at 13 08 07

How works with ruff extension

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

Zed.log


ancieg commented 2 months ago

I encounter the same issue in 0.149.5 in ALT Sisyphus (27.08.2024). I disabled pyright and enabled ruff only:

  "languages": {
    "Python": {
      "language_servers": ["ruff", "!pyright"]
    }
  },
  "lsp": {
    "ruff": {
      "binary": {
        "path": "/usr/bin/ruff"
      }
    }
  }
giovanniOfficioso commented 2 months ago

with the following settings, updating to Zed Preview 0.153.6, there is no error for this issue: both ruff and pyright work. Settings:

{
  "vim_mode": true,
  "telemetry": {
    "diagnostics": false,
    "metrics": false
  },
  "ui_font_size": 15,
  "buffer_font_size": 13,
  "buffer_font_family": "Meslo",
  "buffer_font_weight": 400,
  "ui_font_features": {
    "calt": true
  },
  "buffer_font_features": {
    "ss03": true,
    "ss06": true
  },
  "theme": {
    "mode": "system",
    "light": "Dracula Pro",
    "dark": "One Dark Vivid"
  },
  "lsp": {
    "ruff": {
      "initialization_options": {
        "settings": {
          "lineLength": 80,
          "lint": {
            "extendSelect": ["I"]
          }
        }
      }
    }
  },
  "languages": {
    "Python": {
      "format_on_save": "on",
      "formatter": [
        {
          "code_actions": {
            "source.organizeImports.ruff": true,
            "source.fixAll.ruff": true
          }
        }
      ],
      "tab_size": 4,
      "language_servers": ["ruff", "pyright"]
    }
  },
  "show_completions_on_input": true,
  "current_line_highlight": "all",
  "show_whitespaces": "all",
  "indent_guides": {
    "enabled": true,
    "line_width": 1,
    "active_line_width": 1,
    "coloring": "indent_aware",
    "background_coloring": "indent_aware"
  },
  "show_wrap_guides": true,
  "terminal": {
    "font_family": "MesloLGS NF"
  },
  "cursor_blink": true
}