zed icon indicating copy to clipboard operation
zed copied to clipboard

support global pyright setting in zed settings

Open geoqiao opened this issue 1 year ago • 1 comments
trafficstars

Check for existing issues

  • [X] Completed

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 avatar Apr 16 '24 02:04 geoqiao

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,
}

geoqiao avatar Apr 27 '24 13:04 geoqiao

Made a PR that should allow this:

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

FilipeBisinella avatar Jul 11 '24 21:07 FilipeBisinella

@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

jsnjack avatar Jul 17 '24 09:07 jsnjack

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

  "lsp": {
    "pyright": {
      "settings": {
        "python": {
          "pythonPath": ".venv/bin/python"
        }
      }
    }
  }

FilipeBisinella avatar Jul 17 '24 17:07 FilipeBisinella

Got it!

I tried setting pythonPath, also no luck

jsnjack avatar Jul 18 '24 09:07 jsnjack

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

FilipeBisinella avatar Jul 19 '24 22:07 FilipeBisinella

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

jsnjack avatar Jul 21 '24 20:07 jsnjack