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
45.24k stars 2.47k forks source link

support global pyright setting in zed settings #10587

Open geoqiao opened 4 months ago

geoqiao commented 4 months ago

Check for existing issues

Describe the feature

support global pyright setting in zed settings so that users don't need to generate pyrightconfig.json in every project dir.

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

No response

geoqiao commented 4 months ago

something like:

  "lsp": {
    "pyright": {
      "enabled": true,
      "pythonVersion": "3.11",
      "venvPath": ".",
      "venv": ".venv",
      "typeCheckingMode": "strict",
      "strictListInference": true,
      "reportDuplicateImport": true,
      "reportMissingImports": true,
      "reportMissingTypeStubs": false,
      "defineConstant": { "DEBUG": true }
    }
  }

or pylance in VSCode:

{
    "python.languageServer": "Pylance",
    "python.analysis.typeCheckingMode": "basic",
    "python.analysis.diagnosticSeverityOverrides": {
        "reportMissingModuleSource": "none"
    },
    "python.analysis.typeshedPaths": [
        ".venv/Lib/site-packages"
    ],
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": true,
}
FilipeBisinella commented 1 month ago

Made a PR that should allow this:

https://github.com/zed-industries/zed/pull/14265

jsnjack commented 1 month ago

@FilipeBisinella

Dependency resolution still doesn't work for me with the folowing configuration in settings.json:

  "lsp": {
    "pyright": {
      "settings": {
        "python": {
          "venvPath": ".",
          "venv": ".venv"
        }
      }
    }
  }

At the same time, it works fine with pyrightconfig.json:

{
  "venvPath": ".",
  "venv": ".venv"
}

I'm running zed preview 0.144.3 f11a992

FilipeBisinella commented 1 month ago

The pyright global settings are different from the pyrightconfig.json ones. Try with:

  "lsp": {
    "pyright": {
      "settings": {
        "python": {
          "pythonPath": ".venv/bin/python"
        }
      }
    }
  }
jsnjack commented 1 month ago

Got it!

I tried setting pythonPath, also no luck

FilipeBisinella commented 1 month ago

Looks like this PR was included in the v0.145.0-pre release.

jsnjack commented 1 month ago

Thanks, I have just updated to 0.145 and it works well :+1: