Giter Club home page Giter Club logo

Comments (7)

VonHeikemen avatar VonHeikemen commented on September 22, 2024

That should work. Just have to make sure you place that after lsp-zero's setup function.

from lsp-zero.nvim.

9mm avatar 9mm commented on September 22, 2024

Here is what I have:

return {
  'VonHeikemen/lsp-zero.nvim',
  branch = 'v2.x',
  dependencies = {
    { 'neovim/nvim-lspconfig' },
    {
      'williamboman/mason.nvim',
      build = function()
        pcall(vim.cmd, 'MasonUpdate')
      end,
    },
    { 'williamboman/mason-lspconfig.nvim' }, -- optional
    { 'hrsh7th/nvim-cmp' },     -- required
    { 'hrsh7th/cmp-nvim-lsp' }, -- required
    { 'L3MON4D3/LuaSnip' },     -- required
  },
  config = function()
    local lsp = require('lsp-zero').preset({})

    lsp.on_attach(function(client, bufnr)
      lsp.default_keymaps({ buffer = bufnr })
    end)

    local config = require('lspconfig')

    config.cssls.setup({})
    config.html.setup({})
    config.jsonls.setup({})
    config.lua_ls.setup(lsp.nvim_lua_ls())
    config.ruby_ls.setup({})
    config.tailwindcss.setup({})
    config.tsserver.setup({})
    config.vimls.setup({})
    config.volar.setup({})

    lsp.setup()

    -- don't update diagnostics constantly
    vim.diagnostic.update_in_insert = false

    -- cmp
    local cmp = require('cmp')

    cmp.setup({
      mapping = {
        ['<C-e>'] = cmp.mapping.confirm({ select = false }),
      },
    })
  end,
}

-- V3... for whenever we switch

-- return {
--   {
--     'VonHeikemen/lsp-zero.nvim',
--     branch = 'dev-v3'
--   },
--   { 'williamboman/mason.nvim' },
--   { 'williamboman/mason-lspconfig.nvim' },
--
--   -- lsp support
--   {
--     'neovim/nvim-lspconfig',
--     dependencies = {
--       { 'hrsh7th/cmp-nvim-lsp' },
--     },
--   },
--
--   -- autocompletion
--   {
--     'hrsh7th/nvim-cmp',
--     dependencies = {
--       { 'L3MON4D3/LuaSnip' },
--     },
--   },
-- }

from lsp-zero.nvim.

VonHeikemen avatar VonHeikemen commented on September 22, 2024

That's very odd. It should work. Can you try this?

    cmp.setup({
      mapping = {
       ['<C-e>'] = cmp.mapping(function()
          cmp.confirm({select = false})
        end),
      },
    })

from lsp-zero.nvim.

9mm avatar 9mm commented on September 22, 2024

Sadly no dice

from lsp-zero.nvim.

9mm avatar 9mm commented on September 22, 2024

Dude very weird.................. now it works. I swear I tried 4-5 times, restarted and everything. Part of me is wondering if I now configured something else which indirectly fixed it...

from lsp-zero.nvim.

9mm avatar 9mm commented on September 22, 2024

Hmm........ it turns out the following fixed it. It was enabling the enter key...

I reverted it back to test again and it breaks again. Luckily I want both keys to trigger it, but I have no idea why it wont work with alone

    local cmp_confirm = cmp.mapping.confirm({ select = false })

    cmp.setup({
      mapping = {
        ['<C-e>'] = cmp_confirm,
        ['<CR>'] = cmp_confirm,
      },

from lsp-zero.nvim.

9mm avatar 9mm commented on September 22, 2024

As a side note, i am not a lua expert but i get a warning here from the copy paste docs. I had to change it to a function call to prevent an error.

        pcall(function() vim.cmd('MasonUpdate') end)

from lsp-zero.nvim.

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.