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

undefined global vim #228

Closed
godalming123 opened this issue Mar 23, 2023 · 13 comments
Closed

undefined global vim #228

godalming123 opened this issue Mar 23, 2023 · 13 comments

Comments

@godalming123
Copy link

godalming123 commented Mar 23, 2023

Describe the bug
When I open my init.lua I get errors saying undefined global vim this is quite annoying.

Also I would like to have documentation for the vim commands (such as vim.api.nvim_echo) for developing plugins in my editor if that is possible instead of just removing the warning.

To Reproduce

Use the default config and open init.lua then run MasonInstall lua-language-server

Desktop (please complete the following information):

  • OS: Arch linux
  • Terminal: Alacritty

** Neovim Version **

NVIM v0.8.3
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

  system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"
@girishji
Copy link

You can configure the lsp to recognize 'vim' as a global var. Something like this:

local servers = {
  lua_ls = {
    Lua = {
      diagnostics = {
        globals = { "vim", "describe", "it", "before_each", "after_each", "packer_plugins", "MiniTest" },
      },
    },
  },
}

@godalming123
Copy link
Author

Would that add it my documentation when I press K

@feoh
Copy link
Collaborator

feoh commented Apr 18, 2023

Are you folks still seeing this problem with the latest kickstart.nvim ?

@godalming123
Copy link
Author

godalming123 commented Apr 18, 2023

I don't see any changes in the upstream that would effect this issue but I will check
EDIT:
Can confirm that this is still a issue on master

@feoh
Copy link
Collaborator

feoh commented Apr 19, 2023

Thanks for confirming.

OK, I think what I'm going to do is spin up a VM so I can test the stock config without fear of cross contamination with my existing customized version.

I'll do that and see if I can reproduce.

@feoh
Copy link
Collaborator

feoh commented Apr 19, 2023

Hi there! Would you please consider upgrading to Neovim 0.9.0 ? I can't reproduce with a stock kickstart.nvim and an updated Neovim.

@godalming123
Copy link
Author

godalming123 commented Apr 19, 2023

Wierd, I have neovim 0.9.x and this is still a problem do you have the lua language server installed with mason

@feoh
Copy link
Collaborator

feoh commented Apr 19, 2023

Nope. Can you please give me the exact module to install with :MasonInstall? Please add that to Steps to Reproduce above.

Thanks!

@godalming123
Copy link
Author

It is called lua-language-server in Mason, and I have updated the steps to reproduce which is wierd because in the default config on line ~407 I thought it specified to install this by default

@feoh
Copy link
Collaborator

feoh commented Apr 19, 2023

Ah, no, you're right. My bad. Running :Mason shows me the list of installed lsps and lua_language_server is in fact installed.

I wonder what's different about our respective configurations? You're using the latest files from kickstart.nvim right?

@godalming123
Copy link
Author

Yep using latest kickstart.nvim

@feoh
Copy link
Collaborator

feoh commented Apr 19, 2023

Seems like you're not the first to hit this, see this issue over on the lua-language-server repo.

Also seems from that bug description like it's intermittent and hard to pin down which makes it damnably annoying to try to reproduce.

Have you tried the proposed fix @girishji mentioned above? Please give that a whirl and let us know. Not sure what else to do with this otherwise.

@feoh
Copy link
Collaborator

feoh commented Apr 27, 2023

No response for a week. I'm closing this for now.

@feoh feoh closed this as completed Apr 27, 2023
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

3 participants