LZDQ / notes

0 stars 0 forks source link

pyright #3

Open LZDQ opened 1 week ago

LZDQ commented 1 week ago

pyright

doc

-- npm install -g pyright
lspconfig.pyright.setup {
    autostart = true,
    settings = {
        python = {
            analysis = {
                autoSearchPaths = true,
                diagnosticMode = 'workspace',
                useLibraryCodeForTypes = true,
                typeCheckingMode = 'off',
                reportMissingImports = true,
            }
        }
    },
}

Use pyrightconfig.json to overwrite. Example config to disable import resolve error. However this is not recommended because package autocompletes will fail.

{
    "reportMissingImports": false
}

Or, in pyproject.toml:

# Pyright configuration
[tool.pyright]
reportMissingImports = false

mac cannot resolve imports

Use virtual environment like conda base.