Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 对于 conda 里面的包无法补全 #17

Closed
jczhang02 opened this issue Aug 25, 2021 · 10 comments
Closed

python 对于 conda 里面的包无法补全 #17

jczhang02 opened this issue Aug 25, 2021 · 10 comments

Comments

@jczhang02
Copy link
Contributor

rt,好像pylsp可以但是没尝试过,请问您有相关解决方案吗

@jczhang02
Copy link
Contributor Author

image
在正确加载包的前提下有这样奇怪的报错,但是理应不会报错

@ayamir
Copy link
Owner

ayamir commented Aug 25, 2021

@jczhang02
Copy link
Contributor Author

请问如果设置的话,还是在这个lspconfig.lua文件里设置吗,具体应该是怎么设置?
对不起,问题有些小白,但我确实是刚接触lua,还不是很明白!

@ayamir
Copy link
Owner

ayamir commented Aug 25, 2021

我想你应该是需要在项目的根目录下面手动创建一个pyrightconfig.json文件,里面填写好venvpath

{
  "venv": "path",
}

@jczhang02
Copy link
Contributor Author

我是想问下图中的部分应该被加到哪里,以及怎么加,谢谢!
image

@ayamir
Copy link
Owner

ayamir commented Aug 25, 2021

lspconfig.lua:

local function setup_servers()
    lsp_install.setup()
    local servers = lsp_install.installed_servers()
    for _, lsp in ipairs(servers) do
        nvim_lsp[lsp].setup {
            capabilities = capabilities,
            on_attach = function()
                require('lsp_signature').on_attach({
                    bind = true,
                    use_lspsaga = false,
                    floating_window = true,
                    fix_pos = true,
                    hint_enable = true,
                    hi_parameter = "Search",
                    handler_opts = {"double"}
                })
            end,
            settings = {
                python = {
                    analysis = {
                        autoSearchPaths = true,
                        useLibraryCodeForTypes = false
                    }
                }
            }
        }
    end
end

@jczhang02
Copy link
Contributor Author

require'lspconfig'.pyright.setup{}
这一部分不需要加入吗?
另外如果我想使用pylsp的话,应该怎么加入呢
谢谢!

@ayamir
Copy link
Owner

ayamir commented Aug 25, 2021

pip install python-lsp-server --user
add nvim_lsp.pylsp.setup{} to lspconfig.
image

@jczhang02
Copy link
Contributor Author

谢谢您的回答!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants