Using the following code example:
import pandas as pd from typing import Dict class Test: def __init__(self, df : pd.DataFrame) -> None: self.df = df def example(self, replacements : Dict[str, str]) -> None: self.df = self.df.rename(columns = replacements) Nvim displays:
rename is definitely a member of a dataframe object, and Pyright is aware of the venv I'm using as I get pandas completion:
I even get completion of the member which is an "error"
I'm not sure what exactly to check / post to make things clearer as I'm only recently setting this up.
I think the question is basically - how do I get the LSP to recognise that this is a "known" member? I'm not sure how it determines that, I'd like to be able to use pandas without so many errors though.
"Which plugin do you have installed?"
These are the plugins that I have installed:
use "wbthomason/packer.nvim" -- have packer manage itself use "nvim-lua/popup.nvim" -- implementation of the popup api from vim in nvim use "nvim-lua/plenary.nvim" -- useful lua functions use "windwp/nvim-autopairs" -- integrates with other stuff.... autocmp and whatever use "kyazdani42/nvim-web-devicons" use "kyazdani42/nvim-tree.lua" use "lunarvim/colorschemes" use "folke/tokyonight.nvim" use "tanvirtin/monokai.nvim" use "hrsh7th/nvim-cmp" -- completion plugin use "hrsh7th/cmp-buffer" -- buffer completions use "hrsh7th/cmp-path" -- path completions use "hrsh7th/cmp-cmdline" -- cmdline completions use "hrsh7th/cmp-nvim-lua" -- cmdline completions use "hrsh7th/cmp-nvim-lsp" -- lsp completions use "saadparwaiz1/cmp_luasnip" -- snippet completions completions use "L3MON4D3/Luasnip" -- snippet engine use "rafamadriz/friendly-snippets" -- snippet engine use "neovim/nvim-lspconfig" -- enable lsp use "williamboman/nvim-lsp-installer" -- simple to use language server installer use "jose-elias-alvarez/null-ls.nvim" -- for formatters and linters use "nvim-telescope/telescope.nvim" use 'nvim-telescope/telescope-media-files.nvim' use "lewis6991/gitsigns.nvim" "What is the lsp configuration?"
-- Following: https://github.com/neovim/nvim-lspconfig#Suggested-configuration -- See `:help vim.diagnostic.*` for documentation on any of the below functions local opts = { noremap=true, silent=true } -- NOTE: Not sure about these atm -- vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts) -- vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) -- vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) -- vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts) -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) -- Enable completion triggered by <c-x><c-o> vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions local bufopts = { noremap=true, silent=true, buffer=bufnr } vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts) vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts) vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts) vim.keymap.set('n', '<space>wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, bufopts) vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts) vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts) vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts) end local lsp_flags = { -- This is the default in Nvim 0.7+ debounce_text_changes = 150, } require('lspconfig')['pyright'].setup{ on_attach = on_attach, flags = lsp_flags, } 



