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
46.87k stars 2.68k forks source link

Python lsp: Pyright isn't good #7296

Open lctzz540 opened 7 months ago

lctzz540 commented 7 months ago

Check for existing issues

Describe the feature

it should be pylsp. The pyright has issues about recognize libraries installed

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

No response

m1guer commented 1 month ago

@m1guer Thanks for bringing basedpyright to Zed!

For those curious, the extension is under review at zed-industries/extensions#1080

your welcome, im just waiting for the review approvement. i fixed all the bugs related to the schema.

hirako2000 commented 1 month ago

neither pyright.json and myproject.toml with the pyright setting worked for me. In case someone faces the same fate this fixed it:

mkdir .zed # in the root folder of the project
touch .zed/settings.json

in that settings.json, having installed ruff as linter.

{
  "tools": {
    "ruff": {
      "command": "ruff",
      "args": ["--format", "json", "--stdin-filename", "$FILENAME", "-"],
      "rootPatterns": ["pyproject.toml", "setup.cfg", ".git"],
      "filePatterns": ["*.py"],
      "runOnSave": true,
      "errorPatterns": [
        {
          "regexp": "^(.*?):(\\d+):(\\d+): (.*)$",
          "file": 1,
          "line": 2,
          "column": 3,
          "message": 4
        }
      ]
    }
  }
}

if using another linter, adjust accordingly.

chrisemke commented 1 month ago

Is there any chance of support for the mypy daemon? I currently use ruff and mypy together in vscodium, it would be nice to have the mypy information inside the editor as well using dmypy

https://mypy.readthedocs.io/en/stable/mypy_daemon.html

andre0xFF commented 1 month ago

neither pyright.json and myproject.toml with the pyright setting worked for me. In case someone faces the same fate this fixed it:

mkdir .zed # in the root folder of the project
touch .zed/settings.json

in that settings.json, having installed ruff as linter.

{
  "tools": {
    "ruff": {
      "command": "ruff",
      "args": ["--format", "json", "--stdin-filename", "$FILENAME", "-"],
      "rootPatterns": ["pyproject.toml", "setup.cfg", ".git"],
      "filePatterns": ["*.py"],
      "runOnSave": true,
      "errorPatterns": [
        {
          "regexp": "^(.*?):(\\d+):(\\d+): (.*)$",
          "file": 1,
          "line": 2,
          "column": 3,
          "message": 4
        }
      ]
    }
  }
}

if using another linter, adjust accordingly.

it's pyrightconfig.json on the project root

v3ss0n commented 3 weeks ago

Any updates here? current pyright in Zed is down right disapponting . Need BasedPyRIght + Ruff + MyPY.

m1guer commented 3 weeks ago

ruff and basedpyright are on extensions.

rgbkrk commented 3 weeks ago

I don't want people to be burdened by too much choice but I put together an extension using python-lsp-server you can try by installing as a dev extension: https://github.com/rgbkrk/python-lsp-zed-extension

Thus far I'm enjoying it and it feels like one I should submit to the extensions repo. python-lsp-server has mypy support but I've yet to see it working in practice. Happy to hack with folks on it!

bersace commented 3 weeks ago

Wow, pyright eats 3.5G of RAM after a few days. Never had this with jedi.

bersace commented 3 weeks ago

Thus far I'm enjoying it and it feels like one I should submit to the extensions repo. python-lsp-server has mypy support but I've yet to see it working in practice. Happy to hack with folks on it!

How to disable pyright and move to pylsp ?

rgbkrk commented 2 weeks ago

You can now search for "Python LSP" in extensions to enable it.

image

Note that you will need to install the python lsp server directly first.

Read more in the python-lsp-zed-extension README and file issues there. I'm still figuring out what else I can enable. I would ❤️ if someone gets mypy configuration working with it.

a-kachurin commented 2 weeks ago

You can now search for "Python LSP" in extensions to enable it.

image

Note that you will need to install the python lsp server directly first.

Read more in the python-lsp-zed-extension README and file issues there. I'm still figuring out what else I can enable. I would ❤️ if someone gets mypy configuration working with it.

Is the "Go to Definition" feature implemented in your plugin? I would like to try Zed on Win11. Could you please provide more detailed instructions on how to set up the plugin?

lucianosrp commented 2 weeks ago

Is the "Go to Definition" feature implemented in your plugin? I would like to try Zed on Win11.

Even with pylsp and basedpyright I am still not able to "Go to Definition" on Windows 11