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

docs: don't skip VIMRUNTIME in lua lsp if ~/.config/nvim/.luarc.json exists #3603

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

jyn514
Copy link
Contributor

@jyn514 jyn514 commented Feb 6, 2025

.luarc is created by lua-lsp itself (e.g. if you hit "disable diagnostics" in a code action), at which point the lsp will start showing errors that the vim global is undefined after the next restart.

@jyn514 jyn514 requested a review from glepnir as a code owner February 6, 2025 07:00
Copy link
Contributor

github-actions bot commented Feb 6, 2025

Note that configs.md or configs.txt will be regenerated by the docgen CI process. Edit the Lua source file instead. For details on generating documentation, see: https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#generating-docs

…rc.json exists

.luarc is created by lua-lsp itself (e.g. if you hit "disable diagnostics" in a code action), at which point the lsp will start showing errors that the vim global is undefined after the next restart.
@@ -48,7 +48,7 @@ require'lspconfig'.lua_ls.setup {
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
if path ~= vim.fn.stdpath('config') and (vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc')) then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PR title says if ~/.config/nvim/.luarc.json exists but here you are comparing path ~= vim.fn.stdpath('config') ("NOT equal to ~/.config/nvim") ... ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PR says "DON'T" skip the runtime if this directory exists. if this condition is taken, then the code does an early return, and the runtime is never loaded. so we want the condition to be false when the directory exists, hence ~= instead of ==.

@justinmk justinmk merged commit 7c284f4 into neovim:master Feb 6, 2025
10 of 11 checks passed
@justinmk justinmk changed the title don't skip VIMRUNTIME in lua lsp if ~/.config/nvim/.luarc.json exists docs: don't skip VIMRUNTIME in lua lsp if ~/.config/nvim/.luarc.json exists Feb 6, 2025
@jyn514 jyn514 deleted the patch-1 branch February 6, 2025 15:18
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

Successfully merging this pull request may close these issues.

2 participants