Coder Social home page Coder Social logo

Comments (13)

pta2002 avatar pta2002 commented on May 27, 2024

from nixvim.

Builditluc avatar Builditluc commented on May 27, 2024

I've added the parentheses to the __lspCapabilities function but that doesn't fix the problem (E5107: Error loading lua [string ":lua"]:14: '}' expected (to close '{' at line 12) near 'capabilities')

EDIT: It seems like there are some , missing

-- LSP {{{
local __lspServers = {}
local __lspOnAttach = function(client)

end

local __lspCapabilities = function()

end
for i,server in ipairs(__lspServers) do
  if type(server) == "string" then
    require('lspconfig')[server].setup {
      on_attach = __lspOnAttach
      capabilities = __lspCapabilities
    }
  else
    require('lspconfig')[server.name].setup(server.extraOptions)
  end
end
-- }}}

from nixvim.

legendofmiracles avatar legendofmiracles commented on May 27, 2024

Could you open a PR with your fix?

from nixvim.

Builditluc avatar Builditluc commented on May 27, 2024

Could you open a PR with your fix?

yes, #8

from nixvim.

pta2002 avatar pta2002 commented on May 27, 2024

Fixed by #8, thank you!

from nixvim.

legendofmiracles avatar legendofmiracles commented on May 27, 2024

I should maybe open another issue, but this is still fresh πŸ˜„

The nix lsp seems to be broken:

Error detected while processing FileType Autocommands for "nix":
E5108: Error executing lua vim/shared.lua:260: after the second argument: expected table, got function
stack traceback:
        [C]: in function 'error'
        vim/shared.lua:608: in function 'validate'
        vim/shared.lua:260: in function 'tbl_deep_extend'
        ...e-manager/start/nvim-lspconfig/lua/lspconfig/configs.lua:134: in function '_make_config'
        ...home-manager/start/nvim-lspconfig/lua/lspconfig/util.lua:255: in function 'add'
        ...e-manager/start/nvim-lspconfig/lua/lspconfig/configs.lua:217: in function 'try_add'
        [string ":lua"]:1: in main chunk

from nixvim.

Builditluc avatar Builditluc commented on May 27, 2024

Hmm, that's weird because its works for me

lsp = {
  enable = true;
  servers.rnix-lsp.enable = true;
};

from nixvim.

legendofmiracles avatar legendofmiracles commented on May 27, 2024

Oh my bad, it seems to be only happening when both plugins.nix.enable and plugins.lsp.servers.rnix-lsp.enable are set to true. They're both conflicting

from nixvim.

legendofmiracles avatar legendofmiracles commented on May 27, 2024

Actually, while I'm not getting errors with rnix-lsp (but it doesn't appear to be working) when the nix plugin is disabled. I am getting it for rust, with the nix plugin disabled:

Error detected while processing FileType Autocommands for "rust":
E5108: Error executing lua vim/shared.lua:260: after the second argument: expected table, got function
stack traceback:
        [C]: in function 'error'
        vim/shared.lua:608: in function 'validate'
        vim/shared.lua:260: in function 'tbl_deep_extend'
        ...e-manager/start/nvim-lspconfig/lua/lspconfig/configs.lua:134: in function '_make_config'
        ...home-manager/start/nvim-lspconfig/lua/lspconfig/util.lua:255: in function 'add'
        ...e-manager/start/nvim-lspconfig/lua/lspconfig/configs.lua:217: in function 'try_add'
        [string ":lua"]:1: in main chunk

from nixvim.

pta2002 avatar pta2002 commented on May 27, 2024

I'll be checking this out tomorrow, thanks for reporting. From what I remember, no plugins should conflict at all, so it's definitely a bug.

from nixvim.

Builditluc avatar Builditluc commented on May 27, 2024

Actually, while I'm not getting errors with rnix-lsp (but it doesn't appear to be working) when the nix plugin is disabled. I am getting it for rust, with the nix plugin disabled:

Error detected while processing FileType Autocommands for "rust":
E5108: Error executing lua vim/shared.lua:260: after the second argument: expected table, got function
stack traceback:
        [C]: in function 'error'
        vim/shared.lua:608: in function 'validate'
        vim/shared.lua:260: in function 'tbl_deep_extend'
        ...e-manager/start/nvim-lspconfig/lua/lspconfig/configs.lua:134: in function '_make_config'
        ...home-manager/start/nvim-lspconfig/lua/lspconfig/util.lua:255: in function 'add'
        ...e-manager/start/nvim-lspconfig/lua/lspconfig/configs.lua:217: in function 'try_add'
        [string ":lua"]:1: in main chunk

that's weird because i can't seem to reproduce the error you're getting when enabling plugins.nix and plugins.lsp.servers.rust-analyzer

from nixvim.

pta2002 avatar pta2002 commented on May 27, 2024

Hi, sorry for being gone for so long. Seems like there are several issues to unravel here! First off, after turning on LSP on my config, I get this line:

local __lspCapabilities = function
  
end

in my init.vim, which is clearly wrong, because it's missing the parentheses after function().

However, looking at the culprit code...

      extraConfigLua = ''
        -- LSP {{{
        local __lspServers = ${helpers.toLuaObject cfg.enabledServers}
        local __lspOnAttach = function(client)
          ${cfg.onAttach}
        end
        local __lspCapabilities = function()
          ${cfg.capabilities}
        end
        -- ...
     "; 

Uh, this is odd.... If anyone has any idea why this is happening, help is welcome!

from nixvim.

pta2002 avatar pta2002 commented on May 27, 2024

For now, just to have LSP working, I think I will just comment this part out, since it's not being used by anyone.

from nixvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.