Git Product home page Git Product logo

Comments (7)

thecontinium avatar thecontinium commented on July 28, 2024 1

Im also getting this error using the head of neovim with the boiler plate setup below. Somewhere the require'lspconfig'.<server> is getting set to null after a load. LspInstall twice on any server e.g. vim and you'll see it.

local on_attach = function(client, bufnr)
  local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
  local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end

  -- Mappings.
  local opts = { noremap=true, silent=true }
  buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
  buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
  buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
  buf_set_keymap('n', 'gy', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
  buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
  buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
  buf_set_keymap('n', ',s', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
  buf_set_keymap('n', ',wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
  buf_set_keymap('n', ',wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
  buf_set_keymap('n', ',wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
  buf_set_keymap('n', ',rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
  buf_set_keymap('n', '<Leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
  buf_set_keymap('n', '<Leader>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
  buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
  buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
  buf_set_keymap('n', '<Leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)

  -- Set some keybinds conditional on server capabilities
  if client.resolved_capabilities.document_formatting then
    buf_set_keymap("n", ",f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
  end
  if client.resolved_capabilities.document_range_formatting then
    buf_set_keymap("v", ",f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
  end

  -- Set autocommands conditional on server_capabilities
  if client.resolved_capabilities.document_highlight then
    vim.api.nvim_exec([[
      hi! LspReferenceRead ctermbg=237 guibg=#373b41
      hi! LspReferenceText ctermbg=237 guibg=#373b41
      hi! LspReferenceWrite ctermbg=237 guibg=#373b41
      augroup lsp_document_highlight
        autocmd! * <buffer>
        autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
        autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
      augroup END
    ]], false)
  end

  -- buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
  require "lsp_signature".on_attach({
    bind = true,
    hint_enable = false,
    handler_opts = { border = "single" },
    decorator = {"", ""},
  })
end

local function setup_servers()
  require'lspinstall'.setup()
  local servers = require'lspinstall'.installed_servers()
  for _, server in pairs(servers) do
    print("requiring languange server: " .. server)
    require'lspconfig'[server].setup { on_attach = on_attach }
  end
end

setup_servers()

-- Automatically reload after :LspInstall <server> so we don't have to restart neovim
require'lspinstall'.post_install_hook = function ()
  setup_servers() -- reload installed servers
  vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
end

from nvim-lspinstall.

kabouzeid avatar kabouzeid commented on July 28, 2024 1

Indeed. I have no time right now, but will fix this soon. Thanks for reporting.

from nvim-lspinstall.

kabouzeid avatar kabouzeid commented on July 28, 2024

$HOME/.config/nvim/init.lua:527 line 527 in this file seems to be related to gitsigns. Why do you think this is lspinstall related?

from nvim-lspinstall.

wimstefan avatar wimstefan commented on July 28, 2024

$HOME/.config/nvim/init.lua:527 line 527 in this file seems to be related to gitsigns. Why do you think this is lspinstall related?

Oh sorry - locally I've made some modifications which are not yet committed and pushed to github ...
Line 527 is referring to the setup_servers() function which is line 503 on github -> https://github.com/wimstefan/dotfiles/blob/master/config/nvim/init.lua#L503

Thus the config I've pasted above is here -> https://github.com/wimstefan/dotfiles/blob/master/config/nvim/init.lua#L445-L509

Sorry for the confusion! Do you want me to correct the initial title & post?

from nvim-lspinstall.

thecontinium avatar thecontinium commented on July 28, 2024

Cheers - kinda unusable at the moment.

from nvim-lspinstall.

wimstefan avatar wimstefan commented on July 28, 2024

Thank you for the fix! πŸ‘πŸ™

from nvim-lspinstall.

thecontinium avatar thecontinium commented on July 28, 2024

from nvim-lspinstall.

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.