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

sumneko_lua asks about working environment on every startup #1700

Closed
teenjuna opened this issue Feb 6, 2022 · 3 comments
Closed

sumneko_lua asks about working environment on every startup #1700

teenjuna opened this issue Feb 6, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@teenjuna
Copy link

teenjuna commented Feb 6, 2022

Description

I have set up the sumneko_lua as shown in the docs.

Every time I open Lua file this thing shows me this prompt:

Do you need to configure your work environment as `OpenResty`?

Request Actions:
1. Apply and modify settings
2. Apply but do not modify settings
3. Don't show again
Type number and <Enter> or click with the mouse (q or empty cancels):

I don't really understand anything about OpenResty and sumneko_lua's work environments but tt seems like it doesn't save chosen settings.

Neovim version

NVIM v0.7.0-dev+1004-g6bee2bf79
Build type: Release
LuaJIT 2.1.0-beta3

Nvim-lspconfig version

2008c5c

Operating system and version

macOS 12.0.1

Affected language servers

sumneko_lua

Steps to reproduce

Install sumneko_lua as shown in the docs and open any Lua file.

Actual behavior

As described in the description

Expected behavior

The prompt must not be shown every time I open the file

Minimal config

local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua')
table.insert(runtime_path, 'lua/?/init.lua')
require('lspconfig').sumneko_lua.setup {
  on_attach = function()
    on_attach()
    vim.cmd [[autocmd BufWritePre <buffer> lua require'stylua-nvim'.format_file()]]
  end,
  settings = {
    Lua = {
      runtime = {
        version = 'LuaJIT',
        path = runtime_path,
      },
      diagnostics = {
        globals = { 'vim' },
      },
      workspace = {
        library = vim.api.nvim_get_runtime_file('', true),
      },
      telemetry = {
        enable = false,
      },
    },
  },
}

LSP log

https://gist.github.com/teenjuna/9c5e6cea368d0a889d204950b6161884

@teenjuna teenjuna added the bug Something isn't working label Feb 6, 2022
@mjlbach
Copy link
Contributor

mjlbach commented Feb 8, 2022

In the future, server usage questions should be asked on our discourse: https://neovim.discourse.group/c/language-server-protocol-lsp/7.

What you're seeing is a feature of lua-language-server:

require('lspconfig').sumneko_lua.setup {
  on_attach = function()
    on_attach()
    vim.cmd [[autocmd BufWritePre <buffer> lua require'stylua-nvim'.format_file()]]
  end,
  settings = {
    Lua = {
      runtime = {
        version = 'LuaJIT',
        path = runtime_path,
      },
      diagnostics = {
        globals = { 'vim' },
      },
      workspace = {
        library = vim.api.nvim_get_runtime_file('', true),
        checkThirdParty = false, -- THIS IS THE IMPORTANT LINE TO ADD
      },
      telemetry = {
        enable = false,
      },
    },
  },
}

@natdm
Copy link

natdm commented Nov 10, 2022

In the future, server usage questions should be asked on our discourse

For what it's worth, not everyone uses discourse, and it's appreciated that I can find the answer in the repository issues.

Thanks for posting the fix!

@dbaynard
Copy link

Would a PR be welcome, adding this to the (otherwise great) documentation?

zefr0x added a commit to zefr0x/dotfiles that referenced this issue Dec 30, 2022
xdlin pushed a commit to xdlin/dotfile-neovim that referenced this issue Jan 30, 2023
* refer to neovim/nvim-lspconfig#1700
* disable cmdcmp as its' annonying

Signed-off-by: linxiangdong <linxiangdong@bytedance.com>
minghongx added a commit to minghongx/nvim that referenced this issue May 14, 2023
Vvkmnn added a commit to Vvkmnn/v.nvim that referenced this issue Jun 21, 2023
Blithe-Chiang added a commit to Blithe-Chiang/kickstart.nvim that referenced this issue Jul 3, 2023
alau added a commit to alau/dotfiles that referenced this issue Jul 15, 2023
entombedvirus added a commit to entombedvirus/dotfiles that referenced this issue Aug 4, 2023
m99coder added a commit to m99coder/nvim-config that referenced this issue Jan 17, 2024
Fix `lua-language-server` messages by disabling 3rd party checks. See neovim/nvim-lspconfig#1700 (comment).
m99coder added a commit to m99coder/dotfiles that referenced this issue Jan 17, 2024
Fix `lua-language-server` messages by disabling 3rd party checks. See neovim/nvim-lspconfig#1700 (comment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants